workspai 0.75.0 → 0.75.2
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/dist/analyze-6UEBC5OJ.js +1 -0
- package/dist/{artifact-remediation-plan-HD5K52UJ.js → artifact-remediation-plan-SRH2Q6N2.js} +1 -1
- package/dist/autopilot-release-H5TO6NYY.js +1 -0
- package/dist/chunk-2DZLCINC.js +1 -0
- package/dist/{chunk-W7I65IXY.js → chunk-3HXEPDFF.js} +2 -2
- package/dist/chunk-3N27P3KO.js +7 -0
- package/dist/{chunk-J4J3RYCL.js → chunk-3RNWBFRP.js} +1 -1
- package/dist/{chunk-GE46XKD2.js → chunk-4JXJRIJM.js} +1 -1
- package/dist/chunk-5HNQIMGW.js +1 -0
- package/dist/chunk-5K4O3TAW.js +4 -0
- package/dist/{chunk-CGNMS32W.js → chunk-66O62XNJ.js} +49 -49
- package/dist/{chunk-GIFAGOMK.js → chunk-ADHX7D3F.js} +1 -1
- package/dist/chunk-DTNOF3MP.js +1 -0
- package/dist/{chunk-OH6LV5JP.js → chunk-E42IFQFR.js} +4 -4
- package/dist/{chunk-6B7L4NZE.js → chunk-EFHSRPW7.js} +6 -6
- package/dist/{chunk-CK73SQFF.js → chunk-EP7SUMAX.js} +1 -1
- package/dist/chunk-EWD6QTAM.js +2 -0
- package/dist/{chunk-HLSOZOL3.js → chunk-FNVWDXK2.js} +3 -3
- package/dist/{chunk-RX3U7JKF.js → chunk-FZWLWFR4.js} +1 -1
- package/dist/chunk-G5UCEXP6.js +1 -0
- package/dist/{chunk-WOPZX56J.js → chunk-GDOO2YZW.js} +1 -1
- package/dist/{chunk-V5WVGPOP.js → chunk-IKBE3HOH.js} +1 -1
- package/dist/{chunk-NGU7RYXA.js → chunk-K52IQX3J.js} +1 -1
- package/dist/{chunk-DT3LRKZQ.js → chunk-KDVNRNDU.js} +1 -1
- package/dist/chunk-LARREYZN.js +1 -0
- package/dist/{chunk-MXI2DWLL.js → chunk-LFY7KTPD.js} +1 -1
- package/dist/{chunk-SRCZX2KC.js → chunk-P36TACKN.js} +1 -1
- package/dist/{chunk-4KEZQLBU.js → chunk-PFAGXI3G.js} +1 -1
- package/dist/chunk-ROOPODG6.js +2 -0
- package/dist/{chunk-G3ZC5W4U.js → chunk-SZHRPELL.js} +1 -1
- package/dist/{chunk-DJH2CH42.js → chunk-UHIN3RS6.js} +1 -1
- package/dist/{chunk-FS3WLRQ4.js → chunk-VWBWDDU2.js} +1 -1
- package/dist/chunk-VXFIMEC6.js +2 -0
- package/dist/{chunk-ZW4QV6SB.js → chunk-WHBKKJ7L.js} +1 -1
- package/dist/chunk-WXUCAVFT.js +681 -0
- package/dist/chunk-X7OI24LO.js +418 -0
- package/dist/{chunk-RPM67N7A.js → chunk-XHUM372O.js} +1 -1
- package/dist/chunk-ZGVODK5C.js +12 -0
- package/dist/{create-7UENFCJK.js → create-ZFSFWAW3.js} +1 -1
- package/dist/{demo-kit-ALW6OSQV.js → demo-kit-QNGY4KQ5.js} +1 -1
- package/dist/{doctor-KGADT4PI.js → doctor-4KL4XUCS.js} +1 -1
- package/dist/{dotnet-webapi-clean-6Z4EXEJY.js → dotnet-webapi-clean-GXTNZMKO.js} +1 -1
- package/dist/{goal-lifecycle-HIQGDEEP.js → goal-lifecycle-EXQZD7IA.js} +1 -1
- package/dist/{goal-pack-63PEP2ND.js → goal-pack-DKJU2DEP.js} +1 -1
- package/dist/{gofiber-standard-TDJQIVQZ.js → gofiber-standard-PFBIAMGR.js} +1 -1
- package/dist/{gogin-standard-UEF3IHSJ.js → gogin-standard-DW5GL7YG.js} +1 -1
- package/dist/index.js +182 -174
- package/dist/{pipeline-VFI35PR4.js → pipeline-4GVAOCEN.js} +1 -1
- package/dist/{project-agent-entry-Z3OY3S7T.js → project-agent-entry-7QKNEEXP.js} +1 -1
- package/dist/{project-intelligence-lens-YWICXW6P.js → project-intelligence-lens-IHRYCLNU.js} +1 -1
- package/dist/{proof-carrying-change-BAP2C3KV.js → proof-carrying-change-O37XUPIZ.js} +1 -1
- package/dist/{rust-axum-4TRVPFMB.js → rust-axum-L7UAYARA.js} +1 -1
- package/dist/{springboot-standard-COWL75GT.js → springboot-standard-CZH24KWD.js} +1 -1
- package/dist/verified-goal-XI4RQESU.js +1 -0
- package/dist/{workspace-PAXTJCMH.js → workspace-EYXAKMVI.js} +1 -1
- package/dist/{workspace-agent-sync-MGCEF4ON.js → workspace-agent-sync-SN55KT6N.js} +1 -1
- package/dist/{workspace-context-2G6QZ6D3.js → workspace-context-PW6ESEHH.js} +1 -1
- package/dist/{workspace-contract-VWPOIYHJ.js → workspace-contract-FPLFL4G3.js} +1 -1
- package/dist/{workspace-explain-HLEBUK4K.js → workspace-explain-TVQ5IF5D.js} +1 -1
- package/dist/{workspace-foundation-X7LOGTS3.js → workspace-foundation-DWIJPZRH.js} +1 -1
- package/dist/{workspace-graph-stream-XGSRDRLI.js → workspace-graph-stream-RUTNWLQB.js} +1 -1
- package/dist/workspace-graph-token-efficiency-WF6TGSK7.js +1 -0
- package/dist/{workspace-intelligence-GFJKIWBX.js → workspace-intelligence-4CA2CSPZ.js} +1 -1
- package/dist/{workspace-intelligence-benchmark-R5MEGJQS.js → workspace-intelligence-benchmark-V6AEVDMB.js} +1 -1
- package/dist/{workspace-intelligence-runner-BU6JKNUD.js → workspace-intelligence-runner-VM5SXXAT.js} +1 -1
- package/dist/{workspace-knowledge-graph-OUTCLYS2.js → workspace-knowledge-graph-JXN2ZOAF.js} +1 -1
- package/dist/workspace-knowledge-graph-query-BROIV27M.js +1 -0
- package/dist/workspace-knowledge-graph-snapshot-KBNUXA64.js +1 -0
- package/dist/{workspace-mcp-serve-JYUKX3YS.js → workspace-mcp-serve-4WN4CSD7.js} +1 -1
- package/dist/{workspace-model-DUGPW5IB.js → workspace-model-D4IECQML.js} +1 -1
- package/dist/{workspace-onboarding-C4CKWTJ3.js → workspace-onboarding-6XWDKLM5.js} +1 -1
- package/dist/{workspace-registry-summary-4KX4QD55.js → workspace-registry-summary-Y3ET36NH.js} +1 -1
- package/dist/{workspace-repair-engine-OVW4J3DI.js → workspace-repair-engine-HBUXRHDY.js} +1 -1
- package/dist/workspace-run-VN7KV4BU.js +1 -0
- package/dist/{workspace-verify-B7HEFYO6.js → workspace-verify-OOAZ3NMZ.js} +1 -1
- package/dist/{workspace-watch-TQYAMLIV.js → workspace-watch-BNM5B6HU.js} +1 -1
- package/docs/README.md +1 -1
- package/docs/agent-framework-adapters.md +33 -14
- package/docs/ci-workflows.md +31 -8
- package/docs/commands-reference.md +24 -11
- package/docs/creating-workspaces-and-projects.md +28 -10
- package/docs/doctor-command.md +4 -0
- package/docs/native-kit-baselines.md +3 -0
- package/docs/workspace-operations.md +12 -2
- package/docs/workspace-run.md +8 -0
- package/package.json +5 -4
- package/dist/analyze-FRQVJ3VJ.js +0 -1
- package/dist/autopilot-release-D3UES53H.js +0 -1
- package/dist/chunk-36VNERGC.js +0 -1
- package/dist/chunk-4DX4HBG3.js +0 -4
- package/dist/chunk-CMLLERGG.js +0 -418
- package/dist/chunk-D4AMCZJU.js +0 -7
- package/dist/chunk-LMOTDLJF.js +0 -2
- package/dist/chunk-NFWUAEVQ.js +0 -12
- package/dist/chunk-O2CFT2A3.js +0 -1
- package/dist/chunk-O5XQP5E7.js +0 -1
- package/dist/chunk-P5RZO5BY.js +0 -681
- package/dist/chunk-TXVMHEJS.js +0 -1
- package/dist/chunk-YP436V7Q.js +0 -2
- package/dist/chunk-ZKYH44ER.js +0 -1
- package/dist/verified-goal-A6WOMNTU.js +0 -1
- package/dist/workspace-graph-token-efficiency-YHXFGH3Z.js +0 -1
- package/dist/workspace-knowledge-graph-query-TT2KK3SF.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-XWJRUMAC.js +0 -1
- package/dist/workspace-run-NVQGRZYO.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {l}from'./chunk-36VNERGC.js';import {a as a$1}from'./chunk-FS3WLRQ4.js';import {b}from'./chunk-OA2YJN22.js';import {j}from'./chunk-O2CFT2A3.js';import {b as b$1}from'./chunk-VN2MKTQO.js';import {a}from'./chunk-AFIFZTOY.js';import {c}from'./chunk-EWZZUQBR.js';import {s,t,p}from'./chunk-ODK4LCEL.js';import Pe from'crypto';import O from'fs';import M from'fs/promises';import f from'path';var fe=s.projectAgentEntry.schemaVersion,L=t.projectAgentEntry,Ce="workspai.agent-bootstrap-receipt.v1",Ve="<!-- WORKSPAI:AGENT-ENTRY:START -->",Be="<!-- WORKSPAI:AGENT-ENTRY:END -->",B=["generic","codex","claude","gemini","qwen","kimi","grok","copilot","cursor","windsurf","amazon-q"],Ue=["CLAUDE.md","GEMINI.md","QWEN.md",".amazonq/rules/workspai-agent-entry.md"];function Se(t){let s=t?.trim().toLowerCase()||"generic";if(s==="orca")return "grok";if(B.includes(s))return s;throw new Error(`Unsupported agent host "${s}". Expected one of: ${B.join(", ")}.`)}function me(t){let s=t.map(c=>c.id).sort(),n=[...B].sort();if(s.length!==n.length||s.some((c,p)=>c!==n[p]))throw new Error("Project agent entry must define each supported host exactly once.")}function U(t){let{integrity:s,...n}=t;return n}function T(t){return c(t)}function Je(t$1){me(t$1.hosts);let s={schemaVersion:fe,generatedAt:t$1.context.generatedAt,project:{name:t$1.context.project.name,relativePath:t$1.context.project.relativePath,...t$1.context.project.runtime?{runtime:t$1.context.project.runtime}:{},...t$1.context.project.framework?{framework:t$1.context.project.framework}:{}},workspace:{name:t$1.context.workspace.name,relationship:t$1.context.workspace.relationship,localBinding:t.projectWorkspaceLink,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"},canonical:{projectContext:t.projectContextAgent,projectGrounding:".workspai/PROJECT-GROUNDING.md",projectKnowledgeGraph:t.projectKnowledgeGraphReference,goalIndex:`workspace:${t.goalIndex}`,workspaceIndex:`workspace:${p.agentIndex}`,workspaceContext:`workspace:${p.agentContext}`,workspaceModel:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,workspaceSkillsIndex:`workspace:${p.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:[L,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",t.projectContextAgent,`workspace:${t.goalIndex}`,`workspace:${p.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$1.hosts].sort((c,p)=>c.id.localeCompare(p.id))},n={...s,integrity:{algorithm:"sha256",projectContextHash:t$1.context.integrity.payloadHash,payloadHash:T(s),portable:true,absolutePathsEmitted:false}};if(!A(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 A(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(A):t&&typeof t=="object"?Object.values(t).every(A):true}async function Te(t){let s=f.join(t,L),n=JSON.parse(await M.readFile(s,"utf8"));if(a(n,"contracts/workspace-intelligence/project-agent-entry.v1.json","Project agent entry"),n.integrity.payloadHash!==T(U(n)))throw new Error("Project agent entry integrity validation failed.");if(me(n.hosts),!A(n)||n.integrity.absolutePathsEmitted)throw new Error("Project agent entry contains a non-portable local path.");return n}async function Re(t$1){let s=f.join(t$1,t.projectContextAgent),n=JSON.parse(await M.readFile(s,"utf8"));a(n,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent");let c=U(n),p=Pe.createHash("sha256").update(JSON.stringify(c)).digest("hex");if(n.integrity.payloadHash!==p)throw new Error("Project context agent integrity validation failed.");if(!A(n)||n.integrity.absolutePathsEmitted)throw new Error("Project context agent contains a non-portable local path.");return n}function xe(t){return t.includes("blocked")?"blocked":t.includes("degraded")?"degraded":"ready"}async function Ye(t$1){let s=b({startPath:f.resolve(t$1.startPath??process.cwd()),strict:true,requireProjectMembership:true});if(!s?.projectPath)throw new Error("No canonically bound Workspai project was resolved.");let n=s.projectPath,c$1=s.workspacePath,p$1=await Te(n),o=await Re(n);if(p$1.integrity.projectContextHash!==o.integrity.payloadHash||p$1.project.name!==o.project.name||p$1.workspace.name!==o.workspace.name)throw new Error("Project agent entry is not bound to the current project context.");let J=t$1.forAgent?.trim().toLowerCase()||"generic",Y=J==="all",g=Y?"all":Se(J),D=g,m=Y?p$1.hosts:p$1.hosts.filter(e=>e.id===g),z=p$1.hosts.find(e=>e.id==="generic");if(m.length===0&&z&&m.push(z),m.length===0)throw new Error("Project agent entry does not define generic host coverage.");let y=[],d=(e,r,P,h)=>y.push({id:e,status:r,message:P,...h?{artifact:h}:{}});d("workspace-binding","passed","Canonical workspace membership is resolved."),d("entry-integrity","passed","Project entry manifest integrity is valid.",L),d("project-context-integrity","passed","Project context integrity and manifest binding are valid.",t.projectContextAgent);let $=[...new Set(m.flatMap(e=>e.entryFiles))].sort(),ue=$.filter(e=>!O.existsSync(f.join(n,e))),k=m.some(e=>e.status==="blocked")||ue.length>0?"blocked":m.some(e=>e.status==="degraded")?"degraded":"ready";d("host-discovery",k==="ready"?"passed":k==="degraded"?"warning":"failed",k==="ready"?`${g} has discoverable Workspai entry coverage.`:k==="degraded"?m.find(e=>e.reason)?.reason??`${g} entry coverage is degraded.`:`${g} entry coverage is missing required files.`,$[0]);let Z=[p.agentIndex,p.agentContext,p.skillsIndex,p.model,p.knowledgeGraph],R=Z.filter(e=>!O.existsSync(f.join(c$1,e)));d("canonical-evidence",R.length===0?"passed":"failed",R.length===0?"Required canonical workspace evidence is present.":`Required canonical evidence is missing: ${R.join(", ")}.`);let E=[],x=null,u=null;for(let e of Z)if(!R.includes(e))try{let r=JSON.parse(await M.readFile(f.join(c$1,e),"utf8"));b$1(e,r,e),e===p.model&&(x=r),e===p.knowledgeGraph&&(u=r);}catch{E.push(e);}d("canonical-contracts",E.length===0?"passed":"failed",E.length===0?"Canonical workspace evidence satisfies its published schemas.":`Canonical evidence failed contract validation: ${E.join(", ")}.`);let b$2=t.projectKnowledgeGraphReference,Q=f.join(n,b$2),X="failed",I="The project Knowledge Graph reference is missing.";if(O.existsSync(Q)&&u)try{let e=JSON.parse(await M.readFile(Q,"utf8"));b$1(b$2,e,b$2);let r=j(u,o.project.name),{integrity:P,...h}=e,C=u.source;e.project.name===o.project.name&&e.canonical.sourceHash===C?.hash&&e.canonical.projectionHash===c(r)&&e.integrity.payloadHash===c(h)?(X="passed",I="The project reference integrity-binds the exact current projection of canonical workspace evidence."):I="The project Knowledge Graph reference is stale or does not match the canonical project projection.";}catch{I="The project Knowledge Graph reference failed schema or integrity validation.";}d("project-knowledge-graph",X,I,b$2);let ee=x?.workspace,te=u?.workspace,oe=Array.isArray(u?.entities)?u.entities:[],ne=Array.isArray(x?.projects)?x.projects:[],re=E.length===0&&ee?.name===o.workspace.name&&te?.name===o.workspace.name&&ne.some(e=>e.name===o.project.name)&&oe.some(e=>e.projectId===o.project.name);d("canonical-project-membership",re?"passed":"failed",re?"The project and workspace identities agree across the entry, Model, and Graph.":`The project or workspace identity is missing or inconsistent in canonical evidence (entry workspace=${o.workspace.name}, model workspace=${String(ee?.name??"missing")}, graph workspace=${String(te?.name??"missing")}, entry project=${o.project.name}, model projects=${ne.map(e=>String(e.name??"missing")).join(",")||"missing"}, graph projects=${[...new Set(oe.map(e=>e.projectId).filter(e=>typeof e=="string"))].join(",")||"missing"}).`);let se=!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",j$1=false,G;if(t$1.validateLiveInputs!==false)try{let e=await a$1(c$1);j$1=e.status==="hit";let r=e.status==="hit"?"Live project inputs match the persisted Model and Knowledge Graph snapshot.":`Live project inputs require an intelligence refresh (${e.reason}).`;G={id:"live-inputs",status:j$1?"passed":"failed",message:r};}catch{G={id:"live-inputs",status:"failed",message:"Live project inputs could not be validated against canonical graph evidence."};}else G={id:"live-inputs",status:"warning",message:"Live input validation was skipped; persisted compatibility was checked only."};let K=se==="warning"&&o.intelligence.freshness.model==="unknown"&&o.intelligence.freshness.graph==="fresh"&&o.intelligence.freshness.graphMatchesModel&&j$1?"passed":se;d("persisted-freshness",K,K==="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.":K==="warning"?"Persisted evidence is compatible, but at least one freshness state is unknown.":"Persisted Model or Knowledge Graph evidence is missing, stale, or mismatched."),y.push(G);let i={present:false,appliesToProject:false,status:"none"},_=[],we=f.join(c$1,t.goalIndex);if(O.existsSync(we)){let e=null;try{e=await l({workspacePath:c$1,validateBindings:false});}catch{_.push("workspai goal --list --json"),d("active-goal","failed","The Goal index is present but invalid.");}if(e?.active&&(i={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 r=await l({workspacePath:c$1,validateBindings:true});r.active&&(i={present:true,appliesToProject:r.active.scope.projects.includes(o.project.name),status:"ready",id:r.active.id,objective:r.active.objective,lifecycle:r.active.lifecycle,goalPack:`workspace:${r.active.goalPack}`,agentHandoff:`workspace:${r.active.agentHandoff}`}),d("active-goal","passed",r.active?"The active Goal Pack and agent handoff have valid canonical bindings.":"No active Goal Pack is selected.");}catch(r){let P=r instanceof Error?r.message:String(r),h=i.present&&/\bstale\b|--refresh/i.test(P);if(i.present&&(i.status=h?"stale":"invalid"),h&&i.objective){let w=e.active,ve=w?.scope.kind==="project"&&w.scope.projects.length===1?`project:${w.scope.projects[0]}`:w?.scope.kind==="project-set"&&w.scope.projects.length>1?`projects:${w.scope.projects.join(",")}`:"workspace";_.push(`workspai goal ${JSON.stringify(i.objective)} --scope ${ve} --for-agent generic --refresh --json`);}else _.push("workspai goal --status --json");let C=!i.present||i.appliesToProject;d("active-goal",C?"failed":"warning",h?C?"The selected Goal Pack is present but stale; regenerate it against current canonical evidence before acting.":"The selected Goal Pack is stale, but it does not apply to this project; current project evidence remains usable while the Goal is refreshed for its own scope.":i.present?C?"The selected Goal Pack is present but its canonical binding or handoff is invalid.":"The selected Goal Pack has an invalid canonical binding, but it does not apply to this project; current project evidence remains usable while the Goal is repaired for its own scope.":"The Goal index could not be validated.");}}else d("active-goal","passed","No Goal index is present for this workspace.");let ae=y.filter(e=>e.id!=="active-goal"),W=ae.some(e=>e.status==="failed")?"blocked":ae.some(e=>e.status==="warning")?"degraded":"ready",ye=y.some(e=>e.id==="active-goal"&&e.status==="failed")?"blocked":y.some(e=>e.id==="active-goal"&&e.status==="warning")?"degraded":"ready",N=xe([k,W,ye]),v=o.blockers.some(e=>e.severity==="error")?"blocked":o.blockers.length>0?"degraded":"ready",ke=v==="blocked"?"blocked":v==="degraded"?"degraded":"not-verified",je=`command:workspai agent bootstrap --for-agent ${g} --strict --json`,Ae=p$1.protocol.requiredReadOrder.map(e=>e==="command:workspai agent bootstrap --for-agent generic --strict --json"?je:e),ie={schemaVersion:Ce,generatedAt:(t$1.now??new Date).toISOString(),status:N,statusScope:"agent-grounding",readiness:{agentGrounding:N,architectureEvidence:W,projectEnvironment:v,release:ke},requestedAgent:D,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:L,schemaVersion:fe,hostStatus:k,entryFiles:$},canonicalEvidence:{projectContext:t.projectContextAgent,projectKnowledgeGraph:t.projectKnowledgeGraphReference,workspaceIndex:`workspace:${p.agentIndex}`,workspaceContext:`workspace:${p.agentContext}`,workspaceModel:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,workspaceSkillsIndex:`workspace:${p.skillsIndex}`,boundedGraphSearch:"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json",modelFreshness:j$1?"fresh":o.intelligence.freshness.model,graphFreshness:j$1?"fresh":o.intelligence.freshness.graph,graphMatchesModel:o.intelligence.freshness.graphMatchesModel,liveInputsValidated:j$1,blockerCount:o.blockers.length},activeGoal:i,requiredReadOrder:Ae,claims:{architecture:W==="ready"?"allowed-with-citations":"prohibited",sourceInspection:"bounded-and-targeted",sourceMutation:"governed-cli-transaction-only",verification:"cli-evidence-only"},checks:y,nextActions:N==="ready"?[...i.present&&i.appliesToProject&&i.agentHandoff?[`read:${i.agentHandoff}`]:[],...v==="blocked"?["workspai doctor project --json","workspai workspace explain release-blocked --json"]:v==="degraded"?["workspai doctor project --json"]:[],`workspai workspace graph search <task-query> --scope project:${o.project.name} --limit 12 --json`,"inspect only the returned proof paths and target source files"]:[..._,"workspai workspace intelligence run --for-agent generic --strict --json",`workspai agent bootstrap --for-agent ${g} --strict --json`]},ce=T(U(p$1)),Ee=T({manifestHash:ce,projectContextHash:o.integrity.payloadHash,requestedAgent:D,status:N,generatedAt:ie.generatedAt}),pe={...ie,receiptId:Ee},F={...pe,integrity:{algorithm:"sha256",manifestHash:ce,projectContextHash:o.integrity.payloadHash,payloadHash:T(pe),portable:true,absolutePathsEmitted:false}};if(!A(F))throw new Error("Agent bootstrap receipt rejected a non-portable local path.");return a(F,"contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json","Agent bootstrap receipt"),F}
|
|
1
|
+
import {l}from'./chunk-G5UCEXP6.js';import {a as a$1}from'./chunk-VWBWDDU2.js';import {b}from'./chunk-OA2YJN22.js';import {j}from'./chunk-LARREYZN.js';import {b as b$1}from'./chunk-VN2MKTQO.js';import {a}from'./chunk-AFIFZTOY.js';import {c}from'./chunk-EWZZUQBR.js';import {s,t,p}from'./chunk-ODK4LCEL.js';import Pe from'crypto';import O from'fs';import M from'fs/promises';import f from'path';var fe=s.projectAgentEntry.schemaVersion,L=t.projectAgentEntry,Ce="workspai.agent-bootstrap-receipt.v1",Ve="<!-- WORKSPAI:AGENT-ENTRY:START -->",Be="<!-- WORKSPAI:AGENT-ENTRY:END -->",B=["generic","codex","claude","gemini","qwen","kimi","grok","copilot","cursor","windsurf","amazon-q"],Ue=["CLAUDE.md","GEMINI.md","QWEN.md",".amazonq/rules/workspai-agent-entry.md"];function Se(t){let s=t?.trim().toLowerCase()||"generic";if(s==="orca")return "grok";if(B.includes(s))return s;throw new Error(`Unsupported agent host "${s}". Expected one of: ${B.join(", ")}.`)}function me(t){let s=t.map(c=>c.id).sort(),n=[...B].sort();if(s.length!==n.length||s.some((c,p)=>c!==n[p]))throw new Error("Project agent entry must define each supported host exactly once.")}function U(t){let{integrity:s,...n}=t;return n}function T(t){return c(t)}function Je(t$1){me(t$1.hosts);let s={schemaVersion:fe,generatedAt:t$1.context.generatedAt,project:{name:t$1.context.project.name,relativePath:t$1.context.project.relativePath,...t$1.context.project.runtime?{runtime:t$1.context.project.runtime}:{},...t$1.context.project.framework?{framework:t$1.context.project.framework}:{}},workspace:{name:t$1.context.workspace.name,relationship:t$1.context.workspace.relationship,localBinding:t.projectWorkspaceLink,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"},canonical:{projectContext:t.projectContextAgent,projectGrounding:".workspai/PROJECT-GROUNDING.md",projectKnowledgeGraph:t.projectKnowledgeGraphReference,goalIndex:`workspace:${t.goalIndex}`,workspaceIndex:`workspace:${p.agentIndex}`,workspaceContext:`workspace:${p.agentContext}`,workspaceModel:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,workspaceSkillsIndex:`workspace:${p.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:[L,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",t.projectContextAgent,`workspace:${t.goalIndex}`,`workspace:${p.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$1.hosts].sort((c,p)=>c.id.localeCompare(p.id))},n={...s,integrity:{algorithm:"sha256",projectContextHash:t$1.context.integrity.payloadHash,payloadHash:T(s),portable:true,absolutePathsEmitted:false}};if(!A(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 A(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(A):t&&typeof t=="object"?Object.values(t).every(A):true}async function Te(t){let s=f.join(t,L),n=JSON.parse(await M.readFile(s,"utf8"));if(a(n,"contracts/workspace-intelligence/project-agent-entry.v1.json","Project agent entry"),n.integrity.payloadHash!==T(U(n)))throw new Error("Project agent entry integrity validation failed.");if(me(n.hosts),!A(n)||n.integrity.absolutePathsEmitted)throw new Error("Project agent entry contains a non-portable local path.");return n}async function Re(t$1){let s=f.join(t$1,t.projectContextAgent),n=JSON.parse(await M.readFile(s,"utf8"));a(n,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent");let c=U(n),p=Pe.createHash("sha256").update(JSON.stringify(c)).digest("hex");if(n.integrity.payloadHash!==p)throw new Error("Project context agent integrity validation failed.");if(!A(n)||n.integrity.absolutePathsEmitted)throw new Error("Project context agent contains a non-portable local path.");return n}function xe(t){return t.includes("blocked")?"blocked":t.includes("degraded")?"degraded":"ready"}async function Ye(t$1){let s=b({startPath:f.resolve(t$1.startPath??process.cwd()),strict:true,requireProjectMembership:true});if(!s?.projectPath)throw new Error("No canonically bound Workspai project was resolved.");let n=s.projectPath,c$1=s.workspacePath,p$1=await Te(n),o=await Re(n);if(p$1.integrity.projectContextHash!==o.integrity.payloadHash||p$1.project.name!==o.project.name||p$1.workspace.name!==o.workspace.name)throw new Error("Project agent entry is not bound to the current project context.");let J=t$1.forAgent?.trim().toLowerCase()||"generic",Y=J==="all",g=Y?"all":Se(J),D=g,m=Y?p$1.hosts:p$1.hosts.filter(e=>e.id===g),z=p$1.hosts.find(e=>e.id==="generic");if(m.length===0&&z&&m.push(z),m.length===0)throw new Error("Project agent entry does not define generic host coverage.");let y=[],d=(e,r,P,h)=>y.push({id:e,status:r,message:P,...h?{artifact:h}:{}});d("workspace-binding","passed","Canonical workspace membership is resolved."),d("entry-integrity","passed","Project entry manifest integrity is valid.",L),d("project-context-integrity","passed","Project context integrity and manifest binding are valid.",t.projectContextAgent);let $=[...new Set(m.flatMap(e=>e.entryFiles))].sort(),ue=$.filter(e=>!O.existsSync(f.join(n,e))),k=m.some(e=>e.status==="blocked")||ue.length>0?"blocked":m.some(e=>e.status==="degraded")?"degraded":"ready";d("host-discovery",k==="ready"?"passed":k==="degraded"?"warning":"failed",k==="ready"?`${g} has discoverable Workspai entry coverage.`:k==="degraded"?m.find(e=>e.reason)?.reason??`${g} entry coverage is degraded.`:`${g} entry coverage is missing required files.`,$[0]);let Z=[p.agentIndex,p.agentContext,p.skillsIndex,p.model,p.knowledgeGraph],R=Z.filter(e=>!O.existsSync(f.join(c$1,e)));d("canonical-evidence",R.length===0?"passed":"failed",R.length===0?"Required canonical workspace evidence is present.":`Required canonical evidence is missing: ${R.join(", ")}.`);let E=[],x=null,u=null;for(let e of Z)if(!R.includes(e))try{let r=JSON.parse(await M.readFile(f.join(c$1,e),"utf8"));b$1(e,r,e),e===p.model&&(x=r),e===p.knowledgeGraph&&(u=r);}catch{E.push(e);}d("canonical-contracts",E.length===0?"passed":"failed",E.length===0?"Canonical workspace evidence satisfies its published schemas.":`Canonical evidence failed contract validation: ${E.join(", ")}.`);let b$2=t.projectKnowledgeGraphReference,Q=f.join(n,b$2),X="failed",I="The project Knowledge Graph reference is missing.";if(O.existsSync(Q)&&u)try{let e=JSON.parse(await M.readFile(Q,"utf8"));b$1(b$2,e,b$2);let r=j(u,o.project.name),{integrity:P,...h}=e,C=u.source;e.project.name===o.project.name&&e.canonical.sourceHash===C?.hash&&e.canonical.projectionHash===c(r)&&e.integrity.payloadHash===c(h)?(X="passed",I="The project reference integrity-binds the exact current projection of canonical workspace evidence."):I="The project Knowledge Graph reference is stale or does not match the canonical project projection.";}catch{I="The project Knowledge Graph reference failed schema or integrity validation.";}d("project-knowledge-graph",X,I,b$2);let ee=x?.workspace,te=u?.workspace,oe=Array.isArray(u?.entities)?u.entities:[],ne=Array.isArray(x?.projects)?x.projects:[],re=E.length===0&&ee?.name===o.workspace.name&&te?.name===o.workspace.name&&ne.some(e=>e.name===o.project.name)&&oe.some(e=>e.projectId===o.project.name);d("canonical-project-membership",re?"passed":"failed",re?"The project and workspace identities agree across the entry, Model, and Graph.":`The project or workspace identity is missing or inconsistent in canonical evidence (entry workspace=${o.workspace.name}, model workspace=${String(ee?.name??"missing")}, graph workspace=${String(te?.name??"missing")}, entry project=${o.project.name}, model projects=${ne.map(e=>String(e.name??"missing")).join(",")||"missing"}, graph projects=${[...new Set(oe.map(e=>e.projectId).filter(e=>typeof e=="string"))].join(",")||"missing"}).`);let se=!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",j$1=false,G;if(t$1.validateLiveInputs!==false)try{let e=await a$1(c$1);j$1=e.status==="hit";let r=e.status==="hit"?"Live project inputs match the persisted Model and Knowledge Graph snapshot.":`Live project inputs require an intelligence refresh (${e.reason}).`;G={id:"live-inputs",status:j$1?"passed":"failed",message:r};}catch{G={id:"live-inputs",status:"failed",message:"Live project inputs could not be validated against canonical graph evidence."};}else G={id:"live-inputs",status:"warning",message:"Live input validation was skipped; persisted compatibility was checked only."};let K=se==="warning"&&o.intelligence.freshness.model==="unknown"&&o.intelligence.freshness.graph==="fresh"&&o.intelligence.freshness.graphMatchesModel&&j$1?"passed":se;d("persisted-freshness",K,K==="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.":K==="warning"?"Persisted evidence is compatible, but at least one freshness state is unknown.":"Persisted Model or Knowledge Graph evidence is missing, stale, or mismatched."),y.push(G);let i={present:false,appliesToProject:false,status:"none"},_=[],we=f.join(c$1,t.goalIndex);if(O.existsSync(we)){let e=null;try{e=await l({workspacePath:c$1,validateBindings:false});}catch{_.push("workspai goal --list --json"),d("active-goal","failed","The Goal index is present but invalid.");}if(e?.active&&(i={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 r=await l({workspacePath:c$1,validateBindings:true});r.active&&(i={present:true,appliesToProject:r.active.scope.projects.includes(o.project.name),status:"ready",id:r.active.id,objective:r.active.objective,lifecycle:r.active.lifecycle,goalPack:`workspace:${r.active.goalPack}`,agentHandoff:`workspace:${r.active.agentHandoff}`}),d("active-goal","passed",r.active?"The active Goal Pack and agent handoff have valid canonical bindings.":"No active Goal Pack is selected.");}catch(r){let P=r instanceof Error?r.message:String(r),h=i.present&&/\bstale\b|--refresh/i.test(P);if(i.present&&(i.status=h?"stale":"invalid"),h&&i.objective){let w=e.active,ve=w?.scope.kind==="project"&&w.scope.projects.length===1?`project:${w.scope.projects[0]}`:w?.scope.kind==="project-set"&&w.scope.projects.length>1?`projects:${w.scope.projects.join(",")}`:"workspace";_.push(`workspai goal ${JSON.stringify(i.objective)} --scope ${ve} --for-agent generic --refresh --json`);}else _.push("workspai goal --status --json");let C=!i.present||i.appliesToProject;d("active-goal",C?"failed":"warning",h?C?"The selected Goal Pack is present but stale; regenerate it against current canonical evidence before acting.":"The selected Goal Pack is stale, but it does not apply to this project; current project evidence remains usable while the Goal is refreshed for its own scope.":i.present?C?"The selected Goal Pack is present but its canonical binding or handoff is invalid.":"The selected Goal Pack has an invalid canonical binding, but it does not apply to this project; current project evidence remains usable while the Goal is repaired for its own scope.":"The Goal index could not be validated.");}}else d("active-goal","passed","No Goal index is present for this workspace.");let ae=y.filter(e=>e.id!=="active-goal"),W=ae.some(e=>e.status==="failed")?"blocked":ae.some(e=>e.status==="warning")?"degraded":"ready",ye=y.some(e=>e.id==="active-goal"&&e.status==="failed")?"blocked":y.some(e=>e.id==="active-goal"&&e.status==="warning")?"degraded":"ready",N=xe([k,W,ye]),v=o.blockers.some(e=>e.severity==="error")?"blocked":o.blockers.length>0?"degraded":"ready",ke=v==="blocked"?"blocked":v==="degraded"?"degraded":"not-verified",je=`command:workspai agent bootstrap --for-agent ${g} --strict --json`,Ae=p$1.protocol.requiredReadOrder.map(e=>e==="command:workspai agent bootstrap --for-agent generic --strict --json"?je:e),ie={schemaVersion:Ce,generatedAt:(t$1.now??new Date).toISOString(),status:N,statusScope:"agent-grounding",readiness:{agentGrounding:N,architectureEvidence:W,projectEnvironment:v,release:ke},requestedAgent:D,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:L,schemaVersion:fe,hostStatus:k,entryFiles:$},canonicalEvidence:{projectContext:t.projectContextAgent,projectKnowledgeGraph:t.projectKnowledgeGraphReference,workspaceIndex:`workspace:${p.agentIndex}`,workspaceContext:`workspace:${p.agentContext}`,workspaceModel:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,workspaceSkillsIndex:`workspace:${p.skillsIndex}`,boundedGraphSearch:"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json",modelFreshness:j$1?"fresh":o.intelligence.freshness.model,graphFreshness:j$1?"fresh":o.intelligence.freshness.graph,graphMatchesModel:o.intelligence.freshness.graphMatchesModel,liveInputsValidated:j$1,blockerCount:o.blockers.length},activeGoal:i,requiredReadOrder:Ae,claims:{architecture:W==="ready"?"allowed-with-citations":"prohibited",sourceInspection:"bounded-and-targeted",sourceMutation:"governed-cli-transaction-only",verification:"cli-evidence-only"},checks:y,nextActions:N==="ready"?[...i.present&&i.appliesToProject&&i.agentHandoff?[`read:${i.agentHandoff}`]:[],...v==="blocked"?["workspai doctor project --json","workspai workspace explain release-blocked --json"]:v==="degraded"?["workspai doctor project --json"]:[],`workspai workspace graph search <task-query> --scope project:${o.project.name} --limit 12 --json`,"inspect only the returned proof paths and target source files"]:[..._,"workspai workspace intelligence run --for-agent generic --strict --json",`workspai agent bootstrap --for-agent ${g} --strict --json`]},ce=T(U(p$1)),Ee=T({manifestHash:ce,projectContextHash:o.integrity.payloadHash,requestedAgent:D,status:N,generatedAt:ie.generatedAt}),pe={...ie,receiptId:Ee},F={...pe,integrity:{algorithm:"sha256",manifestHash:ce,projectContextHash:o.integrity.payloadHash,payloadHash:T(pe),portable:true,absolutePathsEmitted:false}};if(!A(F))throw new Error("Agent bootstrap receipt rejected a non-portable local path.");return a(F,"contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json","Agent bootstrap receipt"),F}
|
|
2
2
|
export{fe as a,L as b,Ce as c,Ve as d,Be as e,B as f,Ue as g,Se as h,Je as i,Ye as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c}from'./chunk-KDVNRNDU.js';import {j,i,d as d$1,f as f$1,c as c$2,e,h}from'./chunk-G5UCEXP6.js';import {g}from'./chunk-5HNQIMGW.js';import {a as a$1}from'./chunk-VWBWDDU2.js';import {c as c$3}from'./chunk-ZI54C2AO.js';import {b}from'./chunk-OA2YJN22.js';import {b as b$1}from'./chunk-ZGVODK5C.js';import {d as d$2}from'./chunk-ROOPODG6.js';import {f,i as i$1}from'./chunk-BLEIUQL6.js';import {a}from'./chunk-AFIFZTOY.js';import {d,c as c$1}from'./chunk-EWZZUQBR.js';import {q,p}from'./chunk-ODK4LCEL.js';import R from'path';import _ from'fs-extra';var we=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,ke=/(?:^|\s)(?:\/(?:home|Users|private|var|tmp|mnt|opt|srv|root|workspace|workspaces|data|Volumes|etc|usr|run|dev|proc|sys)\/[^\s]+|[A-Za-z]:[\\/][^\s]+|\\\\[^\\\s]+\\[^\s]+)/,ve=/(?:-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\b(?:github_pat_|gh[pousr]_|glpat-|npm_|xox[baprs]-|sk-(?:proj-)?)[A-Za-z0-9_-]{12,}|\b(?:AKIA|ASIA)[A-Z0-9]{16}\b|\bAIza[A-Za-z0-9_-]{20,}|\bBearer\s+[A-Za-z0-9._~+/-]{16,}|[a-z][a-z0-9+.-]*:\/\/[^\s:/]+:[^\s@/]+@|\b(?:password|passwd|secret|token|api[_-]?key)\s*[:=]\s*[^\s]{6,})/i,ye=[{category:"test-coverage",patterns:[/\b(?:test\s+)?coverage\b/i,/\bcoverage\s+(?:to|above|at least)\b/i]},{category:"dependency-security",patterns:[/\b(?:dependency|dependencies|package|packages)\b.*\b(?:security|vulnerab|audit)\b/i,/\b(?:security|vulnerab|audit)\b.*\b(?:dependency|dependencies|package|packages)\b/i]},{category:"release-readiness",patterns:[/\brelease[ -]readiness\b/i,/\bready (?:this |the )?(?:workspace|project) for release\b/i,/\bprepare (?:this |the )?(?:workspace|project) for release\b/i,/\bprepare\b[^\n]{0,80}\bfor release\b/i]},{category:"defect-repair",patterns:[/\b(?:fix|repair|resolve|debug)\b.*\b(?:bug|error|failure|issue|regression)\b/i]},{category:"performance",patterns:[/\b(?:performance|latency|throughput|cpu|optimi[sz]e|faster|slower)\b/i,/\b(?:memory\s+(?:allocation|consumption|footprint|leak|pressure|usage)|out[ -]of[ -]memory|heap|ram)\b/i]},{category:"refactor",patterns:[/\b(?:refactor|restructure|decouple|extract|simplify|cleanup|clean up)\b/i]},{category:"documentation",patterns:[/\b(?:document|documentation|readme|guide|tutorial|docs)\b/i]},{category:"feature-change",patterns:[/\b(?:add|build|create|enforce|enhance|harden|implement|improve|introduce|support)\b/i]},{category:"system-understanding",patterns:[/\b(?:understand|explain|map|find|where|how|architecture|analy[sz]e|search)\b/i]}];function Pe(e){if(typeof e!="string")throw new Error("Goal intent must be text.");let t=e.trim().replace(/\s+/g," ");if(!t)throw new Error("Goal intent cannot be empty.");if(t.length>2e3)throw new Error("Goal intent exceeds the 2000 character safety limit.");if(we.test(t))throw new Error("Goal intent contains unsupported control characters.");if(ke.test(t))throw new Error("Goal intent contains a machine-local absolute path. Use a workspace-relative path or project scope.");if(ve.test(t))throw new Error("Goal intent appears to contain secret material and was not persisted.");return t}function je(e){let t=e.match(/\b(?:coverage\D{0,24})?((?:100(?:\.0+)?|\d{1,2}(?:\.\d+)?))\s*(?:%|percent(?:age)?(?:\s+points?)?)/i);if(!t||!/coverage/i.test(e))return null;let r=Number(t[1]);return Number.isFinite(r)&&r>=0&&r<=100?r:null}var oe=[{runtime:"cpp",patterns:[/\bc\+\+/i,/\bcpp\b/i]},{runtime:"dotnet",patterns:[/\.net\b/i,/\bdotnet\b/i,/\bc#/i,/\bcsharp\b/i]},{runtime:"node",patterns:[/\bnode(?:\.js)?\b/i,/\btypescript\b/i,/\bjavascript\b/i,/\b(?:js|ts)\b/i]},{runtime:"python",patterns:[/\bpython\b/i,/\bpytest\b/i]},{runtime:"go",patterns:[/\bgolang\b/i,/\bgo(?:\s+(?:test|coverage|tests))\b/i]},{runtime:"java",patterns:[/\bjava\b/i,/\bjunit\b/i,/\bjacoco\b/i]},{runtime:"rust",patterns:[/\brust\b/i,/\bcargo\b/i]},{runtime:"php",patterns:[/\bphp\b/i,/\bphpunit\b/i]},{runtime:"ruby",patterns:[/\bruby\b/i,/\brspec\b/i]},{runtime:"kotlin",patterns:[/\bkotlin\b/i]},{runtime:"scala",patterns:[/\bscala\b/i]},{runtime:"clojure",patterns:[/\bclojure\b/i]},{runtime:"elixir",patterns:[/\belixir\b/i]},{runtime:"deno",patterns:[/\bdeno\b/i]},{runtime:"bun",patterns:[/\bbun\b/i]},{runtime:"c",patterns:[/\bc(?:\s+(?:test|coverage|tests|code))\b/i]}];function Ge(e){return oe.filter(t=>t.patterns.some(r=>r.test(e))).map(t=>t.runtime)}function K(e,t={}){let r=Pe(e),n=ye.filter(u=>u.patterns.some(j=>j.test(r))).map(u=>u.category),a=n.some(u=>u!=="feature-change")?n.filter(u=>u!=="feature-change"):n,s=a[0]??"feature-change",l=je(r),d=Ge(r),p=d.length===0&&t.selectedCoverageRuntime?[t.selectedCoverageRuntime]:d,m=[...new Set((t.availableCoverageRuntimes??[]).filter(u=>oe.some(j=>j.runtime===u)))].sort(),b=[];return a.length>1&&a[0]!=="test-coverage"&&b.push(`The intent also contains signals for: ${a.slice(1).join(", ")}.`),s==="test-coverage"&&l===null&&b.push("A numeric test coverage target is required for machine verification."),s==="test-coverage"&&p.length>1&&b.push(`The Goal names multiple coverage runtimes: ${p.join(", ")}. Select one runtime per Goal.`),s==="test-coverage"&&p.length===0&&m.length>1&&b.push(`Coverage scope is ambiguous across detected runtimes: ${m.join(", ")}. Name one runtime or language in the Goal.`),s==="test-coverage"&&p.length===1&&m.length>0&&!m.includes(p[0])&&b.push(`The requested ${p[0]} coverage runtime is not present in the selected scope. Detected runtimes: ${m.join(", ")}.`),{original:r,normalized:r.toLocaleLowerCase("en-US"),statement:r.replace(/[.!?]+$/,""),category:s,confidence:a.length===1?"high":a.length>1?"medium":"low",ambiguities:b,...l===null?{}:{requestedTarget:{metric:"test-coverage-percent",operator:"at-least",value:l,...p.length===1?{runtime:p[0]}:{}}}}}function ae(e){let t={"test-coverage":["test suite coverage configuration instrumentation","CI tests LCOV Cobertura JaCoCo LLVM coverage"],"dependency-security":["dependency manifest lockfile security audit vulnerability"],"release-readiness":["release pipeline readiness gates build test deploy"],"defect-repair":["failure error test implementation call path"],"feature-change":["API implementation module dependency tests"],refactor:["module dependency ownership implementation tests"],performance:["performance benchmark latency throughput runtime"],documentation:["documentation README guide architecture decision"],"system-understanding":["architecture service API dependency ownership"]};return [...new Set([e.statement,...t[e.category]])].slice(0,3)}var se="contracts/workspace-intelligence/goal-pack.v1.json",ie="contracts/workspace-intelligence/goal-agent-handoff.v1.json",Ce="contracts/workspace-intelligence/goal-plan-result.v1.json",ue="contracts/workspace-intelligence/goal-index.v1.json",de=new Set(["node","bun","deno","python","go","java","dotnet","rust","php","ruby","elixir","clojure","scala","kotlin","c","cpp"]);function Ae(e,t){let r=e.match(/[A-Za-z0-9][A-Za-z0-9+#.%_-]*/g)??[],n=new Set(t.map(m=>m.toLocaleLowerCase("en-US").replace(/[^a-z0-9]/g,"")).filter(Boolean)),a=[];for(let m=0;m<r.length;){let b=0;for(let u=Math.min(4,r.length-m);u>=1;u-=1){let j=r.slice(m,m+u).join("").toLocaleLowerCase("en-US").replace(/[^a-z0-9]/g,"");if(n.has(j)){b=u;break}}if(b>0){m+=b;continue}a.push(r[m]),m+=1;}let s=a.findIndex((m,b)=>{let u=m.toLocaleLowerCase("en-US"),j=a[b+1]?.toLocaleLowerCase("en-US");return u==="without"&&["breaking","changing","modifying","removing"].includes(j??"")||u==="while"&&["keeping","maintaining","preserving"].includes(j??"")}),l=s>=2?a.slice(0,s):a,d=l.length>=2?l.join(" "):e;if(s<2)return [d];let p=a.slice(s).filter(m=>!["without","while","breaking","changing","modifying","removing","keeping","maintaining","preserving"].includes(m.toLocaleLowerCase("en-US")));return p.length>0?[d,p.join(" ")]:[d]}function ce(e){return e.split(R.sep).join("/")}function V(e,t){return d$2(e,t.path,{...t.absolutePath?{absolutePath:t.absolutePath}:{}})}function le(e){let t=e.requested.trim().replace(/^project:/,"");if(!t)throw new Error("Project goal scope must name a project.");let r=R.isAbsolute(t)?R.resolve(t):null,n=e.model.projects.filter(a=>a.name===t||ce(a.path)===ce(t)||r!==null&&V(e.workspacePath,a)===r);if(n.length!==1)throw new Error(n.length===0?`Project goal scope was not found in the canonical model: ${t}`:`Project goal scope is ambiguous in the canonical model: ${t}`);return n[0]}async function Re(e){let t=await a$1(e);if(t.status==="miss")throw new Error(`Canonical model and live graph evidence are required (${t.reason}). Run \`workspai workspace intelligence run --for-agent generic --strict --json\` or retry with --refresh.`);let{model:r,graph:n}=t;return a(r,"contracts/workspace-intelligence/workspace-model.v1.json","Goal source model"),a(n,"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json","Goal source graph"),b$1(n,r),{model:r,graph:n}}function pe(e){let t=e.scope.trim();if(t==="workspace")return {kind:"workspace",projects:e.model.projects.map(n=>n.name).sort(),selectionSource:e.selectionSource,resolution:"selected"};let r=t.startsWith("projects:")?"projects:":t.startsWith("project:")&&t.slice(8).includes(",")?"project:":null;if(r){let n=t.slice(r.length).split(",").map(l=>l.trim()).filter(Boolean);if(n.length<2)throw new Error("A project-set Goal scope must name at least two projects.");let a=n.map(l=>le({workspacePath:e.workspacePath,model:e.model,requested:l})),s=[...new Set(a.map(l=>l.name))].sort();if(s.length!==n.length)throw new Error("A project-set Goal scope must not contain duplicate projects.");return {kind:"project-set",projects:s,selectionSource:e.selectionSource,resolution:"selected"}}if(t)return {kind:"project",projects:[le({workspacePath:e.workspacePath,model:e.model,requested:t}).name],selectionSource:e.selectionSource,resolution:"selected"};throw new Error("Goal scope cannot be empty.")}async function Se(e){if(e.explicitScope?.trim())return {scope:pe({workspacePath:e.workspacePath,model:e.model,scope:e.explicitScope,selectionSource:"explicit"}),selectionRequired:false};if(e.invocationProjectPath){let t=R.resolve(e.invocationProjectPath),r=e.model.projects.filter(n=>V(e.workspacePath,n)===t);if(r.length!==1)throw new Error("The invocation project is not represented uniquely in the canonical workspace model. Refresh intelligence or pass --scope explicitly.");return {scope:{kind:"project",projects:[r[0].name],selectionSource:"invocation-project",resolution:"selected"},selectionRequired:false}}if(e.model.projects.length===1)return {scope:{kind:"project",projects:[e.model.projects[0].name],selectionSource:"single-project-workspace",resolution:"selected"},selectionRequired:false};if(e.selectScope){let t=await e.selectScope({workspaceName:e.model.workspace.name,projects:e.model.projects.map(n=>({name:n.name,runtime:n.runtime,runtimeCandidates:[...n.runtimeCandidates].sort(),framework:n.framework})).sort((n,a)=>n.name.localeCompare(a.name))}),r=t.kind==="workspace"?"workspace":t.projects.length===1?`project:${t.projects[0]}`:`projects:${t.projects.join(",")}`;return {scope:pe({workspacePath:e.workspacePath,model:e.model,scope:r,selectionSource:"interactive"}),selectionRequired:false}}return {scope:{kind:"workspace",projects:e.model.projects.map(t=>t.name).sort(),selectionSource:"workspace",resolution:"selection-required"},selectionRequired:true}}function Ee(e,t){if(t.kind==="workspace")return {entities:e.quality.entityCount,relationships:e.quality.relationCount,proofs:e.quality.proofCount,unresolved:e.quality.unknownCount,proofCoveragePercent:Number((e.quality.relationProofCoverageRatio*100).toFixed(2))};let r=new Set(t.projects),n=e.entities.filter(p=>p.projectId!==void 0&&r.has(p.projectId)),a=new Set(n.map(p=>p.id)),s=e.relations.filter(p=>a.has(p.from)||a.has(p.to)),l=new Set([...n.flatMap(p=>p.proofIds),...s.flatMap(p=>p.proofIds)]),d=s.filter(p=>p.proofIds.length>0).length;return {entities:n.length,relationships:s.length,proofs:l.size,unresolved:s.length-d,proofCoveragePercent:s.length===0?100:Number((d/s.length*100).toFixed(2))}}function Ie(e){let t=new Map;for(let n of e){let a=t.get(n.kind)??[];a.push(n),t.set(n.kind,a);}let r=[];for(let n=0;[...t.values()].some(a=>n<a.length);n+=1)for(let a of t.values()){let s=a[n];s&&r.push(s);}return r}async function Te(e){let t=R.join(e.workspacePath,p.intelligenceRun),r=await _.readJson(t).catch(()=>null),a=(Array.isArray(r?.stages)?r.stages:[]).filter(o=>o.status==="blocked"||o.status==="failed").map(o=>String(o.id??"unknown")).sort(),s=r?.status,l={status:s==="passed"?"passed":s==="blocked"||s==="failed"?"blocked":"unknown",artifact:p.intelligenceRun,blockedStages:a},d={status:"not-applicable",runtime:null,runtimeChoices:[],runner:null,existingEvidence:[],prerequisites:[]};if(e.intent.category==="test-coverage"){let o=e.intent.requestedTarget?.runtime;if(e.intent.ambiguities.some(P=>P.startsWith("Coverage scope is ambiguous")||P.startsWith("The Goal names multiple coverage runtimes")||P.startsWith("The selected projects do not share a common canonical coverage runtime")||P.startsWith("The requested ")))d={status:"requires-setup",runtime:o??null,runtimeChoices:e.coverageRuntimeChoices,runner:null,existingEvidence:[],prerequisites:["Select exactly one detected runtime or language for this coverage Goal."]};else {let P=o?e.projects.filter(c=>c.runtimeCandidates.includes(o)):e.projects,i=await Promise.all(P.map(async c=>({project:c,capability:await c$3(V(e.workspacePath,c),o??(de.has(c.runtime)?c.runtime:"unknown"))}))),h=i.map(c=>c.capability.status);d={status:h.includes("unsupported")?"unsupported":h.includes("requires-setup")?"requires-setup":"available",runtime:i.length===1?i[0].capability.runtime:[...new Set(i.map(c=>c.capability.runtime))].join(","),runtimeChoices:e.coverageRuntimeChoices,runner:i.length===1?i[0].capability.runner:[...new Set(i.flatMap(c=>c.capability.runner?[c.capability.runner]:[]))].join(",")||null,existingEvidence:i.flatMap(c=>c.capability.existingEvidence.map(C=>({project:c.project.name,...C}))).filter((c,C,w)=>w.findIndex(k=>k.project===c.project&&k.path===c.path&&k.sha256===c.sha256)===C).sort((c,C)=>c.project.localeCompare(C.project)||c.path.localeCompare(C.path)),prerequisites:[...new Set(i.flatMap(c=>c.capability.prerequisites))].sort()};}}let p$1=ae(e.intent),m=[...Ae(p$1[0],e.projects.map(o=>o.name)),...p$1.slice(1)].filter((o,y,P)=>P.indexOf(o)===y).slice(0,3),b=m.map((o,y)=>{let P=o.match(/[A-Za-z0-9][A-Za-z0-9+#.%_-]*/g)?.length??0,i=y===0&&P>=4?2:1,h=e.projects.map(w=>{let k=G=>g(e.graph,{query:o,projectId:w.name,...G?{kind:G}:{},limit:60,relationsPerEntity:0,minimumTermMatches:i}).entities,S=k(),me=[...new Set(e.graph.entities.filter(G=>G.projectId===w.name||G.projectId===void 0&&G.identity.scope==="workspace").map(G=>G.kind))].flatMap(G=>k(G).slice(0,8)),F=[...S,...me];return F.filter((G,ge)=>F.findIndex(he=>he.id===G.id)===ge)}),c=[],C=new Set;for(let w=0;h.some(k=>w<k.length);w+=1)for(let k of h){let S=k[w];!S||C.has(S.id)||(C.add(S.id),c.push(S));}return Ie(c)}),u={"test-coverage":["test-suite"],"dependency-security":["package","module"],"release-readiness":["pipeline","deployment","lifecycle-stage"],"defect-repair":["test-suite","lifecycle-stage"],"feature-change":["project","runtime-unit","api","package","module","test-suite"],refactor:["package","module","api","test-suite"],performance:["lifecycle-stage","test-suite","pipeline"],documentation:["document","decision"],"system-understanding":["project","service","api","package","protocol"]},j=new Set(e.projects.map(o=>o.name)),v=e.graph.entities.filter(o=>o.proofIds.length>0&&(!o.projectId||j.has(o.projectId))&&u[e.intent.category].includes(o.kind)).sort((o,y)=>u[e.intent.category].indexOf(o.kind)-u[e.intent.category].indexOf(y.kind)||o.label.localeCompare(y.label)),f=[],M=new Set,E=o=>{!o||f.length>=20||M.has(o.id)||(M.add(o.id),f.push(o));},I=(e.intent.statement.match(/[A-Za-z][A-Za-z0-9+#.-]{1,}/g)??[]).length>=2,g$1=I?b[0]??[]:[];for(let o of g$1.slice(0,12))E(o);if(!I)for(let o of v)E(o);for(let o=0;f.length<20&&b.slice(1).some(y=>o<y.length);o+=1)for(let y of b.slice(1))E(y[o]);if(I)for(let o of v)E(o);for(let o of g$1.slice(12))E(o);let T=f.map(o=>({entityId:o.id,kind:o.kind,label:o.label,proofIds:o.proofIds.slice(0,12)})),L=b[0]?.length??0;return {workspaceIntelligence:l,measurement:d,retrieval:{status:I&&L>=3?"grounded":T.length>0?"partial":"empty",strategy:"deterministic-category-v1",queries:m,anchors:T}}}async function xe(e$1){let t=R.join(e$1,f$1);if(!await _.pathExists(t))return {schemaVersion:e,generatedAt:new Date(0).toISOString(),activeGoalId:null,goals:[]};let r=await _.readJson(t);a(r,ue,"Goal index");try{i(r);}catch(n){let a=h(r);if(!(a!==null&&n instanceof Error&&n.message==="Goal index is inconsistent: activeGoalId must identify the only selected actionable lifecycle entry.")||!a)throw n;return a}return r}function _e(e$1,t,r){let n=e$1.goals.find(l=>l.id===t.id),a=t.state==="ready-to-plan",s={id:t.id,fingerprint:t.fingerprint,objective:t.intent.statement,category:t.intent.category,state:t.state,lifecycle:n?.lifecycle==="cancelled"?"cancelled":a?"active":"planned",scope:t.scope,createdAt:n?.createdAt??t.generatedAt,updatedAt:r,goalPack:t.artifacts.goalPack,agentHandoff:t.artifacts.agentHandoff,...n?.verifiedGoalId?{verifiedGoalId:n.verifiedGoalId}:{},...n?.repairTransactionId?{repairTransactionId:n.repairTransactionId}:{},...n?.repairTransactionIds?{repairTransactionIds:n.repairTransactionIds}:{},...n?.changeTransactionId?{changeTransactionId:n.changeTransactionId}:{},...n?.changeTransactionIds?{changeTransactionIds:n.changeTransactionIds}:{},...n?.verificationReceipt?{verificationReceipt:n.verificationReceipt}:{}};return {schemaVersion:e,generatedAt:r,activeGoalId:s.lifecycle==="active"?t.id:e$1.activeGoalId===t.id?null:e$1.activeGoalId,goals:[...e$1.goals.filter(l=>l.id!==t.id).map(l=>s.lifecycle==="active"&&l.lifecycle==="active"?{...l,lifecycle:"planned",updatedAt:r}:l),s].sort((l,d)=>l.id.localeCompare(d.id))}}async function nt(e){let t=b({startPath:R.resolve(e.startPath),explicitWorkspacePath:e.workspacePath,strict:true,requireProjectMembership:!e.scope?.trim()});if(!t)throw new Error("No canonical Workspai workspace could be resolved.");let r=R.resolve(t.workspacePath);e.refresh&&await c({workspacePath:r,strict:false,agent:"generic"});let{model:n,graph:a$1}=await Re(r),s=await Se({workspacePath:r,invocationProjectPath:t.projectPath,model:n,explicitScope:e.scope,selectScope:e.selectScope}),l=s.scope,d$2=n.projects.filter(i=>l.projects.includes(i.name));if(d$2.length===0)throw new Error("A Goal Pack requires at least one registered project in its selected scope.");let p$1=e.maxAttempts??5;if(!Number.isInteger(p$1)||p$1<1||p$1>25)throw new Error("--max-attempts must be an integer from 1 to 25.");let m=new Date().toISOString(),b$1=d(n),u=d$2.map(i=>({name:i.name,runtimes:[...new Set(i.runtimeCandidates.filter(h=>de.has(h)))].sort()})),j$1=[...new Set(u.flatMap(i=>i.runtimes))].sort(),v=u.length<=1?j$1:u[0].runtimes.filter(i=>u.every(h=>h.runtimes.includes(i))),f$2=K(e.intent,{availableCoverageRuntimes:v,...e.runtime?{selectedCoverageRuntime:e.runtime}:v.length===1?{selectedCoverageRuntime:v[0]}:{}});if(e.runtime&&!v.includes(e.runtime)){let i=e.runtime,h=u.filter(c=>!c.runtimes.includes(i)).map(c=>c.name);throw new Error(d$2.length>1&&h.length>0?`--runtime ${e.runtime} is not canonical for every project in the selected Goal scope. Missing from: ${h.join(", ")}. Split the projects into runtime-compatible Goal scopes.`:`--runtime ${e.runtime} is not present in the canonical Workspace Model for the selected Goal scope. Available runtimes: ${v.join(", ")||"none"}.`)}if(e.runtime&&f$2.category!=="test-coverage")throw new Error("--runtime is valid only for a test-coverage Goal.");if(e.runtime&&f$2.requestedTarget?.runtime&&f$2.requestedTarget.runtime!==e.runtime)throw new Error(`--runtime ${e.runtime} conflicts with the ${f$2.requestedTarget.runtime} runtime named in the Goal intent.`);if(!s.selectionRequired&&f$2.category==="test-coverage"&&f$2.requestedTarget&&!f$2.requestedTarget.runtime&&v.length>1&&!e.runtime&&e.selectCoverageRuntime){let i=await e.selectCoverageRuntime({workspaceName:n.workspace.name,scope:l,projects:d$2.map(h=>({name:h.name,runtime:h.runtime,runtimeCandidates:[...h.runtimeCandidates].sort()})),runtimes:v});if(!v.includes(i))throw new Error("The selected coverage runtime is outside the canonical Goal scope.");f$2=K(e.intent,{availableCoverageRuntimes:v,selectedCoverageRuntime:i});}!s.selectionRequired&&f$2.category==="test-coverage"&&d$2.length>1&&v.length===0&&(f$2={...f$2,ambiguities:[`The selected projects do not share a common canonical coverage runtime: ${u.map(i=>`${i.name} (${i.runtimes.join(", ")||"none"})`).join("; ")}. Split them into runtime-compatible Goal scopes so every selected project is verified.`,...f$2.ambiguities]}),s.selectionRequired&&(f$2={...f$2,ambiguities:[`Goal scope is unresolved across ${l.projects.length} registered projects: ${l.projects.join(", ")}. Select one project, multiple projects, or the entire workspace.`,...f$2.ambiguities]});let M=await Te({workspacePath:r,projects:d$2,graph:a$1,intent:f$2,coverageRuntimeChoices:v}),E={generatedAt:m,intent:f$2,workspaceName:n.workspace.name,scope:l,sourceBinding:{model:{artifact:p.model,schemaVersion:q.model,hashAlgorithm:"sha256",hashSemantics:"workspace-model-structural-v1",hash:b$1,generatedAt:n.generatedAt},graph:{artifact:p.knowledgeGraph,schemaVersion:q.knowledgeGraph,hashAlgorithm:"sha256",hashSemantics:"canonical-json-v1",hash:c$1(a$1),generatedAt:a$1.generatedAt,modelHash:a$1.source.hash,...a$1.source.inputs?.hash?{inputHash:a$1.source.inputs.hash}:{}}},preflight:M,baseline:{projectCount:d$2.length,runtimes:[...new Set(d$2.flatMap(i=>i.runtimeCandidates))].sort(),frameworks:[...new Set(d$2.map(i=>i.framework))].sort(),graph:Ee(a$1,l)},maxAttempts:p$1,consumer:e.consumer??"generic"},I={digestCanonical:c$1},{goalPack:g,handoff:T}=j(E,I);a(g,se,"Goal Pack"),a(T,ie,"Goal agent handoff");let L=false,o=async()=>{let i=R.join(r,g.artifacts.goalPack),h=R.join(r,g.artifacts.agentHandoff),[c,C]=await Promise.all([_.pathExists(i),_.pathExists(h)]);if(c!==C)throw new Error(`Goal Pack instance is incomplete and cannot be resumed: ${g.id}`);if(!c)return;let[w,k]=await Promise.all([_.readJson(i),_.readJson(h)]);a(w,se,"Persisted Goal Pack"),a(k,ie,"Persisted goal agent handoff");let S=j({...E,generatedAt:w.generatedAt,sourceBinding:w.sourceBinding},I);if(w.id!==g.id||k.goalId!==g.id||c$1(w)!==c$1(S.goalPack)||c$1(k)!==c$1(S.handoff))throw new Error(`Goal Pack instance failed immutable integrity validation: ${g.id}`);g=w,T=k,L=true;};if(e.dryRun)await o();else {let i$2=`.workspai/goals/${g.id}/publication`;await f(r,i$2,async()=>{await o();let h=_e(await xe(r),g,new Date().toISOString());a(h,ue,"Goal index"),i(h),await i$1(r,d$1,L?[{relativePath:d$1,payload:g},{relativePath:f$1,payload:h}]:[{relativePath:g.artifacts.goalPack,payload:g},{relativePath:g.artifacts.agentHandoff,payload:T},{relativePath:d$1,payload:g},{relativePath:f$1,payload:h}]);});}let y=[g.artifacts.goalPack,g.artifacts.agentHandoff,d$1,f$1],P={schemaVersion:c$2,result:g.state==="needs-confirmation"?"needs-confirmation":g.state==="blocked"?"blocked":g.state==="needs-evidence"?"needs-evidence":"planned",resolution:{source:t.source,invocationScope:t.projectPath?"project":"workspace"},goalPack:g,agentHandoff:T,writtenArtifacts:e.dryRun?[]:L?[d$1,f$1]:y,dryRun:e.dryRun===true,resumed:L};return a(P,Ce,"Goal plan result"),P}export{nt as a};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {h as h$1,j,i,m,a,c as c$1,l as l$1,k}from'./chunk-7NKM6EHE.js';import {i as i$1}from'./chunk-RGNCL5OB.js';import {u,v}from'./chunk-VQZ5PI5J.js';import d from'fs';import l from'path';import _ from'fs-extra';var be=[{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]"}],ee=new Map;for(let e of be){ee.set(e.id.toLowerCase(),e);for(let t of e.aliases)ee.set(t.toLowerCase(),e);}function W(e){return e?ee.get(e.trim().toLowerCase())??null:null}function Bt(e){return W(e)?.id??e}function $t(){return be.filter(e=>e.owner==="core"||e.generator)}function Kt(e){return W(e)?.owner==="npm"}async function Gt(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-TDJQIVQZ.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-UEF3IHSJ.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-COWL75GT.js');await n(t.projectPath,{project_name:t.projectName,artifact_id:t.projectName,java_version:h(t.args,"--java-version")?.trim(),spring_boot_version:h(t.args,"--spring-boot-version")?.trim(),springdoc_version:h(t.args,"--springdoc-version")?.trim(),group_id:h(t.args,"--group-id")?.trim(),package_name:h(t.args,"--package-name")?.trim(),description:h(t.args,"--description")?.trim(),port:h(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-6Z4EXEJY.js');await n(t.projectPath,{project_name:t.projectName,target_framework:h(t.args,"--target-framework")?.trim(),root_namespace:h(t.args,"--root-namespace")?.trim(),description:h(t.args,"--description")?.trim(),port:h(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="rust-axum"){let{generateRustAxumKit:n}=await import('./rust-axum-4TRVPFMB.js');await n(t.projectPath,{project_name:t.projectName,description:h(t.args,"--description")?.trim(),port:h(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}throw new Error(`Unhandled npm kit generator: ${e.generator}`)}function h(e,t){let n=e.indexOf(t);if(n>=0&&n+1<e.length)return e[n+1];let r=e.find(o=>o.startsWith(`${t}=`));return r?r.slice(t.length+1):void 0}var N=["init","dev","start","build","test","lint","format","help"],ke={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."]}};function O(e){return ke[e||"unknown"]??ke.unknown}function Ce(e){return h$1(e).supportTier}function Se(e){let t=O(e.runtime);return {lifecycleCommands:t.lifecycleCommands,moduleCommands:e.moduleSupport&&t.moduleCommands,unsupportedLifecycleCommands:N.filter(n=>!t.lifecycleCommands.includes(n))}}var We=["python","node","bun","go","java","dotnet","rust","php"];function M(e){return !!e&&We.includes(e)}function J(e,t){return t!=="lint"&&t!=="format"&&t!=="docs"?false:e==="python"}function he(e){let t=O(e),n=M(t.runtime),r=Je[t.runtime]??[],o=qe[t.runtime]??[];return {runtime:t.runtime,displayName:t.displayName,lifecycleCommands:t.lifecycleCommands,hasExecutor:n,packageManagers:r,primaryFiles:o,notes:t.notes}}var Je={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"]},qe={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 D(e,t){let n=j(e)?null:e,r=i({runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0});return r.runtime!=="unknown"?r.runtime:m(t,n).runtime}function xe(e,t={}){let n=e;for(;;){for(let o of u(n,"project.json"))if(d.existsSync(o))try{return JSON.parse(d.readFileSync(o,"utf8"))}catch{return null}if(t.searchParents===false)break;let r=l.dirname(n);if(r===n)break;n=r;}return null}function tn(e,t){return D(e,t)==="go"}function nn(e,t){return D(e,t)==="node"}function rn(e,t){return D(e,t)==="java"}function on(e,t){return D(e,t)==="dotnet"}function sn(e,t){return D(e,t)==="python"}var He=["project.json","context.json","file-hashes.json"];async function yn(e){let t=l.resolve(e),n=[];for(let r of He){let o=v(t,r);if(await _.pathExists(o))continue;let i=l.join(t,".rapidkit",r);if(!await _.pathExists(i))continue;let u=await _.readJson(i);await _.ensureDir(l.dirname(o));let f=`${o}.${process.pid}.${Date.now()}.tmp`;try{await _.writeJson(f,u,{spaces:2}),await _.move(f,o,{overwrite:false}),n.push(o);}finally{await _.remove(f).catch(()=>{});}}return n}function Ve(e){for(let t of u(e,"context.json"))if(d.existsSync(t))try{return JSON.parse(d.readFileSync(t,"utf8"))}catch{return null}return null}function ze(e){let t=e?.engine;return t==="npm"||t==="pip"||t==="python"||t==="poetry"||t==="venv"||t==="pipx"||t==="uv"?t:"unknown"}function Xe(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 Qe(e,t,n){let r=j(t)?null:t,o=i({runtime:typeof r?.runtime=="string"?r.runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof r?.framework=="string"?r.framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof r?.kit_name=="string"?r.kit_name:typeof r?.kit=="string"?r.kit:typeof n?.kit=="string"?n.kit:void 0});return o.key!=="unknown"?o:m(e,r)}function we(e){let t=l.resolve(e);if(![...u(t,"project.json"),...u(t,"context.json")].some(u=>d.existsSync(u)))return null;let r=xe(t,{searchParents:false}),o=Ve(t),i=Qe(t,r,o);return {projectRoot:t,projectJson:r,contextJson:o,detection:i,moduleSupport:Xe(r,o),engine:ze(o)}}var Ze=["build","dev","start","test","lint","format"],ne=["init","test","build","start"],Cn=["lint","format","docs"];function Sn(e){return !!e&&Ze.includes(e)}var et={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"]},ve={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 tt(e){let t=l.join(e,"package.json");if(!d.existsSync(t))return {};try{let r=JSON.parse(d.readFileSync(t,"utf8")).scripts??{};return Object.fromEntries(Object.entries(r).filter(o=>typeof o[1]=="string"))}catch{return {}}}function nt(e,t){let n=t?c$1(t):"unknown",r=n!=="unknown"?a(n,e):[],o=t?ve[t]?.[e]??[]:[],i=et[e]??[],u=[...r,...o,...i];return [...new Set(u)]}function Ne(e,t,n){let r=tt(e),o=new Set(Object.keys(r));if(o.has(t))return {scriptName:t,source:"package.json"};for(let i of nt(t,n?.framework))if(o.has(i))return {scriptName:i,source:a(c$1(n?.framework??"unknown"),t).includes(i)||ve[n?.framework??""]?.[t]?.includes(i)?"framework-candidate":"generic-candidate"};return null}function oe(e){return d.existsSync(l.join(e,"package.json"))}function rt(e){try{let t=JSON.parse(d.readFileSync(l.join(e,"package.json"),"utf8"));return typeof t.packageManager!="string"?null:t.packageManager.trim().match(/^(npm|pnpm|yarn|bun)(?:@|$)/)?.[1]??null}catch{return null}}function Y(e){let t=rt(e);return t||(d.existsSync(l.join(e,"bun.lock"))||d.existsSync(l.join(e,"bunfig.toml"))?"bun":d.existsSync(l.join(e,"pnpm-lock.yaml"))?"pnpm":d.existsSync(l.join(e,"yarn.lock"))?"yarn":d.existsSync(l.join(e,"package-lock.json"))?"npm":d.existsSync(l.join(e,"pnpm-workspace.yaml"))?"pnpm":"npm")}function Mn(e,t,n=Y(e)){return n==="npm"?`npm run ${t}`:`${n} run ${t}`}function _n(e,t=Y(e)){return `${t} install`}var ot="polyglot-lifecycle-plan.v1",Ae=new Set([".git",".workspai",".rapidkit",".venv","bin","build","dist","node_modules","obj","target","third_party","vendor","fixture","fixtures","__fixtures__","testdata"]);function I(e,t){return l.relative(e,t).split(l.sep).join("/")||"."}function it(e){let t=new Set,n=(r,o)=>{if(o>4)return;let i=[];try{i=d.readdirSync(r,{withFileTypes:true});}catch{return}for(let u of i){if(u.isDirectory()){Ae.has(u.name)||n(l.join(r,u.name),o+1);continue}if(!u.isFile()||!u.name.endsWith(".go")||u.name.endsWith("_test.go"))continue;let f=l.join(r,u.name);try{let s=d.readFileSync(f,"utf8");/^\s*package\s+main\b/m.test(s)&&/^\s*func\s+main\s*\(/m.test(s)&&t.add(I(e,r));}catch{}}};return n(e,0),t.size===1?[...t][0]:null}function Re(e,t,n){let r=false;for(let o of e.split(/\r?\n/)){let i=o.match(/^\s*\[([^\]]+)\]\s*(?:#.*)?$/)?.[1]?.trim();if(i!==void 0){r=i===t;continue}if(r&&new RegExp(`^\\s*${n}\\s*=`).test(o))return true}return false}function st(e,t){let n=[],r=(o,i)=>{if(i>t)return;let u=[];try{u=d.readdirSync(o,{withFileTypes:true});}catch{return}for(let f of u.sort((s,y)=>s.name.localeCompare(y.name))){let s=l.join(o,f.name);if(f.isDirectory()){Ae.has(f.name)||r(s,i+1);continue}f.isFile()&&(["package.json","deno.json","deno.jsonc","pyproject.toml","go.mod","Cargo.toml","pom.xml","build.gradle","build.gradle.kts","build.sbt","deps.edn","composer.json","Gemfile","mix.exs","CMakeLists.txt","meson.build"].includes(f.name)||/\.(?:cs|fs|vb)proj$/i.test(f.name))&&n.push(s);}};return r(e,0),n}function at(e,t){if(l.dirname(t)!==e)return false;let n,r;try{n=JSON.parse(d.readFileSync(l.join(e,".workspai","project.json"),"utf8")),r=d.readFileSync(t,"utf8").replace(/\r\n/g,`
|
|
1
|
+
import {h as h$1,j,i,m,a,c as c$1,l as l$1,k}from'./chunk-7NKM6EHE.js';import {i as i$1}from'./chunk-RGNCL5OB.js';import {u,v}from'./chunk-VQZ5PI5J.js';import d from'fs';import l from'path';import _ from'fs-extra';var ke=[{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]"}],ee=new Map;for(let e of ke){ee.set(e.id.toLowerCase(),e);for(let t of e.aliases)ee.set(t.toLowerCase(),e);}function W(e){return e?ee.get(e.trim().toLowerCase())??null:null}function $t(e){return W(e)?.id??e}function Kt(){return ke.filter(e=>e.owner==="core"||e.generator)}function Gt(e){return W(e)?.owner==="npm"}async function Ut(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-PFBIAMGR.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-DW5GL7YG.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-CZH24KWD.js');await n(t.projectPath,{project_name:t.projectName,artifact_id:t.projectName,java_version:h(t.args,"--java-version")?.trim(),spring_boot_version:h(t.args,"--spring-boot-version")?.trim(),springdoc_version:h(t.args,"--springdoc-version")?.trim(),group_id:h(t.args,"--group-id")?.trim(),package_name:h(t.args,"--package-name")?.trim(),description:h(t.args,"--description")?.trim(),port:h(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-GXTNZMKO.js');await n(t.projectPath,{project_name:t.projectName,target_framework:h(t.args,"--target-framework")?.trim(),root_namespace:h(t.args,"--root-namespace")?.trim(),description:h(t.args,"--description")?.trim(),port:h(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="rust-axum"){let{generateRustAxumKit:n}=await import('./rust-axum-L7UAYARA.js');await n(t.projectPath,{project_name:t.projectName,description:h(t.args,"--description")?.trim(),port:h(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}throw new Error(`Unhandled npm kit generator: ${e.generator}`)}function h(e,t){let n=e.indexOf(t);if(n>=0&&n+1<e.length)return e[n+1];let r=e.find(o=>o.startsWith(`${t}=`));return r?r.slice(t.length+1):void 0}var N=["init","dev","start","build","test","lint","format","help"],Ce={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."]}};function D(e){return Ce[e||"unknown"]??Ce.unknown}function Se(e){return h$1(e).supportTier}function he(e){let t=D(e.runtime);return {lifecycleCommands:t.lifecycleCommands,moduleCommands:e.moduleSupport&&t.moduleCommands,unsupportedLifecycleCommands:N.filter(n=>!t.lifecycleCommands.includes(n))}}var Je=["python","node","bun","go","java","dotnet","rust","php"];function M(e){return !!e&&Je.includes(e)}function J(e,t){return t!=="lint"&&t!=="format"&&t!=="docs"?false:e==="python"}function je(e){let t=D(e),n=M(t.runtime),r=qe[t.runtime]??[],o=Ye[t.runtime]??[];return {runtime:t.runtime,displayName:t.displayName,lifecycleCommands:t.lifecycleCommands,hasExecutor:n,packageManagers:r,primaryFiles:o,notes:t.notes}}var qe={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"]},Ye={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=j(e)?null:e,r=i({runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0});return r.runtime!=="unknown"?r.runtime:m(t,n).runtime}function we(e,t={}){let n=e;for(;;){for(let o of u(n,"project.json"))if(d.existsSync(o))try{return JSON.parse(d.readFileSync(o,"utf8"))}catch{return null}if(t.searchParents===false)break;let r=l.dirname(n);if(r===n)break;n=r;}return null}function nn(e,t){return I(e,t)==="go"}function rn(e,t){return I(e,t)==="node"}function on(e,t){return I(e,t)==="java"}function sn(e,t){return I(e,t)==="dotnet"}function an(e,t){return I(e,t)==="python"}var Ve=["project.json","context.json","file-hashes.json"];async function bn(e){let t=l.resolve(e),n=[];for(let r of Ve){let o=v(t,r);if(await _.pathExists(o))continue;let i=l.join(t,".rapidkit",r);if(!await _.pathExists(i))continue;let u=await _.readJson(i);await _.ensureDir(l.dirname(o));let f=`${o}.${process.pid}.${Date.now()}.tmp`;try{await _.writeJson(f,u,{spaces:2}),await _.move(f,o,{overwrite:false}),n.push(o);}finally{await _.remove(f).catch(()=>{});}}return n}function ze(e){for(let t of u(e,"context.json"))if(d.existsSync(t))try{return JSON.parse(d.readFileSync(t,"utf8"))}catch{return null}return null}function Xe(e){let t=e?.engine;return t==="npm"||t==="pip"||t==="python"||t==="poetry"||t==="venv"||t==="pipx"||t==="uv"?t:"unknown"}function Qe(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 Ze(e,t,n){let r=j(t)?null:t,o=i({runtime:typeof r?.runtime=="string"?r.runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof r?.framework=="string"?r.framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof r?.kit_name=="string"?r.kit_name:typeof r?.kit=="string"?r.kit:typeof n?.kit=="string"?n.kit:void 0});return o.key!=="unknown"?o:m(e,r)}function Pe(e){let t=l.resolve(e);if(![...u(t,"project.json"),...u(t,"context.json")].some(u=>d.existsSync(u)))return null;let r=we(t,{searchParents:false}),o=ze(t),i=Ze(t,r,o);return {projectRoot:t,projectJson:r,contextJson:o,detection:i,moduleSupport:Qe(r,o),engine:Xe(o)}}var et=["build","dev","start","test","lint","format"],ne=["init","test","build","start"],Sn=["lint","format","docs"];function hn(e){return !!e&&et.includes(e)}var tt={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"]},Ne={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 nt(e){let t=l.join(e,"package.json");if(!d.existsSync(t))return {};try{let r=JSON.parse(d.readFileSync(t,"utf8")).scripts??{};return Object.fromEntries(Object.entries(r).filter(o=>typeof o[1]=="string"))}catch{return {}}}function rt(e,t){let n=t?c$1(t):"unknown",r=n!=="unknown"?a(n,e):[],o=t?Ne[t]?.[e]??[]:[],i=tt[e]??[],u=[...r,...o,...i];return [...new Set(u)]}function Re(e,t,n){let r=nt(e),o=new Set(Object.keys(r));if(o.has(t))return {scriptName:t,source:"package.json"};for(let i of rt(t,n?.framework))if(o.has(i))return {scriptName:i,source:a(c$1(n?.framework??"unknown"),t).includes(i)||Ne[n?.framework??""]?.[t]?.includes(i)?"framework-candidate":"generic-candidate"};return null}function oe(e){return d.existsSync(l.join(e,"package.json"))}function ot(e){try{let t=JSON.parse(d.readFileSync(l.join(e,"package.json"),"utf8"));return typeof t.packageManager!="string"?null:t.packageManager.trim().match(/^(npm|pnpm|yarn|bun)(?:@|$)/)?.[1]??null}catch{return null}}function Y(e){let t=ot(e);return t||(d.existsSync(l.join(e,"bun.lock"))||d.existsSync(l.join(e,"bunfig.toml"))?"bun":d.existsSync(l.join(e,"pnpm-lock.yaml"))?"pnpm":d.existsSync(l.join(e,"yarn.lock"))?"yarn":d.existsSync(l.join(e,"package-lock.json"))?"npm":d.existsSync(l.join(e,"pnpm-workspace.yaml"))?"pnpm":"npm")}function _n(e,t,n=Y(e)){return n==="npm"?`npm run ${t}`:`${n} run ${t}`}function An(e,t=Y(e)){return `${t} install`}var it="polyglot-lifecycle-plan.v1",Le=new Set([".git",".workspai",".rapidkit",".venv","bin","build","dist","node_modules","obj","target","third_party","vendor","fixture","fixtures","__fixtures__","testdata"]);function B(e,t){return l.relative(e,t).split(l.sep).join("/")||"."}function st(e){let t=new Set,n=(r,o)=>{if(o>4)return;let i=[];try{i=d.readdirSync(r,{withFileTypes:true});}catch{return}for(let u of i){if(u.isDirectory()){Le.has(u.name)||n(l.join(r,u.name),o+1);continue}if(!u.isFile()||!u.name.endsWith(".go")||u.name.endsWith("_test.go"))continue;let f=l.join(r,u.name);try{let s=d.readFileSync(f,"utf8");/^\s*package\s+main\b/m.test(s)&&/^\s*func\s+main\s*\(/m.test(s)&&t.add(B(e,r));}catch{}}};return n(e,0),t.size===1?[...t][0]:null}function Ee(e,t,n){let r=false;for(let o of e.split(/\r?\n/)){let i=o.match(/^\s*\[([^\]]+)\]\s*(?:#.*)?$/)?.[1]?.trim();if(i!==void 0){r=i===t;continue}if(r&&new RegExp(`^\\s*${n}\\s*=`).test(o))return true}return false}function at(e,t){let n=[],r=(o,i)=>{if(i>t)return;let u=[];try{u=d.readdirSync(o,{withFileTypes:true});}catch{return}for(let f of u.sort((s,y)=>s.name.localeCompare(y.name))){let s=l.join(o,f.name);if(f.isDirectory()){Le.has(f.name)||r(s,i+1);continue}f.isFile()&&(["package.json","deno.json","deno.jsonc","pyproject.toml","go.mod","Cargo.toml","pom.xml","build.gradle","build.gradle.kts","build.sbt","deps.edn","composer.json","Gemfile","mix.exs","CMakeLists.txt","meson.build"].includes(f.name)||/\.(?:cs|fs|vb)proj$/i.test(f.name))&&n.push(s);}};return r(e,0),n}function ct(e,t){if(l.dirname(t)!==e)return false;let n,r;try{n=JSON.parse(d.readFileSync(l.join(e,".workspai","project.json"),"utf8")),r=d.readFileSync(t,"utf8").replace(/\r\n/g,`
|
|
2
2
|
`).trim();}catch{return false}if(n.generated_by!=="workspai")return false;let o=String(n.kit??n.kit_name??"");if(o==="agent.microsoft.python"&&l.basename(t)==="pyproject.toml"){let i=typeof n.name=="string"?n.name:"",u=["[project]",`name = ${JSON.stringify(i)}`,'version = "0.1.0"','requires-python = ">=3.10"',"dependencies = []","","[tool.uv]","package = false"].join(`
|
|
3
3
|
`);return i.length>0&&r===u&&d.existsSync(l.join(e,"agents","primary","pyproject.toml"))}if(o==="agent.microsoft.dotnet"&&/\.(?:cs|fs|vb)proj$/iu.test(t)){let i=['<Project Sdk="Microsoft.NET.Sdk">'," <PropertyGroup>"," <TargetFramework>net8.0</TargetFramework>"," <ImplicitUsings>enable</ImplicitUsings>"," <Nullable>enable</Nullable>"," </PropertyGroup>","</Project>"].join(`
|
|
4
|
-
`);return r===i&&d.existsSync(l.join(e,"agents","primary","Primary.csproj"))}return false}function ct(e,t){let n=I(e,t).toLowerCase().split("/"),r=n.findIndex(o=>["test","tests","spec","specs","e2e","integration","integration-tests","eval","evals","bench","benchmark","benchmarks","benchmark-app","benchmark-apps"].includes(o));return r<0?false:n.length-r>2}function lt(e){if(l.basename(e)!=="package.json")return true;try{let t=l.dirname(e),n=JSON.parse(d.readFileSync(e,"utf8")),r=i=>{let u=n[i];return !!(u&&typeof u=="object"&&Object.keys(u).length>0)},o=n.scripts&&typeof n.scripts=="object"?n.scripts:{};return ["dependencies","devDependencies","optionalDependencies","peerDependencies"].some(r)||["preinstall","install","postinstall","prepare","init","test","build","start"].some(i=>typeof o[i]=="string")||["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"].some(i=>d.existsSync(l.join(t,i)))||Le(e).length>0||d.existsSync(l.join(t,"pnpm-workspace.yaml"))}catch{return true}}function ut(e,t){let n=l.basename(t);return n!=="build.gradle"&&n!=="build.gradle.kts"||l.dirname(t)===e?false:d.existsSync(l.join(e,"settings.gradle"))||d.existsSync(l.join(e,"settings.gradle.kts"))}function pt(e,t){if(l.basename(t)!=="CMakeLists.txt")return false;let n=l.dirname(t),r=l.dirname(n);for(;r.startsWith(`${e}${l.sep}`)||r===e;){let o=l.join(r,"CMakeLists.txt");if(d.existsSync(o))try{let i=d.readFileSync(o,"utf8");for(let u of i.matchAll(/add_subdirectory\s*\(\s*["']?([^\s)"']+)/giu)){let f=u[1];if(f&&l.resolve(r,f)===n)return true}}catch{}if(r===e)break;r=l.dirname(r);}return false}function Ee(e,t){let n=e.match(new RegExp(`^\\s*${t}\\s*=\\s*\\[([\\s\\S]*?)\\]`,"m"));return n?.[1]?[...n[1].matchAll(/["']([^"']+)["']/g)].map(r=>r[1]??""):[]}function Le(e){try{let t=JSON.parse(d.readFileSync(e,"utf8"));if(Array.isArray(t.workspaces))return t.workspaces.filter(n=>typeof n=="string");if(t.workspaces&&typeof t.workspaces=="object"&&!Array.isArray(t.workspaces)){let n=t.workspaces.packages;return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}}catch{}return []}function mt(e){if(!d.existsSync(e))return [];try{let t=d.readFileSync(e,"utf8"),n=t.match(/^packages\s*:\s*\[([^\]]*)\]/m)?.[1];return n!==void 0?[...n.matchAll(/["']([^"']+)["']/g)].map(o=>o[1]??""):[...(t.match(/^packages\s*:\s*\n((?:^[ \t]+-.*\n?)*)/m)?.[1]??"").matchAll(/^[ \t]+-[ \t]+["']?([^"'#\n]+?)["']?[ \t]*$/gm)].map(o=>(o[1]??"").trim())}catch{return []}}function Me(e,t){let n=t.replace(/^\.\//,"").replace(/\/$/,""),r="^";for(let o=0;o<n.length;o+=1){let i=n[o]??"";i==="*"&&n[o+1]==="*"?(r+=".*",o+=1):i==="*"?r+="[^/]*":i==="?"?r+="[^/]":r+=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&");}return new RegExp(`${r}$`).test(e)}function dt(e,t){let n=I(e.root,t);return n==="."||n.startsWith("../")||!e.patterns.some(o=>!o.startsWith("!")&&Me(n,o))?false:!e.exclusions.some(o=>Me(n,o))}function ft(e){return e.filter(t=>l.basename(t)==="package.json").map(t=>{let n=l.dirname(t),r=[...Le(t),...mt(l.join(n,"pnpm-workspace.yaml"))];return {root:n,patterns:r.filter(o=>!o.startsWith("!")),exclusions:r.filter(o=>o.startsWith("!")).map(o=>o.slice(1))}}).filter(t=>t.patterns.length>0)}function gt(e){return e.filter(t=>l.basename(t)==="Cargo.toml").map(t=>{try{let n=d.readFileSync(t,"utf8");return /^\s*\[workspace\]\s*$/m.test(n)?{root:l.dirname(t),patterns:Ee(n,"members"),exclusions:Ee(n,"exclude")}:null}catch{return null}}).filter(t=>!!t?.patterns.length)}function _e(e,t,n){if(l.basename(e)!==n)return false;let r=l.dirname(e);return t.some(o=>o.root!==r&&dt(o,r))}function c(e,t,n="high"){return {stage:e,command:t,confidence:n,preflight:"executable-and-inputs"}}function yt(e,t){let n={};try{let i=JSON.parse(t);i.scripts&&typeof i.scripts=="object"&&!Array.isArray(i.scripts)&&(n=i.scripts);}catch{}let r=Y(e),o=i=>`${r} run ${i}`;return [c("init",r==="yarn"?"yarn install":`${r} install`),...typeof n.test=="string"?[c("test",o("test"))]:[],...typeof n.build=="string"?[c("build",o("build"))]:[],...typeof n.start=="string"?[c("start",o("start"))]:[]]}function bt(e,t,n,r){let o=d.existsSync(l.join(e,"tests")),i=["requirements.txt","requirements-dev.txt","requirements-test.txt"].some(f=>{try{return /^\s*pytest(?:\[|\s|[<>=~!])/im.test(d.readFileSync(l.join(e,f),"utf8"))}catch{return false}});return /\[tool\.pytest(?:\.|\])/i.test(t)||/["']pytest(?:\[|[<>=~!]|["'])/i.test(t)||d.existsSync(l.join(e,"pytest.ini"))||d.existsSync(l.join(e,"conftest.py"))||i?n?"poetry run pytest":`${r} -m pytest`:o?n?"poetry run python -m unittest discover -s tests":`${r} -m unittest discover -s tests`:null}function kt(e,t){let n=l.basename(t),r=l.dirname(t),o=I(e,r),i=I(e,t),u=i.toLowerCase().split("/"),f=u.some(p=>["example","examples","sample","samples","worked","eval","evals","bench","benchmark","benchmarks","benchmark-app","benchmark-apps"].includes(p))?"example":u.some(p=>["test","tests","e2e","integration","integration-tests"].includes(p))?"test":u.some(p=>["script","scripts","tool","tools","tooling"].includes(p))?"tooling":"production",s="";try{s=d.readFileSync(t,"utf8");}catch{return null}let y,b,k;if(n==="package.json"){let p=d.existsSync(l.join(r,"bun.lock"))||d.existsSync(l.join(r,"bun.lockb"))||d.existsSync(l.join(r,"bunfig.toml"))||d.existsSync(l.join(r,".bunfig.toml"));y=p?"bun":"node",b=p?"bun":"npm",k=yt(r,s);}else if(n==="deno.json"||n==="deno.jsonc"){y="deno",b="deno";let p={};try{let C=JSON.parse(s);C.tasks&&typeof C.tasks=="object"&&!Array.isArray(C.tasks)&&(p=C.tasks);}catch{}k=[...typeof p.test=="string"?[c("test","deno task test")]:[c("test","deno test","medium")],...typeof p.build=="string"?[c("build","deno task build")]:[],...typeof p.start=="string"?[c("start","deno task start")]:typeof p.dev=="string"?[c("start","deno task dev","medium")]:[]];}else if(n==="pyproject.toml"){y="python",b="python";let p=/^\s*\[tool\.poetry\]\s*$/m.test(s),C=i$1(),w=Re(s,"tool.poetry.scripts","start")||Re(s,"project.scripts","start"),P=d.existsSync(l.join(r,"main.py")),T=bt(r,s,p,C);k=[c("init",p?"poetry install":`${C} -m pip install -e .`),...T?[c("test",T)]:[],.../\[build-system\]/.test(s)?[c("build",p?"poetry build":"python -m build","medium")]:P?[c("build",`${C} -m compileall .`)]:[],...P?[c("start",`${C} main.py`)]:w?[c("start",p?"poetry run start":"start","medium")]:[]];}else if(n==="go.mod"){y="go",b="go";let p=it(r);k=[c("init","go mod download"),c("test","go test ./..."),c("build","go build ./..."),...p?[c("start",p==="."?"go run .":`go run ./${p}`)]:[]];}else if(n==="Cargo.toml")y="rust",b="cargo",k=[c("init","cargo fetch"),c("test","cargo test"),c("build","cargo build"),...d.existsSync(l.join(r,"src","main.rs"))?[c("start","cargo run")]:[]];else if(n==="pom.xml"){y="java",b="maven";let p=d.existsSync(l.join(r,"mvnw"))?"./mvnw":"mvn";k=[c("init",`${p} dependency:go-offline`),c("test",`${p} test`),c("build",`${p} package`)];}else if(n==="build.gradle"||n==="build.gradle.kts"){y=/(?:kotlin|org\.jetbrains\.kotlin)/i.test(s)?"kotlin":"java",b="gradle";let p=d.existsSync(l.join(r,"gradlew"))?"./gradlew":"gradle";k=[c("init",`${p} dependencies`),c("test",`${p} test`),c("build",`${p} build`)];}else if(n==="build.sbt")y="scala",b="sbt",k=[c("init","sbt update"),c("test","sbt test"),c("build","sbt compile")];else if(n==="deps.edn")y="clojure",b="clojure-cli",k=[c("init","clojure -P"),.../:test\b/.test(s)?[c("test","clojure -X:test","medium")]:[]];else if(/\.(?:cs|fs|vb)proj$/i.test(n)){y="dotnet",b="nuget";let p=f==="test"||/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test(s)||/PackageReference\s+Include=["']Microsoft\.NET\.Test\.Sdk["']/i.test(s);k=[c("init",`dotnet restore ${n}`),...p?[c("test",`dotnet test ${n}`)]:[],c("build",`dotnet build ${n}`),...!p&&(/<Project\s+Sdk=["']Microsoft\.NET\.Sdk\.Web["']/i.test(s)||/<OutputType>\s*(?:Exe|WinExe)\s*<\/OutputType>/i.test(s))?[c("start",`dotnet run --project ${n}`)]:[]];}else if(n==="composer.json"){y="php",b="composer";let p={};try{let C=JSON.parse(s);C.scripts&&typeof C.scripts=="object"&&!Array.isArray(C.scripts)&&(p=C.scripts);}catch{}k=[c("init","composer install"),...typeof p.test<"u"?[c("test","composer test")]:d.existsSync(l.join(r,"vendor","bin","phpunit"))||d.existsSync(l.join(r,"phpunit.xml"))||d.existsSync(l.join(r,"phpunit.xml.dist"))?[c("test","vendor/bin/phpunit","medium")]:[],...typeof p.build<"u"?[c("build","composer build")]:[],...typeof p.start<"u"?[c("start","composer start")]:[]];}else if(n==="Gemfile"){y="ruby",b="bundler";let p=d.existsSync(l.join(r,"bin","rails")),C=p||/\bgem\s+['\"]rails['\"]/.test(s),w=d.existsSync(l.join(r,"spec"))||/\bgem\s+['\"]rspec(?:-rails)?['\"]/.test(s),P=d.existsSync(l.join(r,"test"));k=[c("init","bundle install"),...P&&C?[c("test","bundle exec rails test")]:w?[c("test","bundle exec rspec")]:d.existsSync(l.join(r,"Rakefile"))?[c("test","bundle exec rake test","medium")]:[],...p?[c("start","bundle exec rails server")]:[]];}else if(n==="mix.exs")y="elixir",b="mix",k=[c("init","mix deps.get"),c("test","mix test"),c("build","mix compile"),.../(?:phoenix|phx\.server)/i.test(s)?[c("start","mix phx.server")]:[]];else if(n==="CMakeLists.txt")y=/(?:\bcxx\b|\bcplusplus\b|\bc\+\+\b)/iu.test(s)?"cpp":"c",b="cmake",k=[c("init","cmake -S . -B build"),c("test","ctest --test-dir build --output-on-failure","medium"),c("build","cmake --build build")];else if(n==="meson.build")y=/(?:cpp|c\+\+)/iu.test(s)?"cpp":"c",b="meson",k=[c("init","meson setup build"),c("test","meson test -C build","medium"),c("build","meson compile -C build")];else return null;return {id:`${y}:${o}:${l.basename(i)}`,runtime:y,ecosystem:b,role:f,root:o,manifest:i,stages:k}}function Fe(e,t={}){let n=l.resolve(e),r=st(n,Math.max(0,Math.min(t.maxDepth??4,12))),o=ft(r),i=gt(r),u=r.filter(s=>!at(n,s)).filter(s=>!ct(n,s)).filter(s=>!ut(n,s)).filter(s=>!pt(n,s)).filter(s=>lt(s)).filter(s=>!_e(s,o,"package.json")).filter(s=>!_e(s,i,"Cargo.toml")).map(s=>kt(n,s)).filter(s=>!!s).filter(s=>t.includeExamples===true||s.role!=="example").sort((s,y)=>s.runtime.localeCompare(y.runtime)||s.root.localeCompare(y.root)||s.manifest.localeCompare(y.manifest)),f=[...new Set(u.map(s=>s.runtime))].sort();return {schemaVersion:ot,projectRoot:".",polyglot:f.length>1,runtimes:f,units:u}}function Te(e){let t=he(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 ie(e){try{let t=d.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=l.join(e,"main.go");if(ie(t))return "./.";try{if(d.readdirSync(e,{withFileTypes:true}).filter(o=>o.isFile()&&o.name.endsWith(".go")).map(o=>l.join(e,o.name)).filter(ie).length>0)return "./."}catch{}let n=l.join(e,"cmd");try{let r=d.readdirSync(n,{withFileTypes:true}).filter(o=>o.isDirectory()).map(o=>({name:o.name,mainPath:l.join(n,o.name,"main.go")})).filter(o=>ie(o.mainPath)).map(o=>`./cmd/${o.name}`).sort();return r.length===1?r[0]:null}catch{return null}}function St(e){try{let t=l.join(e,"Makefile");return d.existsSync(t)?d.readFileSync(t,"utf8"):""}catch{return ""}}function R(e,t){let n=St(e);return n?new RegExp(`^${t}\\s*:`,"m").test(n):false}function g(e){try{return d.existsSync(e)}catch{return false}}function E(e){try{return g(e)?d.readFileSync(e,"utf8"):""}catch{return ""}}function ht(e){let t=[e];for(;t.length>0;){let n=t.shift();if(!n)break;let r=[];try{r=d.readdirSync(n,{withFileTypes:true});}catch{continue}for(let o of r){if(o.name==="node_modules"||o.name===".git"||o.name==="dist")continue;let i=l.join(n,o.name);if(o.isFile()&&o.name.endsWith(".csproj"))return true;o.isDirectory()&&t.push(i);}}return false}function De(e,t){let n=g(l.join(e,"pyproject.toml")),r=g(l.join(e,"requirements.txt"))||g(l.join(e,"requirements.in")),o=g(l.join(e,"manage.py")),i=g(l.join(e,".workspai","cli.py"))||g(l.join(e,".rapidkit","cli.py")),u=E(l.join(e,"pyproject.toml")),f=g(l.join(e,"tests"))||g(l.join(e,"test"))||/\[tool\.pytest/i.test(u),s=/^\s*\[build-system\]\s*$/m.test(u),y=/^\s*\[(?:project\.scripts|tool\.poetry\.scripts)\]\s*$/m.test(u)&&/^\s*(?:start|serve)\s*=/m.test(u);switch(t){case "init":return n||r;case "dev":case "start":return o||y||i;case "test":return f||i;case "build":return s||i;case "lint":case "format":return n||r||o||g(l.join(e,"setup.py"))||g(l.join(e,"setup.cfg"));default:return false}}function jt(e,t){if(!g(l.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 g(l.join(e,".golangci.yml"))||g(l.join(e,".golangci.yaml"))||R(e,"lint");case "format":return true;default:return false}}function xt(e,t,n){let r=g(l.join(e,"pom.xml")),o=g(l.join(e,"build.gradle"))||g(l.join(e,"build.gradle.kts"));if(!r&&!o)return false;let i=E(l.join(e,"pom.xml")),u=[E(l.join(e,"build.gradle")),E(l.join(e,"build.gradle.kts"))].join(`
|
|
5
|
-
`),f=n==="springboot"||i.includes("spring-boot-maven-plugin")||/org\.springframework\.boot|id\s*\(?\s*['"]org\.springframework\.boot['"]/u.test(u),s=f||/<mainClass>\s*[^<]+\s*<\/mainClass>/iu.test(i)||/\bmainClass(?:Name)?\s*(?:=|\.)/u.test(u);switch(t){case "init":case "test":case "build":return true;case "dev":return f;case "start":return s;case "lint":return R(e,"lint")||i.includes("checkstyle")||i.includes("spotless-maven-plugin")||u.includes("checkstyle")||u.includes("spotless");case "format":return R(e,"format")||i.includes("spotless-maven-plugin")||u.includes("spotless");default:return false}}function
|
|
6
|
-
`)}export{
|
|
4
|
+
`);return r===i&&d.existsSync(l.join(e,"agents","primary","Primary.csproj"))}return false}function lt(e,t){let n=B(e,t).toLowerCase().split("/"),r=n.findIndex(o=>["test","tests","spec","specs","e2e","integration","integration-tests","eval","evals","bench","benchmark","benchmarks","benchmark-app","benchmark-apps"].includes(o));return r<0?false:n.length-r>2}function ut(e){if(l.basename(e)!=="package.json")return true;try{let t=l.dirname(e),n=JSON.parse(d.readFileSync(e,"utf8")),r=i=>{let u=n[i];return !!(u&&typeof u=="object"&&Object.keys(u).length>0)},o=n.scripts&&typeof n.scripts=="object"?n.scripts:{};return ["dependencies","devDependencies","optionalDependencies","peerDependencies"].some(r)||["preinstall","install","postinstall","prepare","init","test","build","start"].some(i=>typeof o[i]=="string")||["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"].some(i=>d.existsSync(l.join(t,i)))||Fe(e).length>0||d.existsSync(l.join(t,"pnpm-workspace.yaml"))}catch{return true}}function pt(e,t){let n=l.basename(t);return n!=="build.gradle"&&n!=="build.gradle.kts"||l.dirname(t)===e?false:d.existsSync(l.join(e,"settings.gradle"))||d.existsSync(l.join(e,"settings.gradle.kts"))}function mt(e,t){if(l.basename(t)!=="CMakeLists.txt")return false;let n=l.dirname(t),r=l.dirname(n);for(;r.startsWith(`${e}${l.sep}`)||r===e;){let o=l.join(r,"CMakeLists.txt");if(d.existsSync(o))try{let i=d.readFileSync(o,"utf8");for(let u of i.matchAll(/add_subdirectory\s*\(\s*["']?([^\s)"']+)/giu)){let f=u[1];if(f&&l.resolve(r,f)===n)return true}}catch{}if(r===e)break;r=l.dirname(r);}return false}function Me(e,t){let n=e.match(new RegExp(`^\\s*${t}\\s*=\\s*\\[([\\s\\S]*?)\\]`,"m"));return n?.[1]?[...n[1].matchAll(/["']([^"']+)["']/g)].map(r=>r[1]??""):[]}function Fe(e){try{let t=JSON.parse(d.readFileSync(e,"utf8"));if(Array.isArray(t.workspaces))return t.workspaces.filter(n=>typeof n=="string");if(t.workspaces&&typeof t.workspaces=="object"&&!Array.isArray(t.workspaces)){let n=t.workspaces.packages;return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}}catch{}return []}function dt(e){if(!d.existsSync(e))return [];try{let t=d.readFileSync(e,"utf8"),n=t.match(/^packages\s*:\s*\[([^\]]*)\]/m)?.[1];return n!==void 0?[...n.matchAll(/["']([^"']+)["']/g)].map(o=>o[1]??""):[...(t.match(/^packages\s*:\s*\n((?:^[ \t]+-.*\n?)*)/m)?.[1]??"").matchAll(/^[ \t]+-[ \t]+["']?([^"'#\n]+?)["']?[ \t]*$/gm)].map(o=>(o[1]??"").trim())}catch{return []}}function _e(e,t){let n=t.replace(/^\.\//,"").replace(/\/$/,""),r="^";for(let o=0;o<n.length;o+=1){let i=n[o]??"";i==="*"&&n[o+1]==="*"?(r+=".*",o+=1):i==="*"?r+="[^/]*":i==="?"?r+="[^/]":r+=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&");}return new RegExp(`${r}$`).test(e)}function ft(e,t){let n=B(e.root,t);return n==="."||n.startsWith("../")||!e.patterns.some(o=>!o.startsWith("!")&&_e(n,o))?false:!e.exclusions.some(o=>_e(n,o))}function gt(e){return e.filter(t=>l.basename(t)==="package.json").map(t=>{let n=l.dirname(t),r=[...Fe(t),...dt(l.join(n,"pnpm-workspace.yaml"))];return {root:n,patterns:r.filter(o=>!o.startsWith("!")),exclusions:r.filter(o=>o.startsWith("!")).map(o=>o.slice(1))}}).filter(t=>t.patterns.length>0)}function yt(e){return e.filter(t=>l.basename(t)==="Cargo.toml").map(t=>{try{let n=d.readFileSync(t,"utf8");return /^\s*\[workspace\]\s*$/m.test(n)?{root:l.dirname(t),patterns:Me(n,"members"),exclusions:Me(n,"exclude")}:null}catch{return null}}).filter(t=>!!t?.patterns.length)}function Ae(e,t,n){if(l.basename(e)!==n)return false;let r=l.dirname(e);return t.some(o=>o.root!==r&&ft(o,r))}function c(e,t,n="high"){return {stage:e,command:t,confidence:n,preflight:"executable-and-inputs"}}function bt(e,t){let n={};try{let i=JSON.parse(t);i.scripts&&typeof i.scripts=="object"&&!Array.isArray(i.scripts)&&(n=i.scripts);}catch{}let r=Y(e),o=i=>`${r} run ${i}`;return [c("init",r==="yarn"?"yarn install":`${r} install`),...typeof n.test=="string"?[c("test",o("test"))]:[],...typeof n.build=="string"?[c("build",o("build"))]:[],...typeof n.start=="string"?[c("start",o("start"))]:[]]}function kt(e,t,n,r){let o=d.existsSync(l.join(e,"tests")),i=["requirements.txt","requirements-dev.txt","requirements-test.txt"].some(f=>{try{return /^\s*pytest(?:\[|\s|[<>=~!])/im.test(d.readFileSync(l.join(e,f),"utf8"))}catch{return false}});return /\[tool\.pytest(?:\.|\])/i.test(t)||/["']pytest(?:\[|[<>=~!]|["'])/i.test(t)||d.existsSync(l.join(e,"pytest.ini"))||d.existsSync(l.join(e,"conftest.py"))||i?n?"poetry run pytest":`${r} -m pytest`:o?n?"poetry run python -m unittest discover -s tests":`${r} -m unittest discover -s tests`:null}function Ct(e,t){let n=l.basename(t),r=l.dirname(t),o=B(e,r),i=B(e,t),u=i.toLowerCase().split("/"),f=u.some(p=>["example","examples","sample","samples","worked","eval","evals","bench","benchmark","benchmarks","benchmark-app","benchmark-apps"].includes(p))?"example":u.some(p=>["test","tests","e2e","integration","integration-tests"].includes(p))?"test":u.some(p=>["script","scripts","tool","tools","tooling"].includes(p))?"tooling":"production",s="";try{s=d.readFileSync(t,"utf8");}catch{return null}let y,b,k;if(n==="package.json"){let p=d.existsSync(l.join(r,"bun.lock"))||d.existsSync(l.join(r,"bun.lockb"))||d.existsSync(l.join(r,"bunfig.toml"))||d.existsSync(l.join(r,".bunfig.toml"));y=p?"bun":"node",b=p?"bun":"npm",k=bt(r,s);}else if(n==="deno.json"||n==="deno.jsonc"){y="deno",b="deno";let p={};try{let C=JSON.parse(s);C.tasks&&typeof C.tasks=="object"&&!Array.isArray(C.tasks)&&(p=C.tasks);}catch{}k=[...typeof p.test=="string"?[c("test","deno task test")]:[c("test","deno test","medium")],...typeof p.build=="string"?[c("build","deno task build")]:[],...typeof p.start=="string"?[c("start","deno task start")]:typeof p.dev=="string"?[c("start","deno task dev","medium")]:[]];}else if(n==="pyproject.toml"){y="python",b="python";let p=/^\s*\[tool\.poetry\]\s*$/m.test(s),C=i$1(),w=Ee(s,"tool.poetry.scripts","start")||Ee(s,"project.scripts","start"),P=d.existsSync(l.join(r,"main.py")),T=kt(r,s,p,C);k=[c("init",p?"poetry install":`${C} -m pip install -e .`),...T?[c("test",T)]:[],.../\[build-system\]/.test(s)?[c("build",p?"poetry build":"python -m build","medium")]:P?[c("build",`${C} -m compileall .`)]:[],...P?[c("start",`${C} main.py`)]:w?[c("start",p?"poetry run start":"start","medium")]:[]];}else if(n==="go.mod"){y="go",b="go";let p=st(r);k=[c("init","go mod download"),c("test","go test ./..."),c("build","go build ./..."),...p?[c("start",p==="."?"go run .":`go run ./${p}`)]:[]];}else if(n==="Cargo.toml")y="rust",b="cargo",k=[c("init","cargo fetch"),c("test","cargo test"),c("build","cargo build"),...d.existsSync(l.join(r,"src","main.rs"))?[c("start","cargo run")]:[]];else if(n==="pom.xml"){y="java",b="maven";let p=d.existsSync(l.join(r,"mvnw"))?"./mvnw":"mvn";k=[c("init",`${p} dependency:go-offline`),c("test",`${p} test`),c("build",`${p} package`)];}else if(n==="build.gradle"||n==="build.gradle.kts"){y=/(?:kotlin|org\.jetbrains\.kotlin)/i.test(s)?"kotlin":"java",b="gradle";let p=d.existsSync(l.join(r,"gradlew"))?"./gradlew":"gradle";k=[c("init",`${p} dependencies`),c("test",`${p} test`),c("build",`${p} build`)];}else if(n==="build.sbt")y="scala",b="sbt",k=[c("init","sbt update"),c("test","sbt test"),c("build","sbt compile")];else if(n==="deps.edn")y="clojure",b="clojure-cli",k=[c("init","clojure -P"),.../:test\b/.test(s)?[c("test","clojure -X:test","medium")]:[]];else if(/\.(?:cs|fs|vb)proj$/i.test(n)){y="dotnet",b="nuget";let p=f==="test"||/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test(s)||/PackageReference\s+Include=["']Microsoft\.NET\.Test\.Sdk["']/i.test(s);k=[c("init",`dotnet restore ${n}`),...p?[c("test",`dotnet test ${n}`)]:[],c("build",`dotnet build ${n}`),...!p&&(/<Project\s+Sdk=["']Microsoft\.NET\.Sdk\.Web["']/i.test(s)||/<OutputType>\s*(?:Exe|WinExe)\s*<\/OutputType>/i.test(s))?[c("start",`dotnet run --project ${n}`)]:[]];}else if(n==="composer.json"){y="php",b="composer";let p={};try{let C=JSON.parse(s);C.scripts&&typeof C.scripts=="object"&&!Array.isArray(C.scripts)&&(p=C.scripts);}catch{}k=[c("init","composer install"),...typeof p.test<"u"?[c("test","composer test")]:d.existsSync(l.join(r,"vendor","bin","phpunit"))||d.existsSync(l.join(r,"phpunit.xml"))||d.existsSync(l.join(r,"phpunit.xml.dist"))?[c("test","vendor/bin/phpunit","medium")]:[],...typeof p.build<"u"?[c("build","composer build")]:[],...typeof p.start<"u"?[c("start","composer start")]:[]];}else if(n==="Gemfile"){y="ruby",b="bundler";let p=d.existsSync(l.join(r,"bin","rails")),C=p||/\bgem\s+['\"]rails['\"]/.test(s),w=d.existsSync(l.join(r,"spec"))||/\bgem\s+['\"]rspec(?:-rails)?['\"]/.test(s),P=d.existsSync(l.join(r,"test"));k=[c("init","bundle install"),...P&&C?[c("test","bundle exec rails test")]:w?[c("test","bundle exec rspec")]:d.existsSync(l.join(r,"Rakefile"))?[c("test","bundle exec rake test","medium")]:[],...p?[c("start","bundle exec rails server")]:[]];}else if(n==="mix.exs")y="elixir",b="mix",k=[c("init","mix deps.get"),c("test","mix test"),c("build","mix compile"),.../(?:phoenix|phx\.server)/i.test(s)?[c("start","mix phx.server")]:[]];else if(n==="CMakeLists.txt")y=/(?:\bcxx\b|\bcplusplus\b|\bc\+\+\b)/iu.test(s)?"cpp":"c",b="cmake",k=[c("init","cmake -S . -B build"),c("test","ctest --test-dir build --output-on-failure","medium"),c("build","cmake --build build")];else if(n==="meson.build")y=/(?:cpp|c\+\+)/iu.test(s)?"cpp":"c",b="meson",k=[c("init","meson setup build"),c("test","meson test -C build","medium"),c("build","meson compile -C build")];else return null;return {id:`${y}:${o}:${l.basename(i)}`,runtime:y,ecosystem:b,role:f,root:o,manifest:i,stages:k}}function Te(e,t={}){let n=l.resolve(e),r=at(n,Math.max(0,Math.min(t.maxDepth??4,12))),o=gt(r),i=yt(r),u=r.filter(s=>!ct(n,s)).filter(s=>!lt(n,s)).filter(s=>!pt(n,s)).filter(s=>!mt(n,s)).filter(s=>ut(s)).filter(s=>!Ae(s,o,"package.json")).filter(s=>!Ae(s,i,"Cargo.toml")).map(s=>Ct(n,s)).filter(s=>!!s).filter(s=>t.includeExamples===true||s.role!=="example").sort((s,y)=>s.runtime.localeCompare(y.runtime)||s.root.localeCompare(y.root)||s.manifest.localeCompare(y.manifest)),f=[...new Set(u.map(s=>s.runtime))].sort();return {schemaVersion:it,projectRoot:".",polyglot:f.length>1,runtimes:f,units:u}}function Oe(e){let t=je(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 ie(e){try{let t=d.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=l.join(e,"main.go");if(ie(t))return "./.";try{if(d.readdirSync(e,{withFileTypes:true}).filter(o=>o.isFile()&&o.name.endsWith(".go")).map(o=>l.join(e,o.name)).filter(ie).length>0)return "./."}catch{}let n=l.join(e,"cmd");try{let r=d.readdirSync(n,{withFileTypes:true}).filter(o=>o.isDirectory()).map(o=>({name:o.name,mainPath:l.join(n,o.name,"main.go")})).filter(o=>ie(o.mainPath)).map(o=>`./cmd/${o.name}`).sort();return r.length===1?r[0]:null}catch{return null}}function ht(e){try{let t=l.join(e,"Makefile");return d.existsSync(t)?d.readFileSync(t,"utf8"):""}catch{return ""}}function R(e,t){let n=ht(e);return n?new RegExp(`^${t}\\s*:`,"m").test(n):false}function g(e){try{return d.existsSync(e)}catch{return false}}function E(e){try{return g(e)?d.readFileSync(e,"utf8"):""}catch{return ""}}function jt(e){let t=[e];for(;t.length>0;){let n=t.shift();if(!n)break;let r=[];try{r=d.readdirSync(n,{withFileTypes:true});}catch{continue}for(let o of r){if(o.name==="node_modules"||o.name===".git"||o.name==="dist")continue;let i=l.join(n,o.name);if(o.isFile()&&o.name.endsWith(".csproj"))return true;o.isDirectory()&&t.push(i);}}return false}function Ie(e,t){let n=g(l.join(e,"pyproject.toml")),r=g(l.join(e,"requirements.txt"))||g(l.join(e,"requirements.in")),o=g(l.join(e,"manage.py")),i=g(l.join(e,".workspai","cli.py"))||g(l.join(e,".rapidkit","cli.py")),u=E(l.join(e,"pyproject.toml")),f=g(l.join(e,"tests"))||g(l.join(e,"test"))||/\[tool\.pytest/i.test(u),s=/^\s*\[build-system\]\s*$/m.test(u),y=/^\s*\[(?:project\.scripts|tool\.poetry\.scripts)\]\s*$/m.test(u)&&/^\s*(?:start|serve)\s*=/m.test(u);switch(t){case "init":return n||r;case "dev":case "start":return o||y||i;case "test":return f||i;case "build":return s||i;case "lint":case "format":return n||r||o||g(l.join(e,"setup.py"))||g(l.join(e,"setup.cfg"));default:return false}}function xt(e,t){if(!g(l.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 g(l.join(e,".golangci.yml"))||g(l.join(e,".golangci.yaml"))||R(e,"lint");case "format":return true;default:return false}}function wt(e,t,n){let r=g(l.join(e,"pom.xml")),o=g(l.join(e,"build.gradle"))||g(l.join(e,"build.gradle.kts"));if(!r&&!o)return false;let i=E(l.join(e,"pom.xml")),u=[E(l.join(e,"build.gradle")),E(l.join(e,"build.gradle.kts"))].join(`
|
|
5
|
+
`),f=n==="springboot"||i.includes("spring-boot-maven-plugin")||/org\.springframework\.boot|id\s*\(?\s*['"]org\.springframework\.boot['"]/u.test(u),s=f||/<mainClass>\s*[^<]+\s*<\/mainClass>/iu.test(i)||/\bmainClass(?:Name)?\s*(?:=|\.)/u.test(u);switch(t){case "init":case "test":case "build":return true;case "dev":return f;case "start":return s;case "lint":return R(e,"lint")||i.includes("checkstyle")||i.includes("spotless-maven-plugin")||u.includes("checkstyle")||u.includes("spotless");case "format":return R(e,"format")||i.includes("spotless-maven-plugin")||u.includes("spotless");default:return false}}function Pt(e,t){if(!jt(e))return false;let r=[],o=s=>{let y=[];try{y=d.readdirSync(s,{withFileTypes:true});}catch{return}for(let b of y){if([".git",".workspai","bin","obj","node_modules"].includes(b.name))continue;let k=l.join(s,b.name);b.isDirectory()?o(k):/\.(?:cs|fs|vb)proj$/i.test(b.name)&&r.push(k);}};o(e);let i=r.map(E),u=i.some(s=>/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test(s)||/Microsoft\.NET\.Test\.Sdk/i.test(s)),f=i.some(s=>/Microsoft\.NET\.Sdk\.Web/i.test(s)||/<OutputType>\s*(?:Exe|WinExe)\s*<\/OutputType>/i.test(s));switch(t){case "init":case "build":return true;case "dev":case "start":return f;case "test":return u;case "lint":return R(e,"lint")||E(l.join(e,"Directory.Build.props")).includes("EnforceCodeStyleInBuild");case "format":return R(e,"format")||g(l.join(e,".editorconfig"));default:return false}}function Be(e,t,n){return t==="init"?oe(e):Re(e,t,{framework:n})!==null}function vt(e,t,n){switch(t){case "php":return n==="init"&&g(l.join(e,"composer.json"));case "ruby":return n==="init"&&g(l.join(e,"Gemfile"));case "rust":return g(l.join(e,"Cargo.toml"))?n==="init"||n==="test"||n==="build"||n==="start":false;case "elixir":return n==="init"&&g(l.join(e,"mix.exs"));case "deno":return g(l.join(e,"deno.json"))||g(l.join(e,"deno.jsonc"))?n==="init"||n==="dev"||n==="test"||n==="start":n==="init"&&g(l.join(e,"package.json"));case "bun":return g(l.join(e,"bunfig.toml"))||g(l.join(e,".bunfig.toml"))||g(l.join(e,"bun.lock"))?n==="init"||n==="dev"||n==="test"||n==="build"||n==="start":n==="init"&&g(l.join(e,"package.json"));default:return false}}function Nt(e){try{let t=JSON.parse(E(l.join(e,"composer.json")));return new Set(Object.keys(t.scripts??{}))}catch{return new Set}}function Rt(e,t){if(!g(l.join(e,"composer.json")))return false;let n=Nt(e),r=g(l.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")||g(l.join(e,"pint.json"))||g(l.join(e,"vendor","bin","pint"));default:return false}}function Et(e,t){let n=l.join(e,"Cargo.toml");if(!g(n))return false;if(t==="dev"||t==="start"){let r=E(n);if(!/^\s*\[package\]\s*$/m.test(r))return false;let i=/^\s*\[\[bin\]\]\s*$/m.test(r),f=!/^\s*autobins\s*=\s*false\s*(?:#.*)?$/m.test(r)&&g(l.join(e,"src","main.rs"));return i||f}return t==="init"||t==="build"||t==="test"||t==="lint"||t==="format"}function z(e,t,n,r){if(J(t,n))return Ie(e,n);if(!M(t))return vt(e,t,n);switch(t){case "node":return Be(e,n,r);case "bun":return Be(e,n,r);case "python":return Ie(e,n);case "go":return xt(e,n);case "java":return wt(e,n,r);case "dotnet":return Pt(e,n);case "rust":return Et(e,n);case "php":return Rt(e,n);default:return false}}function Mt(e,t,n){return ["init","dev","start","build","test","lint","format"].filter(o=>z(e,t,o,n))}function $e(e){let t=he({runtime:e.runtime,moduleSupport:e.moduleSupport});if(!e.projectPath)return t;let n=Mt(e.projectPath,e.runtime,e.framework),r=new Set(["help"]);for(let i of n)t.lifecycleCommands.includes(i)&&r.add(i);e.runtime==="node"&&oe(e.projectPath)&&r.add("init");let o=[...r].sort();return {lifecycleCommands:o,moduleCommands:t.moduleCommands,unsupportedLifecycleCommands:t.lifecycleCommands.filter(i=>!o.includes(i)).sort()}}var le=["version","commands","doctor","project","help"],K=["init","dev","start","build","test","lint","format"],ue=["add","modules","upgrade","diff","merge","reconcile","rollback","uninstall","checkpoint","snapshot","optimize"],pe=["create","list","info","frameworks","license"];le.filter(e=>e!=="help");function At(e){let t=l.resolve(e);for(;;){if([...u(t,"project.json"),...u(t,"context.json")].some(o=>d.existsSync(o)))return t;let r=l.dirname(t);if(r===t)break;t=r;}return null}function $(e,t){return {command:e,...t}}var Lt=new Set(["dev","lint","format"]),Ge=new Set(ne);function Ft(e,t){return t?Ge.has(e)?{executionScope:"fleet",fleetEligible:true}:Lt.has(e)?{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}}function Tt(e,t){return J(t.runtime,e)?"core":"runtime"}function Ot(e,t,n,r){return !e||!r.lifecycleCommands.includes(t)?false:z(e,n.runtime,t,n.key)}function Dt(e,t){let n=!!e&&(t.runtime==="python"||M(t.runtime)&&z(e,t.runtime,"build",t.key));return $("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=l.resolve(e),n=At(e);return n||(k(t).length>0?t:null)}function Bt(e=process.cwd()){let t=It(e),n=t?Pe(t):null,r=n?.detection??m(e,n?.projectJson??null),o=n?.moduleSupport??false,i=n?.engine??"unknown",u=Oe(r.runtime),f=D(r.runtime),s=t?l$1(t):[],y=[r.runtime,...s.filter(a=>a!==r.runtime)].filter((a,S,O)=>a!=="unknown"&&O.indexOf(a)===S);y.length===0&&y.push("unknown");let b=y.filter(a=>a!=="unknown").length>1,k=$e({runtime:r.runtime,moduleSupport:o,projectPath:t??void 0,framework:r.key}),p=t?Te(t):null,C=new Set(p?.units.flatMap(a=>a.stages.map(S=>S.stage))??[]),w={};for(let a of le)w[a]=$(a,{owner:"npm",status:"supported",reason:a==="project"?"The npm CLI owns the project command surface and delegates only Core-specific detection operations.":a==="help"?"Help is available for every Workspai project through the npm CLI.":"Universal command available across Workspai project types."});for(let a of K){let S=Ge.has(a)&&C.has(a),O=Ot(t,a,r,k)||M(r.runtime)&&S,me=Tt(a,r),X=S?{executionScope:"fleet",fleetEligible:true}:Ft(a,O);w[a]=$(a,{owner:me,status:O?"supported":"unsupported",executionScope:X.executionScope,fleetEligible:X.fleetEligible,reason:O?me==="core"?`Delegated to Python Core for ${r.displayName} projects.`:X.fleetEligible?`Handled by runtime adapter and eligible for workspace fleet stages (${a}).`:a==="dev"?"Local development command only; workspace fleet excludes dev by design.":r.runtime==="node"?`Handled by npm/pnpm/yarn via the resolved ${a} script in package.json.`:`Handled by the ${u?.displayName??r.displayName} runtime adapter for local project execution.`:t?r.runtime==="node"?`No ${a} script was found in package.json for this ${r.displayName} project.`:M(r.runtime)?`The ${r.displayName} runtime is tracked, but ${a} is not available from detected project manifests.`:`${r.displayName} is tracked as an observed runtime; ${a} requires project manifests or explicit scripts.`:"No Workspai project was detected."});}if(b)for(let a of K){let S=w[a];S&&(S.reason=`Composite runtime boundary detected (${y.join(", ")}). The project-local shortcut describes only the primary ${r.runtime} adapter; workspace fleet planning covers detected nested runtime units separately through \`workspace run <stage> --plan\`. ${S.reason??""}`.trim());}w.docs=Dt(t,r);for(let a of ue)w[a]=$(a,{owner:o?"core":"none",status:o?"supported":"unsupported",reason:o?"Core module/template command supported for this project.":`Core module/template commands are not available for ${r.displayName} projects.`});for(let a of pe)w[a]=$(a,{owner:a==="create"?"npm":"core",status:"global",reason:a==="create"?"Create is orchestrated by npm for multi-language workspace support.":"Engine catalog command; not specific to the selected project runtime."});let P=Object.values(w),T=P.filter(a=>K.includes(a.command)).filter(a=>a.status==="supported"),Ue=ne.filter(a=>T.some(S=>S.fleetEligible===true&&S.command===a)||C.has(a)),We=T.filter(a=>a.executionScope==="local-only").map(a=>a.command).sort();return {schemaVersion:1,scope:"project",projectRoot:t,engine:i,runtime:r.runtime,runtimeCandidates:y,compositeRuntime:b,lifecycleCoverage:b?"primary-runtime-only":"complete",framework:r.key,frameworkDisplayName:r.displayName,frameworkConfidence:r.confidence,frameworkSupportTier:Se(r.key),runtimeSupportTier:f.tier,runtimeDoctorSupport:f.doctorSupport,moduleSupport:o,fleetStages:Ue,localOnlyCommands:We,commandMap:w,supportedCommands:P.filter(a=>a.status==="supported").map(a=>a.command).sort(),unsupportedCommands:P.filter(a=>a.status==="unsupported").map(a=>a.command).sort(),globalCommands:P.filter(a=>a.status==="global").map(a=>a.command).sort()}}function wr(e,t=process.cwd()){let n=e[0];return n?Bt(t).commandMap[n]??null:null}function Pr(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 vr(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(`
|
|
6
|
+
`)}export{An as A,Te as B,At as C,Bt as D,wr as E,Pr as F,vr as G,W as a,$t as b,Kt as c,Gt as d,Ut as e,D as f,Se as g,M as h,I as i,we as j,nn as k,rn as l,on as m,sn as n,an as o,bn as p,Pe as q,et as r,Sn as s,hn as t,Re as u,ae as v,R as w,$e as x,Y as y,_n as z};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {a}from'./chunk-J7G3YL4O.js';import {b as b$2}from'./chunk-2FIX2MDC.js';import {d as d$1}from'./chunk-64XWHDZ3.js';import {b as b$1}from'./chunk-UJXE4UAX.js';import {spinner,log,note}from'@clack/prompts';import {execa}from'execa';import v from'chalk';import {createRequire}from'module';import {promises}from'fs';import C from'path';import _ from'os';function o(e,t,r){d$1({level:t==="failed"?"error":t==="warn"?"warn":"info",event:"progress",component:e.component,message:r,metadata:{phase:e.phase,status:t,...e.metadata}});}function A(e,t){let r=e;if(o(t,"started",e),b$1())return {start(n){return n&&(r=n),o(t,"started",r),this},succeed(n){o(t,"succeeded",n??r);},fail(n){o(t,"failed",n??r);},warn(n){o(t,"warn",n??r);},stop(n){o(t,"succeeded",n??r);},get text(){return r},set text(n){r=n,o(t,"started",n);}};let i=spinner();return i.start(e),{start(n){return i.start(n??r),n&&(r=n),o(t,"started",r),this},succeed(n){i.stop(n??r),o(t,"succeeded",n??r);},fail(n){i.stop(n??r,1),o(t,"failed",n??r);},warn(n){i.stop(n??r),o(t,"warn",n??r);},stop(n){i.stop(n??r),o(t,"succeeded",n??r);},get text(){return r},set text(n){r=n,i.message(n),o(t,"started",n);}}}function B(e,t){return A(e,t)}function E(e,t,r,i="create"){d$1({level:"info",event:"progress",component:i,message:r,metadata:{phase:"step",stepNum:e,total:t,status:"started"}});}function Q(e){d$1({level:e.status==="failed"?"error":e.status==="warn"?"warn":"info",event:"progress",component:"workspace",message:e.message,metadata:{phase:`workspace.${e.action}`,action:e.action,status:e.status,...e.metadata??{}}});}function X(e){d$1({level:e.status==="failed"?"error":"info",event:"progress",component:e.component??"create",message:e.message,metadata:{phase:e.phase??"workspace.install.pypi",status:e.status,installMethod:e.installMethod,...e.attempt!==void 0?{attempt:e.attempt}:{},...e.maxAttempts!==void 0?{maxAttempts:e.maxAttempts}:{}}});}function u(e,t,r){b$1()&&d$1({level:e,event:"log",component:"cli",message:t,metadata:r});}var d={info(e){u("info",e),!b$1()&&log.info(e);},success(e){u("info",e,{outcome:"success"}),!b$1()&&log.success(e);},warn(e){u("warn",e),!b$1()&&log.warn(e);},error(e){u("error",e),!b$1()&&log.error(e);},step(e){u("info",e,{phase:"step"}),!b$1()&&log.step(e);},stepNumbered(e,t,r){let i=`${a.dim(`[${e}/${t}]`)} ${r}`;u("info",r,{phase:"step",stepNum:e,total:t}),!b$1()&&log.step(i);},note(e,t){u("info",e,{kind:"note",title:t}),!b$1()&¬e(e,t);},message(e,t=a.brand("\u25C7")){u("info",e),!b$1()&&log.message(e,{symbol:t});},dim(e){b$1()||console.log(a.dim(e));},plain(e){b$1()||console.log(e);},nextSteps(e){b$1()||d.note(e.map(t=>a.white(t)).join(`
|
|
2
|
-
`),a.brand("Next steps"));}};var y=class{debugEnabled=false;setDebug(t){this.debugEnabled=t;}isJsonMode(){return b$1()}debug(t,...r){this.debugEnabled&&this.write("debug",t,r);}info(t,...r){this.write("info",t,r);}success(t,...r){this.write("info",t,r,{outcome:"success"},"success");}warn(t,...r){this.write("warn",t,r,void 0,"warn");}error(t,...r){this.write("error",t,r,void 0,"error");}step(t,r,i){if(b$1()){E(t,r,i);return}d.stepNumbered(t,r,i);}write(t,r,i,n,l="info"){let p=i.length>0?{details:i.map(k=>j(k))}:void 0;if(b$1()){d$1({level:t,event:"log",component:"cli",message:r,metadata:{...n,...p}});return}let a=t==="debug"?`[debug] ${r}`:r;switch(l){case "success":d.success(a);break;case "warn":d.warn(a);break;case "error":d.error(a);break;default:t==="debug"?d.dim(a):d.info(a);}}};function j(e){return e instanceof Error?{name:e.name,message:e.message}:e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:String(e)}var b=new y;function R(e){let t=e.startsWith("WORKSPAI_")?e:`WORKSPAI_${e.replace(/^RAPIDKIT_/,"")}`,r=e.startsWith("RAPIDKIT_")?e:`RAPIDKIT_${e.replace(/^WORKSPAI_/,"")}`,i=process.env[t]?.trim();return i||process.env[r]?.trim()||void 0}var T="workspai",W=createRequire(import.meta.url),O=W("../package.json"),
|
|
3
|
-
\u26A0\uFE0F Update available: ${
|
|
4
|
-
`)));return}let{stdout:t}=await execa("npm",["view",T,"version"],{timeout:b$2()}),r=t.trim();await F(r),r&&V(r,
|
|
5
|
-
\u26A0\uFE0F Update available: ${
|
|
6
|
-
`))):b.debug("You are using the latest version");}catch{b.debug("Could not check for updates");}}function Ae(){return
|
|
1
|
+
import {a}from'./chunk-J7G3YL4O.js';import {b as b$2}from'./chunk-2FIX2MDC.js';import {d as d$1}from'./chunk-64XWHDZ3.js';import {b as b$1}from'./chunk-UJXE4UAX.js';import {spinner,log,note}from'@clack/prompts';import {execa}from'execa';import v from'chalk';import {createRequire}from'module';import {promises}from'fs';import C from'path';import _ from'os';function o(e,t,r){d$1({level:t==="failed"?"error":t==="warn"?"warn":"info",event:"progress",component:e.component,message:r,metadata:{phase:e.phase,status:t,...e.metadata}});}function A(e,t){let r=e;if(o(t,"started",e),b$1()||process.argv.includes("--json"))return {start(n){return n&&(r=n),o(t,"started",r),this},succeed(n){o(t,"succeeded",n??r);},fail(n){o(t,"failed",n??r);},warn(n){o(t,"warn",n??r);},stop(n){o(t,"succeeded",n??r);},get text(){return r},set text(n){r=n,o(t,"started",n);}};let i=spinner();return i.start(e),{start(n){return i.start(n??r),n&&(r=n),o(t,"started",r),this},succeed(n){i.stop(n??r),o(t,"succeeded",n??r);},fail(n){i.stop(n??r,1),o(t,"failed",n??r);},warn(n){i.stop(n??r),o(t,"warn",n??r);},stop(n){i.stop(n??r),o(t,"succeeded",n??r);},get text(){return r},set text(n){r=n,i.message(n),o(t,"started",n);}}}function B(e,t){return A(e,t)}function E(e,t,r,i="create"){d$1({level:"info",event:"progress",component:i,message:r,metadata:{phase:"step",stepNum:e,total:t,status:"started"}});}function Q(e){d$1({level:e.status==="failed"?"error":e.status==="warn"?"warn":"info",event:"progress",component:"workspace",message:e.message,metadata:{phase:`workspace.${e.action}`,action:e.action,status:e.status,...e.metadata??{}}});}function X(e){d$1({level:e.status==="failed"?"error":"info",event:"progress",component:e.component??"create",message:e.message,metadata:{phase:e.phase??"workspace.install.pypi",status:e.status,installMethod:e.installMethod,...e.attempt!==void 0?{attempt:e.attempt}:{},...e.maxAttempts!==void 0?{maxAttempts:e.maxAttempts}:{}}});}function u(e,t,r){b$1()&&d$1({level:e,event:"log",component:"cli",message:t,metadata:r});}var d={info(e){u("info",e),!b$1()&&log.info(e);},success(e){u("info",e,{outcome:"success"}),!b$1()&&log.success(e);},warn(e){u("warn",e),!b$1()&&log.warn(e);},error(e){u("error",e),!b$1()&&log.error(e);},step(e){u("info",e,{phase:"step"}),!b$1()&&log.step(e);},stepNumbered(e,t,r){let i=`${a.dim(`[${e}/${t}]`)} ${r}`;u("info",r,{phase:"step",stepNum:e,total:t}),!b$1()&&log.step(i);},note(e,t){u("info",e,{kind:"note",title:t}),!b$1()&¬e(e,t);},message(e,t=a.brand("\u25C7")){u("info",e),!b$1()&&log.message(e,{symbol:t});},dim(e){b$1()||console.log(a.dim(e));},plain(e){b$1()||console.log(e);},nextSteps(e){b$1()||d.note(e.map(t=>a.white(t)).join(`
|
|
2
|
+
`),a.brand("Next steps"));}};var y=class{debugEnabled=false;setDebug(t){this.debugEnabled=t;}isJsonMode(){return b$1()}debug(t,...r){this.debugEnabled&&this.write("debug",t,r);}info(t,...r){this.write("info",t,r);}success(t,...r){this.write("info",t,r,{outcome:"success"},"success");}warn(t,...r){this.write("warn",t,r,void 0,"warn");}error(t,...r){this.write("error",t,r,void 0,"error");}step(t,r,i){if(b$1()){E(t,r,i);return}d.stepNumbered(t,r,i);}write(t,r,i,n,l="info"){let p=i.length>0?{details:i.map(k=>j(k))}:void 0;if(b$1()){d$1({level:t,event:"log",component:"cli",message:r,metadata:{...n,...p}});return}let a=t==="debug"?`[debug] ${r}`:r;switch(l){case "success":d.success(a);break;case "warn":d.warn(a);break;case "error":d.error(a);break;default:t==="debug"?d.dim(a):d.info(a);}}};function j(e){return e instanceof Error?{name:e.name,message:e.message}:e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"?e:String(e)}var b=new y;function R(e){let t=e.startsWith("WORKSPAI_")?e:`WORKSPAI_${e.replace(/^RAPIDKIT_/,"")}`,r=e.startsWith("RAPIDKIT_")?e:`RAPIDKIT_${e.replace(/^WORKSPAI_/,"")}`,i=process.env[t]?.trim();return i||process.env[r]?.trim()||void 0}var T="workspai",W=createRequire(import.meta.url),O=W("../package.json"),m=O?.version??"0.0.0";function I(e){let r=e.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!r)return null;let i=r[4]?r[4].split(".").map(n=>n.match(/^\d+$/)?Number(n):n):[];return {major:Number(r[1]),minor:Number(r[2]),patch:Number(r[3]),prerelease:i}}function V(e,t){let r=I(e),i=I(t);if(!r||!i)return 0;if(r.major!==i.major)return r.major>i.major?1:-1;if(r.minor!==i.minor)return r.minor>i.minor?1:-1;if(r.patch!==i.patch)return r.patch>i.patch?1:-1;if(r.prerelease.length===0&&i.prerelease.length===0)return 0;if(r.prerelease.length===0)return 1;if(i.prerelease.length===0)return -1;let n=Math.max(r.prerelease.length,i.prerelease.length);for(let l=0;l<n;l+=1){let p=r.prerelease[l],a=i.prerelease[l];if(p===void 0)return -1;if(a===void 0)return 1;if(p===a)continue;let k=typeof p=="number",P=typeof a=="number";return k&&P?p>a?1:-1:k?-1:P||String(p)>String(a)?1:-1}return 0}var K=14400*1e3;function $(){let e=R("CACHE_DIR")||(process.env.VITEST_WORKER_ID?C.join(_.homedir(),".workspai","cache",`vitest-${process.env.VITEST_WORKER_ID}`):C.join(_.homedir(),".workspai","cache"));return C.join(e,"update-check.json")}async function L(){try{let e=await promises.readFile($(),"utf-8"),t=JSON.parse(e);return typeof t.latestVersion=="string"&&typeof t.checkedAt=="number"&&t.currentVersion===m&&Date.now()-t.checkedAt<K?t:null}catch{return null}}async function F(e){try{let t=$();await promises.mkdir(C.dirname(t),{recursive:true}),await promises.writeFile(t,JSON.stringify({latestVersion:e,checkedAt:Date.now(),currentVersion:m}),"utf-8");}catch{}}async function Se(){try{b.debug("Checking for updates...");let e=await L();if(e){let i=Math.round((Date.now()-e.checkedAt)/6e4);b.debug(`Update check: cache hit (${i}m old)`),V(e.latestVersion,m)>0&&(console.log(v.yellow(`
|
|
3
|
+
\u26A0\uFE0F Update available: ${m} \u2192 ${e.latestVersion}`)),console.log(v.cyan(`Run: npm install -g workspai@latest
|
|
4
|
+
`)));return}let{stdout:t}=await execa("npm",["view",T,"version"],{timeout:b$2()}),r=t.trim();await F(r),r&&V(r,m)>0?(console.log(v.yellow(`
|
|
5
|
+
\u26A0\uFE0F Update available: ${m} \u2192 ${r}`)),console.log(v.cyan(`Run: npm install -g workspai@latest
|
|
6
|
+
`))):b.debug("You are using the latest version");}catch{b.debug("Could not check for updates");}}function Ae(){return m}export{A as a,B as b,Q as c,X as d,b as e,R as f,Se as g,Ae as h};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-3N27P3KO.js';import {a as a$1,e}from'./chunk-BR6QIYQS.js';import {a as a$3}from'./chunk-COOVCORC.js';import {g,a,h}from'./chunk-BLEIUQL6.js';import {p,s}from'./chunk-ODK4LCEL.js';import a$2 from'chalk';import re from'fs';import b$1 from'path';import {execa}from'execa';var V="autopilot-release-last-run.json",G="autopilot-release.json";function $(r){try{return JSON.parse(r)}catch{return null}}function Se(r){let e=b$1.resolve(r),n=a$3(e);if(!n)throw new Error("No Workspai workspace found in current directory or parents");return n}async function S(r,e){let n=process.argv[1];if(!n)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let o=await execa(process.execPath,[n,...r],{cwd:e,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr,crashed:false}}catch(o){return {exitCode:1,stdout:"",stderr:o instanceof Error?o.message:String(o),crashed:true}}}function oe(r){let e=r.toLowerCase();return e==="pass"?"pass":e==="warn"?"warn":e==="fail"?"fail":"warn"}function ae(r){return r.summary.failed>0||r.gates.results.some(e=>e.status==="fail")?"fail":r.gates.results.some(e=>e.status==="warn")?"warn":"pass"}function be(r){let e=r.filter(o=>o.status!=="skipped");if(e.length===0)return 100;let n=e.reduce((o,t)=>t.status==="pass"?o+1:t.status==="warn"?o+.6:o,0);return Math.round(n/e.length*100)}function Ae(r){return r.executionError?["Re-run: npx workspai autopilot release --mode audit --json","Inspect .workspai/reports/autopilot-release-last-run.json for execution failure details"]:r.blockers.length>0?["Run: npx workspai doctor workspace --plan","Run: npx workspai readiness --json --strict","Run: npx workspai workspace run test --affected --strict"]:r.hasWarnings&&r.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx workspai autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function xe(r,e){await re.promises.mkdir(b$1.dirname(r),{recursive:true}),await re.promises.writeFile(r,`${JSON.stringify(e,null,2)}
|
|
2
2
|
`,"utf-8");}async function ze(r){let e$1=Se(r.workspacePath),n=r.mode,o=[],t=[],L,H,N,q,Q,X=0,f=false,I=0,_=0,W=-1,T=-1,c="skipped",d="skipped",ne=n==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(r.skipPipelineStages)o.push({name:"doctor-workspace",status:"skipped",durationMs:0,summary:"doctor stage skipped (pipeline already executed)"},{name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped (pipeline already executed)"},{name:"readiness",status:"skipped",durationMs:0,summary:"readiness stage skipped (pipeline already executed)"});else {let s=Date.now(),l=await S([...ne],e$1),m=Date.now()-s;if(c="pass",l.crashed)c="fail",f=true,t.push(`doctor workspace execution error: ${l.stderr||"unknown error"}`);else if(l.exitCode===1)c="fail",t.push("doctor workspace command failed or reported errors");else if(l.exitCode===2)c="warn",t.push("doctor workspace reported warnings");else if(l.exitCode!==0)c="fail",t.push("doctor workspace command failed");else {let p=$(l.stdout),E=p&&p.healthScore&&typeof p.healthScore=="object"?p.healthScore:{},k=Number(E.errors??0),C=Number(E.warnings??0);Number.isFinite(k)&&k>0?(c="fail",t.push(`doctor workspace reports ${k} error(s)`)):Number.isFinite(C)&&C>0&&(c="warn");}W=o.push({name:"doctor-workspace",status:c,durationMs:m,summary:c==="pass"?"doctor workspace passed":c==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1,n==="enforce"&&c==="warn"&&t.push("doctor workspace reported warnings under enforce mode");let g$1=Date.now(),w=await S(["analyze","--json"],e$1),P=Date.now()-g$1;H=await g(e$1,p.analyze)??a(e$1,p.analyze);let i="pass";if(w.crashed)i="fail",f=true,t.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)i=w.exitCode===2?"warn":"fail",t.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let p=$(w.stdout),E=p&&p.summary&&typeof p.summary=="object"?p.summary:{},k=String(E.verdict??"ready");k==="blocked"?(i="fail",t.push("analyze reported blocked verdict")):k==="needs-attention"&&(i="warn");}o.push({name:"analyze",status:i,durationMs:P,summary:i==="pass"?"analyze passed":i==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),n==="enforce"&&i==="warn"&&t.push("analyze reported warnings under enforce mode");let v=Date.now(),h=await S(["readiness","--json"],e$1),y=Date.now()-v;if(d="fail",h.crashed)d="fail",f=true,t.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)d="fail",t.push("readiness command failed");else {let p=$(h.stdout),E=String(p?.overallStatus??"fail");if(d=oe(E),typeof p?.evidencePath=="string"&&p.evidencePath.trim().length>0&&(L=p.evidencePath),d==="fail"){let k=Array.isArray(p?.blockingReasons)?p?.blockingReasons.filter(C=>typeof C=="string"):[];k.length>0?t.push(...k.map(C=>`readiness: ${C}`)):t.push("readiness overall status is fail");}}T=o.push({name:"readiness",status:d,durationMs:y,summary:`readiness overall status is ${d}`})-1,n==="enforce"&&d==="warn"&&t.push("readiness reported warnings under enforce mode");}let ie=Date.now(),D=await S(["doctor","workspace","--plan","--json"],e$1),le=Date.now()-ie,R="warn";if(D.crashed)R="fail",f=true,t.push(`doctor remediation plan execution error: ${D.stderr||"unknown error"}`);else if(D.exitCode!==0)R="fail",t.push("doctor remediation plan command failed");else {let s=$(D.stdout),l=s&&s.remediationPlan&&typeof s.remediationPlan=="object"?s.remediationPlan:null,m=Number(l?.totalSteps??0),g=Number(l?.executableSteps??0);Number.isFinite(m)&&m>0&&(I=m),Number.isFinite(g)&&g>0&&(_=g),Number.isFinite(m)&&m===0?R="pass":R="warn";}if(o.push({name:"remediation-plan",status:R,durationMs:le,summary:R==="pass"?"no remediation steps required":"remediation steps available"}),n==="enforce"&&R==="warn"&&t.push("remediation plan has pending steps under enforce mode"),n==="safe-fix"){let s=Date.now(),l=await S(["doctor","workspace","--apply"],e$1),m=Date.now()-s,g=l.crashed||l.exitCode!==0?"fail":"pass";if(l.crashed)f=true,t.push(`doctor remediation apply execution error: ${l.stderr||"unknown error"}`);else if(g==="fail")t.push("doctor remediation apply failed");else {X=_>0?_:I>0?I:1;let w=await S(["doctor","workspace","--json"],e$1);if(w.crashed)c="fail",f=true,t.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",t.push("post-apply doctor workspace command failed");else {let i=$(w.stdout),v=i&&i.healthScore&&typeof i.healthScore=="object"?i.healthScore:{},h=Number(v.errors??0),y=Number(v.warnings??0);Number.isFinite(h)&&h>0?(c="fail",t.push(`post-apply doctor reports ${h} error(s)`)):Number.isFinite(y)&&y>0?c="warn":c="pass";}W>=0&&(o[W].status=c,o[W].summary=`doctor workspace post-apply status is ${c}`);let P=await S(["readiness","--json"],e$1);if(P.crashed)d="fail",f=true,t.push(`post-apply readiness execution error: ${P.stderr||"unknown error"}`);else if(P.exitCode!==0)d="fail",t.push("post-apply readiness command failed");else {let i=$(P.stdout),v=String(i?.overallStatus??"fail");if(d=oe(v),typeof i?.evidencePath=="string"&&i.evidencePath.trim().length>0&&(L=i.evidencePath),d==="fail"){let h=Array.isArray(i?.blockingReasons)?i?.blockingReasons.filter(y=>typeof y=="string"):[];h.length>0?t.push(...h.map(y=>`post-apply readiness: ${y}`)):t.push("post-apply readiness overall status is fail");}}T>=0&&(o[T].status=d,o[T].summary=`readiness post-apply overall status is ${d}`);}o.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else o.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let ce=Date.now(),A="pass",x="workspace test/build completed for selected projects";try{let s=await b({workspacePath:e$1,stage:"test",affected:true,since:r.since,parallel:r.parallel,maxWorkers:r.maxWorkers,strict:true,json:true,enforceGates:false});N=a(e$1,b$1.join(".workspai","reports",a$1)),await e(e$1,s),q=N;let l=ae(s);if(l==="fail")A="fail",x="workspace test stage failed for selected projects",t.push("workspace run test failed for selected projects");else {l==="warn"&&(A="warn",x="workspace test stage completed with warnings",n==="enforce"&&t.push("workspace run test reported warnings under enforce mode"));let m=await b({workspacePath:e$1,stage:"build",affected:true,since:r.since,parallel:r.parallel,maxWorkers:r.maxWorkers,strict:true,json:true,enforceGates:false});await e(e$1,m),Q=N;let g=ae(m);g==="fail"?(A="fail",x="workspace build stage failed for selected projects",t.push("workspace run build failed for selected projects")):g==="warn"&&(A="warn",x="workspace test/build completed with warnings",n==="enforce"&&t.push("workspace run test/build reported warnings under enforce mode"));}}catch(s){A="fail",x="workspace test/build orchestration failed",f=true,t.push(`workspace run orchestration error: ${s instanceof Error?s.message:String(s)}`);}let pe=Date.now()-ce;o.push({name:"workspace-run-test-build",status:A,durationMs:pe,summary:x});let M=o.filter(s=>s.status==="warn").length,ue=o.filter(s=>s.status==="fail").length,F=n==="enforce"?o.some(s=>s.status==="warn"||s.status==="fail"):ue>0,j=[...new Set(t)],O=f||F?Math.max(1,j.length):0,de=O>0?j:[],fe=O===0?j:[],me=be(o),ge=f||F?"blocked":M>0?"partial":"approved",we=f?3:F?1:M>0?2:0,he=Ae({mode:n,executionError:f,blockers:j,hasWarnings:M>0}),Y=a(e$1,".workspai/reports"),ke=b$1.join(Y,V),ye=b$1.join(Y,G),u={schemaVersion:s.autopilotReleaseLastRun.schemaVersion,generatedAt:new Date().toISOString(),workspacePath:e$1,mode:n,summary:{releaseScore:me,verdict:ge,blockers:O,warnings:M,safeFixesApplied:X,manualActions:j.length,exitCode:we},stages:o,blockingReasons:de,warningReasons:fe,nextActions:he,artifacts:{reportPath:ke,aliasEvidencePath:ye,analyzeEvidencePath:H,readinessEvidencePath:L,workspaceRunEvidencePath:N,workspaceRunTestPath:q,workspaceRunBuildPath:Q},enterpriseControls:{jsonReady:true,evidencePath:`.workspai/reports/${V}`,aliasEvidencePath:`.workspai/reports/${G}`}};if(await h(e$1,`.workspai/reports/${V}`,u),await h(e$1,`.workspai/reports/${G}`,u),r.output&&await xe(b$1.resolve(r.output),u),!r.json){console.log(a$2.bold.cyan(`
|
|
3
3
|
\u{1F680} Workspai Autopilot Release
|
|
4
4
|
`)),console.log(a$2.bold(`Workspace: ${a$2.cyan(b$1.basename(e$1))}`)),console.log(a$2.gray(`Path: ${e$1}`)),console.log(a$2.white(`Mode: ${n}`)),console.log(a$2.white(`Verdict: ${u.summary.verdict==="approved"?a$2.green("approved"):u.summary.verdict==="partial"?a$2.yellow("partial"):a$2.red("blocked")}`)),console.log(a$2.white(`Release score: ${u.summary.releaseScore}`));for(let s of u.stages){let l=s.status==="pass"?a$2.green("PASS"):s.status==="warn"?a$2.yellow("WARN"):s.status==="skipped"?a$2.gray("SKIP"):a$2.red("FAIL");console.log(` - ${s.name}: ${l} ${s.summary} (${s.durationMs}ms)`);}if(u.blockingReasons.length>0){console.log(a$2.bold.red(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b as b$1}from'./chunk-B6FJ6RG6.js';import {k as k$1,q as q$1,G}from'./chunk-X7OI24LO.js';import {c}from'./chunk-E42IFQFR.js';import {e,f}from'./chunk-EFHSRPW7.js';import {b}from'./chunk-UJXE4UAX.js';import {m,l}from'./chunk-VQZ5PI5J.js';import {promises}from'fs';import c$1 from'path';import F,{homedir}from'os';import {pathToFileURL}from'url';import u from'process';import J from'fs-extra';var g=["backend","frontend","desktop","agent","extension","gaming"],D=[{id:"backend",label:"Backend",hint:"APIs and services"},{id:"frontend",label:"Frontend",hint:"Web applications"},{id:"desktop",label:"Desktop",hint:"Native desktop applications"},{id:"agent",label:"AI Agent",hint:"Governed agent runtimes"},{id:"extension",label:"Extension",hint:"Editor and platform extensions"},{id:"gaming",label:"Gaming",hint:"Game runtimes and tooling"}];function R(e){let o=e.label.indexOf(" \u2014 ");return o>=0?e.label.slice(o+3).trim():e.label.trim()}function L(e){return g.includes(e.category)?e.category:null}function j(e){let t=c().flatMap(r=>{let s=L(r);return s?[{value:r.id,label:`${W(s)} \xB7 ${R(r)}`,hint:`${r.runtime} \xB7 tested baseline`,name:r.label,category:s}]:[]}),o=k$1().map(r=>({value:r.kitId,label:`Frontend \xB7 ${r.displayName}`,hint:"official \xB7 latest stable",name:`${r.displayName} \u2014 ${r.framework}`,category:"frontend"})),n=q$1().map(r=>({value:r.kitId,label:`${W(r.category)} \xB7 ${r.displayName}`,hint:`${r.runtimeCandidates.join(" + ")} \xB7 official latest stable`,name:`${r.displayName} \u2014 ${r.category}`,category:r.category})),i=G().map(r=>({value:r.id,label:`AI Agent \xB7 ${r.label}`,hint:`${r.runtime} \xB7 release-admitted baseline`,name:r.label,category:"agent"})),a=[...t,...o,...n,...i].filter(r=>!e||r.category===e).sort((r,s)=>{let p=g.indexOf(r.category),_=g.indexOf(s.category);return p-_||(r.label??"").localeCompare(s.label??"")});return A(a),a}function te(){let e=new Set(j().map(t=>t.category));return D.filter(t=>e.has(t.id)).map(t=>({value:t.id,label:t.label,hint:t.hint}))}function W(e){return e.charAt(0).toUpperCase()+e.slice(1)}function A(e){let t=new Set,o=new Set;for(let n of e){let i=n.label??n.name??String(n.value),a=String(n.value);if(t.has(i))throw new Error(`Duplicate kit picker label: ${i}`);if(o.has(a))throw new Error(`Duplicate kit picker value: ${a}`);t.add(i),o.add(a);}}var U=".workspairc.json",O=".rapidkitrc.json",M=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"],V=["workspai.config.json","rapidkit.config.json"];function $(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}function y(e,t){let o=t instanceof Error?t.message:String(t),n=e.endsWith(".js")&&/module is not defined in ES module scope/i.test(o)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${e}.${n} Cause: ${o}`}async function $e(){for(let e$1 of [c$1.join(F.homedir(),U),c$1.join(F.homedir(),O)])try{let t=await promises.readFile(e$1,"utf-8"),o=JSON.parse(t);return e.debug(`Loaded config from ${e$1}`),o}catch{}return e.debug("No user config found, using defaults"),{}}async function Se(e$1=process.cwd(),t={}){let o=e$1,n=c$1.parse(o).root;for(;o!==n;){for(let i of V){let a=c$1.join(o,i);try{let r=await promises.readFile(a,"utf-8"),s=JSON.parse(r);if(!s||typeof s!="object"||Array.isArray(s))throw new Error("configuration root must be a JSON object");return e.debug(`Loaded data-only Workspai config from ${i}`),s}catch(r){if($(r))continue;throw new Error(y(a,r))}}for(let i of M){let a=c$1.join(o,i);try{await promises.access(a);}catch(r){if($(r))continue;throw new Error(y(a,r))}if(e.debug(`Found config file: ${a}`),!t.trustExecutableConfig)throw new Error(`Refusing to execute Workspai config at ${a} without explicit trust. Use a data-only workspai.config.json file, pass --trust-config, or set WORKSPAI_TRUST_CONFIG=1.`);try{let s=await import(pathToFileURL(a).href),p=s.default||s;return e.debug(`Loaded Workspai config from ${i}`),p}catch(r){throw new Error(y(a,r))}}o=c$1.dirname(o);}return e.debug("No Workspai config file found, using defaults"),{}}function Te(e,t,o){return {author:o.author||t.workspace?.defaultAuthor||e.author,pythonVersion:o.pythonVersion||t.workspace?.pythonVersion||e.pythonVersion,defaultInstallMethod:o.defaultInstallMethod||t.workspace?.installMethod||e.defaultInstallMethod,defaultKit:o.defaultKit||t.projects?.defaultKit||e.defaultKit,skipGit:o.skipGit??t.projects?.skipGit??e.skipGit,license:o.license||e.license,testRapidKitPath:o.testRapidKitPath||e.testRapidKitPath}}function Ne(e){return f("DEV_PATH")||e.testRapidKitPath||void 0}var k=class extends Error{constructor(o,n){super(["Workspai workspaces cannot be nested.",`Target: ${o}`,`Containing workspace: ${n}`,"Choose Managed home or pass --output <path> with a location outside the current workspace."].join(`
|
|
2
|
+
`));this.targetPath=o;this.containingWorkspacePath=n;this.name="NestedWorkspaceCreationError";}targetPath;containingWorkspacePath;code="WORKSPACE_NESTING_NOT_SUPPORTED"};async function Y(e){try{return !!await J.stat(e)}catch{return false}}function B(e,t){let o=e.indexOf(t);if(o>=0&&o+1<e.length)return e[o+1];let n=e.find(i=>i.startsWith(`${t}=`));if(n)return n.slice(t.length+1)}function H(e){return e.includes("--here")}async function T(e){let t=c$1.resolve(e);for(;;){let o=[c$1.join(t,".workspai-workspace"),c$1.join(t,".rapidkit-workspace"),c$1.join(t,".workspai","workspace.json"),c$1.join(t,".rapidkit","workspace.json")];if((await Promise.all(o.map(Y))).some(Boolean))return t;let n=c$1.dirname(t);if(n===t)return;t=n;}}async function Je(e){let t=c$1.resolve(e),o=await T(c$1.dirname(t));if(o)throw new k(t,o)}async function q(e,t=homedir()){let n=[{value:"managed",label:"Managed home",hint:l(t)}];return await T(e)||n.push({value:"here",label:"Current directory",hint:e}),n}function N(e,t=u.cwd()){if(H(e))return c$1.resolve(t);let o=B(e,"--output");if(o)return c$1.resolve(o)}function Ye(e,t=u.cwd()){let o=c$1.resolve(e),n=c$1.resolve(t),i=c$1.relative(n,o);return i.length>0&&!i.startsWith("..")&&!c$1.isAbsolute(i)?`cd ${i}`:`cd ${o}`}function Be(e,t={}){let o=t.argv??[],n=t.outputParent??N(o,u.cwd());return m(e.trim(),{homeDir:t.homeDir,outputDir:n})}function He(e,t,o={}){return e?c$1.resolve(e)===c$1.resolve(t)?true:o.outputParent===void 0:false}async function qe(e,t={}){let o=t.cwd??u.cwd(),n=t.homeDir??homedir(),i=N(e,o);if(i!==void 0)return i;let a=t.hasYes??(e.includes("--yes")||e.includes("-y"));if(!(t.interactive??(!a&&!!u.stdin.isTTY&&!b())))return;let s=await q(o,n);if(s.length===1)return;let{location:p}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:s,default:0}]);if(p==="here")return c$1.resolve(o)}export{j as a,te as b,$e as c,Se as d,Te as e,Ne as f,Je as g,Ye as h,Be as i,He as j,qe as k};
|