ultracode 5.4.0 → 5.6.0

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 (151) hide show
  1. package/dist/chunks/analysis-tool-handlers-GH5FDEWW.js +817 -0
  2. package/dist/chunks/analysis-tool-handlers-IXP4MWZX.js +817 -0
  3. package/dist/chunks/analysis-tool-handlers-LC2BTQYK.js +13 -0
  4. package/dist/chunks/analysis-tool-handlers-QYFKQPFL.js +817 -0
  5. package/dist/chunks/autodoc-tool-handlers-2HF6ERYN.js +1112 -0
  6. package/dist/chunks/autodoc-tool-handlers-4OGQJ7C3.js +1112 -0
  7. package/dist/chunks/autodoc-tool-handlers-N736CB56.js +138 -0
  8. package/dist/chunks/autodoc-tool-handlers-NQYBY6U4.js +1112 -0
  9. package/dist/chunks/branch-tool-handlers-KW3H4FJK.js +276 -0
  10. package/dist/chunks/branch-tool-handlers-QOUDZKJ2.js +276 -0
  11. package/dist/chunks/branch-tool-handlers-RB2U36KI.js +2 -0
  12. package/dist/chunks/branch-tool-handlers-ZHJM6PDK.js +276 -0
  13. package/dist/chunks/chunk-2Z6OQPYC.js +656 -0
  14. package/dist/chunks/chunk-3MQ7LRPN.js +322 -0
  15. package/dist/chunks/chunk-4W6QYGXZ.js +10 -0
  16. package/dist/chunks/chunk-533NFGUG.js +1 -0
  17. package/dist/chunks/chunk-5NUPOPWM.js +1 -0
  18. package/dist/chunks/chunk-AK4HIPA2.js +322 -0
  19. package/dist/chunks/chunk-B3H5NS3I.js +656 -0
  20. package/dist/chunks/chunk-DPTZHDST.js +4 -0
  21. package/dist/chunks/chunk-E5HQWLU5.js +322 -0
  22. package/dist/chunks/chunk-EOH25B5P.js +572 -0
  23. package/dist/chunks/chunk-ESV6F6E3.js +3179 -0
  24. package/dist/chunks/chunk-FPELPFER.js +924 -0
  25. package/dist/chunks/chunk-G6J42I55.js +161 -0
  26. package/dist/chunks/chunk-GCQE7ZYW.js +1 -0
  27. package/dist/chunks/chunk-GTIF6MOX.js +1 -0
  28. package/dist/chunks/chunk-I6STSSAK.js +2 -0
  29. package/dist/chunks/chunk-J2WBGTK2.js +4697 -0
  30. package/dist/chunks/chunk-KAYOX5EB.js +4697 -0
  31. package/dist/chunks/chunk-KPMTACOT.js +656 -0
  32. package/dist/chunks/chunk-L376GZ44.js +3179 -0
  33. package/dist/chunks/chunk-LCTOTHDA.js +15 -0
  34. package/dist/chunks/chunk-LEDJ7GVQ.js +316 -0
  35. package/dist/chunks/chunk-LH4OUKNZ.js +277 -0
  36. package/dist/chunks/chunk-O6IE2MEZ.js +161 -0
  37. package/dist/chunks/chunk-OEXPCY3F.js +316 -0
  38. package/dist/chunks/chunk-OMXOLFDN.js +924 -0
  39. package/dist/chunks/chunk-PLPBXWOU.js +3179 -0
  40. package/dist/chunks/chunk-PWLE5DN2.js +572 -0
  41. package/dist/chunks/chunk-PY43JPWL.js +447 -0
  42. package/dist/chunks/chunk-Q3B4EB7A.js +15 -0
  43. package/dist/chunks/chunk-Q5LPVLXA.js +337 -0
  44. package/dist/chunks/chunk-QIRZHZK2.js +5 -0
  45. package/dist/chunks/chunk-ROQ27LSL.js +924 -0
  46. package/dist/chunks/chunk-S5Q7BD6J.js +572 -0
  47. package/dist/chunks/chunk-SAMX3HJQ.js +337 -0
  48. package/dist/chunks/chunk-SV3WKUNV.js +1 -0
  49. package/dist/chunks/chunk-TCHCDCDO.js +167 -0
  50. package/dist/chunks/chunk-TR3HS7U6.js +316 -0
  51. package/dist/chunks/chunk-TUWE6FCW.js +167 -0
  52. package/dist/chunks/chunk-TVOTA7EE.js +277 -0
  53. package/dist/chunks/chunk-VS44D772.js +337 -0
  54. package/dist/chunks/chunk-WIE3G5ES.js +167 -0
  55. package/dist/chunks/chunk-XG3ACLWR.js +5 -0
  56. package/dist/chunks/chunk-XJ2Z5QQO.js +1 -0
  57. package/dist/chunks/chunk-XK2NY7RB.js +277 -0
  58. package/dist/chunks/chunk-Y4F7NZFZ.js +4700 -0
  59. package/dist/chunks/chunk-YS75L3ZS.js +161 -0
  60. package/dist/chunks/chunk-ZVG5HHI3.js +15 -0
  61. package/dist/chunks/dev-agent-DDDIVWOF.js +1 -0
  62. package/dist/chunks/dev-agent-E2VCFKXN.js +1624 -0
  63. package/dist/chunks/dev-agent-KJNSU5KQ.js +1624 -0
  64. package/dist/chunks/dev-agent-NDERYIPV.js +1624 -0
  65. package/dist/chunks/faiss-provider-7R4BQDIV.js +12 -0
  66. package/dist/chunks/faiss-provider-7ZFRSDN5.js +12 -0
  67. package/dist/chunks/faiss-provider-SXB7FTLB.js +1 -0
  68. package/dist/chunks/faiss-provider-TKLBEUSH.js +12 -0
  69. package/dist/chunks/file-tool-handlers-5DODQXGF.js +1027 -0
  70. package/dist/chunks/file-tool-handlers-KGHLE4KR.js +1027 -0
  71. package/dist/chunks/file-tool-handlers-KTOQ4NFS.js +12 -0
  72. package/dist/chunks/file-tool-handlers-V4SFUDQB.js +1027 -0
  73. package/dist/chunks/graph-metrics-tool-handlers-3AV4X4ZY.js +65 -0
  74. package/dist/chunks/graph-metrics-tool-handlers-3VMDQHJ6.js +65 -0
  75. package/dist/chunks/graph-metrics-tool-handlers-BZ6E6YHF.js +1 -0
  76. package/dist/chunks/graph-metrics-tool-handlers-IYBGSXL7.js +65 -0
  77. package/dist/chunks/graph-storage-factory-2CQ2RPDV.js +13 -0
  78. package/dist/chunks/graph-storage-factory-C5SMMYL6.js +13 -0
  79. package/dist/chunks/graph-storage-factory-EEO2V3GJ.js +1 -0
  80. package/dist/chunks/graph-storage-factory-WBCTXP34.js +13 -0
  81. package/dist/chunks/history-tool-handlers-AS7OQFZI.js +1 -0
  82. package/dist/chunks/history-tool-handlers-FSNJYXV2.js +208 -0
  83. package/dist/chunks/history-tool-handlers-JZAH4EIQ.js +208 -0
  84. package/dist/chunks/history-tool-handlers-KCSCXZ7T.js +208 -0
  85. package/dist/chunks/incremental-updater-A2EL4QXU.js +14 -0
  86. package/dist/chunks/incremental-updater-EQIKBVY2.js +14 -0
  87. package/dist/chunks/incremental-updater-JFGRPH3B.js +14 -0
  88. package/dist/chunks/incremental-updater-S5BAAGHP.js +1 -0
  89. package/dist/chunks/indexer-agent-ASKY7JPG.js +1 -0
  90. package/dist/chunks/indexer-agent-NKAOF323.js +21 -0
  91. package/dist/chunks/indexer-agent-PJN5IOKQ.js +21 -0
  92. package/dist/chunks/indexer-agent-WRJFWKZX.js +21 -0
  93. package/dist/chunks/indexing-pipeline-D4P2O72Z.js +249 -0
  94. package/dist/chunks/indexing-pipeline-L7C543N4.js +1 -0
  95. package/dist/chunks/indexing-pipeline-NHPRN3AB.js +249 -0
  96. package/dist/chunks/indexing-pipeline-ZAXCZU22.js +249 -0
  97. package/dist/chunks/layered-faiss-provider-62CNW54X.js +1 -0
  98. package/dist/chunks/layered-faiss-provider-O7L77GFX.js +12 -0
  99. package/dist/chunks/layered-faiss-provider-RVHLHLPK.js +12 -0
  100. package/dist/chunks/layered-faiss-provider-YT7EDIJI.js +12 -0
  101. package/dist/chunks/merge-agent-3RF7VFF5.js +2481 -0
  102. package/dist/chunks/merge-agent-JCKTCBCE.js +2481 -0
  103. package/dist/chunks/merge-agent-VCL7OXPN.js +2481 -0
  104. package/dist/chunks/merge-agent-ZGK24WVF.js +11 -0
  105. package/dist/chunks/merge-tool-handlers-GV2LOIKU.js +277 -0
  106. package/dist/chunks/merge-tool-handlers-TYDWU5X2.js +277 -0
  107. package/dist/chunks/merge-tool-handlers-U7X2ZO2M.js +1 -0
  108. package/dist/chunks/merge-tool-handlers-YH62ZLPJ.js +277 -0
  109. package/dist/chunks/pattern-tool-handlers-76NF5JDS.js +13 -0
  110. package/dist/chunks/pattern-tool-handlers-IJAGEIVD.js +1549 -0
  111. package/dist/chunks/pattern-tool-handlers-VA5WYA62.js +1549 -0
  112. package/dist/chunks/pattern-tool-handlers-WQ6UBMJS.js +1549 -0
  113. package/dist/chunks/query-agent-36ADGCFZ.js +1 -0
  114. package/dist/chunks/query-agent-H22CR5N5.js +191 -0
  115. package/dist/chunks/query-agent-K2UGZS4M.js +191 -0
  116. package/dist/chunks/query-agent-YJCEHOXD.js +191 -0
  117. package/dist/chunks/semantic-agent-AC7CBEDE.js +6381 -0
  118. package/dist/chunks/semantic-agent-HK5X6CKU.js +6381 -0
  119. package/dist/chunks/semantic-agent-KONIKEGW.js +6381 -0
  120. package/dist/chunks/semantic-agent-LH6IZ2L7.js +137 -0
  121. package/dist/chunks/semantic-tool-handlers-5LMSH2U7.js +3 -0
  122. package/dist/chunks/semantic-tool-handlers-735UMO7Y.js +817 -0
  123. package/dist/chunks/semantic-tool-handlers-BNUYPP7X.js +817 -0
  124. package/dist/chunks/semantic-tool-handlers-MYZPEUD2.js +817 -0
  125. package/dist/chunks/snapshot-tool-handlers-6SIHZT2F.js +201 -0
  126. package/dist/chunks/snapshot-tool-handlers-DS4P3KOT.js +201 -0
  127. package/dist/chunks/snapshot-tool-handlers-JYHRFPC7.js +201 -0
  128. package/dist/chunks/snapshot-tool-handlers-YEHMAT3L.js +1 -0
  129. package/dist/chunks/storage-paths-A3C7WHHG.js +8 -0
  130. package/dist/chunks/storage-paths-HDYH7WPM.js +1 -0
  131. package/dist/chunks/storage-paths-IMFRHBWF.js +8 -0
  132. package/dist/chunks/storage-paths-P3PUSMUD.js +8 -0
  133. package/dist/chunks/taint-tool-handlers-CWESOOMQ.js +68 -0
  134. package/dist/chunks/taint-tool-handlers-OG3NVVP3.js +1 -0
  135. package/dist/chunks/taint-tool-handlers-ON3G3FA7.js +68 -0
  136. package/dist/chunks/taint-tool-handlers-P4P5J6DB.js +68 -0
  137. package/dist/chunks/tracing-tool-handlers-4BDCXTZZ.js +3935 -0
  138. package/dist/chunks/tracing-tool-handlers-6FPNM7HX.js +3935 -0
  139. package/dist/chunks/tracing-tool-handlers-LQTQ5SKK.js +89 -0
  140. package/dist/chunks/tracing-tool-handlers-XRQX2DTS.js +3935 -0
  141. package/dist/chunks/validation-tool-handlers-DZUG7KYY.js +2 -0
  142. package/dist/chunks/validation-tool-handlers-O6TGFSH5.js +555 -0
  143. package/dist/chunks/validation-tool-handlers-RREUYKIR.js +555 -0
  144. package/dist/chunks/validation-tool-handlers-XPWSMS37.js +555 -0
  145. package/dist/index.js +13 -13
  146. package/dist/roslyn-addon/.build-hash +1 -1
  147. package/dist/roslyn-addon/ILGPU.Algorithms.dll +0 -0
  148. package/dist/roslyn-addon/ILGPU.dll +0 -0
  149. package/dist/roslyn-addon/UltraCode.CSharp.deps.json +35 -0
  150. package/dist/roslyn-addon/UltraCode.CSharp.dll +0 -0
  151. package/package.json +1 -1
