@vpxa/kb 0.1.27 → 0.1.29

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.
Files changed (107) hide show
  1. package/package.json +1 -1
  2. package/packages/analyzers/dist/symbol-analyzer.js +4 -4
  3. package/packages/analyzers/dist/types.d.ts +8 -0
  4. package/packages/chunker/dist/chunker.interface.d.ts +1 -1
  5. package/packages/chunker/dist/code-chunker.d.ts +1 -1
  6. package/packages/chunker/dist/extractors/symbol-extractor.js +3 -1
  7. package/packages/chunker/dist/extractors/types.d.ts +8 -0
  8. package/packages/chunker/dist/generic-chunker.d.ts +1 -1
  9. package/packages/chunker/dist/markdown-chunker.d.ts +1 -1
  10. package/packages/chunker/dist/wasm-chunker.d.ts +1 -1
  11. package/packages/cli/dist/commands/upgrade.d.ts +6 -0
  12. package/packages/cli/dist/commands/upgrade.js +1 -0
  13. package/packages/cli/dist/helpers.d.ts +2 -2
  14. package/packages/cli/dist/index.js +2 -2
  15. package/packages/cli/dist/kb-init.d.ts +4 -4
  16. package/packages/core/dist/types.d.ts +2 -0
  17. package/packages/elicitation/dist/index.d.ts +2 -2
  18. package/packages/elicitation/dist/index.js +2 -2
  19. package/packages/enterprise-bridge/dist/result-merger.d.ts +1 -1
  20. package/packages/indexer/dist/graph-extractor.d.ts +1 -1
  21. package/packages/indexer/dist/incremental-indexer.d.ts +3 -3
  22. package/packages/kb-client/dist/direct-client.d.ts +2 -2
  23. package/packages/present/dist/index.html +4 -4
  24. package/packages/server/dist/completions.d.ts +1 -1
  25. package/packages/server/dist/config.d.ts +1 -1
  26. package/packages/server/dist/config.js +1 -1
  27. package/packages/server/dist/cross-workspace.d.ts +2 -2
  28. package/packages/server/dist/curated-manager.d.ts +2 -2
  29. package/packages/server/dist/dashboard-static.d.ts +2 -2
  30. package/packages/server/dist/elicitor.d.ts +1 -1
  31. package/packages/server/dist/index.js +1 -1
  32. package/packages/server/dist/output-schemas.d.ts +4 -0
  33. package/packages/server/dist/output-schemas.js +1 -1
  34. package/packages/server/dist/prompts.d.ts +1 -1
  35. package/packages/server/dist/resources/resources.d.ts +1 -1
  36. package/packages/server/dist/server.d.ts +7 -7
  37. package/packages/server/dist/server.js +2 -2
  38. package/packages/server/dist/structured-content-guard.d.ts +26 -0
  39. package/packages/server/dist/structured-content-guard.js +1 -0
  40. package/packages/server/dist/tools/analyze.tools.d.ts +2 -2
  41. package/packages/server/dist/tools/audit.tool.d.ts +2 -2
  42. package/packages/server/dist/tools/brainstorm.tool.d.ts +1 -1
  43. package/packages/server/dist/tools/bridge.tools.d.ts +1 -1
  44. package/packages/server/dist/tools/context.tools.d.ts +3 -3
  45. package/packages/server/dist/tools/context.tools.js +2 -1
  46. package/packages/server/dist/tools/evolution.tools.d.ts +1 -1
  47. package/packages/server/dist/tools/execution.tools.d.ts +2 -2
  48. package/packages/server/dist/tools/forge.tools.d.ts +3 -3
  49. package/packages/server/dist/tools/graph.tool.d.ts +1 -1
  50. package/packages/server/dist/tools/infra.tools.js +4 -2
  51. package/packages/server/dist/tools/lookup.tool.d.ts +1 -1
  52. package/packages/server/dist/tools/onboard.tool.d.ts +4 -3
  53. package/packages/server/dist/tools/onboard.tool.js +1 -1
  54. package/packages/server/dist/tools/policy.tools.d.ts +1 -1
  55. package/packages/server/dist/tools/present.tool.d.ts +1 -1
  56. package/packages/server/dist/tools/produce.tool.d.ts +2 -1
  57. package/packages/server/dist/tools/produce.tool.js +2 -2
  58. package/packages/server/dist/tools/reindex.tool.d.ts +3 -3
  59. package/packages/server/dist/tools/remember.tool.d.ts +1 -1
  60. package/packages/server/dist/tools/search.tool.d.ts +3 -3
  61. package/packages/server/dist/tools/status.tool.d.ts +3 -2
  62. package/packages/server/dist/tools/status.tool.js +2 -2
  63. package/packages/server/dist/tools/utility.tools.js +4 -2
  64. package/packages/server/dist/version-check.js +1 -1
  65. package/packages/store/dist/lance-store.d.ts +1 -1
  66. package/packages/store/dist/store.interface.d.ts +1 -1
  67. package/packages/tools/dist/audit.d.ts +2 -2
  68. package/packages/tools/dist/compact.d.ts +1 -1
  69. package/packages/tools/dist/dead-symbols.d.ts +2 -2
  70. package/packages/tools/dist/digest.d.ts +1 -1
  71. package/packages/tools/dist/find-examples.d.ts +3 -3
  72. package/packages/tools/dist/find.d.ts +7 -3
  73. package/packages/tools/dist/find.js +1 -1
  74. package/packages/tools/dist/forge-ground.d.ts +2 -2
  75. package/packages/tools/dist/graph-query.d.ts +1 -1
  76. package/packages/tools/dist/onboard.js +18 -2
  77. package/packages/tools/dist/scope-map.d.ts +3 -3
  78. package/packages/tools/dist/stratum-card.d.ts +1 -1
  79. package/packages/tools/dist/symbol.d.ts +2 -2
  80. package/packages/tools/dist/trace.d.ts +2 -2
  81. package/packages/tui/dist/App.d.ts +1 -1
  82. package/packages/tui/dist/hooks/useKBClient.d.ts +3 -3
  83. package/packages/tui/dist/index.d.ts +1 -1
  84. package/scaffold/README.md +192 -0
  85. package/scaffold/definitions/bodies.mjs +140 -28
  86. package/scaffold/definitions/protocols.mjs +232 -24
  87. package/scaffold/general/agents/Debugger.agent.md +9 -6
  88. package/scaffold/general/agents/Documenter.agent.md +13 -2
  89. package/scaffold/general/agents/Explorer.agent.md +12 -0
  90. package/scaffold/general/agents/Frontend.agent.md +1 -1
  91. package/scaffold/general/agents/Implementer.agent.md +3 -1
  92. package/scaffold/general/agents/Orchestrator.agent.md +67 -11
  93. package/scaffold/general/agents/Planner.agent.md +19 -2
  94. package/scaffold/general/agents/Refactor.agent.md +1 -1
  95. package/scaffold/general/agents/Security.agent.md +13 -2
  96. package/scaffold/general/agents/_shared/architect-reviewer-base.md +11 -2
  97. package/scaffold/general/agents/_shared/code-agent-base.md +181 -17
  98. package/scaffold/general/agents/_shared/code-reviewer-base.md +11 -2
  99. package/scaffold/general/agents/_shared/researcher-base.md +29 -3
  100. package/packages/elicitation/dist/__tests__/build.test.d.ts +0 -1
  101. package/packages/elicitation/dist/__tests__/fields.test.d.ts +0 -1
  102. package/packages/elicitation/dist/__tests__/normalize.test.d.ts +0 -1
  103. package/packages/elicitation/dist/build.d.ts +0 -13
  104. package/packages/elicitation/dist/fields.d.ts +0 -41
  105. package/packages/elicitation/dist/normalize.d.ts +0 -15
  106. package/packages/elicitation/dist/types.d.ts +0 -85
  107. /package/packages/tui/dist/{types-VcTHNV6s.d.ts → index-Cvx1a7S7.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpxa/kb",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "description": "Local-first AI developer toolkit — knowledge base, code analysis, context management, and developer tools for LLM agents",
6
6
  "license": "MIT",
@@ -1,9 +1,9 @@
1
- import{readFile as e,readdir as t,stat as n}from"node:fs/promises";import{dirname as r,extname as i,join as a,relative as o}from"node:path";import{SUPPORTED_EXTENSIONS as s,WasmRuntime as c,extractCalls as l,extractSymbols as u}from"../../chunker/dist/index.js";const d=new Set([`.ts`,`.tsx`,`.js`,`.jsx`,`.java`,`.py`,`.go`,`.cs`,`.rb`,`.kt`,`.scala`,`.rs`,`.php`,`.swift`]),f=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,`__pycache__`,`.venv`,`target`,`bin`,`obj`,`.gradle`,`venv`,`env`]),p={exported:[{pattern:/^export\s+(?:async\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^export\s+(?:default\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^export\s+interface\s+(\w+)/gm,kind:`interface`},{pattern:/^export\s+type\s+(\w+)/gm,kind:`type`},{pattern:/^export\s+(?:const|let)\s+(\w+)/gm,kind:`const`},{pattern:/^export\s+enum\s+(\w+)/gm,kind:`enum`}],local:[{pattern:/^(?:async\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^class\s+(\w+)/gm,kind:`class`},{pattern:/^interface\s+(\w+)/gm,kind:`interface`},{pattern:/^type\s+(\w+)/gm,kind:`type`},{pattern:/^(?:const|let)\s+(\w+)\s*=/gm,kind:`const`},{pattern:/^enum\s+(\w+)/gm,kind:`enum`}]},m={exported:[{pattern:/^[ \t]*public\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*public\s+(?:static\s+)?interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*public\s+(?:static\s+)?(?:synchronized\s+)?(?:final\s+)?(?:abstract\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])*)\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:synchronized\s+)?(?:final\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])*)\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:final\s+)?(?:\w+(?:<[^>]*>)?)\s+(\w+)\s*[;=]/gm,kind:`variable`}],skipIndentFilter:!0},h={exported:[{pattern:/^def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^async\s+def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^class\s+(\w+)/gm,kind:`class`}],local:[{pattern:/^[ \t]+def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^[ \t]+async\s+def\s+(\w+)\s*\(/gm,kind:`function`}],skipIndentFilter:!0},g={exported:[{pattern:/^func\s+([A-Z]\w*)\s*\(/gm,kind:`function`},{pattern:/^func\s+\([^)]+\)\s+([A-Z]\w*)\s*\(/gm,kind:`function`},{pattern:/^type\s+([A-Z]\w*)\s+struct\b/gm,kind:`class`},{pattern:/^type\s+([A-Z]\w*)\s+interface\b/gm,kind:`interface`},{pattern:/^type\s+([A-Z]\w*)\s+/gm,kind:`type`}],local:[{pattern:/^func\s+([a-z]\w*)\s*\(/gm,kind:`function`},{pattern:/^func\s+\([^)]+\)\s+([a-z]\w*)\s*\(/gm,kind:`function`},{pattern:/^type\s+([a-z]\w*)\s+struct\b/gm,kind:`class`},{pattern:/^type\s+([a-z]\w*)\s+/gm,kind:`type`}],skipIndentFilter:!0},_={exported:[{pattern:/^[ \t]*public\s+(?:static\s+)?(?:partial\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*public\s+(?:static\s+)?interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*public\s+(?:static\s+)?(?:virtual\s+)?(?:override\s+)?(?:async\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])?)\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected|internal)\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:private|protected|internal)\s+(?:static\s+)?(?:async\s+)?(?:\w+(?:<[^>]*>)?)\s+(\w+)\s*\(/gm,kind:`function`}],skipIndentFilter:!0},v={exported:[{pattern:/^(?:open\s+|data\s+|sealed\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^(?:fun|suspend\s+fun)\s+(\w+)\s*[(<]/gm,kind:`function`},{pattern:/^interface\s+(\w+)/gm,kind:`interface`},{pattern:/^object\s+(\w+)/gm,kind:`class`},{pattern:/^enum\s+class\s+(\w+)/gm,kind:`enum`}],local:[{pattern:/^[ \t]+(?:private|internal)\s+(?:fun|suspend\s+fun)\s+(\w+)/gm,kind:`function`},{pattern:/^[ \t]+(?:private|internal)\s+(?:val|var)\s+(\w+)/gm,kind:`variable`}],skipIndentFilter:!0},y={exported:[{pattern:/^class\s+(\w+)/gm,kind:`class`},{pattern:/^module\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]+def\s+self\.(\w+)/gm,kind:`function`}],local:[{pattern:/^[ \t]+def\s+(\w+)/gm,kind:`function`}],skipIndentFilter:!0},b={exported:[{pattern:/^pub\s+(?:async\s+)?fn\s+(\w+)/gm,kind:`function`},{pattern:/^pub\s+struct\s+(\w+)/gm,kind:`class`},{pattern:/^pub\s+trait\s+(\w+)/gm,kind:`interface`},{pattern:/^pub\s+enum\s+(\w+)/gm,kind:`enum`},{pattern:/^pub\s+type\s+(\w+)/gm,kind:`type`}],local:[{pattern:/^(?:async\s+)?fn\s+(\w+)/gm,kind:`function`},{pattern:/^struct\s+(\w+)/gm,kind:`class`},{pattern:/^trait\s+(\w+)/gm,kind:`interface`},{pattern:/^enum\s+(\w+)/gm,kind:`enum`}],skipIndentFilter:!0},x={exported:[{pattern:/^[ \t]*(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^function\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?function\s+(\w+)/gm,kind:`function`}],skipIndentFilter:!0},S={exported:[{pattern:/^[ \t]*(?:open|public)\s+class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:open|public)\s+struct\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:open|public)\s+protocol\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*(?:open|public)\s+enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*(?:open|public)\s+func\s+(\w+)/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|fileprivate|internal)\s+func\s+(\w+)/gm,kind:`function`},{pattern:/^[ \t]*(?:private|fileprivate|internal)\s+class\s+(\w+)/gm,kind:`class`}],skipIndentFilter:!0},C={exported:[{pattern:/^[ \t]*(?:case\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*object\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*trait\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*def\s+(\w+)/gm,kind:`function`}],local:[],skipIndentFilter:!0};function w(e){switch(e){case`.ts`:case`.tsx`:case`.js`:case`.jsx`:return p;case`.java`:return m;case`.py`:return h;case`.go`:return g;case`.cs`:return _;case`.kt`:return v;case`.rb`:return y;case`.rs`:return b;case`.php`:return x;case`.swift`:return S;case`.scala`:return C;default:return p}}function T(e,t){let n=``,r=0,i=!1;for(let a=t;a<Math.min(t+5,e.length);a++){let t=e[a].trim();n+=(n?` `:``)+t;for(let e of t)e===`(`&&(r++,i=!0),e===`)`&&r--;if(i&&r<=0)return n.replace(/\s*\{.*$/,``).replace(/\s*:\s*$/,``).trim()}return n.trim()||void 0}var E=class{name=`symbols`;async analyze(t,n={}){let{format:a=`markdown`,filter:d}=n,f=Date.now(),p=await this.collectFiles(t),m=p.length===1&&p[0]===t?r(t):t,h=[],g=[],_=!1;try{await c.ensure(),_=!0}catch{}for(let t of p){let n=await e(t,`utf-8`),r=o(m,t).replace(/\\/g,`/`),a=i(t);if(_&&s.has(a)){let e=await u(n,a,r);if(e.length>0){h.push(...e);let t=await l(n,a,r);g.push(...t)}else{let e=this.extractSymbolsRegex(n,r);h.push(...e)}}else{let e=this.extractSymbolsRegex(n,r);h.push(...e)}}if(d){let e=d.toLowerCase();h=h.filter(t=>t.name.toLowerCase().includes(e))}return{output:a===`json`?JSON.stringify(h,null,2):this.formatMarkdown(h,m,g),data:{symbols:h,byKind:this.groupByKind(h),exportedCount:h.filter(e=>e.exported).length,totalCount:h.length,callEdges:g},meta:{analyzedAt:new Date().toISOString(),scope:t,fileCount:p.length,durationMs:Date.now()-f}}}async collectFiles(e){let r=[],o;try{o=await n(e)}catch{throw Error(`Path does not exist: ${e}`)}if(o.isFile()){if(d.has(i(e)))return[e];throw Error(`Not a recognized source file: ${e}`)}if(!o.isDirectory())throw Error(`Not a file or directory: ${e}`);let s=async e=>{let n=await t(e,{withFileTypes:!0});for(let t of n){if(f.has(t.name)||t.name.startsWith(`.`))continue;let n=a(e,t.name);t.isDirectory()?await s(n):d.has(i(t.name))&&r.push(n)}};return await s(e),r}extractSymbolsRegex(e,t){let n=[],r=e.split(`
1
+ import{readFile as e,readdir as t,stat as n}from"node:fs/promises";import{dirname as r,extname as i,join as a,relative as o}from"node:path";import{SUPPORTED_EXTENSIONS as s,WasmRuntime as c,extractCalls as l,extractSymbols as u}from"../../chunker/dist/index.js";const d=new Set([`.ts`,`.tsx`,`.js`,`.jsx`,`.java`,`.py`,`.go`,`.cs`,`.rb`,`.kt`,`.scala`,`.rs`,`.php`,`.swift`]),f=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,`__pycache__`,`.venv`,`target`,`bin`,`obj`,`.gradle`,`venv`,`env`]),p={exported:[{pattern:/^export\s+(?:async\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^export\s+(?:default\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^export\s+interface\s+(\w+)/gm,kind:`interface`},{pattern:/^export\s+type\s+(\w+)/gm,kind:`type`},{pattern:/^export\s+(?:const|let)\s+(\w+)/gm,kind:`const`},{pattern:/^export\s+enum\s+(\w+)/gm,kind:`enum`}],local:[{pattern:/^(?:async\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^class\s+(\w+)/gm,kind:`class`},{pattern:/^interface\s+(\w+)/gm,kind:`interface`},{pattern:/^type\s+(\w+)/gm,kind:`type`},{pattern:/^(?:const|let)\s+(\w+)\s*=/gm,kind:`const`},{pattern:/^enum\s+(\w+)/gm,kind:`enum`}]},m={exported:[{pattern:/^[ \t]*public\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*public\s+(?:static\s+)?interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*public\s+(?:static\s+)?(?:synchronized\s+)?(?:final\s+)?(?:abstract\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])*)\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:synchronized\s+)?(?:final\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])*)\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?(?:final\s+)?(?:\w+(?:<[^>]*>)?)\s+(\w+)\s*[;=]/gm,kind:`variable`}],skipIndentFilter:!0},h={exported:[{pattern:/^def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^async\s+def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^class\s+(\w+)/gm,kind:`class`}],local:[{pattern:/^[ \t]+def\s+(\w+)\s*\(/gm,kind:`function`},{pattern:/^[ \t]+async\s+def\s+(\w+)\s*\(/gm,kind:`function`}],skipIndentFilter:!0},g={exported:[{pattern:/^func\s+([A-Z]\w*)\s*\(/gm,kind:`function`},{pattern:/^func\s+\([^)]+\)\s+([A-Z]\w*)\s*\(/gm,kind:`function`},{pattern:/^type\s+([A-Z]\w*)\s+struct\b/gm,kind:`class`},{pattern:/^type\s+([A-Z]\w*)\s+interface\b/gm,kind:`interface`},{pattern:/^type\s+([A-Z]\w*)\s+/gm,kind:`type`}],local:[{pattern:/^func\s+([a-z]\w*)\s*\(/gm,kind:`function`},{pattern:/^func\s+\([^)]+\)\s+([a-z]\w*)\s*\(/gm,kind:`function`},{pattern:/^type\s+([a-z]\w*)\s+struct\b/gm,kind:`class`},{pattern:/^type\s+([a-z]\w*)\s+/gm,kind:`type`}],skipIndentFilter:!0},_={exported:[{pattern:/^[ \t]*public\s+(?:static\s+)?(?:partial\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*public\s+(?:static\s+)?interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*public\s+(?:static\s+)?(?:virtual\s+)?(?:override\s+)?(?:async\s+)?(?:\w+(?:<[^>]*>)?(?:\[\])?)\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected|internal)\s+(?:static\s+)?(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:private|protected|internal)\s+(?:static\s+)?(?:async\s+)?(?:\w+(?:<[^>]*>)?)\s+(\w+)\s*\(/gm,kind:`function`}],skipIndentFilter:!0},v={exported:[{pattern:/^(?:open\s+|data\s+|sealed\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^(?:fun|suspend\s+fun)\s+(\w+)\s*[(<]/gm,kind:`function`},{pattern:/^interface\s+(\w+)/gm,kind:`interface`},{pattern:/^object\s+(\w+)/gm,kind:`class`},{pattern:/^enum\s+class\s+(\w+)/gm,kind:`enum`}],local:[{pattern:/^[ \t]+(?:private|internal)\s+(?:fun|suspend\s+fun)\s+(\w+)/gm,kind:`function`},{pattern:/^[ \t]+(?:private|internal)\s+(?:val|var)\s+(\w+)/gm,kind:`variable`}],skipIndentFilter:!0},y={exported:[{pattern:/^class\s+(\w+)/gm,kind:`class`},{pattern:/^module\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]+def\s+self\.(\w+)/gm,kind:`function`}],local:[{pattern:/^[ \t]+def\s+(\w+)/gm,kind:`function`}],skipIndentFilter:!0},b={exported:[{pattern:/^pub\s+(?:async\s+)?fn\s+(\w+)/gm,kind:`function`},{pattern:/^pub\s+struct\s+(\w+)/gm,kind:`class`},{pattern:/^pub\s+trait\s+(\w+)/gm,kind:`interface`},{pattern:/^pub\s+enum\s+(\w+)/gm,kind:`enum`},{pattern:/^pub\s+type\s+(\w+)/gm,kind:`type`}],local:[{pattern:/^(?:async\s+)?fn\s+(\w+)/gm,kind:`function`},{pattern:/^struct\s+(\w+)/gm,kind:`class`},{pattern:/^trait\s+(\w+)/gm,kind:`interface`},{pattern:/^enum\s+(\w+)/gm,kind:`enum`}],skipIndentFilter:!0},x={exported:[{pattern:/^[ \t]*(?:abstract\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*interface\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*public\s+(?:static\s+)?function\s+(\w+)/gm,kind:`function`},{pattern:/^function\s+(\w+)\s*\(/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|protected)\s+(?:static\s+)?function\s+(\w+)/gm,kind:`function`}],skipIndentFilter:!0},S={exported:[{pattern:/^[ \t]*(?:open|public)\s+class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:open|public)\s+struct\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*(?:open|public)\s+protocol\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*(?:open|public)\s+enum\s+(\w+)/gm,kind:`enum`},{pattern:/^[ \t]*(?:open|public)\s+func\s+(\w+)/gm,kind:`function`}],local:[{pattern:/^[ \t]*(?:private|fileprivate|internal)\s+func\s+(\w+)/gm,kind:`function`},{pattern:/^[ \t]*(?:private|fileprivate|internal)\s+class\s+(\w+)/gm,kind:`class`}],skipIndentFilter:!0},C={exported:[{pattern:/^[ \t]*(?:case\s+)?class\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*object\s+(\w+)/gm,kind:`class`},{pattern:/^[ \t]*trait\s+(\w+)/gm,kind:`interface`},{pattern:/^[ \t]*def\s+(\w+)/gm,kind:`function`}],local:[],skipIndentFilter:!0};function w(e){switch(e){case`.ts`:case`.tsx`:case`.js`:case`.jsx`:return p;case`.java`:return m;case`.py`:return h;case`.go`:return g;case`.cs`:return _;case`.kt`:return v;case`.rb`:return y;case`.rs`:return b;case`.php`:return x;case`.swift`:return S;case`.scala`:return C;default:return p}}function T(e,t){let n=``,r=0,i=!1;for(let a=t;a<Math.min(t+5,e.length);a++){let t=e[a].trim();n+=(n?` `:``)+t;for(let e of t)e===`(`&&(r++,i=!0),e===`)`&&r--;if(i&&r<=0)return n.replace(/\s*\{.*$/,``).replace(/\s*:\s*$/,``).trim()}return n.trim()||void 0}function E(e,t){let n=T(e,t);if(!n)return;let r=n.match(/\)\s*:\s*([^{=]+)/);if(r)return r[1].trim().slice(0,200)||void 0;let i=n.match(/=>\s*([^{]+)/);if(i)return i[1].trim().slice(0,200)||void 0}function D(e,t){for(let n=t-1;n>=Math.max(0,t-10);n--){let t=e[n].trim();if(t!==``){if(t.endsWith(`*/`)){for(let t=n;t>=Math.max(0,n-20);t--)if(e[t].trim().startsWith(`/**`)||e[t].trim().startsWith(`/*`)){for(let r=t;r<=n;r++){let t=e[r].replace(/^\s*\/\*\*?\s*/,``).replace(/\s*\*\/\s*$/,``).replace(/^\s*\*\s?/,``).trim();if(t.length>0&&!t.startsWith(`@`))return t.slice(0,200)}return}}if(t.startsWith(`//`))return t.replace(/^\/\/\s*/,``).slice(0,200)||void 0;break}}}function O(e,t){let n=``,r=0,i=!1;for(let a=t;a<Math.min(t+30,e.length);a++){let t=e[a];n+=` ${t.trim()}`;for(let e of t)e===`{`&&(r++,i=!0),e===`}`&&r--;if(i&&r<=0){let e=n.match(/\{([\s\S]*)\}/);if(e){let t=`{ ${e[1].replace(/\n\s*/g,` `).replace(/\s+/g,` `).trim()} }`;return t.length>500?`${t.slice(0,500)}…`:t}return}}}var k=class{name=`symbols`;async analyze(t,n={}){let{format:a=`markdown`,filter:d}=n,f=Date.now(),p=await this.collectFiles(t),m=p.length===1&&p[0]===t?r(t):t,h=[],g=[],_=!1;try{await c.ensure(),_=!0}catch{}for(let t of p){let n=await e(t,`utf-8`),r=o(m,t).replace(/\\/g,`/`),a=i(t);if(_&&s.has(a)){let e=await u(n,a,r);if(e.length>0){h.push(...e);let t=await l(n,a,r);g.push(...t)}else{let e=this.extractSymbolsRegex(n,r);h.push(...e)}}else{let e=this.extractSymbolsRegex(n,r);h.push(...e)}}if(d){let e=d.toLowerCase();h=h.filter(t=>t.name.toLowerCase().includes(e))}return{output:a===`json`?JSON.stringify(h,null,2):this.formatMarkdown(h,m,g),data:{symbols:h,byKind:this.groupByKind(h),exportedCount:h.filter(e=>e.exported).length,totalCount:h.length,callEdges:g},meta:{analyzedAt:new Date().toISOString(),scope:t,fileCount:p.length,durationMs:Date.now()-f}}}async collectFiles(e){let r=[],o;try{o=await n(e)}catch{throw Error(`Path does not exist: ${e}`)}if(o.isFile()){if(d.has(i(e)))return[e];throw Error(`Not a recognized source file: ${e}`)}if(!o.isDirectory())throw Error(`Not a file or directory: ${e}`);let s=async e=>{let n=await t(e,{withFileTypes:!0});for(let t of n){if(f.has(t.name)||t.name.startsWith(`.`))continue;let n=a(e,t.name);t.isDirectory()?await s(n):d.has(i(t.name))&&r.push(n)}};return await s(e),r}extractSymbolsRegex(e,t){let n=[],r=e.split(`
2
2
  `),a=new Set,o=w(i(t));for(let{pattern:i,kind:s}of o.exported){let o=new RegExp(i.source,i.flags),c;for(;(c=o.exec(e))!==null;){let i=c[1];a.add(i);let o=e.slice(0,c.index).split(`
3
- `).length,l=s===`function`||s===`method`?T(r,o-1):void 0;n.push({name:i,kind:s,exported:!0,filePath:t,line:o,signature:l})}}for(let{pattern:i,kind:s}of o.local){let c=new RegExp(i.source,i.flags),l;for(;(l=c.exec(e))!==null;){let i=l[1];if(a.has(i))continue;if(!o.skipIndentFilter){let t=r[e.slice(0,l.index).split(`
3
+ `).length,l=s===`function`||s===`method`?T(r,o-1):void 0,u=s===`function`||s===`method`?E(r,o-1):void 0,d=D(r,o-1),f=s===`interface`||s===`type`?O(r,o-1):void 0;n.push({name:i,kind:s,exported:!0,filePath:t,line:o,signature:l,returnType:u,jsdoc:d,typeBody:f})}}for(let{pattern:i,kind:s}of o.local){let c=new RegExp(i.source,i.flags),l;for(;(l=c.exec(e))!==null;){let i=l[1];if(a.has(i))continue;if(!o.skipIndentFilter){let t=r[e.slice(0,l.index).split(`
4
4
  `).length-1]??``;if(t.startsWith(` `)||t.startsWith(` `))continue}let c=e.slice(0,l.index).split(`
5
- `).length,u=s===`function`||s===`method`?T(r,c-1):void 0;n.push({name:i,kind:s,exported:!1,filePath:t,line:c,signature:u})}}return n}groupByKind(e){let t={};for(let n of e)t[n.kind]=(t[n.kind]??0)+1;return t}formatMarkdown(e,t,n=[]){let r=[],i=e.filter(e=>e.exported).length;r.push(`## Symbols: ${t}\n`),r.push(`**${e.length} symbols** (${i} exported)\n`);let a={};for(let t of e)a[t.kind]=(a[t.kind]??0)+1;let o=Object.entries(a).sort((e,t)=>t[1]-e[1]).map(([e,t])=>`${t} ${e===`class`?`classes`:`${e}s`}`).join(`, `);r.push(`**Breakdown**: ${o}\n`);let s={};for(let t of e)s[t.filePath]||(s[t.filePath]=[]),s[t.filePath].push(t);r.push(`**${Object.keys(s).length} files** with symbols\n`);let c=0,l=Object.entries(s).sort((e,t)=>{let n=e[1].filter(e=>e.exported).length;return t[1].filter(e=>e.exported).length-n});for(let[e,t]of l){let n=t.filter(e=>e.exported);if(n.length===0)continue;let i=[`### ${e}\n`];for(let e of n){let t=e.signature?` — \`${e.signature}\``:``;i.push(`- 📤 \`${e.kind}\` **${e.name}** (line ${e.line})${t}`)}let a=t.length-n.length;a>0&&i.push(`- _${a} internal ${a===1?`symbol`:`symbols`}_`),i.push(``);let o=i.join(`
5
+ `).length,u=s===`function`||s===`method`?T(r,c-1):void 0,d=s===`function`||s===`method`?E(r,c-1):void 0,f=D(r,c-1),p=s===`interface`||s===`type`?O(r,c-1):void 0;n.push({name:i,kind:s,exported:!1,filePath:t,line:c,signature:u,returnType:d,jsdoc:f,typeBody:p})}}return n}groupByKind(e){let t={};for(let n of e)t[n.kind]=(t[n.kind]??0)+1;return t}formatMarkdown(e,t,n=[]){let r=[],i=e.filter(e=>e.exported).length;r.push(`## Symbols: ${t}\n`),r.push(`**${e.length} symbols** (${i} exported)\n`);let a={};for(let t of e)a[t.kind]=(a[t.kind]??0)+1;let o=Object.entries(a).sort((e,t)=>t[1]-e[1]).map(([e,t])=>`${t} ${e===`class`?`classes`:`${e}s`}`).join(`, `);r.push(`**Breakdown**: ${o}\n`);let s={};for(let t of e)s[t.filePath]||(s[t.filePath]=[]),s[t.filePath].push(t);r.push(`**${Object.keys(s).length} files** with symbols\n`);let c=0,l=Object.entries(s).sort((e,t)=>{let n=e[1].filter(e=>e.exported).length;return t[1].filter(e=>e.exported).length-n});for(let[e,t]of l){let n=t.filter(e=>e.exported);if(n.length===0)continue;let i=[`### ${e}\n`];for(let e of n){let t=e.signature?` — \`${e.signature}\``:``,n=e.returnType?`: ${e.returnType}`:``,r=e.decorators?.length?` ${e.decorators.join(` `)}`:``;i.push(`- 📤 \`${e.kind}\` **${e.name}** (line ${e.line})${t}${n}`),r&&i.push(` ${r}`),e.jsdoc&&i.push(` > ${e.jsdoc}`),e.typeBody&&i.push(` \`${e.typeBody}\``)}let a=t.length-n.length;a>0&&i.push(`- _${a} internal ${a===1?`symbol`:`symbols`}_`),i.push(``);let o=i.join(`
6
6
  `);if(c+=o.length,c>81920){r.push(`\n_Output truncated at 80KB. ${Object.keys(s).length-r.filter(e=>e.startsWith(`### `)).length} files omitted._`);break}r.push(o)}return n.length>0&&r.push(this.formatCallGraph(n)),r.join(`
7
7
  `)}formatCallGraph(e){let t=new Map;for(let n of e){if(n.callerName===`<module>`)continue;let e=`${n.callerFile}:${n.callerName}->${n.calleeName}`,r=t.get(e);r?r.count++:t.set(e,{callerFile:n.callerFile,callerName:n.callerName,calleeName:n.calleeName,count:1})}if(t.size===0)return``;let n=[];n.push(`### Call Graph Summary
8
8
  `),n.push(`**${e.length} call edges** across analyzed files\n`);let r=new Map;for(let e of t.values()){let t=`${e.callerFile}#${e.callerName}`;r.has(t)||r.set(t,[]),r.get(t)?.push(e.calleeName)}let i=[...r.entries()].sort((e,t)=>t[1].length-e[1].length).slice(0,30);for(let[e,t]of i){let[r,i]=e.split(`#`);n.push(`- **${i}** (${r}) → ${t.join(`, `)}`)}return n.push(``),n.join(`
9
- `)}};export{E as SymbolAnalyzer};
9
+ `)}};export{k as SymbolAnalyzer};
@@ -72,6 +72,14 @@ interface SymbolInfo {
72
72
  line: number;
73
73
  /** Full signature for functions/methods (parameter list + return type) */
74
74
  signature?: string;
75
+ /** Return type annotation (e.g. "Promise<void>", "string") */
76
+ returnType?: string;
77
+ /** First line of JSDoc/docstring */
78
+ jsdoc?: string;
79
+ /** Decorator names (e.g. ["@Controller('/api')", "@Injectable"]) */
80
+ decorators?: string[];
81
+ /** Condensed body for interfaces/types (e.g. "{ id: string; name: string }") */
82
+ typeBody?: string;
75
83
  }
76
84
  interface PatternMatch {
77
85
  pattern: string;
@@ -1,4 +1,4 @@
1
- import { ChunkMetadata, RawChunk } from "@kb/core";
1
+ import { ChunkMetadata, RawChunk } from "../../core/dist/index.js";
2
2
 
3
3
  //#region packages/chunker/src/chunker.interface.d.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { IChunker } from "./chunker.interface.js";
2
- import { ChunkMetadata, RawChunk } from "@kb/core";
2
+ import { ChunkMetadata, RawChunk } from "../../core/dist/index.js";
3
3
 
4
4
  //#region packages/chunker/src/code-chunker.d.ts
5
5
  declare class CodeChunker implements IChunker {
@@ -1 +1,3 @@
1
- import{WasmRuntime as e}from"../wasm/runtime.js";import{QueryExecutor as t}from"../wasm/query-executor.js";const n=new t,r={function_declaration:`function`,class_declaration:`class`,interface_declaration:`interface`,type_alias_declaration:`type`,enum_declaration:`enum`,lexical_declaration:`const`,method_definition:`method`,public_field_definition:`variable`,field_definition:`variable`,function_definition:`function`,class_definition:`class`,expression_statement:`variable`,method_declaration:`method`,constructor_declaration:`method`,field_declaration:`variable`,type_spec:`type`,type_declaration:`type`,const_spec:`const`,var_spec:`variable`,function_item:`function`,struct_item:`class`,enum_item:`enum`,trait_item:`interface`,impl_item:`type`,const_item:`const`,static_item:`variable`,type_item:`type`};async function i(t,r,i=``){let o=await e.ensure(),s=await o.parse(t,r);if(!s)return[];let c=o.getLanguage(r);return c?a(n.execute(s.rootNode,c,r,`symbols`),r,i):[]}function a(e,t,n){let i=new Map;for(let n of e){let e=n.captures.get(`name`);if(!e)continue;let r=`${e.text}:${(n.captures.get(`node`)?.startLine??e.startLine)+1}`,a=o(n,t),s=i.get(r);(!s||!s.exported&&a)&&i.set(r,{match:n,exported:a})}let a=[];for(let{match:e,exported:o}of i.values()){let i=e.captures.get(`name`),l=e.captures.get(`node`);if(!i)continue;let u=r[l?.nodeType??i.nodeType]??`variable`,d=(l?.startLine??i.startLine)+1,f=s(u,l?.node,t);a.push({name:i.text,kind:f,exported:o,filePath:n,line:d,signature:c(l?.node,f)})}return a}function o(e,t){if(e.captures.has(`exported`))return!0;let n=e.captures.get(`name`)?.text;if(!n)return!1;if(t===`.py`)return!n.startsWith(`_`);if(t===`.go`)return/^[A-Z]/.test(n);if(t===`.java`){let t=e.captures.get(`node`)?.text??``;return/\bpublic\b/.test(t)}return!1}function s(e,t,n){if(n===`.go`&&e===`type`&&t?.children){let e=t.type===`type_declaration`?t.children.flatMap(e=>e.children??[]):t.children;for(let t of e){if(t.type===`interface_type`)return`interface`;if(t.type===`struct_type`)return`class`}}return e}function c(e,t){if(e){if(t===`function`||t===`method`)return l(e);if(t===`class`)return u(e);if(t===`interface`)return f(e)}}function l(e){let t=e.childForFieldName(`parameters`)??e.childForFieldName(`parameter_list`),n=e.childForFieldName(`return_type`)??e.childForFieldName(`type`),r=e.childForFieldName(`result`);if(!t){for(let t of e.children)if(t.type===`formal_parameters`||t.type===`parameter_list`||t.type===`parameters`){let e=t.text;return n&&(e+=n.text),r&&(e+=` ${r.text}`),e.length>120?`${e.slice(0,117)}...`:e}return}let i=t.text;return n&&(i+=n.text),r&&(i+=` ${r.text}`),i.length>120?`${i.slice(0,117)}...`:i}function u(e){let t=e.childForFieldName(`body`)??e.childForFieldName(`field_declaration_list`);if(!t){for(let t of e.children)if(t.type===`struct_type`||t.type===`class_body`)return d(t);return}return d(t)}function d(e){let t=[];for(let n of e.children){if(n.type===`method_definition`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`method_declaration`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`field_declaration`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`function_definition`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}}if(t.length===0)return;let n=t.join(`, `);return n.length>120?`${n.slice(0,117)}...`:n}function f(e){let t=e.childForFieldName(`body`);if(!t){for(let t of e.children)if(t.type===`interface_type`)return p(t);return}return p(t)}function p(e){let t=[];for(let n of e.children){if(n.type===`property_signature`||n.type===`method_signature`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`method_declaration`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`method_spec`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`function_signature_item`||n.type===`declaration_list`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}}if(t.length===0)return;let n=t.join(`, `);return n.length>120?`${n.slice(0,117)}...`:n}export{i as extractSymbols};
1
+ import{WasmRuntime as e}from"../wasm/runtime.js";import{QueryExecutor as t}from"../wasm/query-executor.js";const n=new t,r={function_declaration:`function`,class_declaration:`class`,interface_declaration:`interface`,type_alias_declaration:`type`,enum_declaration:`enum`,lexical_declaration:`const`,method_definition:`method`,public_field_definition:`variable`,field_definition:`variable`,function_definition:`function`,class_definition:`class`,expression_statement:`variable`,method_declaration:`method`,constructor_declaration:`method`,field_declaration:`variable`,type_spec:`type`,type_declaration:`type`,const_spec:`const`,var_spec:`variable`,function_item:`function`,struct_item:`class`,enum_item:`enum`,trait_item:`interface`,impl_item:`type`,const_item:`const`,static_item:`variable`,type_item:`type`};async function i(t,r,i=``){let o=await e.ensure(),s=await o.parse(t,r);if(!s)return[];let c=o.getLanguage(r);return c?a(n.execute(s.rootNode,c,r,`symbols`),r,i):[]}function a(e,t,n){let i=new Map;for(let n of e){let e=n.captures.get(`name`);if(!e)continue;let r=`${e.text}:${(n.captures.get(`node`)?.startLine??e.startLine)+1}`,a=o(n,t),s=i.get(r);(!s||!s.exported&&a)&&i.set(r,{match:n,exported:a})}let a=[];for(let{match:e,exported:o}of i.values()){let i=e.captures.get(`name`),l=e.captures.get(`node`);if(!i)continue;let u=r[l?.nodeType??i.nodeType]??`variable`,d=(l?.startLine??i.startLine)+1,f=s(u,l?.node,t),p=l?.node??i.node;a.push({name:i.text,kind:f,exported:o,filePath:n,line:d,signature:c(l?.node,f),returnType:m(l?.node,f),jsdoc:h(p),decorators:g(p),typeBody:_(l?.node,f)})}return a}function o(e,t){if(e.captures.has(`exported`))return!0;let n=e.captures.get(`name`)?.text;if(!n)return!1;if(t===`.py`)return!n.startsWith(`_`);if(t===`.go`)return/^[A-Z]/.test(n);if(t===`.java`){let t=e.captures.get(`node`)?.text??``;return/\bpublic\b/.test(t)}return!1}function s(e,t,n){if(n===`.go`&&e===`type`&&t?.children){let e=t.type===`type_declaration`?t.children.flatMap(e=>e.children??[]):t.children;for(let t of e){if(t.type===`interface_type`)return`interface`;if(t.type===`struct_type`)return`class`}}return e}function c(e,t){if(e){if(t===`function`||t===`method`)return l(e);if(t===`class`)return u(e);if(t===`interface`)return f(e)}}function l(e){let t=e.childForFieldName(`parameters`)??e.childForFieldName(`parameter_list`),n=e.childForFieldName(`return_type`)??e.childForFieldName(`type`),r=e.childForFieldName(`result`);if(!t){for(let t of e.children)if(t.type===`formal_parameters`||t.type===`parameter_list`||t.type===`parameters`){let e=t.text;return n&&(e+=n.text),r&&(e+=` ${r.text}`),e.length>120?`${e.slice(0,117)}...`:e}return}let i=t.text;return n&&(i+=n.text),r&&(i+=` ${r.text}`),i.length>120?`${i.slice(0,117)}...`:i}function u(e){let t=e.childForFieldName(`body`)??e.childForFieldName(`field_declaration_list`);if(!t){for(let t of e.children)if(t.type===`struct_type`||t.type===`class_body`)return d(t);return}return d(t)}function d(e){let t=[];for(let n of e.children){if(n.type===`method_definition`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`method_declaration`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`field_declaration`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`function_definition`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}}if(t.length===0)return;let n=t.join(`, `);return n.length>120?`${n.slice(0,117)}...`:n}function f(e){let t=e.childForFieldName(`body`);if(!t){for(let t of e.children)if(t.type===`interface_type`)return p(t);return}return p(t)}function p(e){let t=[];for(let n of e.children){if(n.type===`property_signature`||n.type===`method_signature`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`method_declaration`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`method_spec`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}if(n.type===`function_signature_item`||n.type===`declaration_list`){let e=n.childForFieldName(`name`);e&&t.push(e.text)}}if(t.length===0)return;let n=t.join(`, `);return n.length>120?`${n.slice(0,117)}...`:n}function m(e,t){if(!e||t!==`function`&&t!==`method`)return;let n=e.childForFieldName(`return_type`)??e.childForFieldName(`type`);if(n){let e=n.text.replace(/^:\s*/,``).trim();return e.length>200?`${e.slice(0,200)}…`:e}let r=e.childForFieldName(`result`);if(r)return r.text.trim()}function h(e){let t=e.parent;if(!t?.children)return;let n=t.children.indexOf(e);if(n<=0)return;let r=t.children[n-1];if(r){if(r.type===`comment`||r.type===`block_comment`||r.type===`doc_comment`)return r.text.replace(/^\/\*\*?\s*|\s*\*\/$/g,``).split(`
2
+ `).map(e=>e.replace(/^\s*\*\s?/,``).trim()).filter(e=>e.length>0&&!e.startsWith(`@`))[0]?.slice(0,200)||void 0;if(e.children[0]?.type===`expression_statement`){let t=e.children[0].children[0];if(t&&(t.type===`string`||t.type===`concatenated_string`))return t.text.replace(/^['"`]{1,3}|['"`]{1,3}$/g,``).trim().split(`
3
+ `)[0]?.trim()?.slice(0,200)||void 0}}}function g(e){let t=e.parent;if(!t?.children)return;let n=t.children.indexOf(e),r=[];for(let e=n-1;e>=0;e--){let n=t.children[e];if(n.type===`decorator`||n.type===`annotation`||n.type===`marker_annotation`){let e=n.text.trim();r.unshift(e.length>100?`${e.slice(0,100)}…`:e)}else if(n.type!==`comment`&&n.type!==`block_comment`&&n.type!==`doc_comment`)break}return r.length>0?r:void 0}function _(e,t){if(!e||t!==`interface`&&t!==`type`)return;let n=e.childForFieldName(`body`)??e.childForFieldName(`value`)??e.children.find(e=>e.type===`object_type`||e.type===`interface_body`||e.type===`type_body`);if(!n)return;let r=n.text.replace(/\n\s*/g,` `).replace(/\s+/g,` `).trim();return r.length>500?`${r.slice(0,500)}…`:r}export{i as extractSymbols};
@@ -12,6 +12,14 @@ interface SymbolInfo {
12
12
  filePath: string;
13
13
  line: number;
14
14
  signature?: string;
15
+ /** Return type annotation (e.g. "Promise<void>", "string") */
16
+ returnType?: string;
17
+ /** First line of JSDoc/docstring */
18
+ jsdoc?: string;
19
+ /** Decorator names (e.g. ["@Controller('/api')", "@Injectable"]) */
20
+ decorators?: string[];
21
+ /** Condensed body for interfaces/types (e.g. "{ id: string; name: string }") */
22
+ typeBody?: string;
15
23
  }
16
24
  interface ImportInfo {
17
25
  source: string;
@@ -1,5 +1,5 @@
1
1
  import { IChunker } from "./chunker.interface.js";
2
- import { ChunkMetadata, RawChunk } from "@kb/core";
2
+ import { ChunkMetadata, RawChunk } from "../../core/dist/index.js";
3
3
 
4
4
  //#region packages/chunker/src/generic-chunker.d.ts
5
5
  declare class GenericChunker implements IChunker {
@@ -1,5 +1,5 @@
1
1
  import { IChunker } from "./chunker.interface.js";
2
- import { ChunkMetadata, RawChunk } from "@kb/core";
2
+ import { ChunkMetadata, RawChunk } from "../../core/dist/index.js";
3
3
 
4
4
  //#region packages/chunker/src/markdown-chunker.d.ts
5
5
  declare class MarkdownChunker implements IChunker {
@@ -1,5 +1,5 @@
1
1
  import { IChunker } from "./chunker.interface.js";
2
- import { ChunkMetadata, RawChunk } from "@kb/core";
2
+ import { ChunkMetadata, RawChunk } from "../../core/dist/index.js";
3
3
 
4
4
  //#region packages/chunker/src/wasm-chunker.d.ts
5
5
  declare class WasmChunker implements IChunker {
@@ -0,0 +1,6 @@
1
+ import { Command } from "../types.js";
2
+
3
+ //#region packages/cli/src/commands/upgrade.d.ts
4
+ declare const upgradeCommands: Command[];
5
+ //#endregion
6
+ export { upgradeCommands };
@@ -0,0 +1 @@
1
+ const e=[{name:`upgrade`,description:`Upgrade KB agents, prompts, and skills to the latest version`,usage:`kb upgrade`,run:async()=>{let{initUser:e}=await import(`./init/user.js`);await e({force:!0})}}];export{e as upgradeCommands};
@@ -1,6 +1,6 @@
1
1
  import { KBContext } from "./kb-init.js";
2
- import { SearchResult } from "@kb/core";
3
- import { BatchOperation, ManagedProcess, check, checkpointSave, diffParse, fileSummary, findDeadSymbols, findExamples, gitContext, parseOutput, symbol, testRun, trace } from "@kb/tools";
2
+ import { SearchResult } from "../../core/dist/index.js";
3
+ import { BatchOperation, ManagedProcess, check, checkpointSave, diffParse, fileSummary, findDeadSymbols, findExamples, gitContext, parseOutput, symbol, testRun, trace } from "../../tools/dist/index.js";
4
4
 
5
5
  //#region packages/cli/src/helpers.d.ts
6
6
  declare function extractNumFlag(args: string[], flag: string, defaultValue: number): number;
@@ -1,3 +1,3 @@
1
- import{getCtx as e}from"./context.js";import{analyzeCommands as t}from"./commands/analyze.js";import{contextCommands as n}from"./commands/context-cmds.js";import{environmentCommands as r}from"./commands/environment.js";import{executionCommands as i}from"./commands/execution.js";import{graphCommands as a}from"./commands/graph.js";import{knowledgeCommands as o}from"./commands/knowledge.js";import{searchCommands as s}from"./commands/search.js";import{systemCommands as c}from"./commands/system.js";import{workspaceCommands as l}from"./commands/workspace.js";import{readFileSync as u}from"node:fs";import{dirname as d,resolve as f}from"node:path";import{fileURLToPath as p}from"node:url";const m=[...s,...o,...t,...a,...c,...i,...n,...l,...r];m.push({name:`help`,description:`Show available commands`,run:async()=>{g()}});async function h(t){let n=[...t],r=n.shift();if(!r||r===`--help`||r===`-h`){g();return}if(r===`--version`||r===`-v`){let e=f(d(p(import.meta.url)),`..`,`..`,`..`,`package.json`),t=JSON.parse(u(e,`utf-8`));console.log(t.version);return}let i=m.find(e=>e.name===r);i||(console.error(`Unknown command: ${r}`),g(),process.exit(1));try{await i.run(n)}finally{let t=e();t&&await t.store.close()}}function g(){console.log(`@vpxa/kb — Local-first AI developer toolkit
1
+ import{getCtx as e}from"./context.js";import{analyzeCommands as t}from"./commands/analyze.js";import{contextCommands as n}from"./commands/context-cmds.js";import{environmentCommands as r}from"./commands/environment.js";import{executionCommands as i}from"./commands/execution.js";import{graphCommands as a}from"./commands/graph.js";import{knowledgeCommands as o}from"./commands/knowledge.js";import{searchCommands as s}from"./commands/search.js";import{systemCommands as c}from"./commands/system.js";import{upgradeCommands as l}from"./commands/upgrade.js";import{workspaceCommands as u}from"./commands/workspace.js";import{readFileSync as d}from"node:fs";import{dirname as f,resolve as p}from"node:path";import{fileURLToPath as m}from"node:url";const h=[...s,...o,...t,...a,...c,...i,...n,...u,...r,...l];h.push({name:`help`,description:`Show available commands`,run:async()=>{_()}});async function g(t){let n=[...t],r=n.shift();if(!r||r===`--help`||r===`-h`){_();return}if(r===`--version`||r===`-v`){let e=p(f(m(import.meta.url)),`..`,`..`,`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));console.log(t.version);return}let i=h.find(e=>e.name===r);i||(console.error(`Unknown command: ${r}`),_(),process.exit(1));try{await i.run(n)}finally{let t=e();t&&await t.store.close()}}function _(){console.log(`@vpxa/kb — Local-first AI developer toolkit
2
2
  `),console.log(`Usage: kb <command> [options]
3
- `),console.log(`Commands:`);let e=Math.max(...m.map(e=>e.name.length));for(let t of m)console.log(` ${t.name.padEnd(e+2)}${t.description}`);console.log(``),console.log(`Options:`),console.log(` --help, -h Show this help`),console.log(` --version, -v Show version`)}export{h as run};
3
+ `),console.log(`Commands:`);let e=Math.max(...h.map(e=>e.name.length));for(let t of h)console.log(` ${t.name.padEnd(e+2)}${t.description}`);console.log(``),console.log(`Options:`),console.log(` --help, -h Show this help`),console.log(` --version, -v Show version`)}export{g as run};
@@ -1,7 +1,7 @@
1
- import { KBConfig } from "@kb/core";
2
- import { IEmbedder } from "@kb/embeddings";
3
- import { IncrementalIndexer } from "@kb/indexer";
4
- import { IGraphStore, IKnowledgeStore } from "@kb/store";
1
+ import { KBConfig } from "../../core/dist/index.js";
2
+ import { IEmbedder } from "../../embeddings/dist/index.js";
3
+ import { IncrementalIndexer } from "../../indexer/dist/index.js";
4
+ import { IGraphStore, IKnowledgeStore } from "../../store/dist/index.js";
5
5
 
6
6
  //#region packages/cli/src/kb-init.d.ts
7
7
  interface ICuratedManager {
@@ -108,6 +108,8 @@ interface KBConfig {
108
108
  curated: {
109
109
  path: string;
110
110
  };
111
+ /** Resolved directory for onboard/produce_knowledge output. User-level mode redirects this outside the project. */
112
+ onboardDir?: string;
111
113
  /** Enterprise RAG bridge configuration (optional) */
112
114
  er?: {
113
115
  /** Whether ER integration is enabled */enabled: boolean; /** Base URL of the ER API (e.g., https://xxx.execute-api.region.amazonaws.com/prod) */
@@ -4,7 +4,7 @@
4
4
  * Provides field builders, request construction, and response normalization
5
5
  * for MCP elicitation (interactive user input during tool execution).
6
6
  */
7
- export type { ElicitAction, ElicitContent, ElicitFormSchema, ElicitOptions, ElicitResponse, Elicitor, FieldSchema, TextFieldSchema, EnumFieldSchema, ArrayFieldSchema, BooleanFieldSchema, NumberFieldSchema, } from './types.js';
7
+ export { buildElicitRequest, buildFormSchema } from './build.js';
8
8
  export { field } from './fields.js';
9
- export { buildFormSchema, buildElicitRequest } from './build.js';
10
9
  export { normalizeResponse } from './normalize.js';
10
+ export type { ArrayFieldSchema, BooleanFieldSchema, ElicitAction, ElicitContent, ElicitFormSchema, ElicitOptions, Elicitor, ElicitResponse, EnumFieldSchema, FieldSchema, NumberFieldSchema, TextFieldSchema, } from './types.js';
@@ -4,9 +4,9 @@
4
4
  * Provides field builders, request construction, and response normalization
5
5
  * for MCP elicitation (interactive user input during tool execution).
6
6
  */
7
+ // Request construction
8
+ export { buildElicitRequest, buildFormSchema } from './build.js';
7
9
  // Field builders
8
10
  export { field } from './fields.js';
9
- // Request construction
10
- export { buildFormSchema, buildElicitRequest } from './build.js';
11
11
  // Response normalization
12
12
  export { normalizeResponse } from './normalize.js';
@@ -1,5 +1,5 @@
1
1
  import { ERSearchResult, MergedSearchResult } from "./types.js";
2
- import { SearchResult } from "@kb/core";
2
+ import { SearchResult } from "../../core/dist/index.js";
3
3
 
4
4
  //#region packages/enterprise-bridge/src/result-merger.d.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { GraphEdge, GraphNode } from "@kb/store";
1
+ import { GraphEdge, GraphNode } from "../../store/dist/index.js";
2
2
 
3
3
  //#region packages/indexer/src/graph-extractor.d.ts
4
4
  interface ExtractedGraph {
@@ -1,7 +1,7 @@
1
1
  import { FileHashCache } from "./hash-cache.js";
2
- import { IGraphStore, IKnowledgeStore } from "@kb/store";
3
- import { IndexStats, KBConfig } from "@kb/core";
4
- import { IEmbedder } from "@kb/embeddings";
2
+ import { IndexStats, KBConfig } from "../../core/dist/index.js";
3
+ import { IGraphStore, IKnowledgeStore } from "../../store/dist/index.js";
4
+ import { IEmbedder } from "../../embeddings/dist/index.js";
5
5
 
6
6
  //#region packages/indexer/src/incremental-indexer.d.ts
7
7
  interface IndexProgress {
@@ -1,6 +1,6 @@
1
1
  import { IKBClient, KBGraphData, KBKnowledgeEntry, KBSearchResult, KBStatus } from "./types.js";
2
- import { IEmbedder } from "@kb/embeddings";
3
- import { IGraphStore, IKnowledgeStore } from "@kb/store";
2
+ import { IEmbedder } from "../../embeddings/dist/index.js";
3
+ import { IGraphStore, IKnowledgeStore } from "../../store/dist/index.js";
4
4
 
5
5
  //#region packages/kb-client/src/direct-client.d.ts
6
6
  interface CuratedEntry {