@vpxa/aikit 0.1.128 → 0.1.130
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/package.json +1 -1
- package/packages/core/dist/index.js +1 -1
- package/packages/embeddings/dist/index.d.ts +14 -0
- package/packages/embeddings/dist/index.js +1 -1
- package/packages/present/dist/index.html +275 -248
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/{server-C_cXoajp.js → server-nizfrMPw.js} +323 -1047
- package/packages/tools/dist/index.js +1 -1
- package/scaffold/dist/adapters/skills.mjs +1 -1
- package/scaffold/dist/definitions/prompts.mjs +126 -1
- package/scaffold/dist/definitions/skills/c4-architecture.mjs +26 -2
- package/scaffold/dist/definitions/skills/docs.mjs +7 -3
- package/scaffold/dist/definitions/skills/present.mjs +3 -47
- package/scaffold/dist/generated/block-docs.mjs +81 -0
- package/scaffold/generated/block-docs.mjs +13 -0
|
@@ -9,7 +9,7 @@ import{DependencyAnalyzer as e,DiagramGenerator as t,EntryPointAnalyzer as n,Pat
|
|
|
9
9
|
### Patterns Detected
|
|
10
10
|
`),n.push(`| Pattern | Confidence | Count |`),n.push(`|---------|-----------|-------|`);for(let t of e.patterns)n.push(`| ${t.name} | ${t.confidence} | ${t.count} |`)}else t===`normal`&&n.push(`\n**Patterns:** ${e.patterns.map(e=>e.name).join(`, `)}`);return n.join(`
|
|
11
11
|
`)}const rt=/^[a-zA-Z0-9_./\-~^@{}]+$/;function it(e){let{from:t,to:n=`HEAD`,format:r=`grouped`,includeBreaking:i=!0,cwd:a=process.cwd()}=e;if(!rt.test(t))throw Error(`Invalid git ref: ${t}`);if(!rt.test(n))throw Error(`Invalid git ref: ${n}`);let o;try{o=u(`git`,[`log`,`${t}..${n}`,`--format=%H%s%b%an%ai`],{cwd:a,encoding:`utf8`,maxBuffer:10*1024*1024,timeout:3e4})}catch{throw Error(`Git log failed. Ensure "${t}" and "${n}" are valid refs.`)}let s=o.split(``).map(e=>e.trim()).filter(Boolean).map(e=>{let[t=``,n=``,r=``,i=``,a=``]=e.split(``),o=n.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.+)/);return{hash:t.slice(0,8),type:o?.[1]??`other`,scope:o?.[2]??``,subject:o?.[4]??n,body:r.trim(),author:i.trim(),date:a.trim().split(` `)[0],breaking:!!(o?.[3]||/BREAKING[\s-]CHANGE/i.test(r))}}),c={},l=0;for(let e of s)c[e.type]=(c[e.type]??0)+1,e.breaking&&l++;return{entries:s,markdown:at(s,r,i),stats:{total:s.length,breaking:l,types:c}}}function at(e,t,n){let r=[`# Changelog`,``];if(n){let t=e.filter(e=>e.breaking);if(t.length>0){r.push(`## Breaking Changes`,``);for(let e of t)r.push(`- ${e.subject} (${e.hash})`);r.push(``)}}if(t===`grouped`){let t={};for(let n of e)t[n.type]||(t[n.type]=[]),t[n.type].push(n);let n=[`feat`,`fix`,`refactor`,`perf`,`test`,`docs`,`chore`],i={feat:`Features`,fix:`Bug Fixes`,refactor:`Refactoring`,perf:`Performance`,test:`Tests`,docs:`Documentation`,chore:`Chores`,other:`Other`};for(let e of[...n,...Object.keys(t).filter(e=>!n.includes(e))])if(t[e]?.length){r.push(`## ${i[e]??e}`,``);for(let n of t[e]){let e=n.scope?`**${n.scope}:** `:``;r.push(`- ${e}${n.subject} (${n.hash})`)}r.push(``)}}else if(t===`chronological`)for(let t of e){let e=t.scope?`(${t.scope}) `:``;r.push(`- \`${t.date}\` ${t.type}: ${e}${t.subject} (${t.hash})`)}else{let t={};for(let n of e){let e=n.scope||`general`;t[e]||(t[e]=[]),t[e].push(n)}for(let[e,n]of Object.entries(t)){r.push(`## ${e}`,``);for(let e of n)r.push(`- ${e.type}: ${e.subject} (${e.hash})`);r.push(``)}}return r.join(`
|
|
12
|
-
`)}const ot=/^[a-z0-9][a-z0-9-]*$/,st=new Map;function ct(e){let t=w(e),n=st.get(t);if(n!==void 0)return n;try{return u(`git`,[`rev-parse`,`--git-dir`],{cwd:t,timeout:1e4,encoding:`utf8`}),st.set(t,!0),!0}catch{return st.set(t,!1),!1}}function U(e,t,n,r){try{return u(`git`,e,{cwd:t,timeout:1e4,input:n,encoding:`utf8`}).trim()}catch(t){r||console.warn(`Git operation failed (${e.join(` `)}): ${t instanceof Error?t.message:String(t)}`);return}}function lt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,60)||`untitled`}function ut(e,t,n,r,i){let a=U([`hash-object`,`-w`,`--stdin`],i,n);if(!a)return;let o=U([`mktree`],i,`100644 blob ${a}\t${t}\n`);if(!o)return;let s=U([`rev-parse`,e],i,void 0,!0),c=[`commit-tree`,o];s&&c.push(`-p`,s),c.push(`-m`,r);let l=U(c,i);if(l)return U([`update-ref`,e,l],i)===void 0?void 0:l}function dt(){st.clear()}const ft=`refs/aikit/checkpoints`,pt=ot;function W(e){let t=lt(e);return t===`untitled`?`checkpoint`:t}function mt(e,t,n){if(typeof e!=`string`||e.length<1||e.length>120)throw Error(`Checkpoint label must be 1-120 characters.`);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Checkpoint data must be a JSON-serializable object.`);let r;try{r=JSON.stringify(t)}catch{throw Error(`Checkpoint data must be a JSON-serializable object.`)}if(typeof r!=`string`)throw Error(`Checkpoint data must be a JSON-serializable object.`);if(Buffer.byteLength(r,`utf8`)>5e5)throw Error(`Checkpoint data must be 500KB or less when serialized.`);if(n?.notes!==void 0&&Buffer.byteLength(n.notes,`utf8`)>1e4)throw Error(`Checkpoint notes must be 10KB or less.`)}function ht(e,t){let n=W(e.label),r=`${ft}/${n}`;if(ot.test(n))return ut(r,`checkpoint.json`,`${JSON.stringify(e,null,2)}\n`,`checkpoint: ${e.label}`,t)}function gt(e,t){let n=new Set,r=/^\d+-(.+)$/.exec(e);r?.[1]&&n.add(r[1]),n.add(W(e));for(let e of n){if(!pt.test(e))continue;let n=U([`rev-parse`,`${ft}/${e}`],t);if(!n)continue;let r=U([`cat-file`,`blob`,`${n}:checkpoint.json`],t);if(r)try{let e=JSON.parse(r);if(typeof e?.id!=`string`||typeof e.label!=`string`||typeof e.createdAt!=`string`||!e.data||typeof e.data!=`object`||Array.isArray(e.data))continue;return mt(e.label,e.data,{notes:e.notes}),{...e,gitSha:n}}catch(e){console.warn(`Corrupt git-backed checkpoint ${n}: ${e instanceof Error?e.message:String(e)}`)}}}function _t(e){let t=w(z(e??process.cwd()),`checkpoints`);return j(t)||M(t,{recursive:!0}),t}function vt(e,t,n){mt(e,t,{notes:n?.notes});let r=W(e),i={id:`${Date.now()}-${r}`,label:e,createdAt:new Date().toISOString(),data:t,files:n?.files,notes:n?.notes},a=w(_t(n?.cwd),`${i.id}.json`),o=`${a}.tmp`;L(o,`${JSON.stringify(i,null,2)}\n`,`utf-8`),F(o,a);let s=n?.cwd??process.cwd();if(ct(s)){let e=ht(i,s);e&&(i.gitSha=e)}return i}function yt(e,t){let n=_t(t),r=w(n,`${e}.json`);if(r.startsWith(w(n))){if(!j(r)){let n=t??process.cwd();return ct(n)?gt(e,n):void 0}try{return JSON.parse(N(r,`utf-8`))}catch(e){if(e?.code===`ENOENT`)return;console.warn(`Corrupt state file ${r}: ${e instanceof Error?e.message:String(e)}`);return}}}function bt(e){let t=_t(e);return P(t).filter(e=>e.endsWith(`.json`)).flatMap(e=>{let n=w(t,e);try{return[JSON.parse(N(n,`utf-8`))]}catch(e){return e?.code===`ENOENT`||console.warn(`Corrupt state file ${n}: ${e instanceof Error?e.message:String(e)}`),[]}}).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function xt(e){return bt(e)[0]}function St(e,t,n){let r=yt(e,n),i=yt(t,n);if(!r||!i)return;let a=new Set(Object.keys(r.data)),o=new Set(Object.keys(i.data));return{fromId:e,toId:t,added:[...o].filter(e=>!a.has(e)),removed:[...a].filter(e=>!o.has(e)),modified:[...a].filter(e=>o.has(e)).filter(e=>JSON.stringify(r.data[e])!==JSON.stringify(i.data[e]))}}function Ct(e,t){let n=t?.cwd??process.cwd(),r=t?.limit??20,i=W(e);if(ct(n)){let e=`refs/aikit/checkpoints/${i}`,t=U([`log`,`--format=%H %aI %s`,`-n`,String(r),e],n);if(t)return t.trim().split(`
|
|
12
|
+
`)}const ot=/^[a-z0-9][a-z0-9-]*$/,st=new Map;function ct(e){let t=w(e),n=st.get(t);if(n!==void 0)return n;try{return u(`git`,[`rev-parse`,`--git-dir`],{cwd:t,timeout:1e4,encoding:`utf8`}),st.set(t,!0),!0}catch{return st.set(t,!1),!1}}function U(e,t,n,r){try{return u(`git`,e,{cwd:t,timeout:1e4,input:n,encoding:`utf8`,stdio:[`pipe`,`pipe`,`pipe`]}).trim()}catch(t){r||console.warn(`Git operation failed (${e.join(` `)}): ${t instanceof Error?t.message:String(t)}`);return}}function lt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,60)||`untitled`}function ut(e,t,n,r,i){let a=U([`hash-object`,`-w`,`--stdin`],i,n);if(!a)return;let o=U([`mktree`],i,`100644 blob ${a}\t${t}\n`);if(!o)return;let s=U([`rev-parse`,e],i,void 0,!0),c=[`commit-tree`,o];s&&c.push(`-p`,s),c.push(`-m`,r);let l=U(c,i);if(l)return U([`update-ref`,e,l],i)===void 0?void 0:l}function dt(){st.clear()}const ft=`refs/aikit/checkpoints`,pt=ot;function W(e){let t=lt(e);return t===`untitled`?`checkpoint`:t}function mt(e,t,n){if(typeof e!=`string`||e.length<1||e.length>120)throw Error(`Checkpoint label must be 1-120 characters.`);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Checkpoint data must be a JSON-serializable object.`);let r;try{r=JSON.stringify(t)}catch{throw Error(`Checkpoint data must be a JSON-serializable object.`)}if(typeof r!=`string`)throw Error(`Checkpoint data must be a JSON-serializable object.`);if(Buffer.byteLength(r,`utf8`)>5e5)throw Error(`Checkpoint data must be 500KB or less when serialized.`);if(n?.notes!==void 0&&Buffer.byteLength(n.notes,`utf8`)>1e4)throw Error(`Checkpoint notes must be 10KB or less.`)}function ht(e,t){let n=W(e.label),r=`${ft}/${n}`;if(ot.test(n))return ut(r,`checkpoint.json`,`${JSON.stringify(e,null,2)}\n`,`checkpoint: ${e.label}`,t)}function gt(e,t){let n=new Set,r=/^\d+-(.+)$/.exec(e);r?.[1]&&n.add(r[1]),n.add(W(e));for(let e of n){if(!pt.test(e))continue;let n=U([`rev-parse`,`${ft}/${e}`],t);if(!n)continue;let r=U([`cat-file`,`blob`,`${n}:checkpoint.json`],t);if(r)try{let e=JSON.parse(r);if(typeof e?.id!=`string`||typeof e.label!=`string`||typeof e.createdAt!=`string`||!e.data||typeof e.data!=`object`||Array.isArray(e.data))continue;return mt(e.label,e.data,{notes:e.notes}),{...e,gitSha:n}}catch(e){console.warn(`Corrupt git-backed checkpoint ${n}: ${e instanceof Error?e.message:String(e)}`)}}}function _t(e){let t=w(z(e??process.cwd()),`checkpoints`);return j(t)||M(t,{recursive:!0}),t}function vt(e,t,n){mt(e,t,{notes:n?.notes});let r=W(e),i={id:`${Date.now()}-${r}`,label:e,createdAt:new Date().toISOString(),data:t,files:n?.files,notes:n?.notes},a=w(_t(n?.cwd),`${i.id}.json`),o=`${a}.tmp`;L(o,`${JSON.stringify(i,null,2)}\n`,`utf-8`),F(o,a);let s=n?.cwd??process.cwd();if(ct(s)){let e=ht(i,s);e&&(i.gitSha=e)}return i}function yt(e,t){let n=_t(t),r=w(n,`${e}.json`);if(r.startsWith(w(n))){if(!j(r)){let n=t??process.cwd();return ct(n)?gt(e,n):void 0}try{return JSON.parse(N(r,`utf-8`))}catch(e){if(e?.code===`ENOENT`)return;console.warn(`Corrupt state file ${r}: ${e instanceof Error?e.message:String(e)}`);return}}}function bt(e){let t=_t(e);return P(t).filter(e=>e.endsWith(`.json`)).flatMap(e=>{let n=w(t,e);try{return[JSON.parse(N(n,`utf-8`))]}catch(e){return e?.code===`ENOENT`||console.warn(`Corrupt state file ${n}: ${e instanceof Error?e.message:String(e)}`),[]}}).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function xt(e){return bt(e)[0]}function St(e,t,n){let r=yt(e,n),i=yt(t,n);if(!r||!i)return;let a=new Set(Object.keys(r.data)),o=new Set(Object.keys(i.data));return{fromId:e,toId:t,added:[...o].filter(e=>!a.has(e)),removed:[...a].filter(e=>!o.has(e)),modified:[...a].filter(e=>o.has(e)).filter(e=>JSON.stringify(r.data[e])!==JSON.stringify(i.data[e]))}}function Ct(e,t){let n=t?.cwd??process.cwd(),r=t?.limit??20,i=W(e);if(ct(n)){let e=`refs/aikit/checkpoints/${i}`,t=U([`log`,`--format=%H %aI %s`,`-n`,String(r),e],n);if(t)return t.trim().split(`
|
|
13
13
|
`).filter(Boolean).map(e=>{let[t,n,...r]=e.split(` `);return{sha:t,id:t.slice(0,12),createdAt:n,label:r.join(` `)}})}return bt(n).filter(e=>W(e.label)===i).slice(0,r).map(e=>({id:e.id,createdAt:e.createdAt,label:e.label}))}function wt(e){let t=bt(e?.cwd),n=e?.keepLast??10,r=e?.dryRun??!0,i=e?.maxAgeDays===void 0?void 0:Date.now()-e.maxAgeDays*864e5,a=e?.label?W(e.label):void 0,o=new Map;for(let e of t){let t=W(e.label);if(a&&t!==a)continue;let n=o.get(t);n?n.push(e):o.set(t,[e])}let s=[],c=0;for(let e of o.values())e.forEach((e,t)=>{let r=Date.parse(e.createdAt);if(t<n&&!(i!==void 0&&!Number.isNaN(r)&&r<i)){c+=1;return}s.push(e.id)});if(!r&&s.length>0){let t=_t(e?.cwd),n=e?.cwd??process.cwd(),r=new Set(s);for(let e of s){let n=w(t,`${e}.json`);if(n.startsWith(w(t)))try{ie(n)}catch(e){if(e?.code===`ENOENT`)continue;console.warn(`Failed to remove checkpoint ${n}: ${e instanceof Error?e.message:String(e)}`)}}if(ct(n))for(let[e,t]of o.entries())t.every(e=>r.has(e.id))&&pt.test(e)&&U([`update-ref`,`-d`,`${ft}/${e}`],n)}return{deleted:s.length,kept:c,labels:[...o.keys()],deletedIds:s}}const Tt=[`.ts`,`.tsx`,`.js`,`.jsx`],Et=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,R.state]);function Dt(e){return e.replace(/\\/g,`/`)}function Ot(e){return e.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}function kt(e,t){let n=Dt(e),r=Dt(t).trim();if(!r)return!1;let i=Ot(r).replace(/\*\*/g,`::DOUBLE_STAR::`).replace(/\*/g,`[^/]*`).replace(/\?/g,`[^/]`).replace(/::DOUBLE_STAR::/g,`.*`);return RegExp(`^${i}$`).test(n)}function At(e,t,n){return t.some(t=>kt(e,t)?!0:n?kt(`${e}/`,t):!1)}async function jt(e,t,n){let r=[],i=t.map(e=>e.toLowerCase());async function a(t){let o=await m(t);for(let s of o){if(Et.has(s))continue;let o=S(t,s),c=await g(o),l=Dt(C(e,o));if(c.isDirectory()){At(l,n,!0)||await a(o);continue}At(l,n,!1)||i.includes(b(s).toLowerCase())&&r.push(o)}}return await a(e),r.sort((e,t)=>e.localeCompare(t)),r}const Mt=R.restorePoints;function Nt(){let e=S(process.cwd(),Mt);return j(e)||M(e,{recursive:!0}),e}function Pt(e,t,n){let r=Nt(),i=`${Date.now()}-${e}`,a={id:i,timestamp:new Date().toISOString(),operation:e,files:t,description:n};L(S(r,`${i}.json`),`${JSON.stringify(a,null,2)}\n`,`utf-8`);let o=P(r).filter(e=>e.endsWith(`.json`)).sort();for(;o.length>50;){let e=o.shift();if(!e)break;try{ie(S(r,e))}catch{}}return i}function Ft(){let e=S(process.cwd(),Mt);return j(e)?P(e).filter(e=>e.endsWith(`.json`)).sort().reverse().map(t=>{try{return JSON.parse(N(S(e,t),`utf-8`))}catch(n){return console.debug(`Skipping corrupt restore point ${S(e,t)}: ${n instanceof Error?n.message:String(n)}`),null}}).filter(e=>e!==null):[]}async function It(e){let t=S(S(process.cwd(),Mt),`${e}.json`);if(!j(t))throw Error(`Restore point not found: ${e}`);let n=JSON.parse(N(t,`utf-8`)),r=[];for(let e of n.files){let t=y(e.path);j(t)||M(t,{recursive:!0}),await _(e.path,e.content,`utf-8`),r.push(e.path)}return r}function Lt(e){return e.replace(/\\/g,`/`)}async function Rt(e){let{rootPath:t,rules:n,extensions:r=Tt,exclude:i=[],dryRun:a=!1}=e,o=n.map(e=>({...e,regex:new RegExp(e.pattern,`g`)})),s=await jt(t,r,i),c=[],l=new Set,u=0,d=[];for(let e of s){let n=Lt(C(t,e)),r=await p(e,`utf-8`),i=r.split(/\r?\n/),s=!1;for(let[e,t]of o.entries())if(!(t.fileFilter&&!kt(n,t.fileFilter)))for(let r=0;r<i.length;r++){let a=i[r];t.regex.lastIndex=0;let o=a.replace(t.regex,t.replacement);a!==o&&(i[r]=o,s=!0,l.add(e),c.push({rule:t.description,path:n,line:r+1,before:a,after:o}))}s&&(u+=1,a||(d.push({path:e,content:r}),await _(e,i.join(`
|
|
14
14
|
`),`utf-8`)))}return!a&&d.length>0&&Pt(`codemod`,d,`codemod: ${n.length} rules, ${u} files`),{changes:c,rulesApplied:l.size,filesModified:u,dryRun:a}}const zt=new ce({max:200,ttl:1e3*60*30});function Bt(e){return B(`sha256`).update(e).digest(`hex`).slice(0,16)}function Vt(e,t){let n=Bt(t),r=zt.get(e);if(zt.set(e,{hash:n,text:t,timestamp:Date.now()}),!r||r.hash===n)return{text:r?.hash===n?`[No changes since last read]`:t,isDelta:r?.hash===n,hash:n};let i=se(e,e,r.text,t,`previous`,`current`,{context:3});return i.length>=t.length*.8?{text:t,isDelta:!1,hash:n}:{text:i,isDelta:!0,hash:n}}const Ht=.6;function Ut(e){if(!e||e.length===0)return 0;let t=le(e),n=e.length;return n===0?0:Math.min(t.length/n,Ht)/Ht}function Wt(e){if(e.length===0)return[];let t=new Map,n=[];for(let r of e){let e=le(r);n.push(e);for(let n of e)t.set(n,(t.get(n)??0)+1)}let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=n[i];if(!a||o.length===0){r.push(0);continue}let s=Math.min(o.length/a.length,Ht)/Ht,c=0;for(let e of o)(t.get(e)??0)===1&&c++;let l=c/o.length,u=.6*s+.4*l;r.push(Math.min(u,1))}return r}function Gt(e){if(!e||e.length===0)return 0;let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);let n=0,r=e.length;for(let e of t.values()){let t=e/r;t>0&&(n-=t*Math.log2(t))}return Math.min(n/6.6,1)}function Kt(e){try{return Ut(e)}catch{return Gt(e)}}async function qt(e,t){let{query:n,maxChars:r=3e3,minScore:i=.3,segmentation:a=`paragraph`}=t,o=t.tokenBudget?t.tokenBudget*4:r,s;if(t.text)s=t.text;else if(t.path){let e;try{e=await g(t.path)}catch(e){let n=e.code;throw n===`ENOENT`?Error(`File not found: ${t.path}. Check the path and try again.`):n===`EACCES`||n===`EPERM`?Error(`Permission denied reading ${t.path}. The file exists but is not accessible.`):e}if(e.isDirectory())throw Error(`Path is a directory: ${t.path}. compact requires a file path, not a directory. Use analyze({ aspect: "structure", path }) or find to explore directories.`);if(e.size>1e7)throw Error(`File too large (${(e.size/1e6).toFixed(1)}MB). compact supports files up to 10MB. Consider splitting or using search instead.`);s=t.cache?(await t.cache.get(t.path)).content:await p(t.path,`utf-8`)}else throw Error(`Either "text" or "path" must be provided`);if(t.mode===`delta`&&t.path){let e=Vt(t.path,s);if(e.isDelta)return{text:e.text,originalChars:s.length,compressedChars:e.text.length,ratio:e.text.length/s.length,segmentsKept:1,segmentsTotal:1}}if(s.length<=o)return{text:s,originalChars:s.length,compressedChars:s.length,ratio:1,segmentsKept:1,segmentsTotal:1};let c=Ye(s,a);if(c.length===0)return{text:``,originalChars:s.length,compressedChars:0,ratio:0,segmentsKept:0,segmentsTotal:0};let l=await e.embed(n),u=Wt(c),d=[];for(let t=0;t<c.length;t++){let n=.85*Xe(l,await e.embed(c[t]))+.15*(u[t]??0);d.push({text:c[t],score:n,index:t})}let f=d.filter(e=>e.score>=i).sort((e,t)=>t.score-e.score),m=[],h=0;for(let e of f){if(h+e.text.length>o){h===0&&(m.push({...e,text:e.text.slice(0,o)}),h=o);break}m.push(e),h+=e.text.length+2}let _=Ze(m.sort((e,t)=>t.score-e.score)).map(e=>e.text).join(`
|
|
15
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SKILLS as e}from"../definitions/skills/index.mjs";function
|
|
1
|
+
import{SKILLS as e}from"../definitions/skills/index.mjs";import{ALL_BLOCK_DOCS as t,BLOCK_DOCS_BY_SKILL as n,BLOCK_TYPE_LIST as r}from"../generated/block-docs.mjs";const i={bySkill:n,all:t,typeList:r};function a(){let t=[];for(let[n,r]of Object.entries(e)){let e=typeof r==`function`?r({blockDocs:i}):r;for(let{file:r,content:i}of e)t.push({path:`${n}/${r}`,content:i})}return t}export{a as generateSkills};
|
|
@@ -222,4 +222,129 @@ Each step README should include:
|
|
|
222
222
|
- **Inputs** — What context/artifacts from prior steps are needed
|
|
223
223
|
- **Instructions** — Detailed steps for the agent to follow
|
|
224
224
|
- **Output** — What artifact(s) to produce and where to save them
|
|
225
|
-
- **Acceptance criteria** — How to know the step is complete`}
|
|
225
|
+
- **Acceptance criteria** — How to know the step is complete`},docs:{description:`Deep codebase understanding — analyze, learn, document, and visualize the entire project as an interactive knowledge graph`,agent:`Orchestrator`,tools:[`onboard`,`analyze`,`audit`,`produce_knowledge`,`graph`,`measure`,`blast_radius`,`search`,`symbol`,`trace`,`dead_symbols`,`file_summary`,`compact`,`digest`,`knowledge`,`present`,`check`,`test_run`,`git_context`],content:`## Understand & Document — Full Codebase Intelligence
|
|
226
|
+
|
|
227
|
+
Turn this codebase into a deeply understood, richly documented, and visually explorable project.
|
|
228
|
+
"Understand Anything" philosophy: **graphs that teach > graphs that impress.**
|
|
229
|
+
|
|
230
|
+
This is NOT just documentation generation — it is a full **analyze → understand → learn → document → present** pipeline.
|
|
231
|
+
|
|
232
|
+
### Phase 1: Deep Scan (parallel analysis)
|
|
233
|
+
|
|
234
|
+
Run all analysis tools in parallel to build a comprehensive baseline:
|
|
235
|
+
|
|
236
|
+
1. **Onboard** — \`onboard({ path: "." })\` if not already done (check \`status()\` first)
|
|
237
|
+
2. **Structure** — \`analyze({ aspect: "structure", path: "." })\`
|
|
238
|
+
3. **Dependencies** — \`analyze({ aspect: "dependencies", path: "." })\`
|
|
239
|
+
4. **Symbols** — \`analyze({ aspect: "symbols", path: "." })\`
|
|
240
|
+
5. **Patterns** — \`analyze({ aspect: "patterns", path: "." })\`
|
|
241
|
+
6. **Entry Points** — \`analyze({ aspect: "entry_points", path: "." })\`
|
|
242
|
+
7. **Diagrams** — \`analyze({ aspect: "diagram", path: "." })\`
|
|
243
|
+
8. **Health Audit** — \`audit({ path: "." })\`
|
|
244
|
+
9. **Complexity** — \`measure({ path: "." })\`
|
|
245
|
+
10. **Git Context** — \`git_context({ include_diff: true })\`
|
|
246
|
+
11. **Dead Symbols** — \`dead_symbols({ path: "." })\`
|
|
247
|
+
|
|
248
|
+
Stash all results for later phases.
|
|
249
|
+
|
|
250
|
+
### Phase 2: Knowledge Graph Construction
|
|
251
|
+
|
|
252
|
+
Build a navigable knowledge graph of the codebase:
|
|
253
|
+
|
|
254
|
+
1. **Discover modules** — \`graph({ action: 'find_nodes' })\` to get all indexed modules
|
|
255
|
+
2. **Map relationships** — For key modules, \`graph({ action: 'neighbors', node_id, direction: 'both' })\`
|
|
256
|
+
3. **Trace critical paths** — Use \`trace({ start: "<entry-point>", direction: "forward" })\` on each entry point
|
|
257
|
+
4. **Identify layers** — Classify modules into architectural layers (API, Service, Domain, Data, Infrastructure, UI, Utility, Config)
|
|
258
|
+
5. **Detect communities** — \`graph({ action: 'detect_communities' })\` to find natural module clusters
|
|
259
|
+
6. **Symbol deep-dive** — For each public API/export, \`symbol({ name })\` to understand usage
|
|
260
|
+
|
|
261
|
+
Persist the graph structure and layer classification.
|
|
262
|
+
|
|
263
|
+
### Phase 3: Multi-Agent Understanding (parallel dispatch)
|
|
264
|
+
|
|
265
|
+
Dispatch Researcher agents **in parallel** to deeply understand different aspects:
|
|
266
|
+
|
|
267
|
+
**Researcher-Alpha** — Architecture & Design Patterns:
|
|
268
|
+
- What architectural style is used? (layered, hexagonal, microservice, monolith)
|
|
269
|
+
- What design patterns appear? (repository, factory, strategy, observer, etc.)
|
|
270
|
+
- How is data flow organized? (request lifecycle, event pipeline, etc.)
|
|
271
|
+
|
|
272
|
+
**Researcher-Beta** — Business Logic & Domain:
|
|
273
|
+
- What are the core business domains/bounded contexts?
|
|
274
|
+
- What are the key business flows and processes?
|
|
275
|
+
- What domain entities and value objects exist?
|
|
276
|
+
- How is business logic separated from infrastructure?
|
|
277
|
+
|
|
278
|
+
**Researcher-Gamma** — Integration & Infrastructure:
|
|
279
|
+
- What external services, APIs, databases are used?
|
|
280
|
+
- How is authentication/authorization handled?
|
|
281
|
+
- What is the deployment topology?
|
|
282
|
+
- What monitoring, logging, observability exists?
|
|
283
|
+
|
|
284
|
+
**Researcher-Delta** — Quality & Concerns:
|
|
285
|
+
- What is the test coverage strategy?
|
|
286
|
+
- What tech debt or code smells exist?
|
|
287
|
+
- What security concerns should be noted?
|
|
288
|
+
- What performance bottlenecks are visible?
|
|
289
|
+
- What are the highest-complexity files?
|
|
290
|
+
|
|
291
|
+
### Phase 4: Document Everything
|
|
292
|
+
|
|
293
|
+
Load the \`docs\` skill and generate comprehensive documentation:
|
|
294
|
+
|
|
295
|
+
1. **Project Knowledge** (7 architecture docs):
|
|
296
|
+
- \`docs/architecture/stack.md\` — Language, runtime, frameworks, all dependencies
|
|
297
|
+
- \`docs/architecture/structure.md\` — Directory layout, entry points, key files
|
|
298
|
+
- \`docs/architecture/design.md\` — Layers, patterns, data flow, component boundaries
|
|
299
|
+
- \`docs/architecture/conventions.md\` — Naming, formatting, error handling, imports
|
|
300
|
+
- \`docs/architecture/integrations.md\` — External APIs, databases, auth, monitoring
|
|
301
|
+
- \`docs/architecture/testing.md\` — Test frameworks, file organization, mocking
|
|
302
|
+
- \`docs/architecture/concerns.md\` — Tech debt, security risks, performance issues
|
|
303
|
+
|
|
304
|
+
2. **Component Docs** — For each major module/component:
|
|
305
|
+
- \`docs/architecture/components/{name}.md\` — Purpose, API, design decisions, data flow
|
|
306
|
+
|
|
307
|
+
3. **Reference Docs**:
|
|
308
|
+
- \`docs/reference/api.md\` — API surface, endpoints, schemas
|
|
309
|
+
- \`docs/reference/configuration.md\` — Config options, environment variables
|
|
310
|
+
|
|
311
|
+
4. **Guides**:
|
|
312
|
+
- \`docs/guides/onboarding.md\` — Guided tour for new developers (dependency-ordered walkthrough)
|
|
313
|
+
- \`docs/guides/architecture-tour.md\` — Visual architecture walkthrough
|
|
314
|
+
|
|
315
|
+
5. **Project Overview**:
|
|
316
|
+
- \`docs/README.md\` — Index linking all docs, project summary
|
|
317
|
+
|
|
318
|
+
6. **Persist Knowledge** — \`produce_knowledge({ path: "." })\` + \`knowledge({ action: "remember", ... })\` for key findings
|
|
319
|
+
|
|
320
|
+
### Phase 5: Interactive Presentation
|
|
321
|
+
|
|
322
|
+
Present the understanding as a rich interactive dashboard using \`present\`:
|
|
323
|
+
|
|
324
|
+
1. **Architecture Overview** — Mermaid diagram of system layers and component relationships
|
|
325
|
+
2. **Dependency Graph** — Module dependency visualization
|
|
326
|
+
3. **Metrics Dashboard** — File count, complexity distribution, test coverage, health score
|
|
327
|
+
4. **Knowledge Map** — Key modules with descriptions, organized by architectural layer
|
|
328
|
+
5. **Guided Tour** — Recommended reading order for codebase onboarding
|
|
329
|
+
6. **Concerns Board** — Tech debt, dead code, security risks as a status board
|
|
330
|
+
7. **Business Domain Map** — Domain entities and their relationships
|
|
331
|
+
|
|
332
|
+
Use the \`c4-architecture\` skill for generating proper C4 architecture diagrams (Context, Container, Component levels).
|
|
333
|
+
|
|
334
|
+
### Output Summary
|
|
335
|
+
|
|
336
|
+
After all phases complete, present a final summary to the user:
|
|
337
|
+
- Total files analyzed, modules discovered, patterns detected
|
|
338
|
+
- Architecture style and key design decisions identified
|
|
339
|
+
- Number of docs generated and their locations
|
|
340
|
+
- Top concerns and recommendations
|
|
341
|
+
- Links to the interactive dashboard
|
|
342
|
+
|
|
343
|
+
### Rules
|
|
344
|
+
|
|
345
|
+
- **Every claim must be traceable** to source files or tool output
|
|
346
|
+
- **Never infer or assume** — only document what is verifiable
|
|
347
|
+
- **Mark unknowns** with \`[TODO]\` and intent-dependent decisions with \`[ASK USER]\`
|
|
348
|
+
- **Delegate to specialists**: architecture diagrams → \`c4-architecture\` skill, ADRs → \`adr-skill\`
|
|
349
|
+
- **Compress between phases** — use \`digest\` and \`stash\` to manage context
|
|
350
|
+
- **🛑 STOP after Phase 5** — present results and ask user for feedback before any follow-up work`}};export{e as PROMPTS};
|