ultracode 5.3.0 → 5.5.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.
- package/dist/chunks/analysis-tool-handlers-H2RXLDPX.js +817 -0
- package/dist/chunks/analysis-tool-handlers-RJZAR6VT.js +817 -0
- package/dist/chunks/analysis-tool-handlers-Z2RF24T7.js +13 -0
- package/dist/chunks/autodoc-tool-handlers-CV5JEQUA.js +1112 -0
- package/dist/chunks/autodoc-tool-handlers-EHTNCH6I.js +1112 -0
- package/dist/chunks/autodoc-tool-handlers-MECXQJ2K.js +138 -0
- package/dist/chunks/chaos-CO7TOBOJ.js +18 -0
- package/dist/chunks/chaos-VM2PXERO.js +1573 -0
- package/dist/chunks/chaos-W3XRVJ7K.js +1564 -0
- package/dist/chunks/chunk-6K37BWK5.js +439 -0
- package/dist/chunks/chunk-EALTCYHZ.js +10 -0
- package/dist/chunks/chunk-FTBE7VMY.js +316 -0
- package/dist/chunks/chunk-KBW6LRQP.js +322 -0
- package/dist/chunks/chunk-NKUHX4CU.js +5 -0
- package/dist/chunks/chunk-NZFF4DQ4.js +3179 -0
- package/dist/chunks/chunk-RGP5UVQ7.js +3179 -0
- package/dist/chunks/chunk-RMZXFGQZ.js +322 -0
- package/dist/chunks/chunk-UG44F23Y.js +316 -0
- package/dist/chunks/chunk-V2SCB5H5.js +4403 -0
- package/dist/chunks/chunk-V6JAQNM3.js +1 -0
- package/dist/chunks/chunk-XFGXM4CR.js +4403 -0
- package/dist/chunks/dev-agent-JVIGBMHQ.js +1 -0
- package/dist/chunks/dev-agent-TRVP5U6N.js +1624 -0
- package/dist/chunks/dev-agent-Y5G5WKQ4.js +1624 -0
- package/dist/chunks/graph-storage-factory-AYZ57YSL.js +13 -0
- package/dist/chunks/graph-storage-factory-GTAIJEI5.js +1 -0
- package/dist/chunks/graph-storage-factory-T2WO5QVG.js +13 -0
- package/dist/chunks/incremental-updater-KDIQGAUU.js +14 -0
- package/dist/chunks/incremental-updater-OJRSTO3Q.js +1 -0
- package/dist/chunks/incremental-updater-SBEBH7KF.js +14 -0
- package/dist/chunks/indexer-agent-H3QIEL3Z.js +21 -0
- package/dist/chunks/indexer-agent-KHF5JMV7.js +21 -0
- package/dist/chunks/indexer-agent-SHJD6Z77.js +1 -0
- package/dist/chunks/indexing-pipeline-J6Z4BHKF.js +1 -0
- package/dist/chunks/indexing-pipeline-OY3337QN.js +249 -0
- package/dist/chunks/indexing-pipeline-WCXIDMAP.js +249 -0
- package/dist/chunks/merge-agent-LSUBDJB2.js +2481 -0
- package/dist/chunks/merge-agent-MJEW3HWU.js +2481 -0
- package/dist/chunks/merge-agent-O45OXF33.js +11 -0
- package/dist/chunks/merge-tool-handlers-BDSVNQVZ.js +277 -0
- package/dist/chunks/merge-tool-handlers-HP7DRBXJ.js +1 -0
- package/dist/chunks/merge-tool-handlers-RUJAKE3D.js +277 -0
- package/dist/chunks/pattern-tool-handlers-L62W3CXR.js +1549 -0
- package/dist/chunks/pattern-tool-handlers-SAHX2CVW.js +13 -0
- package/dist/chunks/query-agent-3TWDFIMT.js +191 -0
- package/dist/chunks/query-agent-HXQ3BMMF.js +191 -0
- package/dist/chunks/query-agent-USMC2GNG.js +1 -0
- package/dist/chunks/semantic-agent-MQCAWIAB.js +6381 -0
- package/dist/chunks/semantic-agent-NDGR3NAK.js +6381 -0
- package/dist/chunks/semantic-agent-S4ZL6GZC.js +137 -0
- package/dist/index.js +17 -17
- package/dist/roslyn-addon/.build-hash +1 -1
- package/dist/roslyn-addon/ILGPU.Algorithms.dll +0 -0
- package/dist/roslyn-addon/ILGPU.dll +0 -0
- package/dist/roslyn-addon/UltraCode.CSharp.deps.json +35 -0
- package/dist/roslyn-addon/UltraCode.CSharp.dll +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {a}from'./chunk-W5ZEGGQZ.js';import {a as a$1,d,b}from'./chunk-RPKK6MZA.js';import'./chunk-QBFXI33X.js';import'./chunk-RK5TLU72.js';import {d as d$1}from'./chunk-3IFLFBQ4.js';import'./chunk-GVQNDMAK.js';import'./chunk-PZF7YC35.js';import {a as a$2}from'./chunk-F3VMUQ7O.js';import {R,I}from'./chunk-4BI7EBPQ.js';import'./chunk-DXB73IDG.js';import {execSync}from'child_process';import {z}from'zod';R();var H=z.object({entityId:z.string().optional(),filePath:z.string().optional(),projectPath:a,type:z.enum(["extract_method","rename","move","simplify","all"]).optional().default("all"),offset:z.number().optional().default(0),limit:z.number().optional().default(a$1.searchResults)}),T=class extends d{parseArgs(t){return H.parse(t)}async execute(t){let c=await this.ensureGraphStorageForProject(t.projectPath),m=await this.context.getSemanticAgent(),o=Math.min(t.limit,200),n,r=t.entityId,h=t.filePath?this.context.normalizeInputPath(t.filePath):void 0;if(t.entityId){let d=await c.getEntity(t.entityId);d?.filePath&&(h=d.filePath);}if(!n&&h)try{let{readFile:d}=await import('fs/promises');n=await d(h,"utf-8");}catch{return {content:[{type:"text",text:JSON.stringify({error:`Cannot read file: ${h}`})}]}}if(!n)return {content:[{type:"text",text:JSON.stringify({error:"No code found. Provide entityId or filePath."})}]};let l=await m.suggestRefactoring(n),g=b(l,t.offset,o);return {content:[{type:"text",text:JSON.stringify({entityId:r,filePath:h,suggestionsFound:g.data.length,pagination:g.pagination,suggestions:g.data.map(d=>({type:d.type,impact:d.impact,confidence:d.confidence,description:d.description,entityId:r,filePath:h,suggestedCode:d.code}))},null,2)}]}}},G=z.object({projectPath:a,metric:z.enum(["complexity","changes","coupling","all"]).optional().default("complexity"),offset:z.number().optional().default(0),limit:z.number().optional().default(a$1.hotspots),includeHistoricalMetrics:z.boolean().optional().default(true).describe("Use Prolly Tree history for changeFrequency calculation"),lookbackDays:z.number().optional().default(30).describe("Number of days to look back for change frequency")}),M=class extends d{changeFrequencyCache=new Map;parseArgs(t){return G.parse(t)}async execute(t){this.changeFrequencyCache.clear();let c=await this.ensureGraphStorageForProject(t.projectPath),m=Math.min(t.limit,200),o=await c.findEntities({filters:{},limit:5e3});t.includeHistoricalMetrics&&(t.metric==="changes"||t.metric==="all")&&await this.preloadChangeFrequencies(o,c,t.lookbackDays);let r=[];for(let l of o){let{score:g,changeMetrics:d}=this.calculateHotspotScore(l,t.metric,t.includeHistoricalMetrics);if(g>0){let i=l.metadata?.metrics??{},a=i.linesOfCode,p=a??(l.location?.end?.line&&l.location?.start?.line?l.location.end.line-l.location.start.line+1:void 0);r.push({id:l.id,name:l.name,type:l.type,filePath:l.filePath,score:Math.round(g*100)/100,metrics:{...i,...p!==void 0&&a===void 0?{linesOfCode:p}:{},...d}});}}r.sort((l,g)=>g.score-l.score);let h=b(r,t.offset,m);return {content:[{type:"text",text:JSON.stringify({metric:t.metric,includeHistoricalMetrics:t.includeHistoricalMetrics,lookbackDays:t.lookbackDays,hotspotsFound:h.data.length,pagination:h.pagination,hotspots:h.data,nextSteps:["graph_metrics({metric:'pagerank'}) \u2014 rank hotspots by architectural importance","taint_analysis() \u2014 check if hotspots contain security vulnerabilities"]},null,2)}]}}async preloadChangeFrequencies(t,c,m){let o=c.getLibSQLAdapter?.(),n=o?.getCommitManager?.(),r=o?.getProllyNodeStore?.(),h=new Map,l=false;for(let i of t)h.set(i.id,{count:0,source:"none"});if(n&&r){let i=Date.now()-m*24*60*60*1e3,a=await n.getCommitsSince(i);if(a.length>=2){l=true;let p=new d$1(r,n);for(let u=0;u<a.length-1;u++){let S=a[u],e=a[u+1];if(!(!S||!e))try{let s=await p.diffCommits(e.commitHash,S.commitHash);if(!s)continue;for(let y of [...s.treeDiff.added,...s.treeDiff.modified,...s.treeDiff.deleted]){let P=h.get(y.key);P&&h.set(y.key,{count:P.count+1,source:"prolly"});}}catch(s){I.w("HOTSPOTS","diff_failed",{error:s.message});}}I.d("HOTSPOTS","prolly_preload_complete",{commits:a.length,withChanges:[...h.values()].filter(u=>u.count>0).length});}else I.d("HOTSPOTS","insufficient_commits",{count:a.length});}else I.d("HOTSPOTS","prolly_not_available",{reason:"missing components"});let g=new Map,d=0;for(let i of t){let a=h.get(i.id);if(!a||a.count>0||!i.filePath)continue;let p=g.get(i.filePath);p===void 0&&(p=this.getChangeFrequencyFromGit(i.filePath,m),g.set(i.filePath,p)),p>0&&(h.set(i.id,{count:p,source:"git"}),d++);}d>0&&I.d("HOTSPOTS","git_fallback_complete",{filesChecked:g.size,entitiesUpdated:d});for(let[i,a]of h)this.changeFrequencyCache.set(i,{changeCount:a.count,source:a.source});I.d("HOTSPOTS","preloaded_change_frequencies",{entities:t.length,prollyAvailable:l,withChanges:[...h.values()].filter(i=>i.count>0).length});}getChangeFrequencyFromGit(t,c){try{let m=new Date(Date.now()-c*24*60*60*1e3).toISOString().split("T")[0];return execSync(`git log --oneline --since="${m}" -- "${t}"`,{encoding:"utf-8",timeout:5e3,stdio:["pipe","pipe","pipe"]}).trim().split(`
|
|
2
|
+
`).filter(Boolean).length}catch{return 0}}calculateHotspotScore(t,c,m){let o=t.metadata?.metrics||{},n=0,r,h=o.linesOfCode||(t.location?.end?.line&&t.location?.start?.line?t.location.end.line-t.location.start.line+1:0);if(c==="complexity"||c==="all"){n+=(o.cyclomaticComplexity||0)*2,n+=(o.cognitiveComplexity||0)*1.5,n+=(o.nestingDepth||0)*3,n+=h/50;let l=o.parameterCount||0;n+=l>4?(l-4)*2:0;}if(c==="changes"||c==="all")if(m){let l=this.changeFrequencyCache.get(t.id);if(l&&l.changeCount>0){let g=Math.log(l.changeCount+1)*10;n+=g,r={changeFrequency:l.changeCount,changeFrequencyScore:Math.round(g*100)/100,changeSource:l.source};}else r={changeFrequency:0,changeFrequencyScore:0,changeSource:"none"};}else n+=(o.changeFrequency||0)*10;return (c==="coupling"||c==="all")&&(n+=o.couplingScore||0,n+=(o.dependencyCount||0)/5),{score:n,changeMetrics:r}}},$=z.object({entityId:z.string().describe("Entity ID to find related concepts for"),projectPath:a,offset:z.number().optional().default(0),limit:z.number().optional().default(a$1.searchResults)}),O=class extends d{parseArgs(t){return $.parse(t)}async execute(t){let c=await this.ensureGraphStorageForProject(t.projectPath),m=await this.context.getSemanticAgent(),o=Math.min(t.limit,200),n=await c.getEntity(t.entityId);if(!n)return {content:[{type:"text",text:JSON.stringify({error:`Entity not found: ${t.entityId}`})}]};let r=n.name,l=(await m.semanticSearch(r,500)).results||[],g=b(l,t.offset,o),d=await Promise.all(g.data.map(async i=>{try{let a=null,u=i.metadata?.entityId;if(u&&/^[0-9a-f]{12}$/.test(u)&&(a=await c.getEntity(u)),!a&&typeof i.id=="string"&&i.id.startsWith("ent:")){let y=i.id.slice(4);/^[0-9a-f]{12}$/.test(y)&&(a=await c.getEntity(y));}if(!a){let y=u??(typeof i.id=="string"&&i.id.startsWith("ent:")?i.id.slice(4):void 0);if(y&&y.includes(":")){let P=y.lastIndexOf(":"),I=y.slice(P+1);if(I){let k=await c.searchEntities({namePattern:I});a=k.find(j=>j.metadata?.communityId!=null||j.metadata?.pageRank!=null)??k[0]??null;}}}if(!a)return i;let S=a.metadata??{},e=S.communityId,s=S.pageRank;if(e!=null||s!=null)return {...i,...e!=null?{communityId:e}:{},...typeof s=="number"?{pageRank:Math.round(s*1e4)/1e4}:{}}}catch{}return i}));return {content:[{type:"text",text:JSON.stringify({entityId:t.entityId,concept:r,relatedCount:d.length,pagination:g.pagination,related:d},null,2)}]}}},J=z.object({projectPath:a,scope:z.enum(["file","module","project"]).optional().default("project"),stateIdentifiers:z.array(z.string()).optional(),autoDetect:z.boolean().optional().default(true),maxDepth:z.number().optional(),excludePatterns:z.array(z.string()).optional(),format:z.enum(["summary","detailed","json"]).optional().default("summary")}),N=class extends d{parseArgs(t){return J.parse(t)}async execute(t){let c=await this.ensureGraphStorageForProject(t.projectPath),{ChaosAnalyzer:m}=await import('./chaos-CO7TOBOJ.js'),o=new m(c),n=await o.analyze({scope:t.scope||"project",stateIdentifiers:t.stateIdentifiers,autoDetect:t.autoDetect??true,maxDepth:t.maxDepth,excludePatterns:t.excludePatterns}),r=[];for(let d of n){let i=d.statePattern.identifier;if(i)try{let a=await c.searchEntities({namePattern:i}),p=null,u=null;for(let S of a){let e=S.metadata??{};if(e.communityId!=null||e.pageRank!=null){p=e.pageRank,u=e.communityId;break}}a.length>0&&r.push({stateIdentifier:i,pageRank:typeof p=="number"?p:null,communityId:typeof u=="number"?u:null,communityRisk:typeof p=="number"&&p>.7?"high":typeof p=="number"&&p>.4?"medium":"low"});}catch{}}let h=["graph_metrics({metric:'louvain'}) \u2014 cluster chaotic modules by community","graph_metrics({metric:'pagerank'}) \u2014 assess architectural importance of chaotic entities"];if(t.format==="json")return {content:[{type:"text",text:JSON.stringify({statePatterns:n,csharpPatterns:o.csharpPatterns,graphContext:r,nextSteps:h},null,2)}]};if(t.format==="detailed"&&(n.length>0||o.csharpPatterns.length>0)){let d=[];return n.length>0&&d.push(n.map(i=>o.formatDetailed(i)).join(`
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`)),o.csharpPatterns.length>0&&n.length===0&&d.push(o.formatForAI(n)),{content:[{type:"text",text:d.join(`
|
|
7
|
+
|
|
8
|
+
`)}]}}let l=o.formatForAI(n),g=`
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
Next steps:
|
|
12
|
+
${h.map(d=>`- ${d}`).join(`
|
|
13
|
+
`)}`;return {content:[{type:"text",text:l+g}]}}},Q=z.object({entityId:z.string().optional(),filePath:z.string().optional(),projectPath:a,depth:z.number().optional().default(3),highlightRecentChanges:z.boolean().optional().default(false).describe("Annotate impacted entities with recently-changed status (Prolly Tree)"),recentCommitsCount:z.number().optional().default(10).describe("Number of recent commits to consider for highlighting")}),D=class extends d{parseArgs(t){return Q.parse(t)}async execute(t){let c=await this.ensureGraphStorageForProject(t.projectPath),m=t.entityId;if(m&&!await c.getEntity(m)){let a=await c.searchEntities({namePattern:m});if(a.length>0)if(t.filePath){let u=(this.context.normalizeInputPath(t.filePath)||"").replace(/\\/g,"/").toLowerCase(),S=a.find(e=>{let s=(e.filePath||"").replace(/\\/g,"/").toLowerCase();return s.includes(u)||s.endsWith(u)});S?m=S.id:m=a[0].id;}else m=a[0].id;else m=void 0;}if(!m&&t.filePath){let i=this.context.normalizeInputPath(t.filePath),a=await c.findEntities({filters:{filePath:i},limit:1});a.length>0&&a[0]&&(m=a[0].id);}if(!m)return {content:[{type:"text",text:JSON.stringify({error:"Entity not found"})}]};let o=await c.getEntity(m),n=await c.getRelationshipsForEntity(m),r=new Set,h=[m],l=0;for(;h.length>0&&l<t.depth;){let i=[];for(let a of h){let p=await c.getRelationshipsForEntity(a);for(let u of p){let S=u.fromId===a?u.toId:u.fromId;!r.has(S)&&S!==m&&(r.add(S),i.push(S));}}h=i,l++;}let g;{let i=Array.from(r),a=await c.getEntitiesBatch(i),p=[],u=[],S=[];for(let[,e]of a)if(e.metadata?.isApiContract){let s=e.metadata.swaggerType;if(s==="endpoint"){let y=`${e.metadata.httpMethod||""} ${e.metadata.path||""}`.trim();p.push(y||e.name);}else s==="schema"&&u.push(e.name);}if(o?.metadata?.isApiContract){let e=o.metadata.swaggerType;if(e==="endpoint"){let s=`${o.metadata.httpMethod||""} ${o.metadata.path||""}`.trim();p.push(s||o.name);}else e==="schema"&&u.push(o.name);}for(let e of n)if(e.type==="consumes_api"||e.metadata?.context?.includes("consumes")){let s=e.fromId===m?e.toId:e.fromId,y=a.get(s);y&&S.push(y.name);}if(p.length>0||u.length>0){let e=p.length>3||u.length>5?"high":p.length>0?"medium":"low";g={affectsApiContract:true,affectedEndpoints:[...new Set(p)],affectedSchemas:[...new Set(u)],breakingChangeRisk:e,consumers:[...new Set(S)],warning:"Changes affect external API contract \u2014 consumers may break"};}}let d;if(t.highlightRecentChanges){let{getRecentlyChangedEntities:i}=await import('./recently-changed-277BN4MZ.js'),a=c.getLibSQLAdapter?.();if(a){let p=await i(a,{lastCommits:t.recentCommitsCount});if(p){let u=0,S=0;for(let s of r)p.addedIds.has(s)?u++:p.modifiedIds.has(s)&&S++;let e=u+S;d={recentlyAddedCount:u,recentlyModifiedCount:S,volatileRatio:r.size>0?Math.round(e/r.size*100)/100:0,commitsAnalyzed:p.commitsAnalyzed};}}}return {content:[{type:"text",text:JSON.stringify({entity:o?{id:o.id,name:o.name,type:o.type}:null,directRelationships:n.length,totalImpactedEntities:r.size,impactDepth:t.depth,riskLevel:r.size>50?"high":r.size>20?"medium":"low",...g?{contractImpact:g}:{},...d?{recentlyChangedImpact:d}:{},nextSteps:["graph_metrics({metric:'pagerank'}) \u2014 assess importance of impacted entities","taint_analysis() \u2014 check if impacted code has security vulnerabilities"]},null,2)}]}}},B=z.object({projectPath:a,swaggerFile:z.string().optional().describe("Path to swagger file (auto-detected if omitted)"),schemaName:z.string().optional().describe("Specific schema name to analyze"),endpointPath:z.string().optional().describe("Specific endpoint like 'GET /api/users'")}),v=class extends d{parseArgs(t){return B.parse(t)}async execute(t){let c=await this.ensureGraphStorageForProject(t.projectPath),m=await c.getAllEntities(),o=await c.getAllRelationships(),n=m.filter(e=>e.metadata?.isApiContract);if(n.length===0)return {content:[{type:"text",text:JSON.stringify({error:"No swagger/OpenAPI specifications found in the project graph. Index a project with swagger files first."})}]};if(t.swaggerFile){let e=this.context.normalizeInputPath(t.swaggerFile);n=n.filter(s=>s.filePath.replace(/\\/g,"/").toLowerCase().includes((e||"").replace(/\\/g,"/").toLowerCase()));}if(t.schemaName&&(n=n.filter(e=>e.metadata?.swaggerType==="schema"&&e.name===t.schemaName)),t.endpointPath){let[e,...s]=t.endpointPath.split(" "),y=s.join(" ");n=n.filter(P=>{if(P.metadata?.swaggerType!=="endpoint")return false;let I=(P.metadata.httpMethod||"").toUpperCase(),k=P.metadata.path||"";return (!e||I===e.toUpperCase())&&(!y||k===y)});}let r=[],h=[],l=[],g=new Set(n.map(e=>e.id)),d=new Map(m.map(e=>[e.id,e]));for(let e of o)if(e.type==="produces_api"){let s=d.get(e.fromId),y=d.get(e.toId);s&&y&&(g.has(e.toId)||g.has(e.fromId))&&r.push({name:s.name,file:s.filePath,type:s.type});}else if(e.type==="consumes_api"){let s=d.get(e.fromId),y=d.get(e.toId);s&&y&&(g.has(e.toId)||g.has(e.fromId))&&h.push({name:s.name,file:s.filePath,type:s.type});}else if(e.type==="generated_from"){let s=d.get(e.fromId),y=d.get(e.toId);s&&y&&(g.has(e.toId)||g.has(e.fromId))&&l.push({name:s.name,file:s.filePath,schemaName:y.name});}let i=r.length+h.length+l.length,a=i>10?"high":i>3?"medium":"low",p=[];h.length>0&&p.push(`${h.length} generated client(s) may need regeneration after swagger changes`),l.length>0&&p.push(`${l.length} generated type(s) are linked to swagger schemas \u2014 regenerate after schema changes`),r.length>0&&p.push(`${r.length} controller(s) produce this API \u2014 update swagger spec after changing these`);let u=n.filter(e=>e.metadata?.swaggerType==="endpoint").map(e=>({name:e.name,method:e.metadata?.httpMethod,path:e.metadata?.path})),S=n.filter(e=>e.metadata?.swaggerType==="schema").map(e=>e.name);return {content:[{type:"text",text:JSON.stringify({swaggerFiles:[...new Set(n.map(e=>e.filePath))],endpoints:u,schemas:S,producers:r,consumers:h,generatedTypes:l,breakingChangeRisk:a,totalAffectedEntities:i,recommendations:p},null,2)}]}}},U=z.object({directory:z.string().optional(),projectPath:a}),_=class extends d{parseArgs(t){return U.parse(t)}async execute(t){let c=t.directory?this.context.normalizeInputPath(t.directory)??this.resolveProjectPath({}):this.resolveProjectPath({projectPath:t.projectPath});try{let{TechnologyDetector:m}=await import('./technology-detector-MM7TXWRB.js'),o=await this.context.getGraphStorage();o.setProject(c);let r=await new m(o,c).detectStack();return {content:[{type:"text",text:JSON.stringify({directory:c,languages:r.languages,frameworks:r.frameworks,buildTools:r.buildTools,dependencies:r.dependencies,confidence:r.confidence},null,2)}]}}catch(m){let o=a$2(m);return {content:[{type:"text",text:JSON.stringify({error:o.message})}]}}}};export{D as AnalyzeCodeImpactToolHandler,M as AnalyzeHotspotsToolHandler,N as AnalyzeStateChaosToolHandler,v as AnalyzeSwaggerImpactToolHandler,_ as DetectTechnologyStackToolHandler,O as FindRelatedConceptsToolHandler,T as SuggestRefactoringToolHandler};
|