@vpxa/aikit 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/package.json +1 -1
- package/packages/aikit-client/dist/types.d.ts +3 -3
- package/packages/cli/dist/aikit-init.d.ts +1 -1
- package/packages/cli/dist/aikit-init.js +1 -1
- package/packages/cli/dist/commands/context-cmds.js +1 -1
- package/packages/cli/dist/commands/environment.js +1 -1
- package/packages/cli/dist/commands/init/config.d.ts +1 -1
- package/packages/cli/dist/commands/init/config.js +2 -2
- package/packages/cli/dist/commands/init/constants.d.ts +3 -3
- package/packages/cli/dist/commands/init/index.d.ts +4 -4
- package/packages/cli/dist/commands/init/index.js +4 -4
- package/packages/cli/dist/commands/init/templates.js +12 -12
- package/packages/cli/dist/commands/init/user.d.ts +3 -3
- package/packages/cli/dist/commands/init/user.js +2 -2
- package/packages/cli/dist/commands/search.js +1 -1
- package/packages/cli/dist/commands/system.js +4 -4
- package/packages/cli/dist/commands/upgrade.js +1 -1
- package/packages/cli/dist/commands/workspace.js +1 -1
- package/packages/cli/dist/helpers.js +1 -1
- package/packages/cli/dist/index.d.ts +1 -1
- package/packages/core/dist/constants.d.ts +3 -3
- package/packages/core/dist/global-registry.d.ts +7 -1
- package/packages/core/dist/global-registry.js +1 -1
- package/packages/core/dist/index.d.ts +2 -2
- package/packages/core/dist/index.js +1 -1
- package/packages/core/dist/types.d.ts +6 -2
- package/packages/dashboard/dist/assets/{index-BjA4YODs.js → index-CO2S9BKY.js} +2 -2
- package/packages/dashboard/dist/assets/index-CO2S9BKY.js.map +1 -0
- package/packages/dashboard/dist/index.html +2 -2
- package/packages/enterprise-bridge/dist/er-client.d.ts +1 -1
- package/packages/flows/dist/git.js +1 -1
- package/packages/flows/dist/registry.d.ts +3 -3
- package/packages/flows/dist/registry.js +1 -1
- package/packages/flows/dist/symlinks.js +1 -1
- package/packages/indexer/dist/filesystem-crawler.js +1 -1
- package/packages/indexer/dist/hash-cache.js +1 -1
- package/packages/indexer/dist/incremental-indexer.js +1 -1
- package/packages/kb-client/dist/direct-client.d.ts +37 -0
- package/packages/kb-client/dist/direct-client.js +1 -0
- package/packages/kb-client/dist/index.d.ts +5 -0
- package/packages/kb-client/dist/index.js +1 -0
- package/packages/kb-client/dist/mcp-client.d.ts +19 -0
- package/packages/kb-client/dist/mcp-client.js +4 -0
- package/packages/kb-client/dist/parsers.d.ts +35 -0
- package/packages/kb-client/dist/parsers.js +2 -0
- package/packages/kb-client/dist/types.d.ts +62 -0
- package/packages/kb-client/dist/types.js +1 -0
- package/packages/present/dist/index.html +28 -28
- package/packages/server/dist/background-task.d.ts +47 -0
- package/packages/server/dist/background-task.js +1 -0
- package/packages/server/dist/config.js +1 -1
- package/packages/server/dist/idle-timer.d.ts +33 -0
- package/packages/server/dist/idle-timer.js +1 -0
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/memory-monitor.d.ts +37 -0
- package/packages/server/dist/memory-monitor.js +1 -0
- package/packages/server/dist/prompts.js +5 -5
- package/packages/server/dist/resource-links.d.ts +1 -1
- package/packages/server/dist/resource-links.js +1 -1
- package/packages/server/dist/resources/curated-resources.d.ts +2 -2
- package/packages/server/dist/resources/curated-resources.js +2 -2
- package/packages/server/dist/resources/resource-notifier.d.ts +1 -1
- package/packages/server/dist/resources/resource-notifier.js +1 -1
- package/packages/server/dist/resources/resources.js +1 -1
- package/packages/server/dist/server.d.ts +4 -2
- package/packages/server/dist/server.js +3 -3
- package/packages/server/dist/tool-metadata.d.ts +1 -1
- package/packages/server/dist/tool-metadata.js +1 -1
- package/packages/server/dist/tool-timeout.d.ts +27 -0
- package/packages/server/dist/tool-timeout.js +1 -0
- package/packages/server/dist/tools/bridge.tools.d.ts +1 -1
- package/packages/server/dist/tools/bridge.tools.js +3 -3
- package/packages/server/dist/tools/config.tool.d.ts +8 -0
- package/packages/server/dist/tools/config.tool.js +12 -0
- package/packages/server/dist/tools/evolution.tools.js +1 -1
- package/packages/server/dist/tools/flow.tools.js +1 -1
- package/packages/server/dist/tools/infra.tools.js +1 -1
- package/packages/server/dist/tools/onboard.tool.js +1 -1
- package/packages/server/dist/tools/present/browser.js +9 -9
- package/packages/server/dist/tools/present/tool.js +4 -4
- package/packages/server/dist/tools/reindex.tool.js +1 -1
- package/packages/server/dist/tools/search.tool.js +4 -4
- package/packages/server/dist/tools/status.tool.d.ts +1 -1
- package/packages/server/dist/tools/status.tool.js +3 -3
- package/packages/store/dist/sqlite-graph-store.d.ts +3 -0
- package/packages/store/dist/sqlite-graph-store.js +3 -3
- package/packages/tools/dist/checkpoint.js +1 -1
- package/packages/tools/dist/config-extractor.js +1 -1
- package/packages/tools/dist/evidence-map.js +1 -1
- package/packages/tools/dist/find.d.ts +1 -1
- package/packages/tools/dist/forge-ground.d.ts +1 -1
- package/packages/tools/dist/guide.js +1 -1
- package/packages/tools/dist/lane.js +1 -1
- package/packages/tools/dist/onboard.d.ts +2 -2
- package/packages/tools/dist/onboard.js +2 -2
- package/packages/tools/dist/queue.js +1 -1
- package/packages/tools/dist/replay.js +1 -1
- package/packages/tools/dist/response-envelope.d.ts +1 -1
- package/packages/tools/dist/restore-points.js +1 -1
- package/packages/tools/dist/schema-validate.js +1 -1
- package/packages/tools/dist/snippet.js +1 -1
- package/packages/tools/dist/stash.js +1 -1
- package/packages/tools/dist/synthesis-engine.js +2 -2
- package/packages/tools/dist/workset.js +1 -1
- package/packages/tui/dist/{App-DU2KEylW.js → App-DpjN3iS-.js} +1 -1
- package/packages/tui/dist/App.d.ts +1 -1
- package/packages/tui/dist/App.js +1 -1
- package/packages/tui/dist/LogPanel-Db-SeZhR.js +3 -0
- package/packages/tui/dist/hooks/useKBClient.d.ts +1 -1
- package/packages/tui/dist/{index-BXafekwr.d.ts → index-MXJeXmCf.d.ts} +3 -3
- package/packages/tui/dist/index.d.ts +1 -1
- package/packages/tui/dist/index.js +1 -1
- package/packages/tui/dist/panels/LogPanel.js +1 -1
- package/scaffold/README.md +192 -192
- package/scaffold/definitions/bodies.mjs +16 -16
- package/scaffold/definitions/plugins.mjs +1 -1
- package/scaffold/definitions/prompts.mjs +6 -6
- package/scaffold/definitions/protocols.mjs +12 -12
- package/scaffold/definitions/tools.mjs +1 -1
- package/scaffold/flows/aikit-advanced/skills/execute/SKILL.md +124 -124
- package/scaffold/flows/aikit-advanced/skills/plan/SKILL.md +100 -100
- package/scaffold/flows/aikit-advanced/skills/spec/SKILL.md +100 -100
- package/scaffold/flows/aikit-advanced/skills/task/SKILL.md +99 -99
- package/scaffold/flows/aikit-advanced/skills/verify/SKILL.md +122 -122
- package/scaffold/flows/aikit-basic/skills/assess/SKILL.md +82 -82
- package/scaffold/flows/aikit-basic/skills/implement/SKILL.md +105 -105
- package/scaffold/flows/aikit-basic/skills/verify/SKILL.md +96 -96
- package/scaffold/general/agents/Debugger.agent.md +2 -2
- package/scaffold/general/agents/Documenter.agent.md +2 -2
- package/scaffold/general/agents/Explorer.agent.md +2 -2
- package/scaffold/general/agents/Frontend.agent.md +1 -1
- package/scaffold/general/agents/Implementer.agent.md +2 -2
- package/scaffold/general/agents/Orchestrator.agent.md +1 -1
- package/scaffold/general/agents/Planner.agent.md +2 -2
- package/scaffold/general/agents/Refactor.agent.md +2 -2
- package/scaffold/general/agents/Security.agent.md +2 -2
- package/scaffold/general/agents/_shared/architect-reviewer-base.md +1 -1
- package/scaffold/general/agents/_shared/code-agent-base.md +6 -6
- package/scaffold/general/agents/_shared/code-reviewer-base.md +1 -1
- package/scaffold/general/agents/_shared/forge-protocol.md +1 -1
- package/scaffold/general/agents/_shared/researcher-base.md +3 -3
- package/scaffold/general/prompts/ask.prompt.md +4 -4
- package/scaffold/general/prompts/debug.prompt.md +1 -1
- package/scaffold/general/prompts/plan.prompt.md +1 -1
- package/scaffold/general/skills/aikit/SKILL.md +5 -5
- package/scaffold/general/skills/multi-agents-development/SKILL.md +435 -435
- package/scaffold/general/skills/present/SKILL.md +424 -424
- package/packages/dashboard/dist/assets/index-BjA4YODs.js.map +0 -1
- package/packages/tui/dist/LogPanel-Bo8a8QXB.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region packages/tools/src/response-envelope.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Standardized response envelope for
|
|
3
|
+
* Standardized response envelope for AI Kit tools (E-009).
|
|
4
4
|
* New tools should return KBResponse<T>. Existing tools can adopt gradually.
|
|
5
5
|
*/
|
|
6
6
|
interface KBNextHint {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeFile as e}from"node:fs/promises";import{dirname as t,join as n}from"node:path";import{existsSync as r,mkdirSync as i,readFileSync as a,readdirSync as o,unlinkSync as s,writeFileSync as c}from"node:fs";import{AIKIT_PATHS as l}from"../../core/dist/index.js";const u=l.restorePoints;function d(){let e=n(process.cwd(),u);return r(e)||i(e,{recursive:!0}),e}function f(e,t,r){let i=d(),a=`${Date.now()}-${e}`,l={id:a,timestamp:new Date().toISOString(),operation:e,files:t,description:r};c(n(i,`${a}.json`),`${JSON.stringify(l,null,2)}\n`,`utf-8`);let u=o(i).filter(e=>e.endsWith(`.json`)).sort();for(;u.length>50;){let e=u.shift();if(!e)break;try{s(n(i,e))}catch{}}return a}function p(){let e=n(process.cwd(),u);return r(e)?o(e).filter(e=>e.endsWith(`.json`)).sort().reverse().map(t=>JSON.parse(a(n(e,t),`utf-8`))):[]}async function m(o){let s=n(n(process.cwd(),u),`${o}.json`);if(!r(s))throw Error(`Restore point not found: ${o}`);let c=JSON.parse(a(s,`utf-8`)),l=[];for(let n of c.files){let a=t(n.path);r(a)||i(a,{recursive:!0}),await e(n.path,n.content,`utf-8`),l.push(n.path)}return l}export{f as createRestorePoint,p as listRestorePoints,m as restoreFromPoint};
|
|
1
|
+
import{writeFile as e}from"node:fs/promises";import{dirname as t,join as n}from"node:path";import{existsSync as r,mkdirSync as i,readFileSync as a,readdirSync as o,unlinkSync as s,writeFileSync as c}from"node:fs";import{AIKIT_PATHS as l}from"../../core/dist/index.js";const u=l.restorePoints;function d(){let e=n(process.cwd(),u);return r(e)||i(e,{recursive:!0}),e}function f(e,t,r){let i=d(),a=`${Date.now()}-${e}`,l={id:a,timestamp:new Date().toISOString(),operation:e,files:t,description:r};c(n(i,`${a}.json`),`${JSON.stringify(l,null,2)}\n`,`utf-8`);let u=o(i).filter(e=>e.endsWith(`.json`)).sort();for(;u.length>50;){let e=u.shift();if(!e)break;try{s(n(i,e))}catch{}}return a}function p(){let e=n(process.cwd(),u);return r(e)?o(e).filter(e=>e.endsWith(`.json`)).sort().reverse().map(t=>{try{return JSON.parse(a(n(e,t),`utf-8`))}catch(r){return console.debug(`Skipping corrupt restore point ${n(e,t)}: ${r instanceof Error?r.message:String(r)}`),null}}).filter(e=>e!==null):[]}async function m(o){let s=n(n(process.cwd(),u),`${o}.json`);if(!r(s))throw Error(`Restore point not found: ${o}`);let c=JSON.parse(a(s,`utf-8`)),l=[];for(let n of c.files){let a=t(n.path);r(a)||i(a,{recursive:!0}),await e(n.path,n.content,`utf-8`),l.push(n.path)}return l}export{f as createRestorePoint,p as listRestorePoints,m as restoreFromPoint};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){let n=[];return t(e.data,e.schema,`$`,n),{valid:n.length===0,errors:n}}function t(e,i,a,o){if(`type`in i){let t=i.type;if(!n(e,t)){o.push({path:a,message:`Expected type "${t}"`,expected:t,received:r(e)});return}}if(`enum`in i){let t=i.enum;t.some(t=>JSON.stringify(t)===JSON.stringify(e))||o.push({path:a,message:`Must be one of: ${JSON.stringify(t)}`,received:JSON.stringify(e)})}if(`const`in i&&JSON.stringify(e)!==JSON.stringify(i.const)&&o.push({path:a,message:`Must equal ${JSON.stringify(i.const)}`,received:JSON.stringify(e)}),typeof e==`string`&&(`minLength`in i&&e.length<i.minLength&&o.push({path:a,message:`String too short (min: ${i.minLength})`,received:`length ${e.length}`}),`maxLength`in i&&e.length>i.maxLength&&o.push({path:a,message:`String too long (max: ${i.maxLength})`,received:`length ${e.length}`}),`pattern`in i
|
|
1
|
+
function e(e){let n=[];return t(e.data,e.schema,`$`,n),{valid:n.length===0,errors:n}}function t(e,i,a,o){if(`type`in i){let t=i.type;if(!n(e,t)){o.push({path:a,message:`Expected type "${t}"`,expected:t,received:r(e)});return}}if(`enum`in i){let t=i.enum;t.some(t=>JSON.stringify(t)===JSON.stringify(e))||o.push({path:a,message:`Must be one of: ${JSON.stringify(t)}`,received:JSON.stringify(e)})}if(`const`in i&&JSON.stringify(e)!==JSON.stringify(i.const)&&o.push({path:a,message:`Must equal ${JSON.stringify(i.const)}`,received:JSON.stringify(e)}),typeof e==`string`&&(`minLength`in i&&e.length<i.minLength&&o.push({path:a,message:`String too short (min: ${i.minLength})`,received:`length ${e.length}`}),`maxLength`in i&&e.length>i.maxLength&&o.push({path:a,message:`String too long (max: ${i.maxLength})`,received:`length ${e.length}`}),`pattern`in i))try{new RegExp(i.pattern).test(e)||o.push({path:a,message:`Does not match pattern: ${i.pattern}`})}catch(e){o.push({path:a,message:`Invalid pattern: ${e instanceof Error?e.message:String(e)}`})}if(typeof e==`number`&&(`minimum`in i&&e<i.minimum&&o.push({path:a,message:`Below minimum (${i.minimum})`,received:String(e)}),`maximum`in i&&e>i.maximum&&o.push({path:a,message:`Above maximum (${i.maximum})`,received:String(e)})),Array.isArray(e)&&(`minItems`in i&&e.length<i.minItems&&o.push({path:a,message:`Too few items (min: ${i.minItems})`,received:`length ${e.length}`}),`maxItems`in i&&e.length>i.maxItems&&o.push({path:a,message:`Too many items (max: ${i.maxItems})`,received:`length ${e.length}`}),`items`in i))for(let n=0;n<e.length;n++)t(e[n],i.items,`${a}[${n}]`,o);if(e&&typeof e==`object`&&!Array.isArray(e)){let n=e;if(`required`in i)for(let e of i.required)e in n||o.push({path:`${a}.${e}`,message:`Required property missing`});if(`properties`in i){let e=i.properties;for(let[r,i]of Object.entries(e))r in n&&t(n[r],i,`${a}.${r}`,o)}if(`additionalProperties`in i&&i.additionalProperties===!1){let e=Object.keys(i.properties??{});for(let t of Object.keys(n))e.includes(t)||o.push({path:`${a}.${t}`,message:`Additional property not allowed`})}}}function n(e,t){switch(t){case`string`:return typeof e==`string`;case`number`:return typeof e==`number`&&!Number.isNaN(e);case`integer`:return typeof e==`number`&&Number.isInteger(e);case`boolean`:return typeof e==`boolean`;case`null`:return e===null;case`array`:return Array.isArray(e);case`object`:return typeof e==`object`&&!!e&&!Array.isArray(e);default:return!0}}function r(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}export{e as schemaValidate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as e}from"node:path";import{existsSync as t,mkdirSync as n,readFileSync as r,readdirSync as i,
|
|
1
|
+
import{join as e}from"node:path";import{existsSync as t,mkdirSync as n,readFileSync as r,readdirSync as i,renameSync as a,unlinkSync as o,writeFileSync as s}from"node:fs";import{resolveStateDir as c}from"../../core/dist/index.js";const l=()=>e(c(process.cwd()),`snippets`);function u(){let e=l();return t(e)||n(e,{recursive:!0}),e}function d(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,`_`);if(!t)throw Error(`Invalid snippet name`);return t}function f(n){switch(n.action){case`save`:{if(!n.name||!n.code)throw Error(`name and code required for save`);let i=e(u(),`${d(n.name)}.json`),o=null;if(t(i))try{o=JSON.parse(r(i,`utf8`))}catch(e){e?.code!==`ENOENT`&&console.warn(`Corrupt state file ${i}: ${e instanceof Error?e.message:String(e)}`),o=null}let c=new Date().toISOString(),l={name:n.name,language:n.language??`text`,code:n.code,tags:n.tags??[],created:o?.created??c,updated:c},f=`${i}.tmp`;return s(f,JSON.stringify(l,null,2)),a(f,i),l}case`get`:{if(!n.name)throw Error(`name required for get`);let i=e(l(),`${d(n.name)}.json`);if(!t(i))throw Error(`Snippet not found: ${n.name}`);try{return JSON.parse(r(i,`utf8`))}catch(e){throw e?.code!==`ENOENT`&&console.warn(`Corrupt state file ${i}: ${e instanceof Error?e.message:String(e)}`),Error(`Snippet corrupted: ${n.name}`)}}case`list`:{let t=u();return{snippets:i(t).filter(e=>e.endsWith(`.json`)).flatMap(n=>{let i=e(t,n);try{let e=JSON.parse(r(i,`utf8`));return[{name:e.name,language:e.language,tags:e.tags,updated:e.updated}]}catch(e){return e?.code!==`ENOENT`&&console.warn(`Corrupt state file ${i}: ${e instanceof Error?e.message:String(e)}`),[]}})}}case`search`:{if(!n.query)throw Error(`query required for search`);let t=n.query.toLowerCase(),a=u();return{snippets:i(a).filter(e=>e.endsWith(`.json`)).flatMap(t=>{let n=e(a,t);try{return[JSON.parse(r(n,`utf8`))]}catch(e){return e?.code!==`ENOENT`&&console.warn(`Corrupt state file ${n}: ${e instanceof Error?e.message:String(e)}`),[]}}).filter(e=>e.name.toLowerCase().includes(t)||e.tags.some(e=>e.toLowerCase().includes(t))||e.language.toLowerCase().includes(t)||e.code.toLowerCase().includes(t)).map(e=>({name:e.name,language:e.language,tags:e.tags,updated:e.updated}))}}case`delete`:{if(!n.name)throw Error(`name required for delete`);let r=e(l(),`${d(n.name)}.json`);return t(r)?(o(r),{deleted:!0}):{deleted:!1}}default:throw Error(`Unknown action: ${n.action}`)}}export{f as snippet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as
|
|
1
|
+
import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,renameSync as a,writeFileSync as o}from"node:fs";import{resolveStateDir as s}from"../../core/dist/index.js";function c(e){return t(s(e??process.cwd()),`stash.json`)}function l(e){let t=c(e);if(!n(t))return{};try{let e=i(t,`utf-8`);return JSON.parse(e)}catch(e){return e?.code===`ENOENT`||console.warn(`Corrupt state file ${t}: ${e instanceof Error?e.message:String(e)}`),{}}}function u(t,i){let s=c(i),l=e(s);n(l)||r(l,{recursive:!0});let u=`${s}.tmp`;o(u,`${JSON.stringify(t,null,2)}\n`,`utf-8`),a(u,s)}function d(e,t,n){let r=l(n),i={key:e,value:t,type:typeof t,storedAt:new Date().toISOString()};return r[e]=i,u(r,n),i}function f(e,t){return l(t)[e]}function p(e){return Object.values(l(e))}function m(e,t){let n=l(t);return e in n?(delete n[e],u(n,t),!0):!1}function h(e){let t=l(e),n=Object.keys(t).length;return u({},e),n}export{h as stashClear,m as stashDelete,f as stashGet,p as stashList,d as stashSet};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{getPackageKey as e,isTestPath as t,resolveExtensionlessPath as n}from"./onboard-utils.js";const r={structure:`Project Structure`,dependencies:`Dependencies`,"entry-points":`Entry Points`,symbols:`Symbols`,patterns:`Patterns`,diagram:`C4 Container Diagram`,"code-map":`Code Map (Module Graph)`,"config-values":`Configuration Values`,"synthesis-guide":`Synthesis Guide`};function i(e,t,n,i){let a=[`Analysis baselines for **${n}** have been generated.`];t===`generate`?a.push("Individual results are in the sibling `.md` and `.json` files in this directory.",``):a.push(`Results are stored in the
|
|
2
|
-
`);let S=e.filter(e=>e.status===`success`),C=e.filter(e=>e.status===`failed`);a.push(`### Completed Analyses`,``);for(let e of S){let n=r[e.name]??e.name,i=e.output.length>1e3?`${Math.round(e.output.length/1024)}KB`:`${e.output.length}B`;t===`generate`?a.push(`- ✓ [${n}](./${e.name}.md) (${i})`):a.push(`- ✓ ${n} (${i})`)}if(C.length>0){a.push(``,`### Failed Analyses`,``);for(let e of C)a.push(`- ✗ ${e.name}: ${e.error}`)}a.push(``,`### Recommended Reading Order`,``,"1. **Start with** `synthesis-guide.md` (this file) → `entry-points.md` → `patterns.md`","2. **Module graph** via `code-map.md` — cross-package call edges with function names","3. **Architecture** via `diagram.md` (C4 Container) → `dependencies.md`","4. **Browse structure** via `structure.md` for file layout","5. **API surface** via `symbols.md` — file paths + exported symbols (capped at 80KB)","6. **Reference**: `config-values.md` (config reference)",``,`> **Size guidance:** Total output is ~`);let w=S.reduce((e,t)=>e+t.output.length,0)/1024;return a[a.length-1]+=`${Math.round(w)}KB. Focus on code-map.md + entry-points.md + diagram.md (~${Math.round((S.find(e=>e.name===`code-map`)?.output.length??0)/1024+(S.find(e=>e.name===`entry-points`)?.output.length??0)/1024+(S.find(e=>e.name===`diagram`)?.output.length??0)/1024)}KB) for maximum signal-to-token ratio.`,a.push(``,`### Synthesize Knowledge`,``,"Produce the following `aikit_remember` entries:",``),a.push("1. **Architecture Summary** (category: `architecture`)"),x?(a.push(` - Package boundaries, dependency graph between packages`),a.push(` - Shared vs service-specific code`)):v?(a.push(` - Lambda functions, triggers, event flow`),a.push(` - Infrastructure patterns (queues, tables, APIs)`)):h?(a.push(` - Controller → Service → Repository layers`),a.push(` - Spring configuration and profiles`)):(a.push(` - Layer structure, dependency flow`),a.push(` - Key design decisions`)),a.push(``),a.push("2. **Domain Model** (category: `architecture`)"),a.push(` - Key entities/types and their relationships`),a.push(` - Data flow from entry points through processing`),a.push(``),a.push("3. **Conventions** (category: `conventions`)"),a.push(` - Naming patterns, file organization, testing approach`),g&&a.push(` - CDK construct patterns and stack organization`),b&&a.push(` - Build tooling, package manager, module system`),_&&a.push(` - Maven module structure, dependency management`),a.push(``,`### Using
|
|
1
|
+
import{getPackageKey as e,isTestPath as t,resolveExtensionlessPath as n}from"./onboard-utils.js";const r={structure:`Project Structure`,dependencies:`Dependencies`,"entry-points":`Entry Points`,symbols:`Symbols`,patterns:`Patterns`,diagram:`C4 Container Diagram`,"code-map":`Code Map (Module Graph)`,"config-values":`Configuration Values`,"synthesis-guide":`Synthesis Guide`};function i(e,t,n,i){let a=[`Analysis baselines for **${n}** have been generated.`];t===`generate`?a.push("Individual results are in the sibling `.md` and `.json` files in this directory.",``):a.push(`Results are stored in the AI Kit vector store.`,``);let o=i.get(`symbols`),s=i.get(`dependencies`),c=i.get(`patterns`),l=i.get(`entry-points`),u=o?.totalCount??0,d=o?.exportedCount??0,f=s?.totalImports??0,p=l?.total??0,m=(c?.patterns??[]).map(e=>e.pattern),h=m.some(e=>e.startsWith(`Spring`)),g=m.includes(`AWS CDK`)||m.includes(`CDK IaC`),_=m.includes(`Maven`),v=m.includes(`Serverless`)||p>3,y=s?.external?Object.keys(s.external):[],b=y.some(e=>[`express`,`fastify`,`next`,`react`,`vitest`,`jest`].includes(e))||f>0,x=y.some(e=>[`turbo`,`lerna`,`nx`].includes(e))||m.includes(`Monorepo`);if(a.push(`### Project Profile`,``),a.push(`- **${u} symbols** (${d} exported), **${f} imports**, **${p} entry ${p===1?`point`:`points`}**`),m.length>0&&a.push(`- **Detected**: ${m.slice(0,8).join(`, `)}`),a.push(``),u===0&&f===0&&p===0)return a.push(`> **Note:** This project appears to be empty or contains no analyzable source code.`,`> Run onboard again after adding source files.`),a.join(`
|
|
2
|
+
`);let S=e.filter(e=>e.status===`success`),C=e.filter(e=>e.status===`failed`);a.push(`### Completed Analyses`,``);for(let e of S){let n=r[e.name]??e.name,i=e.output.length>1e3?`${Math.round(e.output.length/1024)}KB`:`${e.output.length}B`;t===`generate`?a.push(`- ✓ [${n}](./${e.name}.md) (${i})`):a.push(`- ✓ ${n} (${i})`)}if(C.length>0){a.push(``,`### Failed Analyses`,``);for(let e of C)a.push(`- ✗ ${e.name}: ${e.error}`)}a.push(``,`### Recommended Reading Order`,``,"1. **Start with** `synthesis-guide.md` (this file) → `entry-points.md` → `patterns.md`","2. **Module graph** via `code-map.md` — cross-package call edges with function names","3. **Architecture** via `diagram.md` (C4 Container) → `dependencies.md`","4. **Browse structure** via `structure.md` for file layout","5. **API surface** via `symbols.md` — file paths + exported symbols (capped at 80KB)","6. **Reference**: `config-values.md` (config reference)",``,`> **Size guidance:** Total output is ~`);let w=S.reduce((e,t)=>e+t.output.length,0)/1024;return a[a.length-1]+=`${Math.round(w)}KB. Focus on code-map.md + entry-points.md + diagram.md (~${Math.round((S.find(e=>e.name===`code-map`)?.output.length??0)/1024+(S.find(e=>e.name===`entry-points`)?.output.length??0)/1024+(S.find(e=>e.name===`diagram`)?.output.length??0)/1024)}KB) for maximum signal-to-token ratio.`,a.push(``,`### Synthesize Knowledge`,``,"Produce the following `aikit_remember` entries:",``),a.push("1. **Architecture Summary** (category: `architecture`)"),x?(a.push(` - Package boundaries, dependency graph between packages`),a.push(` - Shared vs service-specific code`)):v?(a.push(` - Lambda functions, triggers, event flow`),a.push(` - Infrastructure patterns (queues, tables, APIs)`)):h?(a.push(` - Controller → Service → Repository layers`),a.push(` - Spring configuration and profiles`)):(a.push(` - Layer structure, dependency flow`),a.push(` - Key design decisions`)),a.push(``),a.push("2. **Domain Model** (category: `architecture`)"),a.push(` - Key entities/types and their relationships`),a.push(` - Data flow from entry points through processing`),a.push(``),a.push("3. **Conventions** (category: `conventions`)"),a.push(` - Naming patterns, file organization, testing approach`),g&&a.push(` - CDK construct patterns and stack organization`),b&&a.push(` - Build tooling, package manager, module system`),_&&a.push(` - Maven module structure, dependency management`),a.push(``,`### Using AI Kit Tools`,``,`This project has an AI Kit MCP server with tools for search, analysis, memory, and more.`,"`aikit init` has already created `.github/copilot-instructions.md` and `AGENTS.md` with the complete tool reference.","If not, run `npx @vpxa/aikit init` to generate them.",``,`**Workflow pattern — use on every task:**`,``,"```",`aikit_search({ query: "your task keywords" }) # Recall prior decisions`,`aikit_scope_map({ task: "what you are doing" }) # Get a reading plan`,`# ... do the work ...`,`aikit_check({}) # Typecheck + lint`,`aikit_test_run({}) # Run tests`,`aikit_remember({ title: "What I learned", category: "decisions" }) # Persist`,"```"),a.join(`
|
|
3
3
|
`)}function a(r,i,a){let o=r.get(`dependencies`),s=r.get(`symbols`),c=r.get(`entry-points`),l=[`## Code Map: ${i}\n`];if(!o&&!s)return l.push(`No dependency or symbol data available.`),l.join(`
|
|
4
4
|
`);let u=o?.reverseGraph??{},d=s?.symbols??[],f=c?.entryPoints??[],p=new Map;for(let e of d){if(!e.exported)continue;let n=e.filePath.replace(/\\/g,`/`);if(t(n))continue;let r=p.get(n);r?r.push({name:e.name,kind:e.kind}):p.set(n,[{name:e.name,kind:e.kind}])}let m=new Map;for(let[e,r]of Object.entries(u)){let i=n(e.replace(/\\/g,`/`),p),a=r.map(e=>e.replace(/\\/g,`/`)).filter(e=>!t(e));if(a.length===0)continue;let o=m.get(i);if(o)for(let e of a)o.add(e);else m.set(i,new Set(a))}let h=new Map;for(let e of f)h.set(e.filePath.replace(/\\/g,`/`),{name:e.name,trigger:e.trigger});let g=new Map,_=new Map;if(a)for(let[n,r]of a){if(t(n))continue;let i=e(n);for(let[a,o]of r){if(t(a)||i===e(a))continue;let r=g.get(n);r||(r=new Map,g.set(n,r)),r.set(a,o);let s=_.get(a),c={file:n,symbols:o};s?s.push(c):_.set(a,[c])}}let v=new Set;for(let e of h.keys())v.add(e);for(let e of g.keys())v.add(e);for(let e of _.keys())v.add(e);if(!a)for(let e of p.keys()){let t=m.get(e);t&&t.size>=3&&v.add(e)}let y=new Map;for(let t of v){let n=e(t),r=y.get(n);r?r.push(t):y.set(n,[t])}let b=[...y.entries()].sort((e,t)=>e[0].localeCompare(t[0])),x=a?`AST call graph`:`import analysis`,S=a?`, ${g.size} cross-package callers`:``;l.push(`**${v.size} key modules** (${x}${S})\n`),l.push(`**Legend:** ⚡ Entry point | 📤 Exports | → Calls (outgoing) | ← Called by (incoming) | ➡ Used by (import)
|
|
5
5
|
`);for(let[e,n]of b){n.sort(),l.push(`### ${e}/\n`);for(let r of n){let n=p.get(r),i=h.get(r),o=g.get(r),s=_.get(r),c=m.get(r),u=r.startsWith(`${e}/`)?r.slice(e.length+1):r;if(l.push(`**${u}**`),i&&l.push(` ⚡ Entry: \`${i.name}\`${i.trigger?` (${i.trigger})`:``}`),n&&n.length>0){let e=n.slice(0,8).map(e=>`${e.name}`).join(`, `),t=n.length>8?` (+${n.length-8})`:``;l.push(` 📤 ${e}${t}`)}if(o&&o.size>0){let t=[...o.entries()].sort((e,t)=>t[1].length-e[1].length);for(let[n,r]of t.slice(0,4)){let t=n.startsWith(`${e}/`)?n.slice(e.length+1):n;l.push(` → ${t}: ${r.slice(0,5).join(`, `)}${r.length>5?`…`:``}`)}t.length>4&&l.push(` → +${t.length-4} more targets`)}if(s&&s.length>0){for(let t of s.slice(0,4)){let n=t.file.startsWith(`${e}/`)?t.file.slice(e.length+1):t.file;l.push(` ← ${n}: ${t.symbols.slice(0,4).join(`, `)}${t.symbols.length>4?`…`:``}`)}s.length>4&&l.push(` ← +${s.length-4} more callers`)}else if(!a&&c&&c.size>0){let e=[...c].filter(e=>!t(e));e.length<=3?l.push(` ➡ Used by: ${e.join(`, `)}`):l.push(` ➡ Used by: ${e.slice(0,3).join(`, `)} (+${e.length-3} more)`)}l.push(``)}}return l.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as
|
|
1
|
+
import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,renameSync as a,writeFileSync as o}from"node:fs";import{resolveStateDir as s}from"../../core/dist/index.js";function c(e){return t(s(e??process.cwd()),`worksets.json`)}function l(e){let t=c(e);if(!n(t))return{worksets:{}};try{let e=i(t,`utf-8`);return JSON.parse(e)}catch(e){return e?.code===`ENOENT`||console.warn(`Corrupt state file ${t}: ${e instanceof Error?e.message:String(e)}`),{worksets:{}}}}function u(t,i){let s=c(i),l=e(s);n(l)||r(l,{recursive:!0});let u=`${s}.tmp`;o(u,`${JSON.stringify(t,null,2)}\n`,`utf-8`),a(u,s)}function d(e,t,n){let r=l(n?.cwd),i=new Date().toISOString(),a=r.worksets[e],o={name:e,files:t,created:a?.created??i,updated:i,description:n?.description??a?.description};return r.worksets[e]=o,u(r,n?.cwd),o}function f(e,t){return l(t).worksets[e]??null}function p(e){let t=l(e);return Object.values(t.worksets).sort((e,t)=>new Date(t.updated).getTime()-new Date(e.updated).getTime())}function m(e,t){let n=l(t);return n.worksets[e]?(delete n.worksets[e],u(n,t),!0):!1}function h(e,t,n){let r=l(n).worksets[e]?.files??[];return d(e,[...new Set([...r,...t])],{cwd:n})}function g(e,t,n){let r=l(n).worksets[e];if(!r)return null;let i=new Set(t);return d(e,r.files.filter(e=>!i.has(e)),{cwd:n})}export{h as addToWorkset,m as deleteWorkset,f as getWorkset,p as listWorksets,g as removeFromWorkset,d as saveWorkset};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{r as e}from"./chunk-D6axbAb-.js";import{t}from"./react-D__J1GQe.js";import{a as n,i as r,n as i,t as a}from"./jsx-runtime-y6Gdq5PZ.js";import{t as o}from"./useKBClient-C35iA4uG.js";import{t as s}from"./StatusPanel-BAbUxyqQ.js";import{t as c}from"./SearchPanel-CpJGczAc.js";import{t as l}from"./CuratedPanel-BIamXLNy.js";import{t as u}from"./LogPanel-
|
|
2
|
+
import{r as e}from"./chunk-D6axbAb-.js";import{t}from"./react-D__J1GQe.js";import{a as n,i as r,n as i,t as a}from"./jsx-runtime-y6Gdq5PZ.js";import{t as o}from"./useKBClient-C35iA4uG.js";import{t as s}from"./StatusPanel-BAbUxyqQ.js";import{t as c}from"./SearchPanel-CpJGczAc.js";import{t as l}from"./CuratedPanel-BIamXLNy.js";import{t as u}from"./LogPanel-Db-SeZhR.js";var d=e(t()),f=a();const p=[`status`,`search`,`curated`,`log`];function m({client:e}){let[t,a]=(0,d.useState)(`status`);return i((e,n)=>{n.tab&&a(p[(p.indexOf(t)+1)%p.length]),e===`1`&&a(`status`),e===`2`&&a(`search`),e===`3`&&a(`curated`),e===`4`&&a(`log`)}),(0,f.jsx)(o,{value:e,children:(0,f.jsxs)(n,{flexDirection:`column`,width:`100%`,children:[(0,f.jsxs)(n,{borderStyle:`single`,paddingX:1,children:[(0,f.jsx)(r,{bold:!0,color:`cyan`,children:`AI Kit Dashboard`}),(0,f.jsx)(r,{children:` │ `}),p.map(e=>(0,f.jsxs)(d.Fragment,{children:[(0,f.jsxs)(r,{color:e===t?`green`:`gray`,bold:e===t,children:[`[`,p.indexOf(e)+1,`] `,e]}),(0,f.jsx)(r,{children:` `})]},e)),(0,f.jsx)(r,{color:`gray`,children:` │ Tab: switch │ Ctrl+C: quit`})]}),(0,f.jsxs)(n,{flexGrow:1,minHeight:10,children:[t===`status`&&(0,f.jsx)(s,{}),t===`search`&&(0,f.jsx)(c,{}),t===`curated`&&(0,f.jsx)(l,{}),t===`log`&&(0,f.jsx)(u,{})]})]})})}export{m as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import { t as IKBClient } from "./index-
|
|
2
|
+
import { t as IKBClient } from "./index-MXJeXmCf.js";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region packages/tui/src/App.d.ts
|
package/packages/tui/dist/App.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{t as e}from"./App-
|
|
2
|
+
import{t as e}from"./App-DpjN3iS-.js";export{e as App};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{r as e}from"./chunk-D6axbAb-.js";import{t}from"./react-D__J1GQe.js";import{a as n,i as r,t as i}from"./jsx-runtime-y6Gdq5PZ.js";import{homedir as a}from"node:os";import{exec as o,execFile as s}from"node:child_process";import{appendFileSync as c,closeSync as l,constants as u,existsSync as d,mkdirSync as f,openSync as p,readFileSync as m,readdirSync as h,renameSync as g,statSync as _,unlinkSync as v,writeFileSync as y}from"node:fs";import{basename as ee,dirname as b,join as x,resolve as S}from"node:path";import{promisify as C}from"node:util";import{fileURLToPath as w}from"node:url";import{createHash as T}from"node:crypto";import"turndown";C(o),x(b(w(import.meta.url)),`..`,`..`,`wasm`),new Set(Object.keys({".ts":`tree-sitter-typescript.wasm`,".tsx":`tree-sitter-typescript.wasm`,".mts":`tree-sitter-typescript.wasm`,".cts":`tree-sitter-typescript.wasm`,".js":`tree-sitter-javascript.wasm`,".jsx":`tree-sitter-javascript.wasm`,".mjs":`tree-sitter-javascript.wasm`,".cjs":`tree-sitter-javascript.wasm`,".py":`tree-sitter-python.wasm`,".go":`tree-sitter-go.wasm`,".rs":`tree-sitter-rust.wasm`,".java":`tree-sitter-java.wasm`,".kt":`tree-sitter-kotlin.wasm`,".kts":`tree-sitter-kotlin.wasm`,".scala":`tree-sitter-scala.wasm`,".sc":`tree-sitter-scala.wasm`,".c":`tree-sitter-c.wasm`,".h":`tree-sitter-c.wasm`,".cpp":`tree-sitter-cpp.wasm`,".cc":`tree-sitter-cpp.wasm`,".cxx":`tree-sitter-cpp.wasm`,".hpp":`tree-sitter-cpp.wasm`,".hxx":`tree-sitter-cpp.wasm`,".cs":`tree-sitter-c_sharp.wasm`,".swift":`tree-sitter-swift.wasm`,".rb":`tree-sitter-ruby.wasm`,".php":`tree-sitter-php.wasm`}));const E={ai:`.ai`,aiKb:`.ai/kb`,aiCurated:`.ai/curated`,restorePoints:`.ai/restore-points`,data:`.aikit-data`,state:`.aikit-state`,logs:`.aikit-state/logs`,brainstorm:`.brainstorm`,handoffs:`.handoffs`},D={root:`.aikit-data`,registry:`registry.json`};E.data;function O(){return process.env.AIKIT_GLOBAL_DATA_DIR??S(a(),D.root)}function k(e){let t=S(e);return`${ee(t).toLowerCase().replace(/[^a-z0-9-]/g,`-`)||`workspace`}-${T(`sha256`).update(t).digest(`hex`).slice(0,8)}`}function te(){let e=S(O(),D.registry);if(!d(e))return{version:1,workspaces:{}};let t=m(e,`utf-8`);try{return JSON.parse(t)}catch{return{version:1,workspaces:{}}}}function ne(e,t=5e3){let n=`${e}.lock`,r=Date.now()+t,i=10;for(;Date.now()<r;)try{let e=p(n,u.O_CREAT|u.O_EXCL|u.O_WRONLY);return y(e,`${process.pid}\n`),l(e),n}catch(e){if(e.code!==`EEXIST`)throw e;try{let{mtimeMs:e}=_(n);if(Date.now()-e>3e4){v(n);continue}}catch{}let t=new SharedArrayBuffer(4);Atomics.wait(new Int32Array(t),0,0,i),i=Math.min(i*2,200)}throw Error(`Failed to acquire registry lock after ${t}ms`)}function re(e){try{v(e)}catch{}}function ie(e){let t=O();f(t,{recursive:!0});let n=S(t,D.registry),r=ne(n);try{let t=`${n}.tmp`;y(t,JSON.stringify(e,null,2),`utf-8`),g(t,n)}finally{re(r)}}function ae(e){let t=te(),n=k(e),r=new Date().toISOString();return t.workspaces[n]?t.workspaces[n].lastAccessedAt=r:t.workspaces[n]={partition:n,workspacePath:S(e),registeredAt:r,lastAccessedAt:r},f(A(n),{recursive:!0}),ie(t),t.workspaces[n]}function A(e){return S(O(),e)}function j(){return d(S(O(),D.registry))}function M(e){return j()?S(A(ae(e).partition),`state`):S(e,E.state)}const N={debug:0,info:1,warn:2,error:3},P=[];let F=process.env.AIKIT_LOG_LEVEL??`info`,I=process.env.AIKIT_LOG_FILE_SINK===`true`||process.env.AIKIT_LOG_FILE_SINK!==`false`&&!process.env.VITEST&&process.env.NODE_ENV!==`test`;function L(){return I?process.env.VITEST||process.env.NODE_ENV===`test`?process.env.AIKIT_LOG_FILE_SINK===`true`:!0:!1}let R;function z(){return R||=S(process.cwd(),E.logs),R}function B(e){let t=e.toISOString().slice(0,10);return x(z(),`${t}.jsonl`)}let V=0;function H(){let e=Date.now();if(!(e-V<36e5)){V=e;try{let t=z(),n=new Date(e-30*864e5).toISOString().slice(0,10);for(let e of h(t))if(e.endsWith(`.jsonl`)&&e.slice(0,10)<n)try{v(x(t,e))}catch{}}catch{}}}function U(e,t){try{f(z(),{recursive:!0}),c(B(t),`${e}\n`),H()}catch{}}function W(e){function t(t,n,r){if(N[t]<N[F])return;let i=new Date,a={ts:i.toISOString(),level:t,component:e,msg:n,...r},o=JSON.stringify(a);console.error(o);for(let i of P)try{i({level:t,component:e,message:n,data:r})}catch{}L()&&(t===`warn`||t===`error`)&&U(o,i)}return{debug:(e,n)=>t(`debug`,e,n),info:(e,n)=>t(`info`,e,n),warn:(e,n)=>t(`warn`,e,n),error:(e,n)=>t(`error`,e,n)}}const G=W(`query-executor`),K=b(w(import.meta.url));function q(){let e=x(K,`..`,`queries`);if(d(e))return e;let t=x(K,`..`,`..`,`src`,`queries`);return d(t)?t:e}const J=q(),oe={".ts":`typescript`,".tsx":`typescript`,".mts":`typescript`,".cts":`typescript`,".js":`javascript`,".jsx":`javascript`,".mjs":`javascript`,".cjs":`javascript`,".py":`python`,".go":`go`,".rs":`rust`,".java":`java`};var Y=class{queryCache=new Map;scmCache=new Map;execute(e,t,n,r){let i=this.getOrCompile(t,n,r);return i?i.matches(e).map(e=>X(e)):[]}executeCaptures(e,t,n,r){let i=this.getOrCompile(t,n,r);return i?i.captures(e).map(e=>Z(e)):[]}executeRaw(e,t,n){return t.query(n).matches(e).map(e=>X(e))}getOrCompile(e,t,n){let r=oe[t];if(!r)return null;let i=`${r}:${n}`,a=this.queryCache.get(i);if(a)return a;let o=this.loadScm(r,n);if(!o)return null;try{let t=e.query(o);return this.queryCache.set(i,t),t}catch(e){throw G.warn(`Failed to compile query`,{langDir:r,queryType:n,error:String(e)}),Error(`Failed to compile ${r}/${n}.scm: ${String(e)}`)}}loadScm(e,t){let n=`${e}:${t}`,r=this.scmCache.get(n);if(r!==void 0)return r;let i=x(J,e,`${t}.scm`);try{let e=m(i,`utf-8`);return this.scmCache.set(n,e),e}catch{return G.info(`Query file not found (graceful skip)`,{langDir:e,queryType:t}),null}}dispose(){this.queryCache.clear(),this.scmCache.clear()}static resolveQueryDir(e){return x(J,e)}};function X(e){let t=new Map;for(let n of e.captures)t.set(n.name,Z(n));return{pattern:e.pattern,captures:t}}function Z(e){let{node:t}=e;return{name:e.name,text:t.text,nodeType:t.type,startLine:t.startPosition.row,endLine:t.endPosition.row,startColumn:t.startPosition.column,endColumn:t.endPosition.column,node:t}}new Y,new Y,new Y,new Y,new Y,new Set(`.ts,.tsx,.js,.jsx,.mjs,.cjs,.java,.kt,.kts,.scala,.py,.go,.rs,.rb,.php,.swift,.cs,.c,.cpp,.h,.hpp,.sh,.bash,.ps1,.sql,.graphql,.gql,.proto,.json,.yaml,.yml,.toml,.env,.ini,.cfg,.xml,.pom,.gradle,.tf,.hcl,.lock,.mjs`.split(`,`)),E.restorePoints,new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,E.state]),new Set([`.git`,E.data,E.state,`.turbo`,`.yarn`,`build`,`coverage`,`dist`,`node_modules`]),C(s),new Set(`if_statement.for_statement.for_in_statement.while_statement.do_statement.switch_case.catch_clause.ternary_expression.if_statement.for_statement.while_statement.except_clause.list_comprehension.if_statement.for_statement.enhanced_for_statement.while_statement.catch_clause.ternary_expression.if_statement.for_statement.select_statement.if_expression.for_expression.while_expression.match_arm`.split(`.`));function se(){return S(M(process.cwd()),`replay.jsonl`)}function ce(e={}){let t=se(),n;try{n=m(t,`utf-8`)}catch{return[]}let r=n.trim().split(`
|
|
3
|
+
`).filter(Boolean),i=[];for(let e of r)try{i.push(JSON.parse(e))}catch{}if(e.tool&&(i=i.filter(t=>t.tool===e.tool)),e.source&&(i=i.filter(t=>t.source===e.source)),e.since){let t=e.since;i=i.filter(e=>e.ts>=t)}let a=e.last??20;return i.slice(-a)}C(o),E.data,`script,style,noscript,iframe,svg,nav,footer,header,aside,form,button,input,select,textarea,[role="navigation"],[role="banner"],[role="contentinfo"],[aria-hidden="true"],.sidebar,.nav,.menu,.footer,.header,.ad,.advertisement,.cookie-banner,.popup,.modal`.split(`,`);var Q=e(t()),$=i();function le(){let[e,t]=(0,Q.useState)([]);return(0,Q.useEffect)(()=>{let e=()=>{t(ce({last:30}))};e();let n=setInterval(e,2e3);return()=>clearInterval(n)},[]),(0,$.jsxs)(n,{flexDirection:`column`,borderStyle:`round`,paddingX:1,children:[(0,$.jsx)(r,{bold:!0,color:`cyan`,children:`Activity Log`}),(0,$.jsx)(r,{children:` `}),e.length===0&&(0,$.jsx)(r,{color:`gray`,children:`No activity recorded yet`}),e.slice().reverse().map((e,t)=>{let n=e.ts.split(`T`)[1]?.split(`.`)[0]??e.ts,i=e.status===`ok`?`green`:`red`;return(0,$.jsxs)(r,{children:[(0,$.jsx)(r,{color:`gray`,children:n}),` `,(0,$.jsx)(r,{color:i,children:e.status===`ok`?`✓`:`✗`}),` `,(0,$.jsx)(r,{bold:!0,children:e.tool}),` `,(0,$.jsxs)(r,{color:`gray`,children:[`(`,e.durationMs,`ms)`]})]},`${e.ts}-${t}`)}),(0,$.jsx)(r,{children:` `}),(0,$.jsx)(r,{color:`gray`,children:`Refreshes every 2s │ Showing last 30`})]})}export{le as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import { t as IKBClient } from "../index-
|
|
2
|
+
import { t as IKBClient } from "../index-MXJeXmCf.js";
|
|
3
3
|
import * as _$react from "react";
|
|
4
4
|
|
|
5
5
|
//#region packages/tui/src/hooks/useKBClient.d.ts
|
|
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from 'node:module'; const require =
|
|
|
2
2
|
//#region packages/aikit-client/dist/types.d.ts
|
|
3
3
|
//#region packages/aikit-client/src/types.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* IKBClient — Unified data access interface for
|
|
5
|
+
* IKBClient — Unified data access interface for AI Kit consumers.
|
|
6
6
|
*
|
|
7
7
|
* Implemented by:
|
|
8
8
|
* - DirectKBClient (in-process, used by TUI)
|
|
@@ -44,9 +44,9 @@ interface KBGraphData {
|
|
|
44
44
|
}>;
|
|
45
45
|
}
|
|
46
46
|
interface IKBClient {
|
|
47
|
-
/** Get
|
|
47
|
+
/** Get AI Kit status. */
|
|
48
48
|
getStatus(): Promise<KBStatus>;
|
|
49
|
-
/** Search
|
|
49
|
+
/** Search AI Kit. */
|
|
50
50
|
search(query: string, options?: {
|
|
51
51
|
limit?: number;
|
|
52
52
|
mode?: 'hybrid' | 'semantic' | 'keyword';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import { t as IKBClient } from "./index-
|
|
2
|
+
import { t as IKBClient } from "./index-MXJeXmCf.js";
|
|
3
3
|
|
|
4
4
|
//#region packages/tui/src/index.d.ts
|
|
5
5
|
declare function launch(client: IKBClient): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{r as e}from"./chunk-D6axbAb-.js";import{t}from"./react-D__J1GQe.js";import{r as n}from"./jsx-runtime-y6Gdq5PZ.js";import{t as r}from"./App-
|
|
2
|
+
import{r as e}from"./chunk-D6axbAb-.js";import{t}from"./react-D__J1GQe.js";import{r as n}from"./jsx-runtime-y6Gdq5PZ.js";import{t as r}from"./App-DpjN3iS-.js";var i=e(t());function a(e){n(i.createElement(r,{client:e}))}export{a as launch};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{t as e}from"../LogPanel-
|
|
2
|
+
import{t as e}from"../LogPanel-Db-SeZhR.js";export{e as LogPanel};
|
package/scaffold/README.md
CHANGED
|
@@ -1,192 +1,192 @@
|
|
|
1
|
-
# Scaffold System — Contributor Guide
|
|
2
|
-
|
|
3
|
-
> **⚠️ GOLDEN RULE: Never edit files in `scaffold/general/` or `scaffold/claude-code/` directly.**
|
|
4
|
-
> They are **generated output** and will be overwritten by `generate.mjs`.
|
|
5
|
-
> Always edit the **source files** in `scaffold/definitions/`.
|
|
6
|
-
|
|
7
|
-
## Architecture
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
scaffold/
|
|
11
|
-
├── definitions/ ← SOURCE OF TRUTH (edit here)
|
|
12
|
-
│ ├── agents.mjs Agent metadata (name, description, model, tools, category)
|
|
13
|
-
│ ├── bodies.mjs Agent body text (mode instructions per agent)
|
|
14
|
-
│ ├── models.mjs Available models per IDE
|
|
15
|
-
│ ├── protocols.mjs Shared protocol files (_shared/*.md) + templates
|
|
16
|
-
│ ├── tools.mjs Tool capability → IDE tool mappings
|
|
17
|
-
│ ├── prompts.mjs Prompt file content
|
|
18
|
-
│ ├── hooks.mjs Hook definitions
|
|
19
|
-
│ └── plugins.mjs Plugin definitions
|
|
20
|
-
│
|
|
21
|
-
├── adapters/ ← IDE-specific generators
|
|
22
|
-
│ ├── copilot.mjs GitHub Copilot adapter (active — generates ~32 files)
|
|
23
|
-
│ └── claude-code.mjs Claude Code adapter (stub — no output yet)
|
|
24
|
-
│
|
|
25
|
-
├── generate.mjs ← BUILD SCRIPT (run after any change)
|
|
26
|
-
│
|
|
27
|
-
├── general/ ← GENERATED OUTPUT for Copilot (DO NOT EDIT)
|
|
28
|
-
│ ├── agents/
|
|
29
|
-
│ │ ├── _shared/ Protocol files (from PROTOCOLS in protocols.mjs)
|
|
30
|
-
│ │ ├── templates/ Template files (from TEMPLATES in protocols.mjs)
|
|
31
|
-
│ │ └── *.agent.md Agent files (from AGENT_BODIES in bodies.mjs)
|
|
32
|
-
│ └── prompts/ Prompt files (from PROMPTS in prompts.mjs)
|
|
33
|
-
│
|
|
34
|
-
└── claude-code/ ← GENERATED OUTPUT for Claude Code (stub, DO NOT EDIT)
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Data Flow
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
definitions/*.mjs → generate.mjs → scaffold/general/ → aikit init → .github/ (user project)
|
|
41
|
-
(source) (build script) (generated output) (deploy) (user workspace)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## How to Make Changes
|
|
45
|
-
|
|
46
|
-
### Step 1: Edit Source Files
|
|
47
|
-
|
|
48
|
-
| What you want to change | Edit this file |
|
|
49
|
-
|--------------------------|---------------|
|
|
50
|
-
| An agent's body/instructions | `definitions/bodies.mjs` → `AGENT_BODIES[agentName]` |
|
|
51
|
-
| Shared rules for code agents | `definitions/protocols.mjs` → `PROTOCOLS['code-agent-base']` |
|
|
52
|
-
| Shared rules for researchers | `definitions/protocols.mjs` → `PROTOCOLS['researcher-base']` |
|
|
53
|
-
| Agent metadata (model, tools) | `definitions/agents.mjs` → `AGENTS[agentName]` |
|
|
54
|
-
| Available models | `definitions/models.mjs` |
|
|
55
|
-
| Tool mappings | `definitions/tools.mjs` |
|
|
56
|
-
| Prompt files | `definitions/prompts.mjs` |
|
|
57
|
-
|
|
58
|
-
### Step 2: Regenerate Output
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
node scaffold/generate.mjs
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
This will:
|
|
65
|
-
1. Clean `general/agents/` and `general/prompts/` directories
|
|
66
|
-
2. Regenerate all files from definitions via the copilot adapter
|
|
67
|
-
3. Print every file written (expect ~32 files)
|
|
68
|
-
|
|
69
|
-
To generate for a specific IDE only:
|
|
70
|
-
```bash
|
|
71
|
-
node scaffold/generate.mjs --ide copilot
|
|
72
|
-
node scaffold/generate.mjs --ide claude-code
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Step 3: Verify
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
# Syntax check the source file you edited
|
|
79
|
-
node -c scaffold/definitions/bodies.mjs
|
|
80
|
-
node -c scaffold/definitions/protocols.mjs
|
|
81
|
-
|
|
82
|
-
# Verify your changes appear in generated output
|
|
83
|
-
# (use grep/Select-String for key phrases)
|
|
84
|
-
grep -r "your key phrase" scaffold/general/agents/
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Step 4: Commit Both Source AND Generated
|
|
88
|
-
|
|
89
|
-
Always commit the definition source files AND the regenerated output together.
|
|
90
|
-
The generated files are checked into git so `aikit init` can deploy them without
|
|
91
|
-
running the generator.
|
|
92
|
-
|
|
93
|
-
## Source File Details
|
|
94
|
-
|
|
95
|
-
### bodies.mjs
|
|
96
|
-
|
|
97
|
-
Contains `AGENT_BODIES` — an object mapping agent names to their body text.
|
|
98
|
-
|
|
99
|
-
- Most values are **template literal strings** (`` `...` ``)
|
|
100
|
-
- The **Orchestrator** body is a **function** `(agentTable) => string` because it
|
|
101
|
-
dynamically includes the agent roster table
|
|
102
|
-
- Backticks inside content must be escaped: `` \` ``
|
|
103
|
-
|
|
104
|
-
```js
|
|
105
|
-
export const AGENT_BODIES = {
|
|
106
|
-
Orchestrator: (agentTable) => `# Orchestrator\n${agentTable}\n...`,
|
|
107
|
-
Implementer: `# Implementer\n...`,
|
|
108
|
-
Debugger: `# Debugger\n...`,
|
|
109
|
-
// ...
|
|
110
|
-
};
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### protocols.mjs
|
|
114
|
-
|
|
115
|
-
Contains `PROTOCOLS` and `TEMPLATES` — objects mapping names to markdown content.
|
|
116
|
-
|
|
117
|
-
- Each `PROTOCOLS` key becomes a file in `_shared/`:
|
|
118
|
-
- `'code-agent-base'` → `agents/_shared/code-agent-base.md`
|
|
119
|
-
- `'researcher-base'` → `agents/_shared/researcher-base.md`
|
|
120
|
-
- `'decision-protocol'` → `agents/_shared/decision-protocol.md`
|
|
121
|
-
- etc.
|
|
122
|
-
- Each `TEMPLATES` key becomes a file in `templates/`
|
|
123
|
-
- All values are template literals — escape backticks as `` \` ``
|
|
124
|
-
|
|
125
|
-
**Protocol → Agent mapping:**
|
|
126
|
-
|
|
127
|
-
| Protocol | Used by |
|
|
128
|
-
|----------|---------|
|
|
129
|
-
| `code-agent-base` | Implementer, Frontend, Refactor, Debugger |
|
|
130
|
-
| `researcher-base` | Researcher-Alpha/Beta/Gamma/Delta |
|
|
131
|
-
| `code-reviewer-base` | Code-Reviewer-Alpha/Beta |
|
|
132
|
-
| `architect-reviewer-base` | Architect-Reviewer-Alpha/Beta |
|
|
133
|
-
| `decision-protocol` | Referenced by Orchestrator workflow |
|
|
134
|
-
| `forge-protocol` | Referenced by code-agent-base |
|
|
135
|
-
|
|
136
|
-
### agents.mjs
|
|
137
|
-
|
|
138
|
-
Defines every agent's metadata:
|
|
139
|
-
- `description`, `argumentHint` — displayed in the agent picker
|
|
140
|
-
- `model` — which LLM model to use
|
|
141
|
-
- `tools` — abstract capability list (mapped to IDE-specific tools by the adapter)
|
|
142
|
-
- `category` — orchestration, implementation, diagnostics, research, review, etc.
|
|
143
|
-
- `sharedBase` — for variant agents (e.g., Researcher-Alpha uses `researcher-base`)
|
|
144
|
-
|
|
145
|
-
## How Users Receive Changes
|
|
146
|
-
|
|
147
|
-
When users run `aikit init`, the scaffold files are deployed to their `.github/` directory.
|
|
148
|
-
|
|
149
|
-
### First Install (Legacy Path)
|
|
150
|
-
|
|
151
|
-
`copyDirectoryRecursive()` — copies all scaffold files, **skips existing** files.
|
|
152
|
-
No tracking, no merging.
|
|
153
|
-
|
|
154
|
-
### Updates (Smart Path)
|
|
155
|
-
|
|
156
|
-
`smartCopyScaffold()` — manifest-based with `.aikit-scaffold.json`:
|
|
157
|
-
|
|
158
|
-
| File Status | Strategy | Behavior |
|
|
159
|
-
|-------------|----------|----------|
|
|
160
|
-
| `new` (not in manifest, not on disk) | deploy | Copy file, record hash |
|
|
161
|
-
| `new` (not in manifest, exists on disk) | record | Record hash only (preserve user edits) |
|
|
162
|
-
| `outdated` (source hash changed) | `merge-frontmatter` | **Agent files**: update body, union tools, keep user's model choice |
|
|
163
|
-
| `outdated` (source hash changed) | `overwrite` | **Protocol/shared files**: replace entirely |
|
|
164
|
-
| `current` (unchanged) | skip | No action |
|
|
165
|
-
|
|
166
|
-
The update strategy is determined by `getUpdateStrategy(relPath)` based on the file path.
|
|
167
|
-
|
|
168
|
-
**Key implication**: When you update an agent body in `bodies.mjs`, existing users will
|
|
169
|
-
get the updated body text while preserving their custom model choice and any extra tools
|
|
170
|
-
they added. Protocol files (`_shared/*.md`) are fully replaced.
|
|
171
|
-
|
|
172
|
-
## Common Mistakes
|
|
173
|
-
|
|
174
|
-
| Mistake | Why it's wrong | What to do instead |
|
|
175
|
-
|---------|---------------|-------------------|
|
|
176
|
-
| Editing `.agent.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `bodies.mjs` for agent bodies |
|
|
177
|
-
| Editing `_shared/*.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `protocols.mjs` PROTOCOLS constant |
|
|
178
|
-
| Forgetting to run `generate.mjs` | Generated files will be stale, `aikit init` deploys stale files | Always run after editing definitions |
|
|
179
|
-
| Committing only source OR only generated | Source and output will be out of sync | Commit both together |
|
|
180
|
-
| Unescaped backticks in template literals | JS syntax error in definitions | Use `` \` `` inside template literal strings |
|
|
181
|
-
|
|
182
|
-
## PR Checklist
|
|
183
|
-
|
|
184
|
-
- [ ] Changes made in `scaffold/definitions/*.mjs` (NOT in generated output)
|
|
185
|
-
- [ ] `node -c scaffold/definitions/<changed-file>.mjs` passes (syntax check)
|
|
186
|
-
- [ ] `node scaffold/generate.mjs` runs without errors
|
|
187
|
-
- [ ] Generated output contains expected changes (verified with grep)
|
|
188
|
-
- [ ] Both source and generated files included in commit
|
|
189
|
-
- [ ] If adding a new agent: entry in `agents.mjs` + body in `bodies.mjs`
|
|
190
|
-
- [ ] If adding a new protocol: entry in `protocols.mjs` + reference in relevant agent bodies
|
|
191
|
-
- [ ] If adding a new file type: check `getUpdateStrategy()` returns correct merge strategy
|
|
192
|
-
- [ ] Consider impact on existing user installations (will merge preserve their customizations?)
|
|
1
|
+
# Scaffold System — Contributor Guide
|
|
2
|
+
|
|
3
|
+
> **⚠️ GOLDEN RULE: Never edit files in `scaffold/general/` or `scaffold/claude-code/` directly.**
|
|
4
|
+
> They are **generated output** and will be overwritten by `generate.mjs`.
|
|
5
|
+
> Always edit the **source files** in `scaffold/definitions/`.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
scaffold/
|
|
11
|
+
├── definitions/ ← SOURCE OF TRUTH (edit here)
|
|
12
|
+
│ ├── agents.mjs Agent metadata (name, description, model, tools, category)
|
|
13
|
+
│ ├── bodies.mjs Agent body text (mode instructions per agent)
|
|
14
|
+
│ ├── models.mjs Available models per IDE
|
|
15
|
+
│ ├── protocols.mjs Shared protocol files (_shared/*.md) + templates
|
|
16
|
+
│ ├── tools.mjs Tool capability → IDE tool mappings
|
|
17
|
+
│ ├── prompts.mjs Prompt file content
|
|
18
|
+
│ ├── hooks.mjs Hook definitions
|
|
19
|
+
│ └── plugins.mjs Plugin definitions
|
|
20
|
+
│
|
|
21
|
+
├── adapters/ ← IDE-specific generators
|
|
22
|
+
│ ├── copilot.mjs GitHub Copilot adapter (active — generates ~32 files)
|
|
23
|
+
│ └── claude-code.mjs Claude Code adapter (stub — no output yet)
|
|
24
|
+
│
|
|
25
|
+
├── generate.mjs ← BUILD SCRIPT (run after any change)
|
|
26
|
+
│
|
|
27
|
+
├── general/ ← GENERATED OUTPUT for Copilot (DO NOT EDIT)
|
|
28
|
+
│ ├── agents/
|
|
29
|
+
│ │ ├── _shared/ Protocol files (from PROTOCOLS in protocols.mjs)
|
|
30
|
+
│ │ ├── templates/ Template files (from TEMPLATES in protocols.mjs)
|
|
31
|
+
│ │ └── *.agent.md Agent files (from AGENT_BODIES in bodies.mjs)
|
|
32
|
+
│ └── prompts/ Prompt files (from PROMPTS in prompts.mjs)
|
|
33
|
+
│
|
|
34
|
+
└── claude-code/ ← GENERATED OUTPUT for Claude Code (stub, DO NOT EDIT)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Data Flow
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
definitions/*.mjs → generate.mjs → scaffold/general/ → aikit init → .github/ (user project)
|
|
41
|
+
(source) (build script) (generated output) (deploy) (user workspace)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## How to Make Changes
|
|
45
|
+
|
|
46
|
+
### Step 1: Edit Source Files
|
|
47
|
+
|
|
48
|
+
| What you want to change | Edit this file |
|
|
49
|
+
|--------------------------|---------------|
|
|
50
|
+
| An agent's body/instructions | `definitions/bodies.mjs` → `AGENT_BODIES[agentName]` |
|
|
51
|
+
| Shared rules for code agents | `definitions/protocols.mjs` → `PROTOCOLS['code-agent-base']` |
|
|
52
|
+
| Shared rules for researchers | `definitions/protocols.mjs` → `PROTOCOLS['researcher-base']` |
|
|
53
|
+
| Agent metadata (model, tools) | `definitions/agents.mjs` → `AGENTS[agentName]` |
|
|
54
|
+
| Available models | `definitions/models.mjs` |
|
|
55
|
+
| Tool mappings | `definitions/tools.mjs` |
|
|
56
|
+
| Prompt files | `definitions/prompts.mjs` |
|
|
57
|
+
|
|
58
|
+
### Step 2: Regenerate Output
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
node scaffold/generate.mjs
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This will:
|
|
65
|
+
1. Clean `general/agents/` and `general/prompts/` directories
|
|
66
|
+
2. Regenerate all files from definitions via the copilot adapter
|
|
67
|
+
3. Print every file written (expect ~32 files)
|
|
68
|
+
|
|
69
|
+
To generate for a specific IDE only:
|
|
70
|
+
```bash
|
|
71
|
+
node scaffold/generate.mjs --ide copilot
|
|
72
|
+
node scaffold/generate.mjs --ide claude-code
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Step 3: Verify
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Syntax check the source file you edited
|
|
79
|
+
node -c scaffold/definitions/bodies.mjs
|
|
80
|
+
node -c scaffold/definitions/protocols.mjs
|
|
81
|
+
|
|
82
|
+
# Verify your changes appear in generated output
|
|
83
|
+
# (use grep/Select-String for key phrases)
|
|
84
|
+
grep -r "your key phrase" scaffold/general/agents/
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Step 4: Commit Both Source AND Generated
|
|
88
|
+
|
|
89
|
+
Always commit the definition source files AND the regenerated output together.
|
|
90
|
+
The generated files are checked into git so `aikit init` can deploy them without
|
|
91
|
+
running the generator.
|
|
92
|
+
|
|
93
|
+
## Source File Details
|
|
94
|
+
|
|
95
|
+
### bodies.mjs
|
|
96
|
+
|
|
97
|
+
Contains `AGENT_BODIES` — an object mapping agent names to their body text.
|
|
98
|
+
|
|
99
|
+
- Most values are **template literal strings** (`` `...` ``)
|
|
100
|
+
- The **Orchestrator** body is a **function** `(agentTable) => string` because it
|
|
101
|
+
dynamically includes the agent roster table
|
|
102
|
+
- Backticks inside content must be escaped: `` \` ``
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
export const AGENT_BODIES = {
|
|
106
|
+
Orchestrator: (agentTable) => `# Orchestrator\n${agentTable}\n...`,
|
|
107
|
+
Implementer: `# Implementer\n...`,
|
|
108
|
+
Debugger: `# Debugger\n...`,
|
|
109
|
+
// ...
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### protocols.mjs
|
|
114
|
+
|
|
115
|
+
Contains `PROTOCOLS` and `TEMPLATES` — objects mapping names to markdown content.
|
|
116
|
+
|
|
117
|
+
- Each `PROTOCOLS` key becomes a file in `_shared/`:
|
|
118
|
+
- `'code-agent-base'` → `agents/_shared/code-agent-base.md`
|
|
119
|
+
- `'researcher-base'` → `agents/_shared/researcher-base.md`
|
|
120
|
+
- `'decision-protocol'` → `agents/_shared/decision-protocol.md`
|
|
121
|
+
- etc.
|
|
122
|
+
- Each `TEMPLATES` key becomes a file in `templates/`
|
|
123
|
+
- All values are template literals — escape backticks as `` \` ``
|
|
124
|
+
|
|
125
|
+
**Protocol → Agent mapping:**
|
|
126
|
+
|
|
127
|
+
| Protocol | Used by |
|
|
128
|
+
|----------|---------|
|
|
129
|
+
| `code-agent-base` | Implementer, Frontend, Refactor, Debugger |
|
|
130
|
+
| `researcher-base` | Researcher-Alpha/Beta/Gamma/Delta |
|
|
131
|
+
| `code-reviewer-base` | Code-Reviewer-Alpha/Beta |
|
|
132
|
+
| `architect-reviewer-base` | Architect-Reviewer-Alpha/Beta |
|
|
133
|
+
| `decision-protocol` | Referenced by Orchestrator workflow |
|
|
134
|
+
| `forge-protocol` | Referenced by code-agent-base |
|
|
135
|
+
|
|
136
|
+
### agents.mjs
|
|
137
|
+
|
|
138
|
+
Defines every agent's metadata:
|
|
139
|
+
- `description`, `argumentHint` — displayed in the agent picker
|
|
140
|
+
- `model` — which LLM model to use
|
|
141
|
+
- `tools` — abstract capability list (mapped to IDE-specific tools by the adapter)
|
|
142
|
+
- `category` — orchestration, implementation, diagnostics, research, review, etc.
|
|
143
|
+
- `sharedBase` — for variant agents (e.g., Researcher-Alpha uses `researcher-base`)
|
|
144
|
+
|
|
145
|
+
## How Users Receive Changes
|
|
146
|
+
|
|
147
|
+
When users run `aikit init`, the scaffold files are deployed to their `.github/` directory.
|
|
148
|
+
|
|
149
|
+
### First Install (Legacy Path)
|
|
150
|
+
|
|
151
|
+
`copyDirectoryRecursive()` — copies all scaffold files, **skips existing** files.
|
|
152
|
+
No tracking, no merging.
|
|
153
|
+
|
|
154
|
+
### Updates (Smart Path)
|
|
155
|
+
|
|
156
|
+
`smartCopyScaffold()` — manifest-based with `.aikit-scaffold.json`:
|
|
157
|
+
|
|
158
|
+
| File Status | Strategy | Behavior |
|
|
159
|
+
|-------------|----------|----------|
|
|
160
|
+
| `new` (not in manifest, not on disk) | deploy | Copy file, record hash |
|
|
161
|
+
| `new` (not in manifest, exists on disk) | record | Record hash only (preserve user edits) |
|
|
162
|
+
| `outdated` (source hash changed) | `merge-frontmatter` | **Agent files**: update body, union tools, keep user's model choice |
|
|
163
|
+
| `outdated` (source hash changed) | `overwrite` | **Protocol/shared files**: replace entirely |
|
|
164
|
+
| `current` (unchanged) | skip | No action |
|
|
165
|
+
|
|
166
|
+
The update strategy is determined by `getUpdateStrategy(relPath)` based on the file path.
|
|
167
|
+
|
|
168
|
+
**Key implication**: When you update an agent body in `bodies.mjs`, existing users will
|
|
169
|
+
get the updated body text while preserving their custom model choice and any extra tools
|
|
170
|
+
they added. Protocol files (`_shared/*.md`) are fully replaced.
|
|
171
|
+
|
|
172
|
+
## Common Mistakes
|
|
173
|
+
|
|
174
|
+
| Mistake | Why it's wrong | What to do instead |
|
|
175
|
+
|---------|---------------|-------------------|
|
|
176
|
+
| Editing `.agent.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `bodies.mjs` for agent bodies |
|
|
177
|
+
| Editing `_shared/*.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `protocols.mjs` PROTOCOLS constant |
|
|
178
|
+
| Forgetting to run `generate.mjs` | Generated files will be stale, `aikit init` deploys stale files | Always run after editing definitions |
|
|
179
|
+
| Committing only source OR only generated | Source and output will be out of sync | Commit both together |
|
|
180
|
+
| Unescaped backticks in template literals | JS syntax error in definitions | Use `` \` `` inside template literal strings |
|
|
181
|
+
|
|
182
|
+
## PR Checklist
|
|
183
|
+
|
|
184
|
+
- [ ] Changes made in `scaffold/definitions/*.mjs` (NOT in generated output)
|
|
185
|
+
- [ ] `node -c scaffold/definitions/<changed-file>.mjs` passes (syntax check)
|
|
186
|
+
- [ ] `node scaffold/generate.mjs` runs without errors
|
|
187
|
+
- [ ] Generated output contains expected changes (verified with grep)
|
|
188
|
+
- [ ] Both source and generated files included in commit
|
|
189
|
+
- [ ] If adding a new agent: entry in `agents.mjs` + body in `bodies.mjs`
|
|
190
|
+
- [ ] If adding a new protocol: entry in `protocols.mjs` + reference in relevant agent bodies
|
|
191
|
+
- [ ] If adding a new file type: check `getUpdateStrategy()` returns correct merge strategy
|
|
192
|
+
- [ ] Consider impact on existing user installations (will merge preserve their customizations?)
|