function e(e){return e&&e[0].toLowerCase()+e.slice(1)}function t(e){return!e||e.length===0?``:`## Skills\n\n| Skill | When to load |\n|-------|--------------|\n${e.map(([e,t])=>`| ${e} | ${t} |`).join(`
`)}`}function n({name:n,title:r,description:i,skills:a,bodyAddendum:o}){let s=t(a),c=[`# ${n} - ${r||n}`,``,`> ${i}`,``,`You are the **${n}**, ${e(i)}.`];return o&&c.push(``,o.trim()),s&&c.push(``,s),c.push(``),c.join(`
`)}function r({name:n,title:r,description:i,body:a,skills:o,additionalSections:s}){let c=[`### ${n} — ${r||n}`,``,`> ${i}`,``,`You are the **${n}**, ${e(i)}.`],l=[a,...s||[],t(o)].filter(Boolean).join(`

`).trim();return l&&c.push(``,l),c.push(``,`---`,``),c.join(`
`)}function i({title:e,content:t}){return`# ${e}\n\n${t}`}function a(e){return Object.entries(e).map(([e,t])=>[`### ${t.title||t.description||e}`,``,t.content.trim(),``,`---`,``].join(`
`)).join(`
`).trimEnd()}function o(e){return[[`Session Start`,e.sessionStart],[`Before Code Change`,e.beforeCodeChange],[`Before Commit`,e.beforeCommit],[`Session End`,e.sessionEnd]].map(([e,t])=>{let n=(t?.actions||[]).map(e=>`- \`${e}\``);return[`### ${e}`,``,...n,``].join(`
`)}).join(`
`).trimEnd()}function s(e,t){if(!e)return null;let n=typeof e==`function`?e(t):e[t];return n?typeof n==`string`?n:n.primary||n.model||null:null}function c(e,t){let n=!!t,r=[];for(let[i,a]of Object.entries(e))if(a.variants)for(let[e,o]of Object.entries(a.variants)){let c=`${i}-${e}`,l=[`| **${c}** | ${o.description} |`];n&&l.push(` ${s(t,c)||`—`} |`),l.push(` ${a.category||`—`} |`),r.push(l.join(``))}else{let e=[`| **${i}** | ${a.description} |`];n&&e.push(` ${s(t,i)||`—`} |`),e.push(` ${a.category||`—`} |`),r.push(e.join(``))}return n?`| Agent | Purpose | Model | Category |\n|-------|---------|-------|----------|\n${r.join(`
`)}`:`| Agent | Purpose | Category |\n|-------|---------|----------|\n${r.join(`
`)}`}function l(e){let t=[];for(let[n,r]of Object.entries(e)){if(n===`Orchestrator`)continue;let e=r.compactRole||r.description;if(r.variants){let i=Object.keys(r.variants);t.push(`| **${n}-${i.join(`/`)}** | ${e} |`)}else t.push(`| **${n}** | ${e} |`)}return`| Agent | Role |\n|-------|------|\n${t.join(`
`)}`}function u({serverName:e,mcpEntry:t,configKey:n,extraServerFields:r}){let i={...t};return r&&Object.assign(i,r),JSON.stringify({[n]:{[e]:i}},null,2)}export{n as buildAgentPrompt,c as buildAgentTable,l as buildCompactAgentTable,o as buildHooksSection,r as buildInlineAgentSection,u as buildMcpConfigJson,i as buildPromptFile,a as buildPromptSections,t as buildSkillsSection,e as lowerFirst};