@@ -0,0 +1,138 @@
1
+ import'./chunk-4W6QYGXZ.js';import {a,b,c,d as d$1,e,f,g,h,i,j as j$1,k}from'./chunk-VDY3Y3CS.js';import {d}from'./chunk-XG3ACLWR.js';import'./chunk-XJ2Z5QQO.js';import'./chunk-PY43JPWL.js';import'./chunk-RK5TLU72.js';import'./chunk-LESND2CW.js';import'./chunk-QUO46LUP.js';import'./chunk-3IFLFBQ4.js';import'./chunk-I6STSSAK.js';import'./chunk-SV3WKUNV.js';import'./chunk-PZF7YC35.js';import {e as e$2}from'./chunk-R7SWWANK.js';import {e as e$1}from'./chunk-SOG7QA72.js';import {a as a$1}from'./chunk-F3VMUQ7O.js';import'./chunk-2KIPXYOB.js';import'./chunk-OG62YNVF.js';import {R,I}from'./chunk-4BI7EBPQ.js';import'./chunk-F45ISXCP.js';import'./chunk-POFMGITV.js';import'./chunk-DXB73IDG.js';import ee,{join}from'path';import {execSync}from'child_process';import {existsSync,mkdirSync,writeFileSync}from'fs';R();var te=["architecture.md","dependencies.md","deployment.md","flow.md","glossary.md","processes.md"],ne={"architecture.md":`# Architecture
2
+
3
+ ## Overview
4
+
5
+ *Describe the high-level architecture of your project here.*
6
+
7
+ ## Core Components
8
+
9
+ | Component | Location | Description |
10
+ |-----------|----------|-------------|
11
+ | Example | [\`src/example.ts\`](../src/example.ts) | Description |
12
+
13
+ ## Data Flow
14
+
15
+ \`\`\`
16
+ [Request] \u2192 [Handler] \u2192 [Service] \u2192 [Storage]
17
+ \`\`\`
18
+
19
+ ## Key Decisions
20
+
21
+ | Decision | Rationale |
22
+ |----------|-----------|
23
+ | Example | Reason |
24
+
25
+ ## Related Documents
26
+
27
+ - [\u2192 dependencies.md](./dependencies.md)
28
+ - [\u2192 deployment.md](./deployment.md)
29
+ - [\u2192 processes.md](./processes.md)
30
+ `,"dependencies.md":`# Dependencies
31
+
32
+ ## Runtime Dependencies
33
+
34
+ | Package | Version | Purpose |
35
+ |---------|---------|---------|
36
+ | example | ^1.0.0 | Description |
37
+
38
+ ## Dev Dependencies
39
+
40
+ | Package | Version | Purpose |
41
+ |---------|---------|---------|
42
+ | typescript | ^5.0.0 | Type checking |
43
+
44
+ ## System Requirements
45
+
46
+ - Node.js 18+
47
+ - *Add other requirements*
48
+
49
+ ## Optional Dependencies
50
+
51
+ *List optional dependencies and when they are needed.*
52
+ `,"deployment.md":`# Deployment
53
+
54
+ ## Build
55
+
56
+ \`\`\`bash
57
+ npm run build
58
+ \`\`\`
59
+
60
+ ## Configuration
61
+
62
+ | Variable | Default | Description |
63
+ |----------|---------|-------------|
64
+ | NODE_ENV | development | Environment |
65
+
66
+ ## Installation
67
+
68
+ \`\`\`bash
69
+ npm install
70
+ \`\`\`
71
+
72
+ ## Production Setup
73
+
74
+ *Describe production deployment steps.*
75
+ `,"flow.md":`# Data Flow
76
+
77
+ ## Request Flow
78
+
79
+ \`\`\`
80
+ \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
81
+ \u2502 Client \u2502 \u2500\u2500\u25BA \u2502 Handler \u2502 \u2500\u2500\u25BA \u2502 Service \u2502
82
+ \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
83
+ \`\`\`
84
+
85
+ ## Key Processes
86
+
87
+ ### Process 1
88
+
89
+ 1. Step one
90
+ 2. Step two
91
+ 3. Step three
92
+
93
+ ## State Management
94
+
95
+ *Describe how state is managed.*
96
+ `,"glossary.md":`# Glossary
97
+
98
+ ## Terms
99
+
100
+ | Term | Definition |
101
+ |------|------------|
102
+ | **Entity** | A code element (function, class, variable) tracked in the graph |
103
+ | **Relationship** | A connection between entities (imports, calls, extends) |
104
+
105
+ ## Abbreviations
106
+
107
+ | Abbr | Full Form |
108
+ |------|-----------|
109
+ | AST | Abstract Syntax Tree |
110
+ | MCP | Model Context Protocol |
111
+ `,"processes.md":`# Processes
112
+
113
+ ## Development Workflow
114
+
115
+ 1. Create feature branch
116
+ 2. Implement changes
117
+ 3. Run tests
118
+ 4. Create PR
119
+
120
+ ## Testing
121
+
122
+ \`\`\`bash
123
+ npm test
124
+ \`\`\`
125
+
126
+ ## Code Style
127
+
128
+ *Describe code style guidelines.*
129
+
130
+ ## Release Process
131
+
132
+ 1. Update version
133
+ 2. Update changelog
134
+ 3. Create release tag
135
+ `};function N(l){existsSync(l)||mkdirSync(l,{recursive:true});for(let e of te){let n=ee.join(l,e);existsSync(n)||writeFileSync(n,ne[e],"utf-8");}}function re(l){try{return execSync("git rev-parse --show-toplevel",{cwd:l,encoding:"utf-8",windowsHide:!0,stdio:["pipe","pipe","pipe"]}).trim()}catch{return l}}async function se(l,e,n){if(l!=="auto")return l;try{let r=(await e())?.getConfig()?.language;if(r&&r!=="auto"&&r!=="en")return r;let{readdir:c,readFile:t}=await import('fs/promises'),{detectLanguageFromText:d,aggregateLanguageDetection:a}=await import('./language-detector-4D6IZXBP.js'),o=n||join(process.cwd(),".autodoc");try{let p=(await c(o)).filter(u=>u.endsWith(".md")).slice(0,5),f=[];for(let u of p)try{let g=await t(join(o,u),"utf-8"),y=d(g);y.confidence>0&&f.push(y);}catch{}if(f.length>0){let u=a(f);if(u.confidence>.3)return I.d("AUTODOCGEN","language_detected",{lang:u.language,conf:u.confidence}),u.language}}catch{}return "en"}catch{return "en"}}async function ie(l,e,n,i){let{detectLLMProviders:r,batchGenerateDocs:c}=await import('./llm-O2QLMW4C.js'),{recommended:t}=await r();if(!t)return I.w("AUTODOCGEN","no_llm_provider",{hint:"Install Ollama or configure TGI/OpenAI"}),{llmStatus:"no_provider_available"};let d=t.selectedModel||t.name;I.i("AUTODOCGEN","using_llm",{provider:t.name,model:d,modules:l.length,lang:n});try{let a=await c(t,l,{concurrency:1,language:n,onProgress:(o,s)=>{I.d("AUTODOCGEN","llm_progress",{completed:o,total:s});}});for(let o of e){let s=a.get(o.path.replace(/AUTODOC\.md$/,"").replace(/[\\/]$/,""));s&&(o.content=s);}return {llmStatus:`using_${t.name}:${d}`}}catch(a){return I.w("AUTODOCGEN","llm_gen_failed",{error:a.message}),{llmStatus:`error_${t.name}`}}}async function ae(l,e,n,i){let{updateModuleDoc:r}=await import('./incremental-updater-S5BAAGHP.js'),c=0,t=[];for(let d of l)try{let a=d.path.replace(/[\\/]AUTODOC\.md$/,""),o=await r(a,d.path,d.content,{useLlm:n});o.updated&&o.newContent&&(e&&await e.saveDocument(d.path,o.newContent,{autoGenerated:!0}),await e$2(d.path,o.newContent),c++,t.push({path:d.path,changes:o.changes.map(s=>s.description)}));}catch(a){I.w("AUTODOCGEN","incr_update_failed",{path:d.path,error:a.message});try{e&&await e.saveDocument(d.path,d.content,{autoGenerated:!0}),await e$2(d.path,d.content),c++;}catch(o){I.w("AUTODOCGEN","write_failed",{path:d.path,error:o.message});}}return {filesWritten:c,incrementalChanges:t}}async function ce(l,e,n){let i=0;for(let r of l)try{e&&await e.saveDocument(r.path,r.content,{autoGenerated:!0}),await e$2(r.path,r.content),i++;}catch(c){I.w("AUTODOCGEN","write_failed",{path:r.path,error:c.message});}return i}async function U(l,e){let n=e.normalizeInputPath(l.rootDir||"")||process.cwd(),i=re(n),r=l.autodocDir?e.normalizeInputPath(l.autodocDir)||l.autodocDir:join(i,".autodoc"),c=await se(l.language||"auto",e.getAutoDocManager,r);N(r);let t=await e$1({rootDir:n,exclude:l.exclude,maxDepth:l.maxDepth});if(l.module){let s=l.module.toLowerCase();t.modules=t.modules.filter(p=>p.name.toLowerCase()===s||p.name.toLowerCase().includes(s)),t.files=t.files.filter(p=>t.modules.some(f=>p.path.includes(f.path)));}let d="not_requested";l.useLlm&&t.modules.length>0&&(d=(await ie(t.modules,t.files,c)).llmStatus);let a=0,o=[];if(!l.preview){let s=await e.getAutoDocManager();if(l.incremental){let p=await ae(t.files,s,l.useLlm||false);a=p.filesWritten,o=p.incrementalChanges;}else a=await ce(t.files,s);}return {success:true,preview:l.preview||false,useLlm:l.useLlm||false,llmStatus:d,incremental:l.incremental||false,language:c,modulesFound:t.modules.length,filesToGenerate:t.files.length,filesWritten:a,incrementalChanges:l.incremental?o:void 0,modules:t.modules.map(s=>({name:s.name,path:s.path,files:s.files.length,exports:s.exports.slice(0,5)})),files:t.files.map(s=>({path:s.path,type:s.type,preview:l.preview?s.content.slice(0,200)+"...":void 0}))}}R();async function x(l){let e=l.getServiceContainer?.();if(!e)return null;let n=await e.getAutoDocManager();if(n&&!n.isInitialized()){let i=await e.getGraphStorage?.();await n.initialize(i);}return n}function D(){return {content:[{type:"text",text:JSON.stringify({success:false,error:"AutoDoc not enabled. Create .autodoc folder in project root to enable."})}]}}var $=class extends d{parseArgs(e){return a.parse(e)}async execute(e){let n=this.context.getServiceContainer?.();if(!n)return D();let i=await n.getAutoDocManager();return i?(i.setConfig({enabled:e.enabled,language:e.language,docsDir:e.docsDir||join(n.directory,".memory_bank")}),{content:[{type:"text",text:JSON.stringify({success:true,message:"AutoDoc initialized",config:i.getConfig()},null,2)}]}):D()}},V=class extends d{parseArgs(e){return b.parse(e)}async execute(e){let n=await x(this.context);if(!n)return D();let i=this.context.normalizeInputPath(e.filePath)||e.filePath,r={type:e.type,autoGenerated:e.autoGenerated},c=await n.saveDocument(i,e.content,r),t=false;try{let{writeDocumentToDisk:o}=await import('./file-sync-X6FXAJ5R.js');await o(i,e.content),t=!0;}catch(o){let s=a$1(o);I.w("AUTODOCTOOL","file_write_failed",{error:s.message,path:i,stack:s.stack});}let d=0,a={savedDocsCount:c.length};if(c.length>0)try{I.i("AUTODOCTOOL","embeddings_start",{docsCount:c.length}),a.step="getSemanticAgent";let o=await this.context.getSemanticAgent();a.hasAgent=!!o,a.agentType=typeof o,I.i("AUTODOCTOOL","embeddings_agent",{hasAgent:!!o,agentType:typeof o}),a.step="getVectorStore";let s=o?.getVectorStore?.();if(a.hasStore=!!s,a.hasGetVectorStoreFn=typeof o?.getVectorStore,I.i("AUTODOCTOOL","embeddings_store",{hasStore:!!s,storeType:typeof s,hasGetVectorStore:typeof o?.getVectorStore}),o&&s){a.step="processing",a.agentAndStoreOk=!0,I.i("AUTODOCTOOL","embeddings_processing",{count:c.length});let p=c.map(u=>u.id),f=await s.getExistingIds(p);I.i("AUTODOCTOOL","embeddings_existing_check",{total:p.length,existing:f.size});for(let u of c){let g=`${u.title}
136
+
137
+ ${u.content}`,y=await o.generateEmbedding(g);if(y){let b=f.has(u.id);I.i("AUTODOCTOOL",b?"updating_embedding":"inserting_embedding",{id:u.id,vectorDim:y.length,contentLen:g.length});let O={type:"autodoc",docType:u.type,filePath:u.filePath,section:u.section,title:u.title};b?await s.update(u.id,y,O):await s.insert({id:u.id,content:g.slice(0,1e3),vector:y,metadata:O,createdAt:Date.now()}),d++,I.d("AUTODOCTOOL","embedding_saved",{id:u.id,operation:b?"update":"insert"});}}I.i("AUTODOCTOOL","embeddings_done",{generated:d}),d>0&&(I.i("AUTODOCTOOL","flushing_embeddings"),await s.flushAndSave(),I.i("AUTODOCTOOL","embeddings_flushed"));}else a.skipped=!0,a.reason=`agent=${!!o}, store=${!!s}`,I.w("AUTODOCTOOL","embeddings_skipped",{hasAgent:!!o,hasStore:!!s});}catch(o){let s=a$1(o);a.error=s.message,a.stack=s.stack,I.e("AUTODOCTOOL","embedding_failed",{error:s.message,stack:s.stack});}return {content:[{type:"text",text:JSON.stringify({success:true,message:`Saved ${c.length} sections`,fileWritten:t,embeddingsGenerated:d,debug:a,docs:c.map(o=>({id:o.id,title:o.title,section:o.section}))},null,2)}]}}},J=class extends d{parseArgs(e){return c.parse(e)}async execute(e){let n=await x(this.context);if(!n)return D();if(e.docId){let i=await n.getDocument(e.docId);return {content:[{type:"text",text:JSON.stringify({success:!!i,doc:i||null},null,2)}]}}if(e.filePath){let i=this.context.normalizeInputPath(e.filePath)||e.filePath,r=await n.getDocumentsByFile(i);return {content:[{type:"text",text:JSON.stringify({success:true,count:r.length,docs:r},null,2)}]}}return {content:[{type:"text",text:JSON.stringify({success:false,error:"Provide docId or filePath"},null,2)}]}}},W=class extends d{parseArgs(e){return d$1.parse(e)}async execute(e){let n=await x(this.context);if(!n)return D();let i=[];if(e.mode==="text"||e.mode==="hybrid"){let r=await n.searchDocsByText(e.query,e.limit);for(let c of r)i.push({id:c.id,title:c.title,filePath:c.filePath,section:c.section,snippet:c.content.slice(0,200),source:"text"});}if(e.mode==="semantic"||e.mode==="hybrid")try{let r=await this.context.getSemanticAgent(),c=r?.getVectorStore?.();if(r&&c){let t=await r.generateEmbedding(e.query);if(I.i("AUTODOCTOOL","search_embedding_generated",{hasEmbedding:!!t,dim:t?.length}),t){let d=await c.searchWithFilters(t,{limit:e.limit,metadataFilter:{type:"autodoc"}});I.i("AUTODOCTOOL","search_results",{count:d.length,ids:d.map(a=>a.id).slice(0,5)});for(let a of d)if(I.d("AUTODOCTOOL","search_result_check",{id:a.id,startsWithDoc:a.id.startsWith("doc::")}),a.id.startsWith("doc::")){let o=await n.getDocument(a.id);o&&!i.some(s=>s.id===o.id)&&i.push({id:o.id,title:o.title,filePath:o.filePath,section:o.section,snippet:o.content.slice(0,200),score:a.similarity,source:"semantic"});}}}}catch(r){let c=a$1(r);I.w("AUTODOCTOOL","semantic_search_err",{error:c.message,stack:c.stack});}return i.sort((r,c)=>(c.score??0)-(r.score??0)),{content:[{type:"text",text:JSON.stringify({success:true,query:e.query,mode:e.mode||"text",resultsCount:i.length,results:i.slice(0,e.limit)},null,2)}]}}},j=class extends d{parseArgs(e$1){return e.parse(e$1)}async execute(e){let n=await x(this.context);if(!n)return D();let i=await n.validateReferences(),r={success:true,total:i.total,valid:i.valid,broken:i.broken.length};if(e.filePath){let c=this.context.normalizeInputPath(e.filePath)||e.filePath;r.brokenInFile=i.broken.filter(t=>t.ref.sourceLocation.filePath===c);}else r.brokenRefs=i.broken.slice(0,20);return {content:[{type:"text",text:JSON.stringify(r,null,2)}]}}},q=class extends d{parseArgs(e){return f.parse(e)}async execute(e){let n=await x(this.context);if(!n)return D();let i=await n.getStatus();return {content:[{type:"text",text:JSON.stringify({success:true,status:i},null,2)}]}}},B=class extends d{parseArgs(e){return g.parse(e)}async execute(e){let n=await x(this.context);if(!n)return D();let{syncBidirectional:i,syncDbToDisk:r,syncDiskToDb:c}=await import('./file-sync-X6FXAJ5R.js'),t={validated:0,brokenRefs:0,outdatedDocs:0,markedOutdated:[]};if(e.docsDir){let s=this.context.normalizeInputPath(e.docsDir)||e.docsDir,p=async u=>n.getDocumentsByFile(u),f=async()=>n.getAllDocuments();if(e.direction==="disk-to-db"){let u=await c(s,p,async(g,y)=>(await n.saveDocument(g,y),[]),8);t.fileSync={diskToDb:{added:u.added,updated:u.updated,errors:u.errors.map(g=>({path:g.file,error:g.error}))},dbToDisk:{written:[],errors:[]}};}else if(e.direction==="db-to-disk"){let u=await r(f,8);t.fileSync={diskToDb:{added:[],updated:[],errors:[]},dbToDisk:{written:u.written,errors:u.errors.map(g=>({path:g.file,error:g.error}))}};}else {let u=await i(s,p,f,async(g,y)=>(await n.saveDocument(g,y),[]),8);t.fileSync={diskToDb:{added:u.diskToDb.added,updated:u.diskToDb.updated,errors:u.diskToDb.errors.map(g=>({path:g.file,error:g.error}))},dbToDisk:{written:u.dbToDisk.written,errors:u.dbToDisk.errors.map(g=>({path:g.file,error:g.error}))}};}}let d=await n.validateReferences();t.validated=d.total,t.brokenRefs=d.broken.length;let a=await n.getOutdatedDocs();if(t.outdatedDocs=a.length,e.scope==="file"&&e.filePath){let s=this.context.normalizeInputPath(e.filePath)||e.filePath,p=await n.getDocumentsByFile(s);for(let f of p)f.confidence&&f.confidence<.7&&t.markedOutdated.push(f.id);}else t.markedOutdated=a.map(s=>s.docId);let o=t.fileSync?` Files: ${t.fileSync.diskToDb.added.length} added, ${t.fileSync.diskToDb.updated.length} updated, ${t.fileSync.dbToDisk.written.length} written.`:"";return {content:[{type:"text",text:JSON.stringify({success:true,message:`Sync completed. ${t.brokenRefs} broken refs, ${t.outdatedDocs} outdated docs.${o}`,...t},null,2)}]}}},H=class extends d{parseArgs(e){return h.parse(e)}async execute(e){let n=this.context.getServiceContainer?.();if(!n)return D();let i=e.useLlm;if(i===void 0)try{let{detectLLMProviders:c}=await import('./llm-provider-ZCW4DWD3.js'),{recommended:t}=await c();i=!!t;}catch{i=false;}let r=await U({rootDir:e.rootDir,autodocDir:e.autodocDir,exclude:e.exclude,maxDepth:e.maxDepth,module:e.module,useLlm:i,preview:e.preview,incremental:e.incremental,language:e.language},{normalizeInputPath:this.context.normalizeInputPath,requestId:this.context.requestId,getAutoDocManager:n.getAutoDocManager.bind(n)});return {content:[{type:"text",text:JSON.stringify(r,null,2)}]}}},K=class extends d{parseArgs(e){return i.parse(e)}async execute(e){let n=await x(this.context);if(!n)return D();let i=await n.getChangelog({since:e.since,limit:e.limit,branch:e.branch});return {content:[{type:"text",text:JSON.stringify({success:true,entriesCount:i.length,entries:i.map(r=>({id:r.id,timestamp:r.timestamp,date:new Date(r.timestamp).toISOString(),branch:r.branch,summary:r.summary,changesCount:r.changes?.length||0,impactedDocsCount:r.impactedDocs?.length||0}))},null,2)}]}}},Q=class extends d{parseArgs(e){return j$1.parse(e)}async execute(e){let n=this.context.getServiceContainer?.();if(!n)return {content:[{type:"text",text:JSON.stringify({error:"ServiceContainer not available"})}]};let{installPreCommitHook:i,uninstallHooks:r,getHookStatus:c}=await import('./hook-installer-RK74YA5D.js'),t=n.directory;if(e.action==="status"){let a=await c(t);return {content:[{type:"text",text:JSON.stringify({success:true,gitRepo:a.gitRepo,hooksDir:a.hooksDir,preCommitInstalled:a.preCommit},null,2)}]}}if(e.action==="uninstall"){let a=await r(t);return {content:[{type:"text",text:JSON.stringify({success:a.success,removed:a.installed,skipped:a.skipped,errors:a.errors},null,2)}]}}let d=await i(t);return {content:[{type:"text",text:JSON.stringify({success:d.success,installed:d.installed,skipped:d.skipped,errors:d.errors},null,2)}]}}},X=class extends d{parseArgs(e){return k.parse(e)}async execute(e){let{detectLanguageFromText:n,aggregateLanguageDetection:i}=await import('./language-detector-4D6IZXBP.js'),r=[];if(e.scope==="comments"||e.scope==="all"){let a=(await(await this.context.getGraphStorage()).getAllEntities()).slice(0,e.sampleSize*2),o=0;for(let s of a){if(o>=e.sampleSize)break;let p=s.metadata?.comments||s.documentation;if(p){let f=Array.isArray(p)?p.join(`
138
+ `):String(p),u=n(f);u.confidence>0&&(r.push(u),o++);}}}if(e.scope==="docs"||e.scope==="all"){let t=await x(this.context);if(t){let d=await t.searchDocsByText("",e.sampleSize);for(let a of d){let o=n(a.content);o.confidence>0&&r.push(o);}}}let c=i(r);return {content:[{type:"text",text:JSON.stringify({success:true,detectedLanguage:c.language,confidence:Math.round(c.confidence*100)/100,samplesAnalyzed:r.length,charCounts:c.charCounts,recommendation:c.confidence>.5?`Use language: ${c.language}`:"Low confidence - defaulting to 'en'"},null,2)}]}}};export{K as AutoDocChangelogToolHandler,X as AutoDocDetectLanguageToolHandler,H as AutoDocGenerateToolHandler,J as AutoDocGetToolHandler,$ as AutoDocInitToolHandler,Q as AutoDocInstallHooksToolHandler,V as AutoDocSaveToolHandler,W as AutoDocSearchToolHandler,q as AutoDocStatusToolHandler,B as AutoDocSyncToolHandler,j as AutoDocValidateToolHandler};