@vpxa/aikit 0.1.362 → 0.1.364

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.
@@ -0,0 +1,7 @@
1
+ import{c as e,l as t,n,o as r,r as i,t as a}from"./scaffold-BNPHP-QC.js";import{a as o,i as s,l as c,n as l,r as u,s as d,t as f,v as p}from"./templates-3QxMwDt5.js";import{appendFileSync as m,existsSync as h,mkdirSync as g,readFileSync as _,unlinkSync as v,writeFileSync as y}from"node:fs";import{basename as b,dirname as x,resolve as S}from"node:path";import{homedir as C}from"node:os";import{AIKIT_PATHS as w,DEFAULT_SERVER_NAME as T,EMBEDDING_DEFAULTS as E,isUserInstalled as D}from"../../core/dist/index.js";function O(e){return h(S(e,`.cursor`))?`cursor`:h(S(e,`.claude`))?`claude-code`:h(S(e,`.windsurf`))?`windsurf`:h(S(e,`.zed`))?`zed`:h(S(e,`.idea`))?`intellij`:h(S(e,`.opencode`))?`opencode`:h(S(e,`AGENTS.md`))?`hermes`:`copilot`}function k(e){let t=[];return h(S(e,`.cursor`))&&t.push(`cursor`),(h(S(e,`.claude`))||h(S(e,`CLAUDE.md`)))&&t.push(`claude-code`),h(S(e,`.windsurf`))&&t.push(`windsurf`),h(S(e,`.zed`))&&t.push(`zed`),h(S(e,`.idea`))&&t.push(`intellij`),h(S(e,`.gemini`))&&t.push(`gemini-cli`),(h(S(e,`.codex`))||h(S(e,`codex.md`)))&&t.push(`codex-cli`),(h(S(e,`.opencode`))||h(S(e,`OPENCODE.md`)))&&t.push(`opencode`),t.push(`copilot`),t.push(`hermes`),[...new Set(t)]}function A(e){return{servers:{[e]:{...o}}}}function j(e){let{type:t,...n}=o;return{mcpServers:{[e]:n}}}function M(e){let{type:t,...n}=o;return{context_servers:{[e]:{...n}}}}function N(e){let{type:t,...n}=o;return{mcp:{[e]:{type:`local`,command:[n.command,...n.args]}}}}const P={scaffoldDir:`general`,writeMcpConfig(e,t){let n=S(e,`.vscode`),r=S(n,`mcp.json`);h(r)||(g(n,{recursive:!0}),y(r,`${JSON.stringify(A(t),null,2)}\n`,`utf-8`),console.log(` Created .vscode/mcp.json`))},writeInstructions(e,t){let n=S(e,`.github`),r=S(n,`copilot-instructions.md`);g(n,{recursive:!0}),y(r,u(b(e),t),`utf-8`),console.log(` Updated .github/copilot-instructions.md`)},writeAgentsMd(e,t){y(S(e,`AGENTS.md`),f(b(e),t),`utf-8`),console.log(` Updated AGENTS.md`)}},F=`orchestrator`;function I(e){let{command:t,args:n}=o;return{[e]:{command:t,args:[...n],type:`stdio`,env:{}}}}function L(e,t){let n=t??S(C(),`.claude`),r=S(n,`settings.json`),i=S(n,`..`,`.claude.json`),a=I(e),o;if(!h(i))o={};else try{o=JSON.parse(_(i,`utf-8`))}catch{console.warn(` ⚠ ${i} invalid JSON — overwriting`),o={}}g(x(i),{recursive:!0}),o.mcpServers={...o.mcpServers||{},...a},y(i,`${JSON.stringify(o,null,2)}\n`,`utf-8`),console.log(` Updated ${i} — ${e} MCP server`);let s;if(!h(r))g(n,{recursive:!0}),s={agent:F};else{try{s=JSON.parse(_(r,`utf-8`))}catch{console.warn(` ⚠ ${r} invalid JSON — overwriting`),s={}}delete s.mcpServers}s.agent=F;let l=S(n,`hooks`,`scripts`).replace(/\\/g,`/`);try{let e=c(`claude`,l);e.hooks&&Object.keys(e.hooks).length>0&&(s.hooks=e.hooks)}catch{console.warn(` ⚠ Failed to generate hooks block`)}y(r,`${JSON.stringify(s,null,2)}\n`,`utf-8`),console.log(` Updated ${r} — default agent + hooks`)}const R={scaffoldDir:`general`,writeMcpConfig(e,t){L(t);let n=S(e,`.mcp.json`);h(n)||(y(n,`${JSON.stringify(j(t),null,2)}\n`,`utf-8`),console.log(` Created .mcp.json`))},writeInstructions(e,t){let n=S(e,`CLAUDE.md`),r=b(e);y(n,`${l(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated CLAUDE.md`)},writeAgentsMd(e,t){}},z={scaffoldDir:`general`,writeMcpConfig(e,t){let n=S(e,`.cursor`),r=S(n,`mcp.json`);h(r)||(g(n,{recursive:!0}),y(r,`${JSON.stringify(j(t),null,2)}\n`,`utf-8`),console.log(` Created .cursor/mcp.json`))},writeInstructions(e,t){let n=S(e,`.cursor`,`rules`),r=S(n,`aikit.mdc`);g(n,{recursive:!0});let i=b(e);y(r,`${u(i,t)}\n---\n\n${f(i,t)}`,`utf-8`),console.log(` Updated .cursor/rules/aikit.mdc`);let a=S(n,`kb.mdc`);h(a)&&a!==r&&(v(a),console.log(` Removed legacy .cursor/rules/kb.mdc`))},writeAgentsMd(e,t){}},B={scaffoldDir:`general`,writeMcpConfig(e,t){let n=S(e,`.vscode`),r=S(n,`mcp.json`);h(r)||(g(n,{recursive:!0}),y(r,`${JSON.stringify(A(t),null,2)}\n`,`utf-8`),console.log(` Created .vscode/mcp.json (Windsurf-compatible)`))},writeInstructions(e,t){let n=S(e,`.windsurfrules`),r=b(e);y(n,`${u(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated .windsurfrules`)},writeAgentsMd(e,t){}},V={scaffoldDir:`general`,writeMcpConfig(e,t){let n=S(e,`.zed`),r=S(n,`settings.json`);if(g(n,{recursive:!0}),!h(r))y(r,`${JSON.stringify(M(t),null,2)}\n`,`utf-8`),console.log(` Created .zed/settings.json`);else{let e;try{e=JSON.parse(_(r,`utf-8`))}catch{console.warn(` ⚠ .zed/settings.json contains invalid JSON — skipping MCP config merge`);return}e.context_servers?.[t]||(e.context_servers={...e.context_servers,...M(t).context_servers},y(r,`${JSON.stringify(e,null,2)}\n`,`utf-8`),console.log(` Updated .zed/settings.json with context_servers`))}},writeInstructions(e,t){let n=S(e,`.rules`),r=b(e);y(n,`${u(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated .rules`)},writeAgentsMd(e,t){}},H={scaffoldDir:`general`,writeMcpConfig(e,t){let n=S(e,`mcp.json`);h(n)||(y(n,`${JSON.stringify(j(t),null,2)}\n`,`utf-8`),console.log(` Created mcp.json`))},writeInstructions(e,t){let n=S(e,`.aiassistant`,`rules`),r=S(n,`aikit.md`);g(n,{recursive:!0});let i=b(e);y(r,`${u(i,t)}\n---\n\n${f(i,t)}`,`utf-8`),console.log(` Updated .aiassistant/rules/aikit.md`)},writeAgentsMd(e,t){}},U={scaffoldDir:`general`,writeMcpConfig(e,t){let n=S(e,`.opencode`),r=S(n,`opencode.json`);h(r)||(g(n,{recursive:!0}),y(r,`${JSON.stringify(N(t),null,2)}\n`,`utf-8`),console.log(` Created .opencode/opencode.json`))},writeInstructions(e,t){let n=S(e,`OPENCODE.md`),r=b(e);y(n,`${u(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated OPENCODE.md`)},writeAgentsMd(e,t){}},W={scaffoldDir:`general`,writeMcpConfig(e,t){},writeInstructions(e,t){let n=S(e,`AGENTS.md`),r=b(e);y(n,`${u(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated AGENTS.md (Hermes)`)},writeAgentsMd(e,t){}};function G(e){switch(e){case`copilot`:return P;case`claude-code`:return R;case`cursor`:return z;case`windsurf`:return B;case`zed`:return V;case`intellij`:return H;case`opencode`:return U;case`hermes`:return W;case`gemini-cli`:case`codex-cli`:return P}}const K={serverName:T,sources:[{path:`.`,excludePatterns:[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.git/**`,`**/${w.data}/**`,`**/coverage/**`,`**/*.min.js`,`**/package-lock.json`,`**/pnpm-lock.yaml`]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:E.model,dimensions:E.dimensions},store:{backend:`sqlite-vec`,path:w.data},curated:{path:w.aiCurated}};function q(e,t){let n=S(e,`aikit.config.json`);return h(n)&&!t?(console.log(`aikit.config.json already exists. Use --force to overwrite.`),!1):(y(n,`${JSON.stringify(K,null,2)}\n`,`utf-8`),console.log(` Created aikit.config.json`),!0)}function J(e){let t=S(e,`.gitignore`),n=[{dir:`.flows/`,label:`AI Kit flow runs`}];if(h(t)){let e=_(t,`utf-8`),r=n.filter(t=>!e.includes(t.dir));r.length>0&&(m(t,`\n${r.map(e=>`# ${e.label}\n${e.dir}`).join(`
2
+ `)}\n`,`utf-8`),console.log(` Added ${r.map(e=>e.dir).join(`, `)} to .gitignore`))}else y(t,`${n.map(e=>`# ${e.label}\n${e.dir}`).join(`
3
+ `)}\n`,`utf-8`),console.log(` Created .gitignore with AI Kit entries`)}const Y=[`decisions`,`patterns`,`conventions`,`troubleshooting`];function X(e){let t=S(e,`.ai`,`curated`);h(t)||(g(t,{recursive:!0}),console.log(` Created .ai/curated/`));for(let e of Y){let n=S(t,e);h(n)||g(n,{recursive:!0})}console.log(` Created .ai/curated/{${Y.join(`,`)}}/`)}function Z(e){switch(e){case`zed`:return`zed`;case`intellij`:return`intellij`;case`claude-code`:return`claude-code`;case`gemini-cli`:return`gemini`;case`codex-cli`:return`codex`;case`opencode`:return`opencode`;case`hermes`:return`hermes`;default:return`copilot`}}async function Q(n){let i=process.cwd();if(S(i)===S(C())){console.log(` Skipping workspace init: cannot scaffold the home directory.`),console.log(" Use `aikit init` (without --workspace) for user-level setup.");return}if(!q(i,n.force))return;J(i);let a=T,o=G(O(i));o.writeMcpConfig(i,a),o.writeInstructions(i,a),o.writeAgentsMd(i,a);let c=p(),l=JSON.parse(_(S(c,`package.json`),`utf-8`)).version;await t(i,c,[...d],l,n.force),await r(i,c,[...s],l,n.force);let u=k(i),f=new Set;for(let t of u){let r=Z(t);f.has(r)||(f.add(r),await e(i,c,r,l,n.force))}X(i),console.log(`
4
+ AI Kit initialized! Next steps:`),console.log(` aikit reindex Index your codebase`),console.log(` aikit search Search indexed content`),console.log(` aikit serve Start MCP server for IDE integration`),D()&&console.log(`
5
+ Note: User-level AI Kit is also installed. This workspace uses its own local data store.`)}async function ee(e){D()?await $(e):await Q(e)}async function $(t){let n=process.cwd();if(S(n)===S(C())){console.log(` Skipping workspace scaffold: cannot scaffold the home directory.`);return}let i=T,a=G(O(n));a.writeInstructions(n,i),a.writeAgentsMd(n,i);let o=p(),c=JSON.parse(_(S(o,`package.json`),`utf-8`)).version,l=k(n),u=new Set;for(let r of l){let i=Z(r);u.has(i)||(u.add(i),await e(n,o,i,c,t.force))}await r(n,o,[...s],c,t.force),X(n),J(n),console.log(`
6
+ Workspace scaffolded for user-level AI Kit! Files added:`),console.log(` Instruction files (AGENTS.md, copilot-instructions.md, etc.)`),console.log(` .ai/curated/ directories`),console.log(` .github/agents/ & .github/prompts/`),console.log(`
7
+ The user-level AI Kit server will auto-index this workspace when opened in your IDE.`)}async function te(){let e=process.cwd(),t=k(e),r=p(),o=[...await i(e,r,[...d])],c=new Set;for(let i of t){let t=Z(i);c.has(t)||(c.add(t),o.push(...await n(e,r,t)))}o.push(...await a(e,r,[...s]));let l={summary:{total:o.length,new:o.filter(e=>e.status===`new`).length,outdated:o.filter(e=>e.status===`outdated`).length,current:o.filter(e=>e.status===`current`).length},files:o};console.log(JSON.stringify(l,null,2))}export{te as guideProject,Q as initProject,$ as initScaffoldOnly,ee as initSmart};
@@ -1,9 +1,9 @@
1
- import{createRequire as e}from"node:module";import{readFileSync as t}from"node:fs";import{dirname as n,resolve as r}from"node:path";import{fileURLToPath as i}from"node:url";import{resolveStateDir as a,safeCwdOrHome as o}from"../../core/dist/index.js";import{createSqliteAdapter as s,createStateStore as c}from"../../store/dist/index.js";import{mkdir as l}from"node:fs/promises";var u=class extends Error{exitCode;constructor(e,t=1){super(e),this.exitCode=t,this.name=`CliError`}};function d(e){let t=e.indexOf(`--json`);return t===-1?!1:(e.splice(t,1),!0)}function f(e){let t=new WeakSet;console.log(JSON.stringify(e,(e,n)=>{if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return typeof n==`bigint`?String(n):n},2))}async function p(e=o()){let t=a(r(e));return await l(t,{recursive:!0}),c(await s(r(t,`state.db`)))}function m(){let t=e(import.meta.url);try{return t.resolve(`@vpxa/aikit/package.json`)}catch{return r(i(import.meta.url),`..`,`..`,`..`,`..`,`package.json`)}}function h(){return n(m())}function g(){try{return JSON.parse(t(m(),`utf-8`)).version??`0.0.0`}catch{return`0.0.0`}}function ee(){let t=e(import.meta.url);try{return r(n(t.resolve(`@aikit/server`)),`bin.js`)}catch{return r(h(),`packages`,`server`,`dist`,`bin.js`)}}function te(e){let t=`--disable-warning=ExperimentalWarning`;return e?e.includes(`ExperimentalWarning`)?e:`${e} ${t}`:t}function ne(e,t,n){let r=e.indexOf(t);if(r===-1||r+1>=e.length)return n;let i=Number.parseInt(e.splice(r,2)[1],10);return Number.isNaN(i)?n:i}function re(e,t,n){let r=e.indexOf(t);return r===-1||r+1>=e.length?n:e.splice(r,2)[1]}function ie(e,t){let n=e.indexOf(t);return n===-1?!1:(e.splice(n,1),!0)}async function ae(){if(process.stdin.isTTY)return``;let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString(`utf-8`)}function oe(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function se(e){return e.map(e=>{let t=e.heading?` ${e.heading}`:``;return`${e.start}-${e.end}${t}`}).join(`, `)}function ce(e){switch(e.tool){case`tsc`:case`biome`:console.log(`${e.tool} errors: ${e.errors.length}`);for(let t of e.errors){let e=[t.line,t.column].filter(e=>e!==void 0).join(`:`),n=e?`${t.file}:${e}`:t.file,r=t.code?` ${t.code}`:``;console.log(`- ${n} [${t.severity}${r}] ${t.message}`)}return;case`vitest`:console.log(`Vitest summary`),console.log(` Passed: ${e.summary.passed}`),console.log(` Failed: ${e.summary.failed}`),console.log(` Skipped: ${e.summary.skipped}`),e.summary.duration!==void 0&&console.log(` Duration: ${e.summary.duration}ms`);for(let t of e.summary.tests)t.status===`fail`&&(console.log(`- ${t.name}${t.file?` (${t.file})`:``}`),t.error&&console.log(` ${t.error}`));return;case`git-status`:console.log(`Branch: ${e.status.branch??`unknown`}`),console.log(`Staged: ${e.status.staged.length}`);for(let t of e.status.staged)console.log(` ${t.status} ${t.file}`);console.log(`Unstaged: ${e.status.unstaged.length}`);for(let t of e.status.unstaged)console.log(` ${t.status} ${t.file}`);console.log(`Untracked: ${e.status.untracked.length}`);for(let t of e.status.untracked)console.log(` ?? ${t}`);return}}function _(e){console.log(`Overall: ${e.passed?`passed`:`failed`}`),v(`tsc`,e.tsc.passed,e.tsc.errors),v(`biome`,e.biome.passed,e.biome.errors)}function v(e,t,n){console.log(`${e}: ${t?`passed`:`${n.length} issue(s)`}`);for(let e of n){let t=[e.line,e.column].filter(e=>e!==void 0).join(`:`),n=t?`${e.file}:${t}`:e.file,r=e.code?` ${e.code}`:``;console.log(` - ${n} [${e.severity}${r}] ${e.message}`)}}function y(e){console.log(`Vitest: ${e.passed?`passed`:`failed`}`),console.log(` Duration: ${e.durationMs}ms`),console.log(` Passed: ${e.summary.passed}`),console.log(` Failed: ${e.summary.failed}`),console.log(` Skipped: ${e.summary.skipped}`),e.summary.suites!==void 0&&console.log(` Suites: ${e.summary.suites}`);let t=e.summary.tests.filter(e=>e.status===`fail`);if(t.length!==0){console.log(`Failed tests:`);for(let e of t)console.log(` - ${e.name}${e.file?` (${e.file})`:``}`),e.error&&console.log(` ${e.error}`)}}function b(e){console.log(`Branch: ${e.branch}`),console.log(`Staged: ${e.status.staged.length}`);for(let t of e.status.staged)console.log(` - ${t}`);console.log(`Modified: ${e.status.modified.length}`);for(let t of e.status.modified)console.log(` - ${t}`);console.log(`Untracked: ${e.status.untracked.length}`);for(let t of e.status.untracked)console.log(` - ${t}`);if(console.log(``),console.log(`Recent commits:`),e.recentCommits.length===0)console.log(` none`);else for(let t of e.recentCommits)console.log(` - ${t.hash} ${t.message}`),console.log(` ${t.author} @ ${t.date}`);e.diff&&(console.log(``),console.log(`Diff stat:`),console.log(e.diff))}function x(e){if(e.length===0){console.log(`No diff files found.`);return}for(let t of e){let e=t.oldPath?` (from ${t.oldPath})`:``;console.log(`${t.path}${e}`),console.log(` Status: ${t.status}`),console.log(` Changes: +${t.additions} -${t.deletions}`),console.log(` Hunks: ${t.hunks.length}`);for(let e of t.hunks){let t=e.header?` ${e.header}`:``;console.log(` @@ -${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines} @@${t}`)}}}function S(e){if(console.log(`Start: ${e.start}`),console.log(`Direction: ${e.direction}`),console.log(`Depth reached: ${e.depth}`),console.log(`Nodes: ${e.nodes.length}`),e.nodes.length===0){console.log(`No trace nodes found.`);return}for(let t of e.nodes)console.log(` - [${t.relationship}] ${t.path}:${t.line} ${t.symbol}`)}function C(e){if(console.log(`Query: ${e.query}`),console.log(`Examples: ${e.examples.length} shown (${e.totalFound} total)`),e.examples.length===0){console.log(`No matching examples found.`);return}for(let t of e.examples){console.log(``),console.log(`${t.path}:${t.startLine}-${t.endLine}`),console.log(` Context: ${t.context}`),console.log(` Relevance: ${(t.relevance*100).toFixed(1)}%`);for(let e of t.content.split(`
2
- `))console.log(` ${e}`)}}function w(e){console.log(e.id),console.log(` Command: ${e.command}${e.args.length>0?` ${e.args.join(` `)}`:``}`),console.log(` PID: ${e.pid??`unknown`}`),console.log(` Status: ${e.status}`),console.log(` Started: ${e.startedAt}`),e.exitCode!==void 0&&console.log(` Exit code: ${e.exitCode}`),console.log(` Logs: ${e.logs.length}`)}function T(e){if(console.log(`Exports scanned: ${e.totalExports}`),console.log(`Dead in source: ${e.totalDeadSource} (actionable)`),console.log(`Dead in docs: ${e.totalDeadDocs} (informational)`),e.totalDeadSource===0&&e.totalDeadDocs===0){console.log(`No dead symbols found.`);return}if(e.deadInSource.length>0){console.log(`
1
+ import{createRequire as e}from"node:module";import{readFileSync as t}from"node:fs";import{dirname as n,resolve as r}from"node:path";import{fileURLToPath as i}from"node:url";import{resolveStateDir as a,safeCwdOrHome as ee}from"../../core/dist/index.js";import{createSqliteAdapter as o,createStateStore as s}from"../../store/dist/index.js";import{mkdir as c}from"node:fs/promises";var l=class extends Error{exitCode;constructor(e,t=1){super(e),this.exitCode=t,this.name=`CliError`}};function u(e){let t=e.indexOf(`--json`);return t===-1?!1:(e.splice(t,1),!0)}function d(e){let t=new WeakSet;console.log(JSON.stringify(e,(e,n)=>{if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return typeof n==`bigint`?String(n):n},2))}async function te(e=ee()){let t=a(r(e));return await c(t,{recursive:!0}),s(await o(r(t,`state.db`)))}function f(){let t=e(import.meta.url);try{return t.resolve(`@vpxa/aikit/package.json`)}catch{return r(i(import.meta.url),`..`,`..`,`..`,`..`,`package.json`)}}function p(){return n(f())}function ne(){try{return JSON.parse(t(f(),`utf-8`)).version??`0.0.0`}catch{return`0.0.0`}}function re(){let t=e(import.meta.url);try{return r(n(t.resolve(`@aikit/server`)),`bin.js`)}catch{return r(p(),`packages`,`server`,`dist`,`bin.js`)}}function ie(e){let t=`--disable-warning=ExperimentalWarning`;return e?e.includes(`ExperimentalWarning`)?e:`${e} ${t}`:t}function ae(e,t,n){let r=e.indexOf(t);if(r===-1||r+1>=e.length)return n;let i=Number.parseInt(e.splice(r,2)[1],10);return Number.isNaN(i)?n:i}function oe(e,t,n){let r=e.indexOf(t);return r===-1||r+1>=e.length?n:e.splice(r,2)[1]}function m(e,t){let n=e.indexOf(t);return n===-1?!1:(e.splice(n,1),!0)}async function h(){if(process.stdin.isTTY)return``;let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString(`utf-8`)}function g(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function se(e){return e.map(e=>{let t=e.heading?` ${e.heading}`:``;return`${e.start}-${e.end}${t}`}).join(`, `)}function ce(e){switch(e.tool){case`tsc`:case`biome`:console.log(`${e.tool} errors: ${e.errors.length}`);for(let t of e.errors){let e=[t.line,t.column].filter(e=>e!==void 0).join(`:`),n=e?`${t.file}:${e}`:t.file,r=t.code?` ${t.code}`:``;console.log(`- ${n} [${t.severity}${r}] ${t.message}`)}return;case`vitest`:console.log(`Vitest summary`),console.log(` Passed: ${e.summary.passed}`),console.log(` Failed: ${e.summary.failed}`),console.log(` Skipped: ${e.summary.skipped}`),e.summary.duration!==void 0&&console.log(` Duration: ${e.summary.duration}ms`);for(let t of e.summary.tests)t.status===`fail`&&(console.log(`- ${t.name}${t.file?` (${t.file})`:``}`),t.error&&console.log(` ${t.error}`));return;case`git-status`:console.log(`Branch: ${e.status.branch??`unknown`}`),console.log(`Staged: ${e.status.staged.length}`);for(let t of e.status.staged)console.log(` ${t.status} ${t.file}`);console.log(`Unstaged: ${e.status.unstaged.length}`);for(let t of e.status.unstaged)console.log(` ${t.status} ${t.file}`);console.log(`Untracked: ${e.status.untracked.length}`);for(let t of e.status.untracked)console.log(` ?? ${t}`);return}}function le(e){console.log(`Overall: ${e.passed?`passed`:`failed`}`),_(`tsc`,e.tsc.passed,e.tsc.errors),_(`biome`,e.biome.passed,e.biome.errors)}function _(e,t,n){console.log(`${e}: ${t?`passed`:`${n.length} issue(s)`}`);for(let e of n){let t=[e.line,e.column].filter(e=>e!==void 0).join(`:`),n=t?`${e.file}:${t}`:e.file,r=e.code?` ${e.code}`:``;console.log(` - ${n} [${e.severity}${r}] ${e.message}`)}}function v(e){console.log(`Vitest: ${e.passed?`passed`:`failed`}`),console.log(` Duration: ${e.durationMs}ms`),console.log(` Passed: ${e.summary.passed}`),console.log(` Failed: ${e.summary.failed}`),console.log(` Skipped: ${e.summary.skipped}`),e.summary.suites!==void 0&&console.log(` Suites: ${e.summary.suites}`);let t=e.summary.tests.filter(e=>e.status===`fail`);if(t.length!==0){console.log(`Failed tests:`);for(let e of t)console.log(` - ${e.name}${e.file?` (${e.file})`:``}`),e.error&&console.log(` ${e.error}`)}}function y(e){console.log(`Branch: ${e.branch}`),console.log(`Staged: ${e.status.staged.length}`);for(let t of e.status.staged)console.log(` - ${t}`);console.log(`Modified: ${e.status.modified.length}`);for(let t of e.status.modified)console.log(` - ${t}`);console.log(`Untracked: ${e.status.untracked.length}`);for(let t of e.status.untracked)console.log(` - ${t}`);if(console.log(``),console.log(`Recent commits:`),e.recentCommits.length===0)console.log(` none`);else for(let t of e.recentCommits)console.log(` - ${t.hash} ${t.message}`),console.log(` ${t.author} @ ${t.date}`);e.diff&&(console.log(``),console.log(`Diff stat:`),console.log(e.diff))}function b(e){if(e.length===0){console.log(`No diff files found.`);return}for(let t of e){let e=t.oldPath?` (from ${t.oldPath})`:``;console.log(`${t.path}${e}`),console.log(` Status: ${t.status}`),console.log(` Changes: +${t.additions} -${t.deletions}`),console.log(` Hunks: ${t.hunks.length}`);for(let e of t.hunks){let t=e.header?` ${e.header}`:``;console.log(` @@ -${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines} @@${t}`)}}}function x(e){if(console.log(`Start: ${e.start}`),console.log(`Direction: ${e.direction}`),console.log(`Depth reached: ${e.depth}`),console.log(`Nodes: ${e.nodes.length}`),e.nodes.length===0){console.log(`No trace nodes found.`);return}for(let t of e.nodes)console.log(` - [${t.relationship}] ${t.path}:${t.line} ${t.symbol}`)}function S(e){if(console.log(`Query: ${e.query}`),console.log(`Examples: ${e.examples.length} shown (${e.totalFound} total)`),e.examples.length===0){console.log(`No matching examples found.`);return}for(let t of e.examples){console.log(``),console.log(`${t.path}:${t.startLine}-${t.endLine}`),console.log(` Context: ${t.context}`),console.log(` Relevance: ${(t.relevance*100).toFixed(1)}%`);for(let e of t.content.split(`
2
+ `))console.log(` ${e}`)}}function C(e){console.log(e.id),console.log(` Command: ${e.command}${e.args.length>0?` ${e.args.join(` `)}`:``}`),console.log(` PID: ${e.pid??`unknown`}`),console.log(` Status: ${e.status}`),console.log(` Started: ${e.startedAt}`),e.exitCode!==void 0&&console.log(` Exit code: ${e.exitCode}`),console.log(` Logs: ${e.logs.length}`)}function w(e){if(console.log(`Exports scanned: ${e.totalExports}`),console.log(`Dead in source: ${e.totalDeadSource} (actionable)`),console.log(`Dead in docs: ${e.totalDeadDocs} (informational)`),e.totalDeadSource===0&&e.totalDeadDocs===0){console.log(`No dead symbols found.`);return}if(e.deadInSource.length>0){console.log(`
3
3
  Dead in source (actionable):`);for(let t of e.deadInSource)console.log(` - ${t.path}:${t.line} ${t.kind} ${t.name}`)}if(e.deadInDocs.length>0){console.log(`
4
- Dead in docs (informational):`);for(let t of e.deadInDocs)console.log(` - ${t.path}:${t.line} ${t.kind} ${t.name}`)}}function E(e){console.log(e.path),console.log(` Language: ${e.language}`),console.log(` Lines: ${e.lines}`),console.log(` Estimated tokens: ~${e.estimatedTokens}`),console.log(``),A(`Imports`,e.imports),A(`Exports`,e.exports),A(`Functions`,e.functions.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}`)),A(`Classes`,e.classes.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}`)),A(`Interfaces`,e.interfaces.map(e=>`${e.name} @ line ${e.line}`)),A(`Types`,e.types.map(e=>`${e.name} @ line ${e.line}`))}function D(e){if(console.log(`Symbol: ${e.name}`),e.definedIn?console.log(`Defined in: ${e.definedIn.path}:${e.definedIn.line} (${e.definedIn.kind})`):console.log(`Defined in: not found`),console.log(``),console.log(`Imported by:`),e.importedBy.length===0)console.log(` none`);else for(let t of e.importedBy)console.log(` - ${t.path}:${t.line} ${t.importStatement}`);if(console.log(``),console.log(`Referenced in:`),e.referencedIn.length===0)console.log(` none`);else for(let t of e.referencedIn)console.log(` - ${t.path}:${t.line} ${t.context}`)}function O(e){console.log(e.name),console.log(` Files: ${e.files.length}`),console.log(` Updated: ${e.updated}`),e.description&&console.log(` Description: ${e.description}`);for(let t of e.files)console.log(` - ${t}`)}function k(e){let t=Array.isArray(e.data.files)?e.data.files.filter(e=>typeof e==`string`):[];if(console.log(e.id),console.log(` Label: ${e.label}`),console.log(` Created: ${e.createdAt}`),e.notes&&console.log(` Notes: ${e.notes}`),t.length>0){console.log(` Files: ${t.length}`);for(let e of t)console.log(` - ${e}`)}console.log(` Data:`);for(let t of JSON.stringify(e.data,null,2).split(`
5
- `))console.log(` ${t}`)}function A(e,t){if(console.log(`${e}:`),t.length===0){console.log(` none`),console.log(``);return}for(let e of t)console.log(` - ${e}`);console.log(``)}function j(e){let t=e.trim();if(!t)return``;try{return JSON.parse(t)}catch{return e}}function M(e){let t=e.trim();if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Checkpoint data must be a JSON object.`);return n}function N(e,t,n=60){let r=new Map;for(let t=0;t<e.length;t++){let i=e[t];r.set(i.record.id,{record:i.record,score:1/(n+t+1)})}for(let e=0;e<t.length;e++){let i=t[e],a=r.get(i.record.id);a?a.score+=1/(n+e+1):r.set(i.record.id,{record:i.record,score:1/(n+e+1)})}return[...r.values()].sort((e,t)=>t.score-e.score)}const P=[`copilot`,`claude`,`copilotCli`,`hermes`],F={SessionStart:{copilot:`SessionStart`,claude:`SessionStart`,copilotCli:`sessionStart`,hermes:`SessionStart`},PreToolUse:{copilot:`PreToolUse`,claude:`PreToolUse`,copilotCli:`preToolUse`,hermes:`PreToolUse`},PostToolUse:{copilot:`PostToolUse`,claude:`PostToolUse`,copilotCli:`postToolUse`,hermes:`PostToolUse`},SubagentStart:{copilot:`SubagentStart`,claude:`SubagentStart`,copilotCli:`subagentStart`,hermes:`SubagentStart`},PreCompact:{copilot:`PreCompact`,claude:`PreCompact`,copilotCli:`preCompact`,hermes:`PreCompact`},Stop:{copilot:`Stop`,claude:`Stop`,copilotCli:`stop`,hermes:`Stop`}},I={fileRead:{copilot:[`read_file`,`readFile`],claude:[`Read`],copilotCli:[`read_file`],hermes:[`read_file`]},fileWrite:{copilot:[`editFiles`,`replace_string_in_file`,`create_file`],claude:[`Edit`,`Write`,`MultiEdit`],copilotCli:[`editFiles`,`replace_string_in_file`],hermes:[`write_file`,`patch`]},fileSearch:{copilot:[`grep_search`,`semantic_search`,`find`],claude:[`Bash`],copilotCli:[`grep_search`],hermes:[`search_files`]}},L={"privacy-guard":{id:`privacy-guard`,event:`PreToolUse`,category:`guard`,description:`Deny reads of secret-bearing files: .env, .pem, .key, .ssh/*, credentials, tokens, .netrc.`,llmBenefit:`Prevents accidental leakage of API keys, tokens, and credentials into conversation context.`,script:`privacy-guard.mjs`,matcher:[`fileRead`],outputBudgetLines:0,executionModel:`child-process`,scope:`user`,failurePolicy:`deny-closed`,supportedPlatforms:[`copilot`,`claude`,`copilotCli`,`hermes`],unsupportedBehavior:`Reject via agent instruction — no native hook runtime available`,evidenceRequirements:`Hook script tested against known secret patterns`,rollbackBehavior:`Remove from settings.json hooks block and delete script file`},"scout-guard":{id:`scout-guard`,event:`PreToolUse`,category:`guard`,description:`Deny reads inside generated/dependency directories: node_modules/, dist/, .git/objects/, vendor/, build/.`,llmBenefit:`Keeps context clean by preventing reads of irrelevant generated or vendored files.`,script:`scout-guard.mjs`,matcher:[`fileRead`,`fileSearch`],outputBudgetLines:0,executionModel:`child-process`,scope:`user`,failurePolicy:`deny-closed`,supportedPlatforms:[`copilot`,`claude`,`copilotCli`,`hermes`],unsupportedBehavior:`Reject via agent instruction — no native hook runtime available`,evidenceRequirements:`Hook script tested against known generated directory patterns`,rollbackBehavior:`Remove from settings.json hooks block and delete script file`},"freshness-signal":{id:`freshness-signal`,event:`SessionStart`,category:`signal`,description:`Check workspace state freshness at session start: onboard staleness, active flow, scaffold drift.`,llmBenefit:`Avoids working with stale onboard data or drifting scaffold state.`,script:`freshness-signal.mjs`,outputBudgetLines:5,executionModel:`child-process`,scope:`user`,silentWhenHealthy:!0,failurePolicy:`allow-open`,matcher:[],supportedPlatforms:[`copilot`,`claude`,`copilotCli`,`hermes`],unsupportedBehavior:`Skip — no native hook runtime on this platform`,evidenceRequirements:`None (signal-only, no enforcement)`,rollbackBehavior:`Remove from settings.json hooks block`},"scope-guard":{id:`scope-guard`,event:`PostToolUse`,category:`signal`,description:`After file writes, detect edit drift: files changed outside flow scope, too many files, scaffold source/dist mismatch.`,llmBenefit:`Prevents accidental scope creep, over-editing, and scaffold drift during a session.`,script:`scope-guard.mjs`,matcher:[`fileWrite`],outputBudgetLines:5,executionModel:`child-process`,scope:`user`,silentWhenHealthy:!0,failurePolicy:`allow-open`,supportedPlatforms:[`copilot`,`claude`,`copilotCli`,`hermes`],unsupportedBehavior:`Skip — no native hook runtime on this platform`,evidenceRequirements:`None (signal-only, no enforcement)`,rollbackBehavior:`Remove from settings.json hooks block`}},R={PreCompact:3e3,PostToolUse:3e3},z={copilot:`hooks.json`,copilotCli:`hooks.json`,hermes:`hooks.json`},B=P;function V(e){if(!B.includes(e))throw Error(`Unknown platform: "${e}". Supported: ${B.join(`, `)}. Add it to SUPPORTED_PLATFORMS in exec-hooks.mjs first, then add entries to HOOK_EVENTS and HOOK_TOOL_MATCHERS. Add FILE_NAMES in generateHooks if file-producing.`);for(let[t,n]of Object.entries(F))if(!(e in n))throw Error(`Platform "${e}" is missing from HOOK_EVENTS.${t}. Add a "${e}" key to HOOK_EVENTS.${t} in exec-hooks.mjs.`);for(let[t,n]of Object.entries(I))if(!(e in n))throw Error(`Platform "${e}" is missing from HOOK_TOOL_MATCHERS.${t}. Add a "${e}" key to HOOK_TOOL_MATCHERS.${t} in exec-hooks.mjs.`)}function H(e,t){return(e.matcher||[]).flatMap(e=>{let n=I[e];if(!n)throw Error(`Unknown hook matcher: ${e}`);return n[t]||[]})}function U(e,t,n,r){let i=`${n}/${e.script}`;if(r===`claude`){let t=H(e,r);return{matcher:t.length>0?t.join(`|`):``,hooks:[{type:`command`,command:`node ${JSON.stringify(i)}`}]}}return r===`copilot`?{event:t,steps:[{type:`command`,command:`node`,args:[i],timeout:R[e.event]||5e3}]}:{command:`node`,args:[i]}}function W(e,t){V(e);let n={};for(let r of Object.values(L)){let i=F[r.event]?.[e];if(!i){console.warn(`[aikit] Unsupported hook event ${r.event} for ${e} — skipping`);continue}n[i]||=[],n[i].push(U(r,i,t,e))}return{hooks:n}}function le(e,t){if(V(e),e===`claude`)return[];if(e===`copilot`){let n=Object.values(L).flatMap(n=>{let r=F[n.event]?.[e];return r?U(n,r,t,e):(console.warn(`[aikit] Unsupported hook event ${n.event} for ${e} — skipping`),[])});return[{path:z[e],content:JSON.stringify({hooks:n},null,2)}]}if(!(e in z))throw Error(`Platform "${e}" is missing from FILE_NAMES. Add "${e}: '<filename>'" to FILE_NAMES in adapters/hooks.mjs.`);let n={};for(let r of Object.values(L)){let i=F[r.event]?.[e];if(!i){console.warn(`[aikit] Unsupported hook event ${r.event} for ${e} — skipping`);continue}n[i]||=[],n[i].push(U(r,i,t,e))}return[{path:z[e],content:JSON.stringify({hooks:n},null,2)}]}function ue(){return[`_runtime.mjs`,...Object.values(L).map(e=>e.script)]}const de=[`const{spawn:s}=require('child_process')`,`const{existsSync:e,readFileSync:r}=require('fs')`,`const{join:j}=require('path')`,`const{homedir:h}=require('os')`,`const n=process.env.NODE_OPTIONS||'';if(!n.includes('ExperimentalWarning'))process.env.NODE_OPTIONS=n?(n+' --disable-warning=ExperimentalWarning'):'--disable-warning=ExperimentalWarning'`,`const l=(c,a,o={})=>{const p=s(c,a,{stdio:'inherit',env:process.env,...o});p.once('error',q=>{try{process.stderr.write('aikit: failed to start MCP server - '+q.message)}catch{}process.exit(1)});p.once('exit',(q,g)=>process.exit(g==='SIGINT'?130:g==='SIGTERM'?143:(q??1)));for(const g of ['SIGINT','SIGTERM'])process.once(g,()=>{if(!p.killed)p.kill(g)})}`,`const f=j(h(),'.aikit','current-version.json');if(e(f)){try{const{version:g}=JSON.parse(r(f,'utf-8'));const p=j(h(),'.aikit','versions','v'+g,'packages','server','dist','bin.js');if(!e(p))throw Error('Local install not found at '+p);l(process.execPath,[p,'serve'])}catch(c){try{process.stderr.write('aikit: local install failed - '+c.message+'. Run: aikit install')}catch{}process.exit(1)}}else{const c=process.platform==='win32'?'npx.cmd':'npx';l(c,['-y','@vpxa/aikit@latest','serve'],process.platform==='win32'?{shell:true}:{})}`].join(`;`),fe=`aikit`,pe={type:`stdio`,command:`node`,args:[`-e`,de]},me=[`aikit`,`brainstorming`,`multi-agents-development`,`session-handoff`,`requirements-clarity`,`lesson-learned`,`c4-architecture`,`adr-skill`,`present`,`frontend-design`,`react`,`typescript`,`docs`,`repo-access`],he=[`aikit-basic`,`aikit-advanced`,`_epilogue`],ge={"chat.agentFilesLocations":{"~/.claude/agents":!1},"chat.useClaudeMdFile":!1,"github.copilot.chat.copilotMemory.enabled":!0,"chat.customAgentInSubagent.enabled":!0,"chat.useNestedAgentsMdFiles":!0,"chat.useAgentSkills":!0,"github.copilot.chat.switchAgent.enabled":!0,"workbench.browser.enableChatTools":!0,"chat.mcp.apps.enabled":!0,"chat.instructionsFilesLocations":{"~/.copilot/instructions":!0,".github/instructions":!0,".claude/rules":!1,"~/.claude/rules":!1}},_e=n(i(import.meta.url)),G=JSON.parse(t(r(_e,`mcp-entry.json`),`utf-8`)),ve=G.serverName;G.command,G.args;const ye=[{id:`no-grep-search`,toolName:`grep_search`,description:`grep_search / semantic_search → use search`,alternative:`search({ query })`,reason:`Hybrid search across all indexed + curated content — richer results than grep`,severity:`error`,action:`redirect`},{id:`no-semantic-search`,toolName:`semantic_search`,description:`semantic_search → use search`,alternative:`search({ query })`,reason:`Hybrid search across all indexed + curated content — vector + FTS fusion`,severity:`error`,action:`redirect`},{id:`no-grep-symbol`,toolName:`grep_search`,description:`grep_search for a symbol → use symbol`,alternative:`symbol({ name })`,reason:`Definition + references with scope and call context`,severity:`error`,action:`redirect`,heuristic:`grep_search for a specific symbol name`},{id:`no-read-file-understanding`,toolName:`read_file`,description:`read_file to understand a file → use file_summary`,alternative:`file_summary({ path })`,reason:`Structure, exports, imports — 10x fewer tokens than raw file reads`,severity:`error`,action:`warn`,heuristic:`read_file with range > 50 lines and no subsequent edit`},{id:`no-read-file-find-code`,toolName:`read_file`,description:`read_file to find specific code → use compact`,alternative:`compact({ path, query })`,reason:`Fresh compression: compact({ path, query }); query is required unless ref is supplied`,severity:`error`,action:`warn`,heuristic:`read_file to locate specific code without editing`},{id:`no-read-file-multiple`,toolName:`read_file`,description:`Multiple read_file calls → use digest`,alternative:`digest({ sources, query: "<task description>" })`,reason:`Compresses multiple files into token-budgeted summary`,severity:`error`,action:`warn`,heuristic:`consecutive read_file calls on different files without edits`},{id:`no-read-file-large`,toolName:`read_file`,description:`read_file (>50 lines to understand) → use file_summary → compact → digest`,alternative:`file_summary → compact → digest`,reason:`Use compressed context, not raw reads — 10x fewer tokens`,severity:`warning`,action:`warn`,heuristic:`read_file with endLine - startLine > 50 and no subsequent edit on same file`},{id:`no-ctxc-misuse`,toolName:`compact`,description:`Cached ctxc ref to refocus prior output → use compact with ref`,alternative:`compact({ ref }) or compact({ ref, query? })`,reason:`ctxc_... values are reversible refs, not ids or file paths. Prefer enrich: true on follow-up retrieval`,severity:`error`,action:`warn`,heuristic:`using ctxc_ value as a file path instead of as a ref`},{id:`no-terminal-test`,toolName:`run_in_terminal`,description:`run_in_terminal for tests → use test_run`,alternative:`test_run({})`,reason:`Run tests with structured output — no shell needed`,severity:`error`,action:`redirect`,commandPatterns:[`vitest`,`jest`,`mocha`,`pnpm test`,`npm test`]},{id:`no-terminal-typecheck`,toolName:`run_in_terminal`,description:`run_in_terminal for tsc/lint → use check`,alternative:`check({})`,reason:`Typecheck + lint combined, summary output — no shell needed`,severity:`error`,action:`redirect`,commandPatterns:[`\\btsc\\b`,`pnpm check`,`pnpm typecheck`,`pnpm lint`,`biome`]},{id:`no-terminal-grep`,toolName:`run_in_terminal`,description:`run_in_terminal for find/grep → use find or search`,alternative:`find({ pattern }) or search({ query })`,reason:`No shell needed, richer results with AI Kit search`,severity:`error`,action:`redirect`,commandPatterns:[`\\bgrep\\b`,`\\bfind\\b`,`\\brg\\b`,`Select-String`]},{id:`no-terminal-code-edits`,toolName:`run_in_terminal`,description:`run_in_terminal for code edits → use replace_string_in_file`,alternative:`replace_string_in_file`,reason:`Avoid shell-edit loops; use native edit tool instead`,severity:`error`,action:`redirect`,commandPatterns:[`sed`,`awk`,`Set-Content`,`Out-File`,`>>`,`\\| tee`]},{id:`no-edit-without-reading`,toolName:`replace_string_in_file`,description:`Editing without reading → use file_summary then targeted read_file`,alternative:`file_summary({ path }) → read_file({ path, offset, limit })`,reason:`Safer edits: understand structure before modifying`,severity:`error`,action:`warn`,heuristic:`replace_string_in_file on a file not previously read`},{id:`no-get-changed-files`,toolName:`get_changed_files`,description:`get_changed_files → use run_in_terminal with git diff`,alternative:"run_in_terminal with `git diff <specific-file>`",reason:`Diff only target file instead of all uncommitted diffs (100K+ tokens)`,severity:`error`,action:`redirect`},{id:`no-fetch-webpage`,toolName:`fetch_webpage`,description:`fetch_webpage → use web_fetch`,alternative:`web_fetch({ url })`,reason:`Readability extract + token budget — richer output than raw fetch`,severity:`error`,action:`redirect`},{id:`no-subagent-present`,toolName:`present`,description:`present (from subagent) → return structured text`,alternative:`Return findings as structured text`,reason:`Subagent present calls are invisible to the user (only Orchestrator should present)`,severity:`error`,action:`warn`,heuristic:`present called in subagent context`},{id:`no-apply-patch`,toolName:`apply_patch`,description:`apply_patch → use native edit tool`,alternative:`edit file tool`,reason:`AI Kit does not manage apply_patch; use the host environment edit tool`,severity:`warning`,action:`warn`},{id:`no-memory-native`,toolName:`memory`,description:`memory tool → use knowledge tool`,alternative:`knowledge (remember / search / list)`,reason:`AI Kit knowledge tool provides persistent cross-session memory with categories and tags`,severity:`warning`,action:`warn`}];function be(e){let t=e.toolName;if(e.commandPatterns&&e.commandPatterns.length>0){let n=e.description.match(/^(.*?)\s*→/);n&&(t=n[1].trim())}else if(e.heuristic){let n=e.description.match(/^(.*?)\s*→/);n&&(t=n[1].trim())}return{id:e.id,forbidden:t,alternative:e.alternative,severity:e.severity,reason:e.reason,matchPattern:e.commandPatterns?null:e.toolName,commandPatterns:e.commandPatterns??null,heuristic:e.heuristic??null}}const xe=ye.map(be);function Se(){return[`| NEVER use this | USE THIS AI Kit TOOL INSTEAD | Why |`,`|---|---|---|`,...xe.filter(e=>e.severity===`error`).map(e=>`| \`${e.forbidden}\` | \`${e.alternative}\` | ${e.reason} |`)].join(`
6
- `)}function K(e){return`
4
+ Dead in docs (informational):`);for(let t of e.deadInDocs)console.log(` - ${t.path}:${t.line} ${t.kind} ${t.name}`)}}function T(e){console.log(e.path),console.log(` Language: ${e.language}`),console.log(` Lines: ${e.lines}`),console.log(` Estimated tokens: ~${e.estimatedTokens}`),console.log(``),k(`Imports`,e.imports),k(`Exports`,e.exports),k(`Functions`,e.functions.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}`)),k(`Classes`,e.classes.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}`)),k(`Interfaces`,e.interfaces.map(e=>`${e.name} @ line ${e.line}`)),k(`Types`,e.types.map(e=>`${e.name} @ line ${e.line}`))}function E(e){if(console.log(`Symbol: ${e.name}`),e.definedIn?console.log(`Defined in: ${e.definedIn.path}:${e.definedIn.line} (${e.definedIn.kind})`):console.log(`Defined in: not found`),console.log(``),console.log(`Imported by:`),e.importedBy.length===0)console.log(` none`);else for(let t of e.importedBy)console.log(` - ${t.path}:${t.line} ${t.importStatement}`);if(console.log(``),console.log(`Referenced in:`),e.referencedIn.length===0)console.log(` none`);else for(let t of e.referencedIn)console.log(` - ${t.path}:${t.line} ${t.context}`)}function D(e){console.log(e.name),console.log(` Files: ${e.files.length}`),console.log(` Updated: ${e.updated}`),e.description&&console.log(` Description: ${e.description}`);for(let t of e.files)console.log(` - ${t}`)}function O(e){let t=Array.isArray(e.data.files)?e.data.files.filter(e=>typeof e==`string`):[];if(console.log(e.id),console.log(` Label: ${e.label}`),console.log(` Created: ${e.createdAt}`),e.notes&&console.log(` Notes: ${e.notes}`),t.length>0){console.log(` Files: ${t.length}`);for(let e of t)console.log(` - ${e}`)}console.log(` Data:`);for(let t of JSON.stringify(e.data,null,2).split(`
5
+ `))console.log(` ${t}`)}function k(e,t){if(console.log(`${e}:`),t.length===0){console.log(` none`),console.log(``);return}for(let e of t)console.log(` - ${e}`);console.log(``)}function A(e){let t=e.trim();if(!t)return``;try{return JSON.parse(t)}catch{return e}}function j(e){let t=e.trim();if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Checkpoint data must be a JSON object.`);return n}function M(e,t,n=60){let r=new Map;for(let t=0;t<e.length;t++){let i=e[t];r.set(i.record.id,{record:i.record,score:1/(n+t+1)})}for(let e=0;e<t.length;e++){let i=t[e],a=r.get(i.record.id);a?a.score+=1/(n+e+1):r.set(i.record.id,{record:i.record,score:1/(n+e+1)})}return[...r.values()].sort((e,t)=>t.score-e.score)}const N=[`copilot`,`claude`,`copilotCli`,`hermes`],P={SessionStart:{copilot:`SessionStart`,claude:`SessionStart`,copilotCli:`sessionStart`,hermes:`SessionStart`},PreToolUse:{copilot:`PreToolUse`,claude:`PreToolUse`,copilotCli:`preToolUse`,hermes:`PreToolUse`},PostToolUse:{copilot:`PostToolUse`,claude:`PostToolUse`,copilotCli:`postToolUse`,hermes:`PostToolUse`},SubagentStart:{copilot:`SubagentStart`,claude:`SubagentStart`,copilotCli:`subagentStart`,hermes:`SubagentStart`},PreCompact:{copilot:`PreCompact`,claude:`PreCompact`,copilotCli:`preCompact`,hermes:`PreCompact`},Stop:{copilot:`Stop`,claude:`Stop`,copilotCli:`stop`,hermes:`Stop`}},F={fileRead:{copilot:[`read_file`,`readFile`],claude:[`Read`],copilotCli:[`read_file`],hermes:[`read_file`]},fileWrite:{copilot:[`editFiles`,`replace_string_in_file`,`create_file`],claude:[`Edit`,`Write`,`MultiEdit`],copilotCli:[`editFiles`,`replace_string_in_file`],hermes:[`write_file`,`patch`]},fileSearch:{copilot:[`grep_search`,`semantic_search`,`find`],claude:[`Bash`],copilotCli:[`grep_search`],hermes:[`search_files`]}},I={"privacy-guard":{id:`privacy-guard`,event:`PreToolUse`,category:`guard`,description:`Deny reads of secret-bearing files: .env, .pem, .key, .ssh/*, credentials, tokens, .netrc.`,llmBenefit:`Prevents accidental leakage of API keys, tokens, and credentials into conversation context.`,script:`privacy-guard.mjs`,matcher:[`fileRead`],outputBudgetLines:0,executionModel:`child-process`,scope:`user`,failurePolicy:`deny-closed`,supportedPlatforms:[`copilot`,`claude`,`copilotCli`,`hermes`],unsupportedBehavior:`Reject via agent instruction — no native hook runtime available`,evidenceRequirements:`Hook script tested against known secret patterns`,rollbackBehavior:`Remove from settings.json hooks block and delete script file`},"scout-guard":{id:`scout-guard`,event:`PreToolUse`,category:`guard`,description:`Deny reads inside generated/dependency directories: node_modules/, dist/, .git/objects/, vendor/, build/.`,llmBenefit:`Keeps context clean by preventing reads of irrelevant generated or vendored files.`,script:`scout-guard.mjs`,matcher:[`fileRead`,`fileSearch`],outputBudgetLines:0,executionModel:`child-process`,scope:`user`,failurePolicy:`deny-closed`,supportedPlatforms:[`copilot`,`claude`,`copilotCli`,`hermes`],unsupportedBehavior:`Reject via agent instruction — no native hook runtime available`,evidenceRequirements:`Hook script tested against known generated directory patterns`,rollbackBehavior:`Remove from settings.json hooks block and delete script file`},"freshness-signal":{id:`freshness-signal`,event:`SessionStart`,category:`signal`,description:`Check workspace state freshness at session start: onboard staleness, active flow, scaffold drift.`,llmBenefit:`Avoids working with stale onboard data or drifting scaffold state.`,script:`freshness-signal.mjs`,outputBudgetLines:5,executionModel:`child-process`,scope:`user`,silentWhenHealthy:!0,failurePolicy:`allow-open`,matcher:[],supportedPlatforms:[`copilot`,`claude`,`copilotCli`,`hermes`],unsupportedBehavior:`Skip — no native hook runtime on this platform`,evidenceRequirements:`None (signal-only, no enforcement)`,rollbackBehavior:`Remove from settings.json hooks block`},"scope-guard":{id:`scope-guard`,event:`PostToolUse`,category:`signal`,description:`After file writes, detect edit drift: files changed outside flow scope, too many files, scaffold source/dist mismatch.`,llmBenefit:`Prevents accidental scope creep, over-editing, and scaffold drift during a session.`,script:`scope-guard.mjs`,matcher:[`fileWrite`],outputBudgetLines:5,executionModel:`child-process`,scope:`user`,silentWhenHealthy:!0,failurePolicy:`allow-open`,supportedPlatforms:[`copilot`,`claude`,`copilotCli`,`hermes`],unsupportedBehavior:`Skip — no native hook runtime on this platform`,evidenceRequirements:`None (signal-only, no enforcement)`,rollbackBehavior:`Remove from settings.json hooks block`},"session-reminder":{id:`session-reminder`,event:`SessionStart`,category:`signal`,description:`Inject aikit skill core instructions at every session start as additionalContext.`,llmBenefit:`Reinforces AI Kit tool usage rules at the start of every session — harder for the model to skip than CLAUDE.md alone.`,script:`session-reminder.mjs`,outputBudgetLines:50,executionModel:`child-process`,scope:`user`,silentWhenHealthy:!1,failurePolicy:`allow-open`,matcher:[],supportedPlatforms:[`claude`],unsupportedBehavior:`Skip — only meaningful on Claude Code with its hooks runtime`,evidenceRequirements:`None (signal-only, no enforcement)`,rollbackBehavior:`Remove from settings.json hooks block and delete script file`}},L={PreCompact:3e3,PostToolUse:3e3},R={copilot:`hooks.json`,copilotCli:`hooks.json`,hermes:`hooks.json`},z=N;function B(e){if(!z.includes(e))throw Error(`Unknown platform: "${e}". Supported: ${z.join(`, `)}. Add it to SUPPORTED_PLATFORMS in exec-hooks.mjs first, then add entries to HOOK_EVENTS and HOOK_TOOL_MATCHERS. Add FILE_NAMES in generateHooks if file-producing.`);for(let[t,n]of Object.entries(P))if(!(e in n))throw Error(`Platform "${e}" is missing from HOOK_EVENTS.${t}. Add a "${e}" key to HOOK_EVENTS.${t} in exec-hooks.mjs.`);for(let[t,n]of Object.entries(F))if(!(e in n))throw Error(`Platform "${e}" is missing from HOOK_TOOL_MATCHERS.${t}. Add a "${e}" key to HOOK_TOOL_MATCHERS.${t} in exec-hooks.mjs.`)}function V(e,t){return!e.supportedPlatforms||e.supportedPlatforms.includes(t)}function H(e,t){return(e.matcher||[]).flatMap(e=>{let n=F[e];if(!n)throw Error(`Unknown hook matcher: ${e}`);return n[t]||[]})}function U(e,t,n,r){let i=`${n}/${e.script}`;if(r===`claude`){let t=H(e,r);return{matcher:t.length>0?t.join(`|`):``,hooks:[{type:`command`,command:`node ${JSON.stringify(i)}`}]}}return r===`copilot`?{event:t,steps:[{type:`command`,command:`node`,args:[i],timeout:L[e.event]||5e3}]}:{command:`node`,args:[i]}}function W(e,t){B(e);let n={};for(let r of Object.values(I)){if(!V(r,e))continue;let i=P[r.event]?.[e];if(!i){console.warn(`[aikit] Unsupported hook event ${r.event} for ${e} — skipping`);continue}n[i]||=[],n[i].push(U(r,i,t,e))}return{hooks:n}}function ue(e,t){if(B(e),e===`claude`)return[];if(e===`copilot`){let n=Object.values(I).flatMap(n=>{if(!V(n,e))return[];let r=P[n.event]?.[e];return r?U(n,r,t,e):(console.warn(`[aikit] Unsupported hook event ${n.event} for ${e} — skipping`),[])});return[{path:R[e],content:JSON.stringify({hooks:n},null,2)}]}if(!(e in R))throw Error(`Platform "${e}" is missing from FILE_NAMES. Add "${e}: '<filename>'" to FILE_NAMES in adapters/hooks.mjs.`);let n={};for(let r of Object.values(I)){if(!V(r,e))continue;let i=P[r.event]?.[e];if(!i){console.warn(`[aikit] Unsupported hook event ${r.event} for ${e} — skipping`);continue}n[i]||=[],n[i].push(U(r,i,t,e))}return[{path:R[e],content:JSON.stringify({hooks:n},null,2)}]}function de(){return[`_runtime.mjs`,...Object.values(I).map(e=>e.script)]}const G=[`const{spawn:s}=require('child_process')`,`const{existsSync:e,readFileSync:r}=require('fs')`,`const{join:j}=require('path')`,`const{homedir:h}=require('os')`,`const n=process.env.NODE_OPTIONS||'';if(!n.includes('ExperimentalWarning'))process.env.NODE_OPTIONS=n?(n+' --disable-warning=ExperimentalWarning'):'--disable-warning=ExperimentalWarning'`,`const l=(c,a,o={})=>{const p=s(c,a,{stdio:'inherit',env:process.env,...o});p.once('error',q=>{try{process.stderr.write('aikit: failed to start MCP server - '+q.message)}catch{}process.exit(1)});p.once('exit',(q,g)=>process.exit(g==='SIGINT'?130:g==='SIGTERM'?143:(q??1)));for(const g of ['SIGINT','SIGTERM'])process.once(g,()=>{if(!p.killed)p.kill(g)})}`,`const f=j(h(),'.aikit','current-version.json');if(e(f)){try{const{version:g}=JSON.parse(r(f,'utf-8'));const p=j(h(),'.aikit','versions','v'+g,'packages','server','dist','bin.js');if(!e(p))throw Error('Local install not found at '+p);l(process.execPath,[p,'serve'])}catch(c){try{process.stderr.write('aikit: local install failed - '+c.message+'. Run: aikit install')}catch{}process.exit(1)}}else{const c=process.platform==='win32'?'npx.cmd':'npx';l(c,['-y','@vpxa/aikit@latest','serve'],process.platform==='win32'?{shell:true}:{})}`].join(`;`),fe=`aikit`,pe={type:`stdio`,command:`node`,args:[`-e`,G]},me=[`aikit`,`brainstorming`,`multi-agents-development`,`session-handoff`,`requirements-clarity`,`lesson-learned`,`c4-architecture`,`adr-skill`,`present`,`frontend-design`,`react`,`typescript`,`docs`,`repo-access`],he=[`aikit-basic`,`aikit-advanced`,`_epilogue`],ge={"chat.agentFilesLocations":{"~/.claude/agents":!1},"chat.useClaudeMdFile":!1,"github.copilot.chat.copilotMemory.enabled":!0,"chat.customAgentInSubagent.enabled":!0,"chat.useNestedAgentsMdFiles":!0,"chat.useAgentSkills":!0,"github.copilot.chat.switchAgent.enabled":!0,"workbench.browser.enableChatTools":!0,"chat.mcp.apps.enabled":!0,"chat.instructionsFilesLocations":{"~/.copilot/instructions":!0,".github/instructions":!0,".claude/rules":!1,"~/.claude/rules":!1}},_e=n(i(import.meta.url)),K=JSON.parse(t(r(_e,`mcp-entry.json`),`utf-8`)),ve=K.serverName;K.command,K.args;const ye=[{id:`no-grep-search`,toolName:`grep_search`,description:`grep_search / semantic_search → use search`,alternative:`search({ query })`,reason:`Hybrid search across all indexed + curated content — richer results than grep`,severity:`error`,action:`redirect`},{id:`no-semantic-search`,toolName:`semantic_search`,description:`semantic_search → use search`,alternative:`search({ query })`,reason:`Hybrid search across all indexed + curated content — vector + FTS fusion`,severity:`error`,action:`redirect`},{id:`no-grep-symbol`,toolName:`grep_search`,description:`grep_search for a symbol → use symbol`,alternative:`symbol({ name })`,reason:`Definition + references with scope and call context`,severity:`error`,action:`redirect`,heuristic:`grep_search for a specific symbol name`},{id:`no-read-file-understanding`,toolName:`read_file`,description:`read_file to understand a file → use file_summary`,alternative:`file_summary({ path })`,reason:`Structure, exports, imports — 10x fewer tokens than raw file reads`,severity:`error`,action:`warn`,heuristic:`read_file with range > 50 lines and no subsequent edit`},{id:`no-read-file-find-code`,toolName:`read_file`,description:`read_file to find specific code → use compact`,alternative:`compact({ path, query })`,reason:`Fresh compression: compact({ path, query }); query is required unless ref is supplied`,severity:`error`,action:`warn`,heuristic:`read_file to locate specific code without editing`},{id:`no-read-file-multiple`,toolName:`read_file`,description:`Multiple read_file calls → use digest`,alternative:`digest({ sources, query: "<task description>" })`,reason:`Compresses multiple files into token-budgeted summary`,severity:`error`,action:`warn`,heuristic:`consecutive read_file calls on different files without edits`},{id:`no-read-file-large`,toolName:`read_file`,description:`read_file (>50 lines to understand) → use file_summary → compact → digest`,alternative:`file_summary → compact → digest`,reason:`Use compressed context, not raw reads — 10x fewer tokens`,severity:`warning`,action:`warn`,heuristic:`read_file with endLine - startLine > 50 and no subsequent edit on same file`},{id:`no-ctxc-misuse`,toolName:`compact`,description:`Cached ctxc ref to refocus prior output → use compact with ref`,alternative:`compact({ ref }) or compact({ ref, query? })`,reason:`ctxc_... values are reversible refs, not ids or file paths. Prefer enrich: true on follow-up retrieval`,severity:`error`,action:`warn`,heuristic:`using ctxc_ value as a file path instead of as a ref`},{id:`no-terminal-test`,toolName:`run_in_terminal`,description:`run_in_terminal for tests → use test_run`,alternative:`test_run({})`,reason:`Run tests with structured output — no shell needed`,severity:`error`,action:`redirect`,commandPatterns:[`vitest`,`jest`,`mocha`,`pnpm test`,`npm test`]},{id:`no-terminal-typecheck`,toolName:`run_in_terminal`,description:`run_in_terminal for tsc/lint → use check`,alternative:`check({})`,reason:`Typecheck + lint combined, summary output — no shell needed`,severity:`error`,action:`redirect`,commandPatterns:[`\\btsc\\b`,`pnpm check`,`pnpm typecheck`,`pnpm lint`,`biome`]},{id:`no-terminal-grep`,toolName:`run_in_terminal`,description:`run_in_terminal for find/grep → use find or search`,alternative:`find({ pattern }) or search({ query })`,reason:`No shell needed, richer results with AI Kit search`,severity:`error`,action:`redirect`,commandPatterns:[`\\bgrep\\b`,`\\bfind\\b`,`\\brg\\b`,`Select-String`]},{id:`no-terminal-code-edits`,toolName:`run_in_terminal`,description:`run_in_terminal for code edits → use replace_string_in_file`,alternative:`replace_string_in_file`,reason:`Avoid shell-edit loops; use native edit tool instead`,severity:`error`,action:`redirect`,commandPatterns:[`sed`,`awk`,`Set-Content`,`Out-File`,`>>`,`\\| tee`]},{id:`no-edit-without-reading`,toolName:`replace_string_in_file`,description:`Editing without reading → use file_summary then targeted read_file`,alternative:`file_summary({ path }) → read_file({ path, offset, limit })`,reason:`Safer edits: understand structure before modifying`,severity:`error`,action:`warn`,heuristic:`replace_string_in_file on a file not previously read`},{id:`no-get-changed-files`,toolName:`get_changed_files`,description:`get_changed_files → use run_in_terminal with git diff`,alternative:"run_in_terminal with `git diff <specific-file>`",reason:`Diff only target file instead of all uncommitted diffs (100K+ tokens)`,severity:`error`,action:`redirect`},{id:`no-fetch-webpage`,toolName:`fetch_webpage`,description:`fetch_webpage → use web_fetch`,alternative:`web_fetch({ url })`,reason:`Readability extract + token budget — richer output than raw fetch`,severity:`error`,action:`redirect`},{id:`no-subagent-present`,toolName:`present`,description:`present (from subagent) → return structured text`,alternative:`Return findings as structured text`,reason:`Subagent present calls are invisible to the user (only Orchestrator should present)`,severity:`error`,action:`warn`,heuristic:`present called in subagent context`},{id:`no-apply-patch`,toolName:`apply_patch`,description:`apply_patch → use native edit tool`,alternative:`edit file tool`,reason:`AI Kit does not manage apply_patch; use the host environment edit tool`,severity:`warning`,action:`warn`},{id:`no-memory-native`,toolName:`memory`,description:`memory tool → use knowledge tool`,alternative:`knowledge (remember / search / list)`,reason:`AI Kit knowledge tool provides persistent cross-session memory with categories and tags`,severity:`warning`,action:`warn`}];function be(e){let t=e.toolName;if(e.commandPatterns&&e.commandPatterns.length>0){let n=e.description.match(/^(.*?)\s*→/);n&&(t=n[1].trim())}else if(e.heuristic){let n=e.description.match(/^(.*?)\s*→/);n&&(t=n[1].trim())}return{id:e.id,forbidden:t,alternative:e.alternative,severity:e.severity,reason:e.reason,matchPattern:e.commandPatterns?null:e.toolName,commandPatterns:e.commandPatterns??null,heuristic:e.heuristic??null}}const xe=ye.map(be);function Se(){return[`| NEVER use this | USE THIS AI Kit TOOL INSTEAD | Why |`,`|---|---|---|`,...xe.filter(e=>e.severity===`error`).map(e=>`| \`${e.forbidden}\` | \`${e.alternative}\` | ${e.reason} |`)].join(`
6
+ `)}function q(e){return`
7
7
  ## Flow Context Bootstrap
8
8
 
9
9
  When dispatched as a subagent within an active flow:
@@ -22,9 +22,9 @@ When dispatched as a subagent within an active flow:
22
22
 
23
23
  ${e===`<PROFILE>`?`**Profile:** Check your role → implementer | documenter | reviewer | researcher | debugger`:`**Profile:** \`${e}\``}
24
24
 
25
- ---`}function Ce(){return"\n## Evidence Citation Protocol (tier-aware)\n\nNo FORGE `task_id` → skip `evidence_map`; use `file:line` citations only.\nDo not create your own `task_id` or run the gate.\n\n| Tier | Your responsibility |\n|------|---------------------|\n| Floor | Findings with `file.ts#Lxx` citations. No `evidence_map`. |\n| Standard | Add 2-4 CRITICAL/HIGH findings with receipts. |\n| Critical | Add all CRITICAL/HIGH findings; tag contract/security claims with `safety_gate`. |\n\n**Every response MUST include:**\n- `**FORGE Task ID:** <task_id>` (passed in by Orchestrator, or state \"not provided\")\n- `**Tier applied:** Floor | Standard | Critical`\n- `**Findings:** <list>` with `file:line` receipts\n- Verdict: `APPROVED` | `CHANGES_REQUESTED` | `BLOCKED`\n\nDo NOT create a new `evidence_map`, run `evidence_map({action:'gate'})`, or add non-critical noise."}function q(...e){return e.filter(Boolean).join(`
25
+ ---`}function Ce(){return"\n## Evidence Citation Protocol (tier-aware)\n\nNo FORGE `task_id` → skip `evidence_map`; use `file:line` citations only.\nDo not create your own `task_id` or run the gate.\n\n| Tier | Your responsibility |\n|------|---------------------|\n| Floor | Findings with `file.ts#Lxx` citations. No `evidence_map`. |\n| Standard | Add 2-4 CRITICAL/HIGH findings with receipts. |\n| Critical | Add all CRITICAL/HIGH findings; tag contract/security claims with `safety_gate`. |\n\n**Every response MUST include:**\n- `**FORGE Task ID:** <task_id>` (passed in by Orchestrator, or state \"not provided\")\n- `**Tier applied:** Floor | Standard | Critical`\n- `**Findings:** <list>` with `file:line` receipts\n- Verdict: `APPROVED` | `CHANGES_REQUESTED` | `BLOCKED`\n\nDo NOT create a new `evidence_map`, run `evidence_map({action:'gate'})`, or add non-critical noise."}function J(...e){return e.filter(Boolean).join(`
26
26
 
27
- `)}const we=Object.freeze({version:1,l0MemoriesDir:`memories`,sessionStart:{requiredCards:[`workspace-core`],maxAdditionalCards:1,activeFlowPreference:`workflow-card`,totalTokenBudget:2100},retrievalOrder:[`l0`,`l1`,`l2-on-demand`,`l3-evidence-only`],noFlowFallback:`l0-plus-l2-with-turn-local-context`,degradedFallback:`prelude-manifest-canonical-markdown`,lifecycleAuthority:`opaque-owner-capability`,autoKnowledgeMode:`observer-only`,l0Budgets:Object.freeze({"workspace-core":{min:800,max:1200},architecture:{min:600,max:900},"testing-release":{min:600,max:900},"known-issues":{min:400,max:700},"workflow:*":{min:500,max:900}})});function J(e={}){let{audience:t=`agent`}=e,n=we,r=`## Layered Knowledge Protocol (v${n.version})
27
+ `)}const we=Object.freeze({version:1,l0MemoriesDir:`memories`,sessionStart:{requiredCards:[`workspace-core`],maxAdditionalCards:1,activeFlowPreference:`workflow-card`,totalTokenBudget:2100},retrievalOrder:[`l0`,`l1`,`l2-on-demand`,`l3-evidence-only`],noFlowFallback:`l0-plus-l2-with-turn-local-context`,degradedFallback:`prelude-manifest-canonical-markdown`,lifecycleAuthority:`opaque-owner-capability`,autoKnowledgeMode:`observer-only`,l0Budgets:Object.freeze({"workspace-core":{min:800,max:1200},architecture:{min:600,max:900},"testing-release":{min:600,max:900},"known-issues":{min:400,max:700},"workflow:*":{min:500,max:900}})});function Y(e={}){let{audience:t=`agent`}=e,n=we,r=`## Layered Knowledge Protocol (v${n.version})
28
28
 
29
29
  AI Kit delivers knowledge through four layers:
30
30
 
@@ -55,15 +55,15 @@ AI Kit delivers knowledge through four layers:
55
55
  - Route L1 withdrawal by configured profile; never promote.
56
56
  - Emit L3 evidence as observer-only; never navigate flow state.`:t===`flow`?r+`
57
57
  ### Step Contracts
58
- Each built-in flow step declares knowledge inputs (L0 card types, L1 fields, L2 refs, L3 evidence), context updates, candidate learnings, and handoff artifacts. The step knowledge contract drives role-aware L1 projection.`:r}const Y=q(`## Output Rules (HARD RULE)`,`**Plain text is allowed only when ALL are true:**`,` - Response is 1-2 short sentences.`,` - No table, list, checklist, plan, report, verdict, review, summary, progress, evidence map, or batch result is being returned.`,` - No user approval, mandatory stop, or choice is needed.`,"Follow the **Presentation Priority** (1st Inline Visual - `present({ schemaVersion: 1, title, blocks })` → 2nd Interactive - `present({ schemaVersion: 1, title, blocks, actions })` → 3rd Plain Text). Only tiny status/questions that pass the gate above → plain text (Priority 3). Prefer `present` for all others, especially summaries, comparisons, reports, task plans, verdicts, and progress.");function X(){return'## Tool Preference — AI Kit First (HARD RULE)\n\n**Never start with `read_file`, `grep_search`, `semantic_search`, or `run_in_terminal`. AI Kit tools replace all of these.**\n\n| Need | Use | NEVER |\n|------|-----|-------|\n| Structure of a file | `file_summary({ path })` | `read_file` to "understand" it |\n| Find specific code | `file_summary({ files, tier: \'T2\', query })` | `read_file` to search |\n| Multiple files | `digest({ sources, query })` | Multiple `read_file` calls |\n| Reuse previous output | `file_summary({ ref, query })` with `enrich:true` | Re-reading same file |\n| Search codebase | `search({ query })` | `grep_search` / `semantic_search` |\n| Find a symbol | `symbol({ name })` | `grep_search` |\n| Trace data flow | `trace({ items: [{start, direction}] })` | Manual code tracing |\n| Module relationships | `graph({action:\'neighbors\', node_id})` | Manual import tracing |\n| Typecheck + lint | `check({})` | `run_in_terminal tsc` / biome |\n| Run tests | `test_run({})` | `run_in_terminal vitest` |\n| Impact analysis | `blast_radius({ changed_files })` | Manual caller tracing |\n| Complexity metrics | `measure({ path })` | Line counting / wc |\n| L0 briefing card (workspace-core) | `aikit://l0/workspace-core` resource (full card), `file_summary` | Raw file discovery |\n| L0 briefing card (known issues) | `search({ query: "known issues" })` + `knowledge({ action: "lesson" })` | Manual history review |\n| Web research | `web_search({ queries })` + `web_fetch({ urls })` | `fetch_webpage` |\n\n`read_file` is ONLY acceptable when you need exact line content FOR EDITING (before `replace_string_in_file`).\n\nEven then, use `file_summary` first to identify which lines to read.'}const Te=q(`## AI Kit Recovery`,`If AI Kit tools are unavailable or missing, run \`npx -y @vpxa/aikit@latest init --user\`, then reload the client so the \`${ve}\` MCP server and user instructions become available.`);`${X()}${Se()}${Ce()}`,`${K(`researcher`)}${X()}`,`${K(`reviewer`)}${X()}`,`${K(`reviewer`)}${X()}`,J({audience:`agent`});const Ee=/{\s*name:\s*'((?:\\.|[^'])*)',\s*rationale:\s*'((?:\\.|[^'])*)',\s*bitterLessonSafe:\s*(?:true|false),\s*}/g;let Z=null;function Q(e){return e.replace(/\\'/g,`'`).replace(/\\n/g,`
59
- `).replace(/\\r/g,`\r`).replace(/\\t/g,` `).replace(/\\\\/g,`\\`)}function De(){if(Z)return Z;let e=r(h(),`scaffold`,`definitions`,`exclusions.mjs`),n=t(e,`utf8`),i=Array.from(n.matchAll(Ee),([,e,t])=>({name:Q(e),rationale:Q(t)}));if(i.length===0)throw Error(`Failed to parse permanent exclusions from ${e}`);return Z=i,i}function $(e){return e.replace(/\|/g,`\\|`).replace(/\r?\n+/g,` `).trim()}function Oe(){return`## Permanent Exclusions
58
+ Each built-in flow step declares knowledge inputs (L0 card types, L1 fields, L2 refs, L3 evidence), context updates, candidate learnings, and handoff artifacts. The step knowledge contract drives role-aware L1 projection.`:r}const Te=J(`## Output Rules (HARD RULE)`,`**Plain text is allowed only when ALL are true:**`,` - Response is 1-2 short sentences.`,` - No table, list, checklist, plan, report, verdict, review, summary, progress, evidence map, or batch result is being returned.`,` - No user approval, mandatory stop, or choice is needed.`,"Follow the **Presentation Priority** (1st Inline Visual - `present({ schemaVersion: 1, title, blocks })` → 2nd Interactive - `present({ schemaVersion: 1, title, blocks, actions })` → 3rd Plain Text). Only tiny status/questions that pass the gate above → plain text (Priority 3). Prefer `present` for all others, especially summaries, comparisons, reports, task plans, verdicts, and progress.");function X(){return'## Tool Preference — AI Kit First (HARD RULE)\n\n**Never start with `read_file`, `grep_search`, `semantic_search`, or `run_in_terminal`. AI Kit tools replace all of these.**\n\n| Need | Use | NEVER |\n|------|-----|-------|\n| Structure of a file | `file_summary({ path })` | `read_file` to "understand" it |\n| Find specific code | `file_summary({ files, tier: \'T2\', query })` | `read_file` to search |\n| Multiple files | `digest({ sources, query })` | Multiple `read_file` calls |\n| Reuse previous output | `file_summary({ ref, query })` with `enrich:true` | Re-reading same file |\n| Search codebase | `search({ query })` | `grep_search` / `semantic_search` |\n| Find a symbol | `symbol({ name })` | `grep_search` |\n| Trace data flow | `trace({ items: [{start, direction}] })` | Manual code tracing |\n| Module relationships | `graph({action:\'neighbors\', node_id})` | Manual import tracing |\n| Typecheck + lint | `check({})` | `run_in_terminal tsc` / biome |\n| Run tests | `test_run({})` | `run_in_terminal vitest` |\n| Impact analysis | `blast_radius({ changed_files })` | Manual caller tracing |\n| Complexity metrics | `measure({ path })` | Line counting / wc |\n| L0 briefing card (workspace-core) | `aikit://l0/workspace-core` resource (full card), `file_summary` | Raw file discovery |\n| L0 briefing card (known issues) | `search({ query: "known issues" })` + `knowledge({ action: "lesson" })` | Manual history review |\n| Web research | `web_search({ queries })` + `web_fetch({ urls })` | `fetch_webpage` |\n\n`read_file` is ONLY acceptable when you need exact line content FOR EDITING (before `replace_string_in_file`).\n\nEven then, use `file_summary` first to identify which lines to read.'}const Ee=J(`## AI Kit Recovery`,`If AI Kit tools are unavailable or missing, run \`npx -y @vpxa/aikit@latest init --user\`, then reload the client so the \`${ve}\` MCP server and user instructions become available.`);`${X()}${Se()}${Ce()}`,`${q(`researcher`)}${X()}`,`${q(`reviewer`)}${X()}`,`${q(`reviewer`)}${X()}`,Y({audience:`agent`});const De=/{\s*name:\s*'((?:\\.|[^'])*)',\s*rationale:\s*'((?:\\.|[^'])*)',\s*bitterLessonSafe:\s*(?:true|false),\s*}/g;let Z=null;function Q(e){return e.replace(/\\'/g,`'`).replace(/\\n/g,`
59
+ `).replace(/\\r/g,`\r`).replace(/\\t/g,` `).replace(/\\\\/g,`\\`)}function Oe(){if(Z)return Z;let e=r(p(),`scaffold`,`definitions`,`exclusions.mjs`),n=t(e,`utf8`),i=Array.from(n.matchAll(De),([,e,t])=>({name:Q(e),rationale:Q(t)}));if(i.length===0)throw Error(`Failed to parse permanent exclusions from ${e}`);return Z=i,i}function $(e){return e.replace(/\|/g,`\\|`).replace(/\r?\n+/g,` `).trim()}function ke(){return`## Permanent Exclusions
60
60
 
61
61
  These capabilities are intentionally NOT provided by aikit. Each decision follows the Bitter Lesson: leverage computation and configurable tools over hand-crafted features.
62
62
 
63
63
  | Capability | Rationale |
64
64
  |-----------|-----------|
65
- ${De().map(({name:e,rationale:t})=>`| ${$(e)} | ${$(t)} |`).join(`
66
- `)}`}function ke(e,t){return`# ${e} — Copilot Instructions
65
+ ${Oe().map(({name:e,rationale:t})=>`| ${$(e)} | ${$(t)} |`).join(`
66
+ `)}`}function Ae(e,t){return`# ${e} — Copilot Instructions
67
67
 
68
68
  This project has an MCP server (\`${t}\`) providing 64 tools for search, analysis, memory, and validation.
69
69
  **These tools REPLACE most native IDE tools.** You MUST use them.
@@ -110,7 +110,7 @@ Do NOT attempt complex multi-file tasks in the default agent mode. The Orchestra
110
110
  **\`read_file\` is ONLY acceptable when you need exact line content FOR EDITING (before \`replace_string_in_file\`).**
111
111
  Even then, use \`file_summary({ files, tier: 'T1' })\` first to identify which lines to read.
112
112
 
113
- ${J({audience:`agent`})}
113
+ ${Y({audience:`agent`})}
114
114
 
115
115
  ## Core Rules
116
116
 
@@ -120,7 +120,7 @@ ${J({audience:`agent`})}
120
120
  4. **Validate** — \`check({})\` + \`test_run({})\` before presenting changes. \`blast_radius({ changed_files })\` for impact.
121
121
  5. **Lifecycle** — Check \`status({})\` first. If onboard not run, run \`onboard({ path: "." })\`. After implementation, \`reindex({})\` + \`produce_knowledge({})\`. At session end, \`remember()\` checkpoint.
122
122
 
123
- ${Oe()}
123
+ ${ke()}
124
124
 
125
125
  ## User Interaction Rules
126
126
 
@@ -138,7 +138,7 @@ When you need to explain something or ask for user input:
138
138
  - Free-form text input always goes through elicitation, even when using \`present\` for the explanation
139
139
  - Prefer the simplest method that adequately conveys the information
140
140
 
141
- ${Y}
141
+ ${Te}
142
142
 
143
143
  ## Communication Style
144
144
 
@@ -212,8 +212,40 @@ knowledge({ action: "remember", title: "Session checkpoint: <topic>", content:
212
212
  search({ query: "SESSION CHECKPOINT", origin: "curated" })
213
213
  \`\`\`
214
214
 
215
- ${Te}
216
- `}function Ae(e,t){return`# ${e} — Agent Instructions
215
+ ${Ee}
216
+ `}function je(e,t){return`# ${e} — Claude Code Instructions
217
+
218
+ This project has an MCP server (\`${t}\`) providing tools for search, analysis, memory, and validation.
219
+ **Tools are auto-available** as \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__<tool>\` (double underscore) — no manual load step needed.
220
+
221
+ Default agent: **orchestrator** (set in \`~/.claude/settings.json\`).
222
+
223
+ ## Start of Session
224
+
225
+ 1. \`flow({ action: 'status' })\` — check for active flow
226
+ 2. Trivial (single question, quick lookup, ≤1 obvious file) → handle directly
227
+ 3. Non-trivial (multi-file, feature, architecture, debugging, refactoring) → Orchestrator handles it
228
+
229
+ ## Tool Usage Rules
230
+
231
+ Use AI Kit tools over native alternatives:
232
+
233
+ | Instead of (CC native) | Use AI Kit tool |
234
+ |---|---|
235
+ | \`Bash\` for grep/find | \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__find\` or \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__search\` |
236
+ | \`Read\` to understand a file | \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__file_summary({ tier: 'T1', query })\` |
237
+ | \`Bash\` for tsc/lint | \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__check\` |
238
+ | \`Bash\` for tests | \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__test_run\` |
239
+ | Manual code tracing | \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__trace({ symbol, direction })\` |
240
+ | \`WebFetch\` | \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__web_fetch\` or \`mcp__${t.toLowerCase().replace(/[^a-z0-9]/g,`_`)}__web_search\` |
241
+
242
+ \`Read\` is only acceptable for getting exact lines before \`Edit\`.
243
+
244
+ ## Custom Agents
245
+
246
+ Agents at \`~/.claude/agents/\` (Orchestrator, Implementer, Debugger, Reviewers, etc.).
247
+ Use \`@AgentName\` to invoke them.
248
+ `}function Me(e,t){return`# ${e} — Agent Instructions
217
249
 
218
250
  ## AI Kit MCP Server (\`${t}\`)
219
251
 
@@ -329,4 +361,4 @@ Both ReactFlow viewers include an **AI Kit** attribution badge (bottom-right). A
329
361
  ## Full Documentation
330
362
 
331
363
  For complete tool documentation (62 tools), workflow chains, search strategies, session protocol, and persistent memory patterns, load the \`aikit\` skill at session start.
332
- `}export{w as A,te as B,k as C,E as D,C as E,O as F,ae as I,ee as L,D as M,y as N,b as O,S as P,N as R,_ as S,x as T,h as _,fe as a,j as b,W as c,u as d,p as f,se as g,re as h,pe as i,ce as j,f as k,le as l,ne as m,ke as n,me as o,ie as p,he as r,ge as s,Ae as t,ue as u,g as v,T as w,M as x,d as y,oe as z};
364
+ `}export{d as A,g as B,le as C,S as D,b as E,x as F,D as I,h as L,ce as M,E as N,T as O,v as P,re as R,j as S,w as T,ie as V,se as _,pe as a,u as b,ge as c,de as d,l as f,oe as g,ae as h,he as i,C as j,y as k,W as l,m,je as n,fe as o,te as p,Ae as r,me as s,Me as t,ue as u,p as v,O as w,A as x,ne as y,M as z};
@@ -12,4 +12,4 @@ import{renderLayeredKnowledgeOperatingPolicyV1 as e}from"../definitions/protocol
12
12
  `)}`:`| Agent | Purpose | Category |\n|-------|---------|----------|\n${r.join(`
13
13
  `)}`}function _(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(`
14
14
  `)}`}function v({serverName:e,mcpEntry:t,configKey:n,extraServerFields:r}){let i={...t};return r&&Object.assign(i,r),JSON.stringify({[n]:{[e]:i}},null,2)}function y({flowTool:t=`flow`,isLifecycleOwner:n=!0}={}){let r=[`## Flows`,``,`This project uses aikit's pluggable flow system. Check flow status with the \`${t}\` MCP tool.`,``];return n?r.push(e({audience:`agent`}),``,`Use \`${t}({ action: 'list' })\` to see available flows and \`${t}({ action: 'start', name, topic })\` to begin one.`,``,`If a flow is active, follow the current step's skill instructions. Advance with \`${t}({ action: 'step', advance: 'next' })\`.`):r.push(`This project uses aikit's pluggable flow system. Use \`${t}({ action: 'status' })\` to check if a flow is active.`,`If dispatched as part of a flow, your work contributes to the current step. Do NOT advance or manage the flow — the Orchestrator handles flow lifecycle.`),r.join(`
15
- `)}function b({flowTool:e=`flow`}={}){return y({flowTool:e,isLifecycleOwner:!1})}export{r as buildAgentPrompt,g as buildAgentTable,_ as buildCompactAgentTable,l as buildEventBusNote,y as buildFlowSection,m as buildHooksSection,i as buildInlineAgentSection,v as buildMcpConfigJson,a as buildPromptFile,o as buildPromptSections,n as buildSkillsSection,b as buildSubagentFlowSection,t as lowerFirst};
15
+ `)}function b({flowTool:e=`flow`}={}){return y({flowTool:e,isLifecycleOwner:!1})}const x=`You MUST follow the Orchestrator Protocol: decompose every task into subtasks, delegate via Task()/sub-agents, and synthesize results. You are an orchestrator, not an implementer. Never write code directly unless the change is trivially small (≤5 lines, one file) or you are fixing a sub-agent's output. When in doubt, delegate.`;function S(e){return[`# ${x}`,``,...e]}export{x as ORCHESTRATOR_DIRECTIVE,r as buildAgentPrompt,g as buildAgentTable,_ as buildCompactAgentTable,l as buildEventBusNote,y as buildFlowSection,m as buildHooksSection,i as buildInlineAgentSection,v as buildMcpConfigJson,a as buildPromptFile,o as buildPromptSections,n as buildSkillsSection,b as buildSubagentFlowSection,S as injectOrchestratorDirective,t as lowerFirst};
@@ -1,8 +1,8 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{getPlatformPrimaryModelMap as a}from"../definitions/models.mjs";import{PLATFORM_HOOK_CAPABILITIES as o}from"../definitions/platform-capabilities.mjs";import{PROMPTS as s}from"../definitions/prompts.mjs";import{AIKIT_INSTALL_HINT_SECTION as c,PLATFORM_OUTPUT_RULES_SECTION as l,PROTOCOLS as u}from"../definitions/protocols.mjs";import{AIKIT_TOOLS as d,CLAUDE_CODE_TOOL_MAP as f,IDE_CAPABILITIES as p}from"../definitions/tools.mjs";import{buildAgentTable as m,buildCompactAgentTable as h,buildFlowSection as g,buildHooksSection as _,buildMcpConfigJson as v,buildSkillsSection as y,lowerFirst as b}from"./_shared.mjs";const x=g({flowTool:`flow`,isLifecycleOwner:!0}),S=g({flowTool:`flow`,isLifecycleOwner:!0}),C=g({flowTool:`flow`,isLifecycleOwner:!1});function w(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}function T(e){return`"${String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function E(e){let t=(p[e]||[]).flatMap(e=>f[e]||[]),n=d.map(e=>`mcp__aikit__${e}`);return[...new Set([...t,...n])].sort((e,t)=>e.localeCompare(t))}function D(e,t){let n=[];return n.push(`# ${i} ${e}`),n.push(``),t.description&&(n.push(`> ${t.description}`),n.push(``)),n.push(t.content.trim()),n.push(``),n.join(`
2
- `)}function O(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function k(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&u[e.sharedBase]&&t.push(u[e.sharedBase]);for(let n of e.sharedProtocols||[])u[n]&&t.push(u[n]);return t}function A(){let t=[];for(let[n,r]of Object.entries(e)){if(r.variants){for(let[e,i]of Object.entries(r.variants))t.push({name:`${n}-${e}`,description:i.description||r.description});continue}t.push({name:n,description:r.description})}return t}function j(e){return A().map(({name:t,description:n})=>`- \`${e}/${t}.md\` — ${n}`).join(`
3
- `)}function M(t=m(e,a(`claude-code`))){return[`# ${i} — Claude Code Agents`,``,l,``,c,``,`## MCP Server`,``,`Server name: \`${i}\``,"Configured in `.mcp.json` (project) and `~/.claude.json` (user-global — `claude mcp add --scope user` format).","Default agent: `Orchestrator` in `~/.claude/settings.json` — every conversation starts as Orchestrator automatically.",``,`## Agents`,``,t,``,`## Agent Files`,``,j(`.claude/agents`),``,`## Commands`,``,"Slash commands live under `.claude/commands/`.",``,`## Session Protocol`,``,_(n,o[`claude-code`]),``].join(`
4
- `)}function N(){return[`# ${i} — Claude Code Instructions`,``,"Detailed workspace instructions live in `AGENTS.md`.","Full sub-agent instructions live in `.claude/agents/`.","Slash commands live in `.claude/commands/`.","MCP server config lives in `.mcp.json` (project) and `~/.claude.json` (user-global — written by `claude mcp add --scope user`).","Default agent set to `Orchestrator` in `~/.claude/settings.json` — every conversation starts as Orchestrator, no `/agent` command needed.",``,"Start with `AGENTS.md`, then open the specific sub-agent file you want to use.",``,l,``,c,``].join(`
5
- `)}function P(e,t,n,r,a){let o=E(t.toolRole),s=k(t),c=y(t.skills),l=e===`Orchestrator`?[x,S]:[C],u=[n,...s,t.bodyAddendum,c,...l].filter(Boolean).join(`
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{getPlatformPrimaryModelMap as a}from"../definitions/models.mjs";import{PLATFORM_HOOK_CAPABILITIES as o}from"../definitions/platform-capabilities.mjs";import{PROMPTS as s}from"../definitions/prompts.mjs";import{AIKIT_INSTALL_HINT_SECTION as c,PLATFORM_OUTPUT_RULES_SECTION as l,PROTOCOLS as u}from"../definitions/protocols.mjs";import{AIKIT_TOOLS as d,CLAUDE_CODE_TOOL_MAP as f,IDE_CAPABILITIES as p}from"../definitions/tools.mjs";import{buildAgentTable as m,buildCompactAgentTable as h,buildFlowSection as g,buildHooksSection as _,buildMcpConfigJson as v,buildSkillsSection as y,injectOrchestratorDirective as b,lowerFirst as x}from"./_shared.mjs";const S=g({flowTool:`flow`,isLifecycleOwner:!0}),C=g({flowTool:`flow`,isLifecycleOwner:!0}),w=g({flowTool:`flow`,isLifecycleOwner:!1});function T(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}function E(e){return`"${String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function D(e){let t=(p[e]||[]).flatMap(e=>f[e]||[]),n=d.map(e=>`mcp__aikit__${e}`);return[...new Set([...t,...n])].sort((e,t)=>e.localeCompare(t))}function O(e,t){let n=[];return n.push(`# ${i} ${e}`),n.push(``),t.description&&(n.push(`> ${t.description}`),n.push(``)),n.push(t.content.trim()),n.push(``),n.join(`
2
+ `)}function k(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function A(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&u[e.sharedBase]&&t.push(u[e.sharedBase]);for(let n of e.sharedProtocols||[])u[n]&&t.push(u[n]);return t}function j(){let t=[];for(let[n,r]of Object.entries(e)){if(r.variants){for(let[e,i]of Object.entries(r.variants))t.push({name:`${n}-${e}`,description:i.description||r.description});continue}t.push({name:n,description:r.description})}return t}function M(e){return j().map(({name:t,description:n})=>`- \`${e}/${t}.md\` — ${n}`).join(`
3
+ `)}function N(t=m(e,a(`claude-code`))){return[`# ${i} — Claude Code Agents`,``,l,``,c,``,`## MCP Server`,``,`Server name: \`${i}\``,"Configured in `.mcp.json` (project) and `~/.claude.json` (user-global — `claude mcp add --scope user` format).","Default agent: `Orchestrator` in `~/.claude/settings.json` — every conversation starts as Orchestrator automatically.",``,`## Agents`,``,t,``,`## Agent Files`,``,M(`.claude/agents`),``,`## Commands`,``,"Slash commands live under `.claude/commands/`.",``,`## Session Protocol`,``,_(n,o[`claude-code`]),``].join(`
4
+ `)}function P(){return b([`# ${i} — Claude Code Instructions`,``,"Detailed workspace instructions live in `AGENTS.md`.","Full sub-agent instructions live in `.claude/agents/`.","Slash commands live in `.claude/commands/`.","MCP server config lives in `.mcp.json` (project) and `~/.claude.json` (user-global — written by `claude mcp add --scope user`).","Default agent set to `Orchestrator` in `~/.claude/settings.json` — every conversation starts as Orchestrator, no `/agent` command needed.",``,"Start with `AGENTS.md`, then open the specific sub-agent file you want to use.",``,l,``,c,``]).join(`
5
+ `)}function F(e,t,n,r,a){let o=D(t.toolRole),s=A(t),c=y(t.skills),l=e===`Orchestrator`?[S,C]:[w],u=[n,...s,t.bodyAddendum,c,...l].filter(Boolean).join(`
6
6
 
7
- `).trim(),d=t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${b(t.description)}.`,f=a?.[e],p=o.length>0?`tools: [${o.join(`, `)}]`:null,m=t.skills?.length>0?`skills: [${t.skills.map(([e])=>e).join(`, `)}]`:null,h=[`---`,`name: ${w(e)}`,`description: ${T(t.description)}`,...f?[`model: ${T(f)}`]:[],...p?[p]:[],`mcpServers:`,` - ${i}`,...m?[m]:[],`---`,``,`# ${e} - ${t.title||e}`,``,d];return u&&h.push(``,u),h.push(``),h.join(`
8
- `)}function F(){let t=[],n=a(`claude-code`),o=m(e,n),c=h(e);t.push({path:`.mcp.json`,content:`${v({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`}),t.push({path:`CLAUDE.md`,content:N()}),t.push({path:`AGENTS.md`,content:M(o)});for(let[e,n]of Object.entries(s))t.push({path:`.claude/commands/aikit-${e}.md`,content:D(e,n)});for(let[r,i]of Object.entries(e)){let e=O(r,c);if(i.variants){for(let[a,s]of Object.entries(i.variants)){let c=`${r}-${a}`;t.push({path:`.claude/agents/${c}.md`,content:P(c,{...i,description:s.description||i.description,identity:s.identity,bodyAddendum:s.bodyAddendum},e,o,n)})}continue}t.push({path:`.claude/agents/${r}.md`,content:P(r,i,e,o,n)})}return t}export{x as CLAUDE_FLOWS_SECTION,S as CLAUDE_ORCHESTRATOR_FLOW_ROUTING_SECTION,F as generateClaudeCode};
7
+ `).trim(),d=t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${x(t.description)}.`,f=a?.[e],p=o.length>0?`tools: [${o.join(`, `)}]`:null,m=t.skills?.length>0?`skills: [${t.skills.map(([e])=>e).join(`, `)}]`:null,h=[`---`,`name: ${T(e)}`,`description: ${E(t.description)}`,...f?[`model: ${E(f)}`]:[],...p?[p]:[],`mcpServers:`,` - ${i}`,...m?[m]:[],`---`,``,`# ${e} - ${t.title||e}`,``,d];return u&&h.push(``,u),h.push(``),h.join(`
8
+ `)}function I(){let t=[],n=a(`claude-code`),o=m(e,n),c=h(e);t.push({path:`.mcp.json`,content:`${v({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`}),t.push({path:`CLAUDE.md`,content:P()}),t.push({path:`AGENTS.md`,content:N(o)});for(let[e,n]of Object.entries(s))t.push({path:`.claude/commands/aikit-${e}.md`,content:O(e,n)});for(let[r,i]of Object.entries(e)){let e=k(r,c);if(i.variants){for(let[a,s]of Object.entries(i.variants)){let c=`${r}-${a}`;t.push({path:`.claude/agents/${c}.md`,content:F(c,{...i,description:s.description||i.description,identity:s.identity,bodyAddendum:s.bodyAddendum},e,o,n)})}continue}t.push({path:`.claude/agents/${r}.md`,content:F(r,i,e,o,n)})}return t}export{S as CLAUDE_FLOWS_SECTION,C as CLAUDE_ORCHESTRATOR_FLOW_ROUTING_SECTION,I as generateClaudeCode};
@@ -1,7 +1,7 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{getPlatformPrimaryModelMap as a}from"../definitions/models.mjs";import{PLATFORM_HOOK_CAPABILITIES as o}from"../definitions/platform-capabilities.mjs";import{PROMPTS as s}from"../definitions/prompts.mjs";import{AIKIT_INSTALL_HINT_SECTION as c,PLATFORM_OUTPUT_RULES_SECTION as l,PROTOCOLS as u}from"../definitions/protocols.mjs";import{AIKIT_TOOLS as d,CLAUDE_CODE_TOOL_MAP as f,IDE_CAPABILITIES as p}from"../definitions/tools.mjs";import{buildAgentTable as m,buildCompactAgentTable as h,buildFlowSection as g,buildHooksSection as _,buildSkillsSection as v,lowerFirst as y}from"./_shared.mjs";const b=g({flowTool:`flow`,isLifecycleOwner:!0}),x=g({flowTool:`flow`,isLifecycleOwner:!1});function S(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}function C(e){return`"${String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function w(e){let t=(p[e]||[]).flatMap(e=>f[e]||[]),n=d.map(e=>`mcp__aikit__${e}`);return[...new Set([...t,...n])].sort((e,t)=>e.localeCompare(t))}function T(e,t){let n=[];return n.push(`# ${i} ${e}`),n.push(``),t.description&&(n.push(`> ${t.description}`),n.push(``)),n.push(t.content.trim()),n.push(``),n.join(`
2
- `)}function E(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function D(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&u[e.sharedBase]&&t.push(u[e.sharedBase]);for(let n of e.sharedProtocols||[])u[n]&&t.push(u[n]);return t}function O(){return[`# ${i} — Claude Desktop Instructions`,``,"Detailed workspace instructions live in `AGENTS.md`.","MCP server config lives in `claude_desktop_config.json`.",``,l,``,c,``,_(n,o[`claude-desktop`]),``].join(`
3
- `)}function k(e){return[`# ${i} — Claude Desktop Agents`,``,l,``,c,``,`## MCP Server`,``,`Server name: \`${i}\``,"Configured in `claude_desktop_config.json`.",``,`## Agents`,``,e,``,_(n,o[`claude-desktop`]),``].join(`
4
- `)}function A(e,t,n,r,i){let a=w(t.toolRole),o=D(t),s=v(t.skills),c=e===`Orchestrator`?[b,x]:[x],l=[n,...o,t.bodyAddendum,s,...c].filter(Boolean).join(`
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{getPlatformPrimaryModelMap as a}from"../definitions/models.mjs";import{PLATFORM_HOOK_CAPABILITIES as o}from"../definitions/platform-capabilities.mjs";import{PROMPTS as s}from"../definitions/prompts.mjs";import{AIKIT_INSTALL_HINT_SECTION as c,PLATFORM_OUTPUT_RULES_SECTION as l,PROTOCOLS as u}from"../definitions/protocols.mjs";import{AIKIT_TOOLS as d,CLAUDE_CODE_TOOL_MAP as f,IDE_CAPABILITIES as p}from"../definitions/tools.mjs";import{buildAgentTable as m,buildCompactAgentTable as h,buildFlowSection as g,buildHooksSection as _,buildSkillsSection as v,injectOrchestratorDirective as y,lowerFirst as b}from"./_shared.mjs";const x=g({flowTool:`flow`,isLifecycleOwner:!0}),S=g({flowTool:`flow`,isLifecycleOwner:!1});function C(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()}function w(e){return`"${String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function T(e){let t=(p[e]||[]).flatMap(e=>f[e]||[]),n=d.map(e=>`mcp__aikit__${e}`);return[...new Set([...t,...n])].sort((e,t)=>e.localeCompare(t))}function E(e,t){let n=[];return n.push(`# ${i} ${e}`),n.push(``),t.description&&(n.push(`> ${t.description}`),n.push(``)),n.push(t.content.trim()),n.push(``),n.join(`
2
+ `)}function D(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function O(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&u[e.sharedBase]&&t.push(u[e.sharedBase]);for(let n of e.sharedProtocols||[])u[n]&&t.push(u[n]);return t}function k(){return y([`# ${i} — Claude Desktop Instructions`,``,"Detailed workspace instructions live in `AGENTS.md`.","MCP server config lives in `claude_desktop_config.json`.",``,l,``,c,``,_(n,o[`claude-desktop`]),``]).join(`
3
+ `)}function A(e){return[`# ${i} — Claude Desktop Agents`,``,l,``,c,``,`## MCP Server`,``,`Server name: \`${i}\``,"Configured in `claude_desktop_config.json`.",``,`## Agents`,``,e,``,_(n,o[`claude-desktop`]),``].join(`
4
+ `)}function j(e,t,n,r,i){let a=T(t.toolRole),o=O(t),s=v(t.skills),c=e===`Orchestrator`?[x,S]:[S],l=[n,...o,t.bodyAddendum,s,...c].filter(Boolean).join(`
5
5
 
6
- `).trim(),u=t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${y(t.description)}.`,d=i?.[e],f=a.length>0?`tools: [${a.join(`, `)}]`:null;t.skills?.length>0&&`${t.skills.map(([e])=>e).join(`, `)}`;let p=[`---`,`name: ${S(e)}`,`description: ${C(t.description)}`,...d?[`model: ${C(d)}`]:[],...f?[f]:[],`---`,``,`# ${e} - ${t.title||e}`,``,u];return l&&p.push(``,l),p.push(``),p.join(`
7
- `)}function j(){let t=[],n=a(`claude-desktop`),o=m(e,n),c=h(e);t.push({path:`claude_desktop_config.json`,content:`${JSON.stringify({mcpServers:{[i]:{command:r.command,args:r.args}}},null,2)}\n`}),t.push({path:`CLAUDE.md`,content:O()}),t.push({path:`AGENTS.md`,content:k(o)});for(let[e,n]of Object.entries(s))t.push({path:`.claude/commands/aikit-${e}.md`,content:T(e,n)});for(let[r,i]of Object.entries(e)){let e=E(r,c);if(i.variants){for(let[a,s]of Object.entries(i.variants)){let c=`${r}-${a}`;t.push({path:`.claude/agents/${c}.md`,content:A(c,{...i,description:s.description||i.description,identity:s.identity,bodyAddendum:s.bodyAddendum},e,o,n)})}continue}t.push({path:`.claude/agents/${r}.md`,content:A(r,i,e,o,n)})}return t}export{j as generateClaudeDesktop};
6
+ `).trim(),u=t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${b(t.description)}.`,d=i?.[e],f=a.length>0?`tools: [${a.join(`, `)}]`:null,p=t.skills?.length>0?`skills: [${t.skills.map(([e])=>e).join(`, `)}]`:null,m=[`---`,`name: ${C(e)}`,`description: ${w(t.description)}`,...d?[`model: ${w(d)}`]:[],...f?[f]:[],...p?[p]:[],`---`,``,`# ${e} - ${t.title||e}`,``,u];return l&&m.push(``,l),m.push(``),m.join(`
7
+ `)}function M(){let t=[],n=a(`claude-desktop`),o=m(e,n),c=h(e);t.push({path:`claude_desktop_config.json`,content:`${JSON.stringify({mcpServers:{[i]:{command:r.command,args:r.args}}},null,2)}\n`}),t.push({path:`CLAUDE.md`,content:k()}),t.push({path:`AGENTS.md`,content:A(o)});for(let[e,n]of Object.entries(s))t.push({path:`.claude/commands/aikit-${e}.md`,content:E(e,n)});for(let[r,i]of Object.entries(e)){let e=D(r,c);if(i.variants){for(let[a,s]of Object.entries(i.variants)){let c=`${r}-${a}`;t.push({path:`.claude/agents/${c}.md`,content:j(c,{...i,description:s.description||i.description,identity:s.identity,bodyAddendum:s.bodyAddendum},e,o,n)})}continue}t.push({path:`.claude/agents/${r}.md`,content:j(r,i,e,o,n)})}return t}export{M as generateClaudeDesktop};
@@ -1,8 +1,8 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{VARIANT_GROUPS as n,getPrimaryAgentModel as r}from"../definitions/models.mjs";import{PROMPTS as i}from"../definitions/prompts.mjs";import{AIKIT_INSTALL_HINT_SECTION as a,PLATFORM_OUTPUT_RULES_SECTION as o,PROTOCOLS as s,TEMPLATES as c}from"../definitions/protocols.mjs";import{IDE_CAPABILITIES as l}from"../definitions/tools.mjs";import{buildCompactAgentTable as u,buildFlowSection as d,buildSubagentFlowSection as f}from"./_shared.mjs";import{generateForbiddenTable as p}from"../definitions/policies.mjs";import{generateHooks as m,getHookScriptFiles as h}from"./hooks.mjs";const g={terminal:`execute/runInTerminal`,problems:`read/problems`,readFile:`read/readFile`,lastCommand:`read/terminalLastCommand`,subagent:`agent/runSubagent`,createFile:`edit/createFile`,editFiles:`edit/editFiles`,rename:`edit/rename`,createDirectory:`edit/createDirectory`,search:`search/changes, search/codebase, search/usages`,web:`web/fetch, web/githubRepo`,todo:`todo`,memory:`vscode/memory`,newWorkspace:`vscode/newWorkspace`,reviewPlan:`vscode/reviewPlan`,askQuestions:`vscode/askQuestions`,resolveMemoryFileUri:`vscode/resolveMemoryFileUri`,runCommand:`vscode/runCommand`,switchAgent:`vscode/switchAgent`,killTerminal:`execute/killTerminal`,createTask:`execute/createAndRunTask`,terminalSel:`read/terminalSelection`,fileSearch:`search/fileSearch`,listDir:`search/listDirectory`,textSearch:`search/textSearch`,searchSubagent:`search/searchSubagent`};function _(e){return`[${[...(l[e]||[]).map(e=>g[e]).filter(Boolean),`aikit/*`].join(`, `)}]`}function v(e){return r(`copilot`,e,`Auto (copilot)`)}const y=d({flowTool:`flow`,isLifecycleOwner:!0}),b=f({flowTool:`flow`});function x(){let t=[];for(let[i,a]of Object.entries(e))if(a.variants)for(let e of n[i]||[]){let n=`${i}-${e}`,o=r(`copilot`,n,`Unknown`),s=(a.variants[e]||{}).description||a.description;t.push(`| **${n}** | ${s} | ${o} | ${a.category} |`)}else{let e=r(`copilot`,i,`Unknown`);t.push(`| **${i}** | ${a.description} | ${e} | ${a.category} |`)}return`| Agent | Purpose | Model | Category |\n|-------|---------|-------|----------|\n${t.join(`
2
- `)}`}function S(e,t,r){let i=`${e}-${t}`,a=r.variants[t]||{},o=v(i),c=a.description||r.description,l=a.identity||(t===n[e]?.[0]?`, the primary ${e} agent.`:`, a variant of ${e}. Same responsibilities, different model perspective.`),u=r.sharedBase&&s[r.sharedBase]?`\n\n${s[r.sharedBase]}`:``,d=r.extraBody?`\n\n${r.extraBody}`:``,f=a.bodyAddendum?`\n\n${a.bodyAddendum}`:``,p=(r.sharedProtocols||[]).map(e=>s[e]?`\n\n${s[e]}`:``).join(``),m=r.skills?.length?`\n\n## Skills (load on demand)\n\n| Skill | When to load |\n|-------|--------------|\n${r.skills.map(([e,t])=>`| ${e} | ${t} |`).join(`
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{VARIANT_GROUPS as n,getPrimaryAgentModel as r}from"../definitions/models.mjs";import{PROMPTS as i}from"../definitions/prompts.mjs";import{AIKIT_INSTALL_HINT_SECTION as a,PLATFORM_OUTPUT_RULES_SECTION as o,PROTOCOLS as s,TEMPLATES as c}from"../definitions/protocols.mjs";import{IDE_CAPABILITIES as l}from"../definitions/tools.mjs";import{buildCompactAgentTable as u,buildFlowSection as d,buildSubagentFlowSection as f,injectOrchestratorDirective as p}from"./_shared.mjs";import{generateForbiddenTable as m}from"../definitions/policies.mjs";import{generateHooks as h,getHookScriptFiles as g}from"./hooks.mjs";const _={terminal:`execute/runInTerminal`,problems:`read/problems`,readFile:`read/readFile`,lastCommand:`read/terminalLastCommand`,subagent:`agent/runSubagent`,createFile:`edit/createFile`,editFiles:`edit/editFiles`,rename:`edit/rename`,createDirectory:`edit/createDirectory`,search:`search/changes, search/codebase, search/usages`,web:`web/fetch, web/githubRepo`,todo:`todo`,memory:`vscode/memory`,newWorkspace:`vscode/newWorkspace`,reviewPlan:`vscode/reviewPlan`,askQuestions:`vscode/askQuestions`,resolveMemoryFileUri:`vscode/resolveMemoryFileUri`,runCommand:`vscode/runCommand`,switchAgent:`vscode/switchAgent`,killTerminal:`execute/killTerminal`,createTask:`execute/createAndRunTask`,terminalSel:`read/terminalSelection`,fileSearch:`search/fileSearch`,listDir:`search/listDirectory`,textSearch:`search/textSearch`,searchSubagent:`search/searchSubagent`};function v(e){return`[${[...(l[e]||[]).map(e=>_[e]).filter(Boolean),`aikit/*`].join(`, `)}]`}function y(e){return r(`copilot`,e,`Auto (copilot)`)}const b=d({flowTool:`flow`,isLifecycleOwner:!0}),x=f({flowTool:`flow`});function S(){let t=[];for(let[i,a]of Object.entries(e))if(a.variants)for(let e of n[i]||[]){let n=`${i}-${e}`,o=r(`copilot`,n,`Unknown`),s=(a.variants[e]||{}).description||a.description;t.push(`| **${n}** | ${s} | ${o} | ${a.category} |`)}else{let e=r(`copilot`,i,`Unknown`);t.push(`| **${i}** | ${a.description} | ${e} | ${a.category} |`)}return`| Agent | Purpose | Model | Category |\n|-------|---------|-------|----------|\n${t.join(`
2
+ `)}`}function C(e,t,r){let i=`${e}-${t}`,a=r.variants[t]||{},o=y(i),c=a.description||r.description,l=a.identity||(t===n[e]?.[0]?`, the primary ${e} agent.`:`, a variant of ${e}. Same responsibilities, different model perspective.`),u=r.sharedBase&&s[r.sharedBase]?`\n\n${s[r.sharedBase]}`:``,d=r.extraBody?`\n\n${r.extraBody}`:``,f=a.bodyAddendum?`\n\n${a.bodyAddendum}`:``,p=(r.sharedProtocols||[]).map(e=>s[e]?`\n\n${s[e]}`:``).join(``),m=r.skills?.length?`\n\n## Skills (load on demand)\n\n| Skill | When to load |\n|-------|--------------|\n${r.skills.map(([e,t])=>`| ${e} | ${t} |`).join(`
3
3
  `)}`:``,h=r.title||e;return`---
4
4
  description: '${c}'
5
- ${r.argumentHint?`argument-hint: "${r.argumentHint}"\n`:``}tools: ${_(r.toolRole)}
5
+ ${r.argumentHint?`argument-hint: "${r.argumentHint}"\n`:``}tools: ${v(r.toolRole)}
6
6
  model: ${o}
7
7
  ---
8
8
 
@@ -11,11 +11,11 @@ model: ${o}
11
11
  You are **${i}**${l}${d}
12
12
  ${u}${p}${f}${m}
13
13
 
14
- ${b}
15
- `}function C(n,r){let i=v(n),a=typeof t[n]==`function`?t[n](u(e)):t[n]||``,o=r.sharedBase&&s[r.sharedBase]?`\n\n${s[r.sharedBase]}`:``,c=(r.sharedProtocols||[]).map(e=>s[e]?`\n\n${s[e]}`:``).join(``),l=r.title||n,d=r.skills?.length?`\n## Skills (load on demand)\n\n| Skill | When to load |\n|-------|--------------|\n${r.skills.map(([e,t])=>`| ${e} | ${t} |`).join(`
14
+ ${x}
15
+ `}function w(n,r){let i=y(n),a=typeof t[n]==`function`?t[n](u(e)):t[n]||``,o=r.sharedBase&&s[r.sharedBase]?`\n\n${s[r.sharedBase]}`:``,c=(r.sharedProtocols||[]).map(e=>s[e]?`\n\n${s[e]}`:``).join(``),l=r.title||n,d=r.skills?.length?`\n## Skills (load on demand)\n\n| Skill | When to load |\n|-------|--------------|\n${r.skills.map(([e,t])=>`| ${e} | ${t} |`).join(`
16
16
  `)}\n`:``;return`---
17
17
  description: '${r.description}'
18
- ${r.argumentHint?`argument-hint: "${r.argumentHint}"\n`:``}tools: ${_(r.toolRole)}
18
+ ${r.argumentHint?`argument-hint: "${r.argumentHint}"\n`:``}tools: ${v(r.toolRole)}
19
19
  model: ${i}
20
20
  ---
21
21
 
@@ -25,20 +25,20 @@ You are the **${n}**, ${r.description.toLowerCase().replace(/^./,e=>e.toLowerCas
25
25
 
26
26
  ${a}${o}${c}${d}
27
27
 
28
- ${n===`Orchestrator`?y:b}
29
- `}function w(e,t){return`---
28
+ ${n===`Orchestrator`?b:x}
29
+ `}function T(e,t){return`---
30
30
  description: "${t.description}"
31
31
  agent: "${t.agent}"
32
32
  ---
33
33
 
34
34
  ${t.content}
35
- `}function T(){return`# Agents
35
+ `}function E(){return`# Agents
36
36
 
37
37
  This directory contains AI agent definitions generated by \`@vpxa/aikit init\`.
38
38
 
39
39
  ## Agent Roster
40
40
 
41
- ${x()}
41
+ ${S()}
42
42
 
43
43
  ## Multi-Model Pattern
44
44
 
@@ -64,5 +64,5 @@ To regenerate after changing models or agent definitions:
64
64
  cd knowledge-base
65
65
  node scaffold/generate.mjs
66
66
  \`\`\`
67
- `}function E(){return[`# AI Kit — Copilot Instructions`,``,"This file is generated from `scaffold/definitions/`. Do not edit directly.",``,o,``,`## Tool Routing Rules`,``,`These rules are enforced by AI Kit compliance checking. Violations are flagged in reports and reduce your compliance score.`,``,p(),``,a,``].join(`
68
- `)}function D(){let t=[];if(h().length===0)throw Error(`Executable hooks are not configured.`);t.push({path:`copilot-instructions.md`,content:E()});for(let[r,i]of Object.entries(e))if(i.variants)for(let e of n[r]||[])t.push({path:`agents/${r}-${e}.agent.md`,content:S(r,e,i)});else t.push({path:`agents/${r}.agent.md`,content:C(r,i)});for(let[e,n]of Object.entries(c))t.push({path:`agents/templates/${e}.md`,content:`${n}\n`});t.push({path:`agents/README.md`,content:T()});for(let[e,n]of Object.entries(i))t.push({path:`prompts/aikit-${e}.prompt.md`,content:w(e,n)});let r=m(`copilot`,`~/.copilot/hooks/scripts`);return t.push(...r.map(e=>({path:`hooks/${e.path}`,content:e.content}))),t}export{D as generateCopilot};
67
+ `}function D(){return p([`# AI Kit — Copilot Instructions`,``,"This file is generated from `scaffold/definitions/`. Do not edit directly.",``,o,``,`## Tool Routing Rules`,``,`These rules are enforced by AI Kit compliance checking. Violations are flagged in reports and reduce your compliance score.`,``,m(),``,a,``]).join(`
68
+ `)}function O(){let t=[];if(g().length===0)throw Error(`Executable hooks are not configured.`);t.push({path:`copilot-instructions.md`,content:D()});for(let[r,i]of Object.entries(e))if(i.variants)for(let e of n[r]||[])t.push({path:`agents/${r}-${e}.agent.md`,content:C(r,e,i)});else t.push({path:`agents/${r}.agent.md`,content:w(r,i)});for(let[e,n]of Object.entries(c))t.push({path:`agents/templates/${e}.md`,content:`${n}\n`});t.push({path:`agents/README.md`,content:E()});for(let[e,n]of Object.entries(i))t.push({path:`prompts/aikit-${e}.prompt.md`,content:T(e,n)});let r=h(`copilot`,`~/.copilot/hooks/scripts`);return t.push(...r.map(e=>({path:`hooks/${e.path}`,content:e.content}))),t}export{O as generateCopilot};
@@ -1,7 +1,7 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{PLATFORM_HOOK_CAPABILITIES as a}from"../definitions/platform-capabilities.mjs";import{PROMPTS as o}from"../definitions/prompts.mjs";import{PROTOCOLS as s}from"../definitions/protocols.mjs";import{buildAgentTable as c,buildCompactAgentTable as l,buildFlowSection as u,buildHooksSection as d,buildMcpConfigJson as f,buildPromptSections as p,buildSkillsSection as m,lowerFirst as h}from"./_shared.mjs";const g=u({flowTool:`flow`,isLifecycleOwner:!0}),_=u({flowTool:`flow`,isLifecycleOwner:!1});function v(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function y(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&s[e.sharedBase]&&t.push(s[e.sharedBase]);for(let n of e.sharedProtocols||[])s[n]&&t.push(s[n]);return t}function b(){let t=[];for(let[n,r]of Object.entries(e)){if(r.variants){for(let[e,i]of Object.entries(r.variants))t.push({name:`${n}-${e}`,description:i.description||r.description});continue}t.push({name:n,description:r.description})}return t}function x(e){return b().map(({name:t,description:n})=>`- \`${e}/${t}.md\` — ${n}`).join(`
2
- `)}function S(e,t,n){let r=y(t),i=m(t.skills),a=e===`Orchestrator`?g:_,o=[n,...r,t.bodyAddendum,i,a].filter(Boolean).join(`
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{MCP_SERVER_ENTRY as r,SERVER_NAME as i}from"../definitions/mcp.mjs";import{PLATFORM_HOOK_CAPABILITIES as a}from"../definitions/platform-capabilities.mjs";import{PROMPTS as o}from"../definitions/prompts.mjs";import{PROTOCOLS as s}from"../definitions/protocols.mjs";import{buildAgentTable as c,buildCompactAgentTable as l,buildFlowSection as u,buildHooksSection as d,buildMcpConfigJson as f,buildPromptSections as p,buildSkillsSection as m,injectOrchestratorDirective as h,lowerFirst as g}from"./_shared.mjs";const _=u({flowTool:`flow`,isLifecycleOwner:!0}),v=u({flowTool:`flow`,isLifecycleOwner:!1});function y(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function b(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&s[e.sharedBase]&&t.push(s[e.sharedBase]);for(let n of e.sharedProtocols||[])s[n]&&t.push(s[n]);return t}function x(){let t=[];for(let[n,r]of Object.entries(e)){if(r.variants){for(let[e,i]of Object.entries(r.variants))t.push({name:`${n}-${e}`,description:i.description||r.description});continue}t.push({name:n,description:r.description})}return t}function S(e){return x().map(({name:t,description:n})=>`- \`${e}/${t}.md\` — ${n}`).join(`
2
+ `)}function C(e,t,n){let r=b(t),i=m(t.skills),a=e===`Orchestrator`?_:v,o=[n,...r,t.bodyAddendum,i,a].filter(Boolean).join(`
3
3
 
4
- `).trim();return[`# ${e} - ${t.title||e}`,``,`> ${t.description}`,``,t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${h(t.description)}.`,...o?[``,o]:[],``].join(`
5
- `)}function C(){let t=c(e);return[`# ${i} — Gemini CLI Agents`,``,"This workspace keeps the root `GEMINI.md` intentionally small. Full agent instructions are split into per-agent files under `.gemini/agents/`.",``,`## MCP Server`,``,`Server name: \`${i}\``,"Configure in `.gemini/settings.json` (already done if scaffold was deployed).",``,`## Agents`,``,t,``,`## Agent Files`,``,x(`.gemini/agents`),``,`## Prompts`,``,p(o),``,`## Session Protocol`,``,d(n,a.gemini),``].join(`
6
- `)}function w(){return[`# ${i} — Gemini CLI Instructions`,``,"Detailed workspace instructions live in `AGENTS.md`.","Per-agent instructions are emitted under `.gemini/agents/`.","MCP server config lives in `.gemini/settings.json`.",``,"Start with `AGENTS.md`, then open the specific agent file you want to use.",``].join(`
7
- `)}function T(){let t=[{path:`.gemini/settings.json`,content:`${f({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`},{path:`GEMINI.md`,content:w()},{path:`AGENTS.md`,content:C()}],n=l(e);for(let[r,i]of Object.entries(e)){let e=v(r,n);if(i.variants){for(let[n,a]of Object.entries(i.variants)){let o=`${r}-${n}`;t.push({path:`.gemini/agents/${o}.md`,content:S(o,{...i,description:a.description||i.description,identity:a.identity,bodyAddendum:a.bodyAddendum},e)})}continue}t.push({path:`.gemini/agents/${r}.md`,content:S(r,i,e)})}return t}export{T as generateGemini};
4
+ `).trim();return[`# ${e} - ${t.title||e}`,``,`> ${t.description}`,``,t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${g(t.description)}.`,...o?[``,o]:[],``].join(`
5
+ `)}function w(){let t=c(e);return[`# ${i} — Gemini CLI Agents`,``,"This workspace keeps the root `GEMINI.md` intentionally small. Full agent instructions are split into per-agent files under `.gemini/agents/`.",``,`## MCP Server`,``,`Server name: \`${i}\``,"Configure in `.gemini/settings.json` (already done if scaffold was deployed).",``,`## Agents`,``,t,``,`## Agent Files`,``,S(`.gemini/agents`),``,`## Prompts`,``,p(o),``,`## Session Protocol`,``,d(n,a.gemini),``].join(`
6
+ `)}function T(){return h([`# ${i} — Gemini CLI Instructions`,``,"Detailed workspace instructions live in `AGENTS.md`.","Per-agent instructions are emitted under `.gemini/agents/`.","MCP server config lives in `.gemini/settings.json`.",``,"Start with `AGENTS.md`, then open the specific agent file you want to use.",``]).join(`
7
+ `)}function E(){let t=[{path:`.gemini/settings.json`,content:`${f({serverName:i,mcpEntry:r,configKey:`mcpServers`})}\n`},{path:`GEMINI.md`,content:T()},{path:`AGENTS.md`,content:w()}],n=l(e);for(let[r,i]of Object.entries(e)){let e=y(r,n);if(i.variants){for(let[n,a]of Object.entries(i.variants)){let o=`${r}-${n}`;t.push({path:`.gemini/agents/${o}.md`,content:C(o,{...i,description:a.description||i.description,identity:a.identity,bodyAddendum:a.bodyAddendum},e)})}continue}t.push({path:`.gemini/agents/${r}.md`,content:C(r,i,e)})}return t}export{E as generateGemini};
@@ -1,6 +1,56 @@
1
- import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{PLATFORM_HOOK_CAPABILITIES as r}from"../definitions/platform-capabilities.mjs";import{PROMPTS as i}from"../definitions/prompts.mjs";import{PROTOCOLS as a}from"../definitions/protocols.mjs";import{buildAgentTable as o,buildCompactAgentTable as s,buildFlowSection as c,buildHooksSection as l,buildPromptSections as u,buildSkillsSection as d,lowerFirst as f}from"./_shared.mjs";const p=c({flowTool:`flow`,isLifecycleOwner:!0}),m=c({flowTool:`flow`,isLifecycleOwner:!1});function h(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function g(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&a[e.sharedBase]&&t.push(a[e.sharedBase]);for(let n of e.sharedProtocols||[])a[n]&&t.push(a[n]);return t}function _(){let t=o(e),a=s(e),c=u(i),d=[];for(let[t,n]of Object.entries(e)){let e=h(t,a);if(n.variants){for(let[r,i]of Object.entries(n.variants)){let a=`${t}-${r}`;d.push(v(a,{...n,description:i.description||n.description,identity:i.identity,bodyAddendum:i.bodyAddendum},e))}continue}d.push(v(t,n,e))}return[`# AI Kit — Hermes Agent Instructions`,``,"This project uses **AI Kit** (`@vpxa/aikit`), a local-first MCP server that provides search,",`code analysis, persistent memory, context compression, and guided development flows.`,``,`The AI Kit MCP server is registered in your Hermes config and its 64 tools are available`,"as `mcp_aikit_*` tool calls in every conversation.",``,`## MCP Server`,``,"Server name: `AI Kit`","Configured via `hermes mcp add` (user-level). Tools are auto-discovered at session start.",``,`## Skills-First Rule`,``,`**Before starting ANY task, check available skills.** If a skill matches your task domain`,`— load it first. Skills contain domain-specific patterns, templates, and constraints.`,``,`## Available Tools (64)`,``,`AI Kit provides tools across the following categories:`,``,`| Category | Tools |`,`|----------|-------|`,"| **Search & Discovery** | `search`, `find`, `symbol`, `trace`, `lookup`, `scope_map`, `file_summary`, `dead_symbols` |","| **Code Analysis** | `analyze`, `blast_radius`, `audit`, `graph`, `health`, `check` |","| **Context Compression** | `file_summary`, `digest` |","| **Memory & Knowledge** | `knowledge`, `remember`, `read`, `update`, `forget`, `list`, `stash` |","| **FORGE Quality Gates** | `forge_classify`, `forge_ground`, `evidence_map`, `compliance_score` |","| **Development Workflows** | `flow`, `onboard`, `reindex`, `status`, `guide`, `config` |","| **Testing & Build** | `test_run`, `parse_output`, `check`, `eval` |","| **Code Manipulation** | `rename`, `codemod`, `data_transform`, `diff_parse`, `git_context`, `replay` |","| **Web & HTTP** | `web_search`, `web_fetch`, `http` |","| **Present & Visualize** | `present`, `signal`, `session_digest` |","| **Sandbox & Process** | `process`, `watch`, `workset`, `lane`, `queue`, `restore`, `delegate` |","| **Utilities** | `encode`, `regex_test`, `measure`, `changelog`, `schema_validate`, `env`, `time` |","| **Browser** | `browser` |",``,`## Important: Prefer AI Kit Tools Over Generic Shell Commands`,``,`When working in this project, use AI Kit MCP tools instead of generic alternatives:`,``,`| Instead of | Use AI Kit Tool | Why |`,`|-----------|----------------|-----|`,"| `grep` / `rg` | `mcp_aikit_search` or `mcp_aikit_find` | Hybrid search (vector + keyword + BM25) across all indexed content |","| `read_file` for understanding | `mcp_aikit_file_summary` | T1=structure, T2=structure+content — 10x fewer tokens than raw file reads |","| `cd` + `ls` | `mcp_aikit_analyze` | Structural analysis with tree views |","| Running tests in terminal | `mcp_aikit_test_run` | Structured test output — no shell needed |","| `tsc` / `biome` in terminal | `mcp_aikit_check` | Typecheck + lint combined |","| Web search | `mcp_aikit_web_search` | Fans out to multiple keyless providers |",``,`## Agents`,``,t,``,`## Agent Instructions`,``,d.join(`
2
- `),``,`## Prompts`,``,c,``,p,``,`## Session Protocol`,``,l(n,r.hermes),``].join(`
3
- `)}function v(e,t,n){let r=g(t),i=d(t.skills),a=e===`Orchestrator`?p:m,o=[n,...r,t.bodyAddendum,i,a].filter(Boolean).join(`
1
+ import{AGENTS as e}from"../definitions/agents.mjs";import{AGENT_BODIES as t}from"../definitions/bodies.mjs";import{HOOKS as n}from"../definitions/hooks.mjs";import{VARIANT_GROUPS as r,getPrimaryAgentModel as i}from"../definitions/models.mjs";import{PLATFORM_HOOK_CAPABILITIES as a}from"../definitions/platform-capabilities.mjs";import{PROMPTS as o}from"../definitions/prompts.mjs";import{PROTOCOLS as s,TEMPLATES as c}from"../definitions/protocols.mjs";import{IDE_CAPABILITIES as l}from"../definitions/tools.mjs";import{buildAgentTable as u,buildCompactAgentTable as d,buildFlowSection as f,buildHooksSection as p,buildPromptSections as m,buildSkillsSection as h,injectOrchestratorDirective as g,lowerFirst as _}from"./_shared.mjs";import{generateHooks as v,getHookScriptFiles as y}from"./hooks.mjs";const b=f({flowTool:`flow`,isLifecycleOwner:!0}),x=f({flowTool:`flow`,isLifecycleOwner:!1});function S(e,n){let r=t[e];return typeof r==`function`?r(n):r||``}function C(e){let t=[];e.extraBody&&t.push(e.extraBody),e.sharedBase&&s[e.sharedBase]&&t.push(s[e.sharedBase]);for(let n of e.sharedProtocols||[])s[n]&&t.push(s[n]);return t}const w={terminal:`terminal`,problems:`mcp_aikit_check`,readFile:`read_file`,lastCommand:`terminal`,subagent:`delegate_task`,createFile:`write_file`,editFiles:`patch`,rename:`write_file`,createDirectory:`terminal(mkdir)`,search:`search_files, mcp_aikit_search, mcp_aikit_find`,web:`web_search, web_extract, mcp_aikit_web_search, mcp_aikit_web_fetch`,todo:`todo`,memory:`memory`,newWorkspace:`terminal(cd)`,reviewPlan:`clarify`,askQuestions:`clarify`,resolveMemoryFileUri:`read_file`,runCommand:`terminal`,switchAgent:`delegate_task`,killTerminal:`process(kill)`,createTask:`todo`,terminalSel:`terminal`,fileSearch:`search_files`,listDir:`search_files(target=files)`,textSearch:`search_files(target=content)`,searchSubagent:`delegate_task`,browser:`mcp_aikit_browser, browser_navigate`};function T(e){let t=(l[e]||[]).map(e=>{let t=w[e];return t?t.split(`,`).map(e=>e.trim()):null}).filter(Boolean).flat();return`[${[...new Set(t),`aikit/*`].join(`, `)}]`}function E(e){return i(`hermes`,e,`Auto (hermes)`)}function D(e){let t=[[/`runSubagent`/g,"`delegate_task`"],[/`runSubagent\(/g,"`delegate_task("],[/\brunSubagent\b/g,`delegate_task`],[/`editFiles`/g,"`patch`"],[/`createFile`/g,"`write_file`"],[/`edit\/createFile`/g,"`write_file`"],[/`edit\/editFiles`/g,"`patch`"],[/`run_in_terminal`/g,"`terminal`"],[/`execute\/runInTerminal`/g,"`terminal`"],[/`execute\/killTerminal`/g,"`process(kill)`"],[/`grep_search`/g,"`search_files`"],[/`search\/codebase`/g,"`mcp_aikit_search`"],[/`search\/changes`/g,"`search_files`"],[/`search\/usages`/g,"`mcp_aikit_symbol` / `mcp_aikit_trace`"],[/`search\/textSearch`/g,"`search_files`"],[/`search\/searchSubagent`/g,"`delegate_task`"],[/`web\/fetch`/g,"`web_extract` / `mcp_aikit_web_fetch`"],[/`web\/githubRepo`/g,"`terminal(git ...)`"],[/`web\/webSearch`/g,"`web_search` / `mcp_aikit_web_search`"],[/`vscode\/memory`/g,"`memory`"],[/`vscode\/runCommand`/g,"`terminal`"],[/`vscode\/switchAgent`/g,"`delegate_task`"],[/`vscode\/newWorkspace`/g,"`terminal(cd)`"],[/`vscode\/reviewPlan`/g,"`clarify`"],[/`vscode\/askQuestions`/g,"`clarify`"],[/`vscode\/resolveMemoryFileUri`/g,"`read_file`"],[/`read\/readFile`/g,"`read_file`"],[/`read\/terminalLastCommand`/g,"`terminal`"],[/`read\/terminalSelection`/g,"`terminal`"],[/`read\/problems`/g,"`mcp_aikit_check`"],[/`agent\/runSubagent`/g,"`delegate_task`"],[/`execute\/createAndRunTask`/g,"`todo` / `delegate_task`"],[/`read_file` \(for understanding\)/g,"`read_file` (Hermes)"],[/(copilot)/g,`(hermes)`],[/runSubagent\(\{agentName:/g,`delegate_task({goal:`],[/runSubagent\(\{/g,`delegate_task({`]],n=e;for(let[e,r]of t)n=n.replace(e,r);return n}function O(){let t=u(e),r=d(e),i=m(o),s=[];for(let[t,n]of Object.entries(e)){let e=S(t,r);if(n.variants){for(let[r,i]of Object.entries(n.variants)){let a=`${t}-${r}`;s.push(k(a,{...n,description:i.description||n.description,identity:i.identity,bodyAddendum:i.bodyAddendum},e))}continue}s.push(k(t,n,e))}return g([`# AI Kit — Hermes Agent Instructions`,``,"This project uses **AI Kit** (`@vpxa/aikit`), a local-first MCP server that provides search,",`code analysis, persistent memory, context compression, and guided development flows.`,``,`The AI Kit MCP server is registered in your Hermes config and its 64 tools are available`,"as `mcp_aikit_*` tool calls in every conversation.",``,`## MCP Server`,``,"Server name: `AI Kit`","Configured via `hermes mcp add` (user-level). Tools are auto-discovered at session start.",``,`## Skills-First Rule`,``,`**Before starting ANY task, check available skills.** If a skill matches your task domain`,`— load it first. Skills contain domain-specific patterns, templates, and constraints.`,``,`## Available Tools (64)`,``,`AI Kit provides tools across the following categories:`,``,`| Category | Tools |`,`|----------|-------|`,"| **Search & Discovery** | `search`, `find`, `symbol`, `trace`, `lookup`, `scope_map`, `file_summary`, `dead_symbols` |","| **Code Analysis** | `analyze`, `blast_radius`, `audit`, `graph`, `health`, `check` |","| **Context Compression** | `file_summary`, `digest` |","| **Memory & Knowledge** | `knowledge`, `remember`, `read`, `update`, `forget`, `list`, `stash` |","| **FORGE Quality Gates** | `forge_classify`, `forge_ground`, `evidence_map`, `compliance_score` |","| **Development Workflows** | `flow`, `onboard`, `reindex`, `status`, `guide`, `config` |","| **Testing & Build** | `test_run`, `parse_output`, `check`, `eval` |","| **Code Manipulation** | `rename`, `codemod`, `data_transform`, `diff_parse`, `git_context`, `replay` |","| **Web & HTTP** | `web_search`, `web_fetch`, `http` |","| **Present & Visualize** | `present`, `signal`, `session_digest` |","| **Sandbox & Process** | `process`, `watch`, `workset`, `lane`, `queue`, `restore`, `delegate` |","| **Utilities** | `encode`, `regex_test`, `measure`, `changelog`, `schema_validate`, `env`, `time` |","| **Browser** | `browser` |",``,`## Important: Prefer AI Kit Tools Over Generic Shell Commands`,``,`When working in this project, use AI Kit MCP tools instead of generic alternatives:`,``,`| Instead of | Use AI Kit Tool | Why |`,`|-----------|----------------|-----|`,"| `grep` / `rg` | `mcp_aikit_search` or `mcp_aikit_find` | Hybrid search (vector + keyword + BM25) across all indexed content |","| `read_file` for understanding | `mcp_aikit_file_summary` | T1=structure, T2=structure+content — 10x fewer tokens than raw file reads |","| `cd` + `ls` | `mcp_aikit_analyze` | Structural analysis with tree views |","| Running tests in terminal | `mcp_aikit_test_run` | Structured test output — no shell needed |","| `tsc` / `biome` in terminal | `mcp_aikit_check` | Typecheck + lint combined |","| Web search | `mcp_aikit_web_search` | Fans out to multiple keyless providers |",``,`## Agents`,``,t,``,`## Agent Instructions`,``,s.join(`
2
+ `),``,`## Prompts`,``,i,``,b,``,`## Session Protocol`,``,p(n,a.hermes),``]).join(`
3
+ `)}function k(e,t,n){let r=C(t),i=h(t.skills),a=e===`Orchestrator`?b:x,o=[n,...r,t.bodyAddendum,i,a].filter(Boolean).join(`
4
4
 
5
- `).trim();return[`## ${e} - ${t.title||e}`,``,`> ${t.description}`,``,t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${f(t.description)}.`,...o?[``,o]:[],``].join(`
6
- `)}function y(){return[{path:`AGENTS.md`,content:_()}]}export{y as generateHermes};
5
+ `).trim();return[`## ${e} - ${t.title||e}`,``,`> ${t.description}`,``,t.identity?`You are the **${e}**${t.identity}`:`You are the **${e}**, ${_(t.description)}.`,...o?[``,o]:[],``].join(`
6
+ `)}function A(e,t,n){let i=`${e}-${t}`,a=n.variants[t]||{},o=E(i),c=a.description||n.description,l=a.identity||(t===r[e]?.[0]?`, the primary ${e} agent.`:`, a variant of ${e}. Same responsibilities, different model perspective.`),u=n.sharedBase&&s[n.sharedBase]?`\n\n${s[n.sharedBase]}`:``;u=D(u);let d=n.extraBody?`\n\n${D(n.extraBody)}`:``,f=a.bodyAddendum?`\n\n${D(a.bodyAddendum)}`:``,p=(n.sharedProtocols||[]).map(e=>{let t=s[e];return t?`\n\n${D(t)}`:``}).join(``),m=n.skills?.length?`\n\n## Skills (load on demand)\n\n${n.skills.map(([e,t])=>`- \`${e}\`: ${t}`).join(`
7
+ `)}`:``,h=n.title||e;return`---
8
+ description: '${c}'
9
+ ${n.argumentHint?`argument-hint: "${n.argumentHint}"\n`:``}tools: ${T(n.toolRole)}
10
+ model: ${o}
11
+ ---
12
+
13
+ # ${i} - ${h}
14
+
15
+ You are **${i}**${l}${d}
16
+ ${u}${p}${f}${m}
17
+
18
+ ${x}
19
+ `}function j(e,n,r){let i=E(e),a=typeof t[e]==`function`?t[e](r):t[e]||``;a=D(a);let o=n.sharedBase&&s[n.sharedBase]?`\n\n${s[n.sharedBase]}`:``;o=D(o);let c=(n.sharedProtocols||[]).map(e=>{let t=s[e];return t?`\n\n${D(t)}`:``}).join(``),l=n.title||e,u=n.skills?.length?`\n## Skills (load on demand)\n\n${n.skills.map(([e,t])=>`- \`${e}\`: ${t}`).join(`
20
+ `)}\n`:``;return`---
21
+ description: '${n.description}'
22
+ ${n.argumentHint?`argument-hint: "${n.argumentHint}"\n`:``}tools: ${T(n.toolRole)}
23
+ model: ${i}
24
+ ---
25
+
26
+ # ${e} - ${l}
27
+
28
+ You are the **${e}**, ${n.description.toLowerCase().replace(/^./,e=>e.toLowerCase())}
29
+
30
+ ${a}${o}${c}${u}
31
+
32
+ ${e===`Orchestrator`?b:x}
33
+ `}function M(e,t){return`---
34
+ description: "${t.description}"
35
+ agent: "${t.agent}"
36
+ ---
37
+
38
+ ${t.content}
39
+ `}function N(){return`# Hermes Agents
40
+
41
+ This directory contains AI agent definitions generated by \`@vpxa/aikit init\` for **Hermes Agent**.
42
+
43
+ ## Agent Roster
44
+
45
+ ${u(e)}
46
+
47
+ ## Multi-Model Pattern
48
+
49
+ Variant agents (Researcher-Alpha/Beta/Gamma/Delta, Code-Reviewer-Alpha/Beta, Architect-Reviewer-Alpha/Beta) share the same inlined methodology. They differ only in which LLM model backs them — enabling multi-model decision analysis and dual-review workflows.
50
+
51
+ ## Tools
52
+
53
+ Hermes provides native tools (\`terminal\`, \`read_file\`, \`write_file\`, \`patch\`, \`search_files\`, \`delegate_task\`, etc.)
54
+ plus AI Kit MCP tools (\`mcp_aikit_search\`, \`mcp_aikit_knowledge\`, etc.) for code analysis, memory, and context compression.
55
+
56
+ See \`AGENTS.md\` (in Hermes config directory) for complete tool usage guidance.`}function P(){let t=[];if(y().length===0)throw Error(`Executable hooks are not configured.`);t.push({path:`AGENTS.md`,content:O()});let n=d(e);for(let[i,a]of Object.entries(e))if(a.variants)for(let e of r[i]||[])t.push({path:`agents/${i}-${e}.agent.md`,content:A(i,e,a)});else t.push({path:`agents/${i}.agent.md`,content:j(i,a,n)});for(let[e,n]of Object.entries(c))t.push({path:`agents/templates/${e}.md`,content:`${n}\n`});t.push({path:`agents/README.md`,content:N()});for(let[e,n]of Object.entries(o))t.push({path:`prompts/aikit-${e}.prompt.md`,content:M(e,n)});let i=v(`hermes`,`~/.hermes/hooks/scripts`);return t.push(...i.map(e=>({path:`hooks/${e.path}`,content:e.content}))),t}export{P as generateHermes};
@@ -1 +1 @@
1
- import{EXEC_HOOKS as e,HOOK_EVENTS as t,HOOK_TOOL_MATCHERS as n,SUPPORTED_PLATFORMS as r}from"../definitions/exec-hooks.mjs";const i={PreCompact:3e3,PostToolUse:3e3},a={copilot:`hooks.json`,copilotCli:`hooks.json`,hermes:`hooks.json`},o=r;function s(e){if(!o.includes(e))throw Error(`Unknown platform: "${e}". Supported: ${o.join(`, `)}. Add it to SUPPORTED_PLATFORMS in exec-hooks.mjs first, then add entries to HOOK_EVENTS and HOOK_TOOL_MATCHERS. Add FILE_NAMES in generateHooks if file-producing.`);for(let[n,r]of Object.entries(t))if(!(e in r))throw Error(`Platform "${e}" is missing from HOOK_EVENTS.${n}. Add a "${e}" key to HOOK_EVENTS.${n} in exec-hooks.mjs.`);for(let[t,r]of Object.entries(n))if(!(e in r))throw Error(`Platform "${e}" is missing from HOOK_TOOL_MATCHERS.${t}. Add a "${e}" key to HOOK_TOOL_MATCHERS.${t} in exec-hooks.mjs.`)}function c(e,t){return(e.matcher||[]).flatMap(e=>{let r=n[e];if(!r)throw Error(`Unknown hook matcher: ${e}`);return r[t]||[]})}function l(e,t,n,r){let a=`${n}/${e.script}`;if(r===`claude`){let t=c(e,r);return{matcher:t.length>0?t.join(`|`):``,hooks:[{type:`command`,command:`node ${JSON.stringify(a)}`}]}}return r===`copilot`?{event:t,steps:[{type:`command`,command:`node`,args:[a],timeout:i[e.event]||5e3}]}:{command:`node`,args:[a]}}function u(n,r){s(n);let i={};for(let a of Object.values(e)){let e=t[a.event]?.[n];if(!e){console.warn(`[aikit] Unsupported hook event ${a.event} for ${n} — skipping`);continue}i[e]||=[],i[e].push(l(a,e,r,n))}return{hooks:i}}function d(n,r){if(s(n),n===`claude`)return[];if(n===`copilot`){let i=Object.values(e).flatMap(e=>{let i=t[e.event]?.[n];return i?l(e,i,r,n):(console.warn(`[aikit] Unsupported hook event ${e.event} for ${n} — skipping`),[])});return[{path:a[n],content:JSON.stringify({hooks:i},null,2)}]}if(!(n in a))throw Error(`Platform "${n}" is missing from FILE_NAMES. Add "${n}: '<filename>'" to FILE_NAMES in adapters/hooks.mjs.`);let i={};for(let a of Object.values(e)){let e=t[a.event]?.[n];if(!e){console.warn(`[aikit] Unsupported hook event ${a.event} for ${n} — skipping`);continue}i[e]||=[],i[e].push(l(a,e,r,n))}return[{path:a[n],content:JSON.stringify({hooks:i},null,2)}]}function f(){return[`_runtime.mjs`,...Object.values(e).map(e=>e.script)]}function p(){let t={PostToolUse:`tool:after`,SessionStart:`session:start`,Stop:`server:stop`},n={fileRead:[`read_file`,`readFile`,`Read`,`grep_search`,`semantic_search`],fileWrite:[`write_file`,`patch`,`editFiles`,`Edit`,`Write`,`MultiEdit`],fileSearch:[`search_files`,`grep_search`,`semantic_search`,`find`,`Bash`,`mcp_aikit_search`,`mcp_aikit_find`]};return Object.values(e).map(e=>{let r=t[e.event]||e.event.toLowerCase().replace(/([a-z])([A-Z])/g,`$1:$2`).replace(/^./,e=>e.toLowerCase()),i=(e.matcher||[]).flatMap(e=>n[e]||[]);return{id:`scaffold-${e.id}`,eventType:r,policy:`async`,name:e.id,toolFilter:i.length>0?i:void 0,description:e.description,llmBenefit:e.llmBenefit,category:e.category,failurePolicy:e.failurePolicy,executionModel:e.executionModel}})}export{u as buildHooksBlock,p as buildServerHookConfig,d as generateHooks,f as getHookScriptFiles};
1
+ import{EXEC_HOOKS as e,HOOK_EVENTS as t,HOOK_TOOL_MATCHERS as n,SUPPORTED_PLATFORMS as r}from"../definitions/exec-hooks.mjs";const i={PreCompact:3e3,PostToolUse:3e3},a={copilot:`hooks.json`,copilotCli:`hooks.json`,hermes:`hooks.json`},o=r;function s(e){if(!o.includes(e))throw Error(`Unknown platform: "${e}". Supported: ${o.join(`, `)}. Add it to SUPPORTED_PLATFORMS in exec-hooks.mjs first, then add entries to HOOK_EVENTS and HOOK_TOOL_MATCHERS. Add FILE_NAMES in generateHooks if file-producing.`);for(let[n,r]of Object.entries(t))if(!(e in r))throw Error(`Platform "${e}" is missing from HOOK_EVENTS.${n}. Add a "${e}" key to HOOK_EVENTS.${n} in exec-hooks.mjs.`);for(let[t,r]of Object.entries(n))if(!(e in r))throw Error(`Platform "${e}" is missing from HOOK_TOOL_MATCHERS.${t}. Add a "${e}" key to HOOK_TOOL_MATCHERS.${t} in exec-hooks.mjs.`)}function c(e,t){return!e.supportedPlatforms||e.supportedPlatforms.includes(t)}function l(e,t){return(e.matcher||[]).flatMap(e=>{let r=n[e];if(!r)throw Error(`Unknown hook matcher: ${e}`);return r[t]||[]})}function u(e,t,n,r){let a=`${n}/${e.script}`;if(r===`claude`){let t=l(e,r);return{matcher:t.length>0?t.join(`|`):``,hooks:[{type:`command`,command:`node ${JSON.stringify(a)}`}]}}return r===`copilot`?{event:t,steps:[{type:`command`,command:`node`,args:[a],timeout:i[e.event]||5e3}]}:{command:`node`,args:[a]}}function d(n,r){s(n);let i={};for(let a of Object.values(e)){if(!c(a,n))continue;let e=t[a.event]?.[n];if(!e){console.warn(`[aikit] Unsupported hook event ${a.event} for ${n} — skipping`);continue}i[e]||=[],i[e].push(u(a,e,r,n))}return{hooks:i}}function f(n,r){if(s(n),n===`claude`)return[];if(n===`copilot`){let i=Object.values(e).flatMap(e=>{if(!c(e,n))return[];let i=t[e.event]?.[n];return i?u(e,i,r,n):(console.warn(`[aikit] Unsupported hook event ${e.event} for ${n} — skipping`),[])});return[{path:a[n],content:JSON.stringify({hooks:i},null,2)}]}if(!(n in a))throw Error(`Platform "${n}" is missing from FILE_NAMES. Add "${n}: '<filename>'" to FILE_NAMES in adapters/hooks.mjs.`);let i={};for(let a of Object.values(e)){if(!c(a,n))continue;let e=t[a.event]?.[n];if(!e){console.warn(`[aikit] Unsupported hook event ${a.event} for ${n} — skipping`);continue}i[e]||=[],i[e].push(u(a,e,r,n))}return[{path:a[n],content:JSON.stringify({hooks:i},null,2)}]}function p(){return[`_runtime.mjs`,...Object.values(e).map(e=>e.script)]}function m(){let t={PostToolUse:`tool:after`,SessionStart:`session:start`,Stop:`server:stop`},n={fileRead:[`read_file`,`readFile`,`Read`,`grep_search`,`semantic_search`],fileWrite:[`write_file`,`patch`,`editFiles`,`Edit`,`Write`,`MultiEdit`],fileSearch:[`search_files`,`grep_search`,`semantic_search`,`find`,`Bash`,`mcp_aikit_search`,`mcp_aikit_find`]};return Object.values(e).map(e=>{let r=t[e.event]||e.event.toLowerCase().replace(/([a-z])([A-Z])/g,`$1:$2`).replace(/^./,e=>e.toLowerCase()),i=(e.matcher||[]).flatMap(e=>n[e]||[]);return{id:`scaffold-${e.id}`,eventType:r,policy:`async`,name:e.id,toolFilter:i.length>0?i:void 0,description:e.description,llmBenefit:e.llmBenefit,category:e.category,failurePolicy:e.failurePolicy,executionModel:e.executionModel}})}export{d as buildHooksBlock,m as buildServerHookConfig,f as generateHooks,p as getHookScriptFiles};