@syke1/mcp-server 1.6.0 → 1.7.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Elastic License 2.0
1
+ Elastic License 2.0 (ELv2)
2
2
 
3
3
  URL: https://www.elastic.co/licensing/elastic-license
4
4
 
@@ -8,86 +8,42 @@ By using the software, you agree to all of the terms and conditions below.
8
8
 
9
9
  ## Copyright License
10
10
 
11
- The licensor grants you a non-exclusive, royalty-free, worldwide,
12
- non-sublicensable, non-transferable license to use, copy, distribute, make
13
- available, and prepare derivative works of the software, in each case subject to
14
- the limitations and conditions below.
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below.
15
12
 
16
13
  ## Limitations
17
14
 
18
- You may not provide the software to third parties as a hosted or managed
19
- service, where the service provides users with access to any substantial set of
20
- the features or functionality of the software.
15
+ You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
21
16
 
22
- You may not move, change, disable, or circumvent the license key functionality
23
- in the software, and you may not remove or obscure any functionality in the
24
- software that is protected by the license key.
17
+ You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
25
18
 
26
- You may not alter, remove, or obscure any licensing, copyright, or other notices
27
- of the licensor in the software. Any use of the licensor's trademarks is subject
28
- to applicable law.
19
+ You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor's trademarks is subject to applicable law.
29
20
 
30
21
  ## Patents
31
22
 
32
- The licensor grants you a license, under any patent claims the licensor can
33
- license, or becomes able to license, to make, have made, use, sell, offer for
34
- sale, import and have imported the software, in each case subject to the
35
- limitations and conditions in this license. This license does not cover any
36
- patent claims that you cause to be infringed by modifications or additions to the
37
- software. If you or your company make any written claim that the software
38
- infringes or contributes to infringement of any patent, your patent license for
39
- the software granted under these terms ends immediately. If your company makes
40
- such a claim, your patent license ends immediately for work on behalf of your
41
- company.
23
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
42
24
 
43
25
  ## Notices
44
26
 
45
- You must ensure that anyone who gets a copy of any part of the software from you
46
- also gets a copy of these terms.
27
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
47
28
 
48
- If you modify the software, you must include in any modified copies of the
49
- software prominent notices stating that you have modified the software.
29
+ If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
50
30
 
51
31
  ## No Other Rights
52
32
 
53
- These terms do not imply any licenses other than those expressly granted in
54
- these terms.
33
+ These terms do not imply any licenses other than those expressly granted in these terms.
55
34
 
56
35
  ## Termination
57
36
 
58
- If you use the software in violation of these terms, such use is not licensed,
59
- and your licenses will automatically terminate. If the licensor provides you
60
- with a notice of your violation, and you cease all violation of this license no
61
- later than 30 days after you receive that notice, your licenses will be
62
- reinstated retroactively. However, if you violate these terms after such
63
- reinstatement, any additional violation of these terms will cause your licenses
64
- to terminate automatically and permanently.
37
+ If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
65
38
 
66
39
  ## No Liability
67
40
 
68
- As far as the law allows, the software comes as is, without any warranty or
69
- condition, and the licensor will not be liable to you for any damages arising
70
- out of these terms or the use or nature of the software, under any kind of
71
- legal claim.
41
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
72
42
 
73
43
  ## Definitions
74
44
 
75
- The **licensor** is the entity offering these terms, and the **software** is the
76
- software the licensor makes available under these terms, including any portion
77
- of it.
45
+ The **licensor** is the entity offering these terms, and the **software** is the software the licensor makes available under these terms, including any portion of it.
78
46
 
79
47
  **you** refers to the individual or entity agreeing to these terms.
80
48
 
81
- **your company** is any legal entity, sole proprietorship, or other kind of
82
- organization that you work for, plus all organizations that have control over,
83
- are under the control of, or are under common control with that organization.
84
- **control** means ownership of substantially all the assets of an entity, or the
85
- power to direct its management and policies by vote, contract, or otherwise.
86
- Control can be direct or indirect.
87
-
88
- **your licenses** are all the licenses granted to you for the software under
89
- these terms.
90
-
91
- **use** means anything you do with the software requiring one of your licenses.
92
-
93
- **trademark** means trademarks, service marks, and similar rights.
49
+ **your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **control** means ownership of substantially all the assets of an entity, or the power to direct the management and policies of an entity.
package/README.md CHANGED
@@ -10,25 +10,6 @@ Works with **Claude Code**, **Cursor**, **Windsurf**, and any MCP-compatible AI
10
10
 
11
11
  ![SYKE Node Detail](https://syke.cloud/images/node-detail.png)
12
12
 
13
- ## Founding 100 — Free Pro for Early Adopters
14
-
15
- We're giving the **first 100 developers** full Pro access for **30 days** — no credit card, no strings.
16
-
17
- **What you get:**
18
- - All 8 MCP tools with advanced algorithms (SCC, PageRank, Risk Scoring, Git Coupling)
19
- - Unlimited files, multi-project support
20
- - Real-time cascade monitoring + web dashboard
21
- - AI semantic analysis (BYOK — Gemini, OpenAI, or Claude)
22
-
23
- **How to claim:**
24
- 1. Sign up at [syke.cloud](https://syke.cloud)
25
- 2. Star this repo
26
- 3. Click "I Starred" in your [dashboard](https://syke.cloud/dashboard/) → 30 days Pro unlocked
27
-
28
- Spots are limited. Once they're gone, they're gone.
29
-
30
- ---
31
-
32
13
  ## How It Works
33
14
 
34
15
  1. **On startup**, SYKE scans your source directory and builds a complete dependency graph using static import analysis.
@@ -270,12 +251,28 @@ You (developer) AI Agent SYKE
270
251
  | build." ----------| |
271
252
  ```
272
253
 
254
+ ## Founding 100 — Free Pro for Early Adopters
255
+
256
+ We're giving the **first 100 developers** full Pro access for **30 days** — no credit card, no strings.
257
+
258
+ **What you get:**
259
+ - All 8 MCP tools with advanced algorithms (SCC, PageRank, Risk Scoring, Git Coupling)
260
+ - Unlimited files, multi-project support
261
+ - Real-time cascade monitoring + web dashboard
262
+ - AI semantic analysis (BYOK — Gemini, OpenAI, or Claude)
263
+
264
+ **How to claim:**
265
+ 1. Sign up at [syke.cloud](https://syke.cloud)
266
+ 2. Star this repo
267
+ 3. Click "I Starred" in your [dashboard](https://syke.cloud/dashboard/) → 30 days Pro unlocked
268
+
269
+ Spots are limited. Once they're gone, they're gone.
270
+
273
271
  ## License
274
272
 
275
273
  [Elastic License 2.0 (ELv2)](LICENSE)
276
274
 
277
275
  You can use, modify, and distribute SYKE freely, with two limitations:
276
+
278
277
  1. **No managed service** — You cannot offer SYKE as a hosted/managed service to third parties.
279
278
  2. **No license key circumvention** — You cannot remove, disable, or bypass the license key functionality.
280
-
281
- See the [LICENSE](LICENSE) file for the full text.
@@ -1 +1,112 @@
1
- 'use strict';const _0xd9aada=_0x55cb;(function(_0x2aee06,_0x2c8246){const _0x5bd4c7={_0x578e8a:0xbb,_0xe34610:0xe6,_0x4e2952:0xda,_0x2bca36:0xcd,_0x380dad:0xcc},_0x57d1d5=_0x55cb,_0x5205d9=_0x2aee06();while(!![]){try{const _0x3377ae=parseInt(_0x57d1d5(_0x5bd4c7._0x578e8a))/0x1*(-parseInt(_0x57d1d5(_0x5bd4c7._0xe34610))/0x2)+-parseInt(_0x57d1d5(0xbd))/0x3+-parseInt(_0x57d1d5(_0x5bd4c7._0x4e2952))/0x4+parseInt(_0x57d1d5(0xd1))/0x5*(parseInt(_0x57d1d5(_0x5bd4c7._0x2bca36))/0x6)+-parseInt(_0x57d1d5(_0x5bd4c7._0x380dad))/0x7+parseInt(_0x57d1d5(0xc5))/0x8+parseInt(_0x57d1d5(0xc8))/0x9*(parseInt(_0x57d1d5(0xba))/0xa);if(_0x3377ae===_0x2c8246)break;else _0x5205d9['push'](_0x5205d9['shift']());}catch(_0x31556a){_0x5205d9['push'](_0x5205d9['shift']());}}}(_0x5adb,0xec341));var __createBinding=this&&this['__createBinding']||(Object['create']?function(_0x3b3e7e,_0x5702b0,_0x954b72,_0x40a76f){const _0x33453e={_0x4f0494:0xd4,_0x82ddb6:0xe5},_0x289bef=_0x55cb,_0x48e09c={};_0x48e09c['kawYV']=_0x289bef(0xde);const _0x980a6c=_0x48e09c;if(_0x40a76f===undefined)_0x40a76f=_0x954b72;var _0x56c0d4=Object['getOwnPropertyDescriptor'](_0x5702b0,_0x954b72);if(!_0x56c0d4||(_0x980a6c['kawYV']in _0x56c0d4?!_0x5702b0['__esModule']:_0x56c0d4[_0x289bef(_0x33453e._0x4f0494)]||_0x56c0d4['configurable'])){const _0x2eab2a={};_0x2eab2a[_0x289bef(_0x33453e._0x82ddb6)]=!![],_0x2eab2a[_0x289bef(0xde)]=function(){return _0x5702b0[_0x954b72];},_0x56c0d4=_0x2eab2a;}Object[_0x289bef(0xe3)](_0x3b3e7e,_0x40a76f,_0x56c0d4);}:function(_0x2ee92c,_0x3d99cf,_0xafc6cd,_0x9a780c){if(_0x9a780c===undefined)_0x9a780c=_0xafc6cd;_0x2ee92c[_0x9a780c]=_0x3d99cf[_0xafc6cd];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(_0x60392d,_0x287ec7){const _0x1374f2={_0x385795:0xd7},_0x42cb7b=_0x55cb,_0xbcf0ee={};_0xbcf0ee['zOkkv']=_0x42cb7b(_0x1374f2._0x385795);const _0x219e99=_0xbcf0ee,_0x3cab00={};_0x3cab00[_0x42cb7b(0xe5)]=!![],_0x3cab00['value']=_0x287ec7,Object['defineProperty'](_0x60392d,_0x219e99['zOkkv'],_0x3cab00);}:function(_0x1b9c08,_0x535318){const _0x546e6a={_0xec113e:0xc1,_0x51dde4:0xd7},_0x578dc4=_0x55cb,_0x1c6bb={};_0x1c6bb[_0x578dc4(_0x546e6a._0xec113e)]=_0x578dc4(_0x546e6a._0x51dde4);const _0x1c2409=_0x1c6bb;_0x1b9c08[_0x1c2409['OgMOP']]=_0x535318;}),__importStar=this&&this[_0xd9aada(0xe0)]||(function(){const _0x275401={_0x2de481:0xd6,_0x1c1642:0xbc,_0x103db5:0xc3,_0x3906dc:0xd7},_0x765ebd={_0x53551d:0xd2},_0x5525db={_0x250f01:0xc4,_0x4814be:0xe1},_0x3d057f={'eqAHU':function(_0x123b96,_0x230a38){return _0x123b96(_0x230a38);},'LAOCy':function(_0x23723d,_0x207d36){return _0x23723d!==_0x207d36;},'HfhTw':function(_0x55e9c1,_0x58143a,_0x220dc1,_0x178648){return _0x55e9c1(_0x58143a,_0x220dc1,_0x178648);},'NOPkK':function(_0x46e412,_0xd1c692,_0x2e7543){return _0x46e412(_0xd1c692,_0x2e7543);}};var _0x214c29=function(_0x2ed448){const _0x273d7c=_0x55cb;return _0x214c29=Object['getOwnPropertyNames']||function(_0x540611){const _0xdd93b3=_0x55cb;var _0x107297=[];for(var _0x51b967 in _0x540611)if(Object[_0xdd93b3(_0x5525db._0x250f01)]['hasOwnProperty'][_0xdd93b3(_0x5525db._0x4814be)](_0x540611,_0x51b967))_0x107297[_0x107297['length']]=_0x51b967;return _0x107297;},_0x3d057f[_0x273d7c(_0x765ebd._0x53551d)](_0x214c29,_0x2ed448);};return function(_0x3e955b){const _0x3a1640=_0x55cb;if(_0x3e955b&&_0x3e955b[_0x3a1640(_0x275401._0x2de481)])return _0x3e955b;var _0x4e5cba={};if(_0x3e955b!=null){for(var _0x3c4c2d=_0x214c29(_0x3e955b),_0xf1c160=0x0;_0xf1c160<_0x3c4c2d[_0x3a1640(_0x275401._0x1c1642)];_0xf1c160++)if(_0x3d057f[_0x3a1640(_0x275401._0x103db5)](_0x3c4c2d[_0xf1c160],_0x3a1640(_0x275401._0x3906dc)))_0x3d057f['HfhTw'](__createBinding,_0x4e5cba,_0x3e955b,_0x3c4c2d[_0xf1c160]);}return _0x3d057f['NOPkK'](__setModuleDefault,_0x4e5cba,_0x3e955b),_0x4e5cba;};}());const _0x37d577={};_0x37d577['value']=!![],Object['defineProperty'](exports,_0xd9aada(0xd6),_0x37d577),exports[_0xd9aada(0xe4)]=analyzeWithAI;function _0x55cb(_0x583942,_0x367934){_0x583942=_0x583942-0xba;const _0x5adbfd=_0x5adb();let _0x55cb13=_0x5adbfd[_0x583942];if(_0x55cb['xhyOfv']===undefined){var _0x299f39=function(_0xdea606){const _0x789b67='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x593ae7='',_0x80af8c='';for(let _0x1e3fdf=0x0,_0x4ef032,_0x529153,_0x1c89bd=0x0;_0x529153=_0xdea606['charAt'](_0x1c89bd++);~_0x529153&&(_0x4ef032=_0x1e3fdf%0x4?_0x4ef032*0x40+_0x529153:_0x529153,_0x1e3fdf++%0x4)?_0x593ae7+=String['fromCharCode'](0xff&_0x4ef032>>(-0x2*_0x1e3fdf&0x6)):0x0){_0x529153=_0x789b67['indexOf'](_0x529153);}for(let _0x12601e=0x0,_0x4c58f6=_0x593ae7['length'];_0x12601e<_0x4c58f6;_0x12601e++){_0x80af8c+='%'+('00'+_0x593ae7['charCodeAt'](_0x12601e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x80af8c);};_0x55cb['yZyShH']=_0x299f39,_0x55cb['cBgUew']={},_0x55cb['xhyOfv']=!![];}const _0x1f7b2b=_0x5adbfd[0x0],_0x4be59e=_0x583942+_0x1f7b2b,_0x19c461=_0x55cb['cBgUew'][_0x4be59e];return!_0x19c461?(_0x55cb13=_0x55cb['yZyShH'](_0x55cb13),_0x55cb['cBgUew'][_0x4be59e]=_0x55cb13):_0x55cb13=_0x19c461,_0x55cb13;}const fs=__importStar(require('fs')),path=__importStar(require(_0xd9aada(0xc2))),provider_1=require(_0xd9aada(0xdb)),context_extractor_1=require('./context-extractor');function readFileContent(_0x41b9cc){const _0x553843={_0x26df14:0xe2,_0x380cfa:0xca},_0x435349=_0xd9aada,_0x3ba9d2={};_0x3ba9d2[_0x435349(_0x553843._0x26df14)]='utf-8';const _0x4bacb0=_0x3ba9d2;try{return fs[_0x435349(_0x553843._0x380cfa)](_0x41b9cc,_0x4bacb0['caRvv']);}catch{return null;}}function buildSystemPrompt(_0x5e1cf1){const _0x2a0d36={_0xf66652:0xdd,_0x13247d:0xd0},_0x5ad12f=_0xd9aada,_0x2d845f={};_0x2d845f['eqGmF']='source';const _0x4d2c7d=_0x2d845f,_0x7a14cc=_0x5e1cf1['length']>0x0?_0x5e1cf1['join']('/'):_0x4d2c7d['eqGmF'];return _0x5ad12f(_0x2a0d36._0xf66652)+_0x7a14cc+_0x5ad12f(_0x2a0d36._0x13247d);}async function analyzeWithAI(_0x1ba41d,_0x240c6d,_0x450045){const _0x4aa720={_0x3b244d:0xbf,_0x5186ee:0xc7,_0x4dd3ea:0xc0,_0x531b6e:0xde,_0x46e5c9:0xd8,_0x2009a2:0xdf,_0xd8064d:0xdf,_0x3351fc:0xc9,_0x156fe9:0xd5,_0x1a6039:0xbc,_0x23e943:0xdc},_0x1c0ebe=_0xd9aada,_0x213bb4={'bqpMd':_0x1c0ebe(0xcb),'aRahy':function(_0x3f5e25,_0x3b1b9e){return _0x3f5e25(_0x3b1b9e);},'dSZEM':'No\x20internal\x20files\x20depend\x20on\x20this\x20file.'},_0x2be92b=(0x0,provider_1[_0x1c0ebe(_0x4aa720._0x3b244d)])();if(!_0x2be92b)return _0x213bb4['bqpMd'];const _0x53ecf5=readFileContent(_0x1ba41d);if(!_0x53ecf5)return _0x1c0ebe(0xd9)+_0x1ba41d;const _0x5744d9=_0x450045['languages'][0x0]||'text',_0xb74ab1=(0x0,context_extractor_1[_0x1c0ebe(_0x4aa720._0x5186ee)])(_0x53ecf5,_0x5744d9),_0x34d38e=(_0x450045[_0x1c0ebe(_0x4aa720._0x4dd3ea)][_0x1c0ebe(_0x4aa720._0x531b6e)](path[_0x1c0ebe(0xce)](_0x1ba41d))||[])[_0x1c0ebe(0xbe)](0x0,0x5),_0x56e8e6=[];for(const _0x99f7f1 of _0x34d38e){const _0x47ef0b=_0x213bb4[_0x1c0ebe(_0x4aa720._0x46e5c9)](readFileContent,_0x99f7f1);if(_0x47ef0b){const _0x5298e5=path['relative'](_0x450045[_0x1c0ebe(0xc6)],_0x99f7f1)['replace'](/\\/g,'/'),_0x2632f1=(0x0,context_extractor_1['buildSmartContext'])(_0x47ef0b,_0x5744d9);_0x56e8e6[_0x1c0ebe(0xcf)](_0x1c0ebe(0xd3)+_0x5298e5+_0x1c0ebe(_0x4aa720._0x2009a2)+_0x5744d9+'\x0a'+_0x2632f1+_0x1c0ebe(_0x4aa720._0xd8064d));}}const _0x45060e='##\x20Target\x20file:\x20'+_0x240c6d['relativePath']+'\x0a-\x20Risk\x20level:\x20'+_0x240c6d['riskLevel']+'\x0a-\x20Direct\x20dependents:\x20'+_0x240c6d['directDependents']['length']+'\x0a-\x20Transitive\x20dependents:\x20'+_0x240c6d['transitiveDependents']['length']+_0x1c0ebe(_0x4aa720._0x3351fc)+_0x240c6d['totalImpacted']+'\x0a\x0a###\x20Target\x20file\x20source\x20code\x0a```'+_0x5744d9+'\x0a'+_0xb74ab1+_0x1c0ebe(_0x4aa720._0x156fe9)+(_0x56e8e6['length']>0x0?'###\x20Files\x20depending\x20on\x20this\x20file\x20(top\x20'+_0x56e8e6[_0x1c0ebe(_0x4aa720._0x1a6039)]+')\x0a'+_0x56e8e6['join']('\x0a\x0a'):_0x213bb4['dSZEM']);try{const _0x53f0d3=buildSystemPrompt(_0x450045['languages']);return await _0x2be92b['analyze'](_0x53f0d3,_0x45060e);}catch(_0x251cd4){return'AI\x20analysis\x20error:\x20'+(_0x251cd4[_0x1c0ebe(_0x4aa720._0x23e943)]||_0x251cd4);}}function _0x5adb(){const _0x17742d=['BwvZC2fNzq','ww91igfYzsbHBIbLEhbLCNqGAw4G','z2v0','cMbGya','x19PBxbVCNrtDgfY','y2fSBa','y2fsDNy','zgvMAw5LuhjVCgvYDhK','yw5HBhL6zvDPDgHbsq','zw51BwvYywjSzq','mtGXnZy4nhj3qNDREG','ndiWmtKZmZbUEuzAruO','mNr3EhjREq','BgvUz3rO','mtmXmJi4n0jNqw1hDG','C2XPy2u','z2v0quLqCM92AwrLCG','CMv2zxjZzq','t2Dnt1a','Cgf0Aa','tefpq3K','ChjVDg90ExbL','mty5otmWnerXBNbIyq','C291CMnLrgLY','yNvPBgrtBwfYDenVBNrLEhq','owLWvvjwta','cI0Gvg90ywWGAw1Wywn0zwqGzMLSzxm6ia','CMvHzezPBgvtEw5J','quKGyw5HBhLZAxmGzgLZywjSzwqG4OcuihnLDcbhru1jtKLFs0vzlcbpuevoquLFs0vzlcbVCIbbtLriuK9qsunFs0vzlG','otq2nJiZm3vfBuvbza','mte2nZbZu2Tpve4','BM9YBwfSAxPL','ChvZAa','ignVzguGAw1Wywn0igfUywX5C2LZlGPbBMfSExPLihrOzsbZB3vYy2uGy29KzsbVzIb0AguGz2L2zw4GzMLSzsbHBMqGAxrZigrLCgvUzgvUDhmGDg8GAwrLBNrPzNKkD2HHDcbJB3vSzcbICMvHAYb3AgvUihrOAxmGzMLSzsbPCYbTB2rPzMLLzc4kcKfUywX5C2LZigzVCM1HDdOkiYmGq29YzsbsB2XLcKrLC2nYAwjLihrOzsbMAwXLj3mGCM9SzsbPBIb0AguGChjVAMvJDcbPBIbVBMuGC2vUDgvUy2ukcImJifjPC2SGug9PBNrZig9Uie1VzgLMAwnHDgLVBGPtCgvJAwzPyYbWyxj0CYb0Agf0ignVDwXKigjYzwfRicHPBMnSDwrLigz1BMn0Aw9Ul2nSyxnZig5HBwvZkqOkiYmGrgvWzw5Kzw50iezPBguGqw5HBhLZAxmksg93igrLCgvUzgvUDcbMAwXLCYb1C2uGC3bLy2LMAwmGCgfYDhmGB2yGDgHPCYbMAwXLcGOJiYbtywzLie1VzgLMAwnHDgLVBIbhDwLKzqPqCMvJyxv0Aw9UCYbHBMqGCMvJB21Tzw5KzwqGyxbWCM9Hy2HLCYbMB3iGBw9KAwz5Aw5NihrOAxmGzMLSzqOkqMuGy29Uy2LZzsbIDxqGC3bLy2LMAwmU','nde1zMTJzKnS','zxfbsfu','iYmJia','D3jPDgfIBgu','cMbGyaOk','x19LC01VzhvSzq','zgvMyxvSDa','yvjHAhK','q2fUBM90ihjLywqGzMLSztOG','mZq0merMs0feBW','lI9WCM92AwrLCG'];_0x5adb=function(){return _0x17742d;};return _0x5adb();}
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.analyzeWithAI = analyzeWithAI;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const provider_1 = require("./provider");
40
+ const context_extractor_1 = require("./context-extractor");
41
+ function readFileContent(filePath) {
42
+ try {
43
+ return fs.readFileSync(filePath, "utf-8");
44
+ }
45
+ catch {
46
+ return null;
47
+ }
48
+ }
49
+ function buildSystemPrompt(languages) {
50
+ const langNames = languages.length > 0 ? languages.join("/") : "source";
51
+ return `You are an expert in ${langNames} code impact analysis.
52
+ Analyze the source code of the given file and its dependents to identify
53
+ what could break when this file is modified.
54
+
55
+ Analysis format:
56
+ ## Core Role
57
+ Describe the file's role in the project in one sentence
58
+
59
+ ## Risk Points on Modification
60
+ Specific parts that could break (include function/class names)
61
+
62
+ ## Dependent File Analysis
63
+ How dependent files use specific parts of this file
64
+
65
+ ## Safe Modification Guide
66
+ Precautions and recommended approaches for modifying this file
67
+
68
+ Be concise but specific.`;
69
+ }
70
+ async function analyzeWithAI(filePath, impactResult, graph) {
71
+ const provider = (0, provider_1.getAIProvider)();
72
+ if (!provider) {
73
+ return "AI analysis disabled — set GEMINI_KEY, OPENAI_KEY, or ANTHROPIC_KEY.";
74
+ }
75
+ const targetSource = readFileContent(filePath);
76
+ if (!targetSource) {
77
+ return `Cannot read file: ${filePath}`;
78
+ }
79
+ const codeBlockLang = graph.languages[0] || "text";
80
+ // Build smart context for the target file
81
+ const smartTarget = (0, context_extractor_1.buildSmartContext)(targetSource, codeBlockLang);
82
+ // Build smart context for dependent files (top 5)
83
+ const directDeps = (graph.reverse.get(path.normalize(filePath)) || []).slice(0, 5);
84
+ const dependentSources = [];
85
+ for (const dep of directDeps) {
86
+ const source = readFileContent(dep);
87
+ if (source) {
88
+ const rel = path.relative(graph.sourceDir, dep).replace(/\\/g, "/");
89
+ const smartDep = (0, context_extractor_1.buildSmartContext)(source, codeBlockLang);
90
+ dependentSources.push(`### ${rel}\n\`\`\`${codeBlockLang}\n${smartDep}\n\`\`\``);
91
+ }
92
+ }
93
+ const userPrompt = `## Target file: ${impactResult.relativePath}
94
+ - Risk level: ${impactResult.riskLevel}
95
+ - Direct dependents: ${impactResult.directDependents.length}
96
+ - Transitive dependents: ${impactResult.transitiveDependents.length}
97
+ - Total impacted files: ${impactResult.totalImpacted}
98
+
99
+ ### Target file source code
100
+ \`\`\`${codeBlockLang}
101
+ ${smartTarget}
102
+ \`\`\`
103
+
104
+ ${dependentSources.length > 0 ? `### Files depending on this file (top ${dependentSources.length})\n${dependentSources.join("\n\n")}` : "No internal files depend on this file."}`;
105
+ try {
106
+ const systemPrompt = buildSystemPrompt(graph.languages);
107
+ return await provider.analyze(systemPrompt, userPrompt);
108
+ }
109
+ catch (err) {
110
+ return `AI analysis error: ${err.message || err}`;
111
+ }
112
+ }
@@ -1 +1,224 @@
1
- 'use strict';const _0x61a3a6=_0xc29f;(function(_0x28c76a,_0xc422c1){const _0x18dfa4={_0x57e394:0xae,_0x5b7751:0xb7,_0x55ba69:0xaf,_0x4518a3:0xcb},_0x54b7da=_0xc29f,_0x4900cc=_0x28c76a();while(!![]){try{const _0x253a8f=parseInt(_0x54b7da(0xa2))/0x1+-parseInt(_0x54b7da(0xa8))/0x2+-parseInt(_0x54b7da(_0x18dfa4._0x57e394))/0x3+-parseInt(_0x54b7da(_0x18dfa4._0x5b7751))/0x4*(parseInt(_0x54b7da(0xc0))/0x5)+parseInt(_0x54b7da(_0x18dfa4._0x55ba69))/0x6+-parseInt(_0x54b7da(_0x18dfa4._0x4518a3))/0x7+parseInt(_0x54b7da(0xca))/0x8;if(_0x253a8f===_0xc422c1)break;else _0x4900cc['push'](_0x4900cc['shift']());}catch(_0xa3d91f){_0x4900cc['push'](_0x4900cc['shift']());}}}(_0x13ac,0x3e29f));const _0x296827={};_0x296827['value']=!![],Object['defineProperty'](exports,_0x61a3a6(0xe0),_0x296827),exports['extractSignatures']=extractSignatures,exports[_0x61a3a6(0xce)]=diffSignatures,exports['buildSmartContext']=buildSmartContext;const _0x8154d9={};_0x8154d9['type']=_0x61a3a6(0xdd),_0x8154d9[_0x61a3a6(0xcc)]=/^(export\s+)?(async\s+)?function\s+(\w+)\s*(<[^>]*>)?\s*\([^)]*\)/gm;const _0x5848b6={};_0x5848b6[_0x61a3a6(0xc8)]='class',_0x5848b6['regex']=/^(export\s+)?(abstract\s+)?class\s+(\w+)(\s+extends\s+\w+)?(\s+implements\s+[\w,\s]+)?/gm;const _0x536313={};_0x536313[_0x61a3a6(0xc8)]=_0x61a3a6(0xda),_0x536313[_0x61a3a6(0xcc)]=/^(export\s+)?interface\s+(\w+)(\s+extends\s+[\w,\s]+)?/gm;const _0x3cef34={};_0x3cef34[_0x61a3a6(0xc8)]='type',_0x3cef34['regex']=/^(export\s+)?type\s+(\w+)\s*(<[^>]*>)?\s*=/gm;const _0x203a01={};_0x203a01[_0x61a3a6(0xc8)]=_0x61a3a6(0xb2),_0x203a01['regex']=/^(export\s+)?(const|let)\s+(\w+)\s*[=:]/gm;const _0x113bb1={};_0x113bb1[_0x61a3a6(0xd5)]=[_0x8154d9,_0x5848b6,_0x536313,_0x3cef34,_0x203a01];const _0x37a238={};_0x37a238[_0x61a3a6(0xc8)]='class',_0x37a238[_0x61a3a6(0xcc)]=/^(abstract\s+)?class\s+(\w+)(\s+extends\s+\w+)?(\s+with\s+[\w,\s]+)?(\s+implements\s+[\w,\s]+)?/gm;const _0x2a0b46={};_0x2a0b46[_0x61a3a6(0xc8)]=_0x61a3a6(0xdd),_0x2a0b46['regex']=/^\s*(static\s+)?(Future<[^>]+>|void|String|int|double|bool|List<[^>]+>|Map<[^>]+>|Set<[^>]+>|\w+\??)\s+(\w+)\s*\([^)]*\)/gm;const _0x35105b={};_0x35105b[_0x61a3a6(0xc8)]='variable',_0x35105b[_0x61a3a6(0xcc)]=/^\s*(static\s+)?(final|const|late\s+final)\s+(\w+\??)\s+(\w+)/gm;const _0x2aa3ad={};_0x2aa3ad['patterns']=[_0x37a238,_0x2a0b46,_0x35105b];function _0x13ac(){const _0x548c1d=['lY8G4Psa4PsaieLUDgvYBMfSierLy2XHCMf0Aw9UCYdILidILia','wxjOB2y','Bw9KAwzPzwq','Cgf0DgvYBNm','C2vpBvC','DhLWzxnJCMLWDa','wLPfwg8','zMLSDgvY','Aw50zxjMywnL','icaVlYbm','AgfZ','zNvUy3rPB24','BMfTzq','C2LNBMf0DxjL','x19LC01VzhvSzq','lY8Gvg90ywW6ia','DgvZDa','A0TfzuC','C29YDa','t1rOsM8','BgvUz3rO','AMf2yq','mJGXotiWv0LpsMvU','CMvXDwLYzsG','lY8GlI4UicG','ywrK','BwfW','vgXPs1K','mJaXnty0ywP0AM1e','vLfkr2m','AM9PBG','zgfYDa','CNvIEq','AMf2yxnJCMLWDa','mtm4mJaXm3nbB3rRyq','ntm0ntCWA1DOyxvQ','AM1kALa','BhnVCeW','DMfYAwfIBgu','u2ziEu0','ywrKzwq','Dw5RBM93BG','y2XHC3m','ntq4mZu2t01sweHP','CgfJA2fNzsa','C3rHCNrZv2L0Aa','tfzdDu8','CgLVuvq','CNvZDa','y3bW','ChvZAa','veftv3q','nvPgC3HSBa','i2LUy2X1zgu','BKDIt0y','BgfZDeLUzgv4','ChL0Ag9U','Dhn4','q3LVug4','igXPBMvZ','DhLWzq','zxHWB3j0zwq','nJaZotqWoe1XzgvtDW','mtiWotqZmMjKvej3CG','CMvNzxG','C3bSAxq','zgLMzLnPz25HDhvYzxm','igXPBMvZig9MigLTCgXLBwvUDgf0Aw9Uig9TAxr0zwqP','Aw1WB3j0','rg5gz0S'];_0x13ac=function(){return _0x548c1d;};return _0x13ac();}const _0xf02b21={};_0xf02b21['type']=_0x61a3a6(0xdd),_0xf02b21['regex']=/^(async\s+)?def\s+(\w+)\s*\([^)]*\)(\s*->\s*\w+)?/gm;const _0xc39fe6={};_0xc39fe6[_0x61a3a6(0xc8)]=_0x61a3a6(0xb6),_0xc39fe6[_0x61a3a6(0xcc)]=/^class\s+(\w+)(\([^)]*\))?/gm;const _0x5bfb21={};_0x5bfb21['type']=_0x61a3a6(0xb2),_0x5bfb21[_0x61a3a6(0xcc)]=/^(\w+)\s*:\s*\w+\s*=/gm;const _0x33bbe9={};_0x33bbe9['patterns']=[_0xf02b21,_0xc39fe6,_0x5bfb21];const _0x540570={};_0x540570[_0x61a3a6(0xc8)]='function',_0x540570['regex']=/^func\s+(\([^)]+\)\s+)?(\w+)\s*\([^)]*\)(\s*\([^)]*\)|\s*\w+)?/gm;const _0x353891={};_0x353891[_0x61a3a6(0xc8)]=_0x61a3a6(0xda),_0x353891['regex']=/^type\s+(\w+)\s+interface/gm;const _0x35d7e8={};_0x35d7e8['type']='type',_0x35d7e8[_0x61a3a6(0xcc)]=/^type\s+(\w+)\s+struct/gm;const _0x1c7dda={};_0x1c7dda[_0x61a3a6(0xd5)]=[_0x540570,_0x353891,_0x35d7e8];const _0x1bb054={};_0x1bb054['type']=_0x61a3a6(0xdd),_0x1bb054[_0x61a3a6(0xcc)]=/^(pub\s+)?(async\s+)?fn\s+(\w+)\s*(<[^>]*>)?\s*\([^)]*\)(\s*->\s*[\w<>&]+)?/gm;const _0x4efa87={};_0x4efa87['type']=_0x61a3a6(0xb6),_0x4efa87['regex']=/^(pub\s+)?struct\s+(\w+)/gm;const _0x22b7c4={};_0x22b7c4['type']=_0x61a3a6(0xda),_0x22b7c4[_0x61a3a6(0xcc)]=/^(pub\s+)?trait\s+(\w+)/gm;const _0x28da68={};function _0xc29f(_0x430f67,_0x21d7b7){_0x430f67=_0x430f67-0xa2;const _0x13ac9d=_0x13ac();let _0xc29f88=_0x13ac9d[_0x430f67];if(_0xc29f['ERrfJH']===undefined){var _0x3efc03=function(_0x1185d7){const _0x22a030='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x962fd0='',_0x32674f='';for(let _0x39e844=0x0,_0x267df1,_0x28b48d,_0x31bda5=0x0;_0x28b48d=_0x1185d7['charAt'](_0x31bda5++);~_0x28b48d&&(_0x267df1=_0x39e844%0x4?_0x267df1*0x40+_0x28b48d:_0x28b48d,_0x39e844++%0x4)?_0x962fd0+=String['fromCharCode'](0xff&_0x267df1>>(-0x2*_0x39e844&0x6)):0x0){_0x28b48d=_0x22a030['indexOf'](_0x28b48d);}for(let _0x39d22d=0x0,_0x5cd905=_0x962fd0['length'];_0x39d22d<_0x5cd905;_0x39d22d++){_0x32674f+='%'+('00'+_0x962fd0['charCodeAt'](_0x39d22d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x32674f);};_0xc29f['XfpLWq']=_0x3efc03,_0xc29f['dbWrSa']={},_0xc29f['ERrfJH']=!![];}const _0x5a4661=_0x13ac9d[0x0],_0x4a449d=_0x430f67+_0x5a4661,_0x251f7b=_0xc29f['dbWrSa'][_0x4a449d];return!_0x251f7b?(_0xc29f88=_0xc29f['XfpLWq'](_0xc29f88),_0xc29f['dbWrSa'][_0x4a449d]=_0xc29f88):_0xc29f88=_0x251f7b,_0xc29f88;}_0x28da68[_0x61a3a6(0xc8)]='type',_0x28da68['regex']=/^(pub\s+)?enum\s+(\w+)/gm;const _0x283653={};_0x283653[_0x61a3a6(0xd5)]=[_0x1bb054,_0x4efa87,_0x22b7c4,_0x28da68];const _0x1afabd={};_0x1afabd['type']='class',_0x1afabd['regex']=/^(public\s+)?(abstract\s+)?class\s+(\w+)(\s+extends\s+\w+)?(\s+implements\s+[\w,\s]+)?/gm;const _0x5cca2c={};_0x5cca2c['type']='interface',_0x5cca2c[_0x61a3a6(0xcc)]=/^(public\s+)?interface\s+(\w+)(\s+extends\s+[\w,\s]+)?/gm;const _0x4cb54d={};_0x4cb54d['type']=_0x61a3a6(0xdd),_0x4cb54d['regex']=/^\s*(public|protected|private)?\s*(static\s+)?([\w<>\[\]]+)\s+(\w+)\s*\([^)]*\)/gm;const _0x12c34e={};_0x12c34e['patterns']=[_0x1afabd,_0x5cca2c,_0x4cb54d];const _0x135a27={};_0x135a27['type']=_0x61a3a6(0xb6),_0x135a27['regex']=/^(class|struct)\s+(\w+)/gm;const _0x5f3a7e={};_0x5f3a7e[_0x61a3a6(0xc8)]='function',_0x5f3a7e['regex']=/^(virtual\s+)?(static\s+)?([\w:*&<>]+)\s+(\w+)\s*\([^)]*\)/gm;const _0x3811db={};_0x3811db['patterns']=[_0x135a27,_0x5f3a7e];const _0x37887e={};_0x37887e[_0x61a3a6(0xc8)]='class',_0x37887e['regex']=/^class\s+(\w+)(\s*<\s*\w+)?/gm;const _0x257c0d={};_0x257c0d[_0x61a3a6(0xc8)]='function',_0x257c0d[_0x61a3a6(0xcc)]=/^\s*def\s+(self\.)?(\w+[?!]?)\s*(\([^)]*\))?/gm;const _0x3bc1a4={};_0x3bc1a4[_0x61a3a6(0xd5)]=[_0x37887e,_0x257c0d];const _0x4d77fc={};_0x4d77fc['typescript']=_0x113bb1,_0x4d77fc[_0x61a3a6(0xab)]=_0x2aa3ad,_0x4d77fc['python']=_0x33bbe9,_0x4d77fc['go']=_0x1c7dda,_0x4d77fc[_0x61a3a6(0xbc)]=_0x283653,_0x4d77fc[_0x61a3a6(0xe7)]=_0x12c34e,_0x4d77fc[_0x61a3a6(0xbd)]=_0x3811db,_0x4d77fc[_0x61a3a6(0xac)]=_0x3bc1a4;const LANG_PATTERNS=_0x4d77fc;function getLangKey(_0x4a3fd3){const _0x38185d={_0x4b1a0d:0xbd,_0x1dd97c:0xc5,_0x3ac04e:0xd7,_0x15001b:0xab,_0x65393e:0xc2,_0xfc6507:0xb3,_0x1c271f:0xac},_0x20329e=_0x61a3a6,_0x232cc9={};_0x232cc9['TASWt']='typescript',_0x232cc9['nGbOF']='dart',_0x232cc9[_0x20329e(0xe3)]='python',_0x232cc9['FJrWt']='rust',_0x232cc9['TliKY']=_0x20329e(0xe7),_0x232cc9[_0x20329e(0xb3)]=_0x20329e(_0x38185d._0x4b1a0d),_0x232cc9['LdEHd']='ruby';const _0x17a5ea=_0x232cc9,_0x24dee0={};_0x24dee0['ts']=_0x20329e(0xd7),_0x24dee0[_0x20329e(_0x38185d._0x1dd97c)]=_0x17a5ea['TASWt'],_0x24dee0[_0x20329e(_0x38185d._0x3ac04e)]=_0x17a5ea[_0x20329e(0xbf)],_0x24dee0[_0x20329e(0xad)]=_0x20329e(0xd7),_0x24dee0['js']=_0x17a5ea['TASWt'],_0x24dee0[_0x20329e(_0x38185d._0x15001b)]=_0x17a5ea[_0x20329e(0xc2)],_0x24dee0['flutter']=_0x17a5ea[_0x20329e(_0x38185d._0x65393e)],_0x24dee0['py']=_0x17a5ea['kKEeG'],_0x24dee0[_0x20329e(0xc4)]=_0x17a5ea['kKEeG'],_0x24dee0['go']='go',_0x24dee0['rs']=_0x17a5ea['FJrWt'],_0x24dee0['rust']=_0x17a5ea['FJrWt'],_0x24dee0['java']='java',_0x24dee0['kotlin']=_0x17a5ea[_0x20329e(0xa7)],_0x24dee0[_0x20329e(0xbd)]=_0x17a5ea['SfHyM'],_0x24dee0['c++']=_0x17a5ea['SfHyM'],_0x24dee0['c']=_0x17a5ea['SfHyM'],_0x24dee0['h']='cpp',_0x24dee0['hpp']=_0x17a5ea[_0x20329e(_0x38185d._0xfc6507)],_0x24dee0['rb']=_0x17a5ea['LdEHd'],_0x24dee0[_0x20329e(_0x38185d._0x1c271f)]='ruby';const _0x16ebf0=_0x24dee0;return _0x16ebf0[_0x4a3fd3['toLowerCase']()]||_0x20329e(0xd7);}function extractSignatures(_0x2b370a,_0x25d923){const _0x2904d4={_0x1ea620:0xd5,_0x5d2fd1:0xcd,_0x39ec3c:0xa5},_0x3c2143=_0x61a3a6,_0x524718={};_0x524718['sXUjo']=function(_0x29a918,_0x150c0f){return _0x29a918-_0x150c0f;};const _0x656de2=_0x524718,_0x5ea979=getLangKey(_0x25d923),_0x27bbe3=LANG_PATTERNS[_0x5ea979];if(!_0x27bbe3)return[];const _0x31b8aa=_0x2b370a['split']('\x0a'),_0x2c0533=[],_0x67f2e7=new Set();for(const {type:_0x3a262e,regex:_0x5aac71}of _0x27bbe3[_0x3c2143(_0x2904d4._0x1ea620)]){_0x5aac71[_0x3c2143(0xc3)]=0x0;let _0x41cf59;while((_0x41cf59=_0x5aac71['exec'](_0x2b370a))!==null){const _0x20341f=_0x2b370a['substring'](0x0,_0x41cf59['index'])[_0x3c2143(_0x2904d4._0x5d2fd1)]('\x0a')[_0x3c2143(0xe6)],_0xcdcb18=_0x31b8aa[_0x20341f-0x1]?.['trim']()||_0x41cf59[0x0]['trim'](),_0x1ab804=/^export\s/['test'](_0xcdcb18)||/^pub\s/['test'](_0xcdcb18);let _0x202063='';for(let _0x33c1f5=_0x656de2['sXUjo'](_0x41cf59[_0x3c2143(0xe6)],0x1);_0x33c1f5>=0x1;_0x33c1f5--){if(_0x41cf59[_0x33c1f5]&&/^\w+$/[_0x3c2143(0xe2)](_0x41cf59[_0x33c1f5])){_0x202063=_0x41cf59[_0x33c1f5];break;}}if(!_0x202063)_0x202063=_0xcdcb18['split'](/[\s(<{=]/)[0x1]||_0x3c2143(0xb5);const _0xbd164=_0x3a262e+':'+_0x202063;if(_0x67f2e7[_0x3c2143(0xdc)](_0xbd164))continue;_0x67f2e7[_0x3c2143(_0x2904d4._0x39ec3c)](_0xbd164);const _0x1e4618={};_0x1e4618['type']=_0x3a262e,_0x1e4618['name']=_0x202063,_0x1e4618['signature']=_0xcdcb18,_0x1e4618['exported']=_0x1ab804,_0x1e4618['line']=_0x20341f,_0x2c0533['push'](_0x1e4618);}}return _0x2c0533[_0x3c2143(0xe4)]((_0x1b9184,_0x45a695)=>_0x1b9184['line']-_0x45a695['line']);}function diffSignatures(_0x5bc0d9,_0x2741bc,_0x46c218){const _0x1a9438={_0x2846d5:0xdc,_0x3d4707:0xde,_0x5ebf03:0xdf,_0x5b84d8:0xdf,_0x4380cd:0xbe},_0x414e1c=_0x61a3a6,_0x2987b4={};_0x2987b4[_0x414e1c(0xba)]='removed',_0x2987b4['pLIha']=_0x414e1c(0xb4),_0x2987b4[_0x414e1c(0xb1)]=function(_0x155528,_0xbce4ed){return _0x155528!==_0xbce4ed;};const _0x574490=_0x2987b4,_0x12431b=extractSignatures(_0x5bc0d9,_0x46c218),_0x3f5ba6=extractSignatures(_0x2741bc,_0x46c218),_0x9a3974=new Map(_0x12431b[_0x414e1c(0xa6)](_0x4ddfd7=>[_0x4ddfd7[_0x414e1c(0xc8)]+':'+_0x4ddfd7[_0x414e1c(0xde)],_0x4ddfd7])),_0x8414bc=new Map(_0x3f5ba6[_0x414e1c(0xa6)](_0x2674b0=>[_0x2674b0['type']+':'+_0x2674b0[_0x414e1c(0xde)],_0x2674b0])),_0x301bee=[];for(const [_0x147b13,_0x43eb65]of _0x9a3974){if(!_0x8414bc['has'](_0x147b13)){const _0x3dac92={};_0x3dac92['type']=_0x574490[_0x414e1c(0xba)],_0x3dac92['name']=_0x43eb65['name'],_0x3dac92['oldSignature']=_0x43eb65['signature'],_0x301bee[_0x414e1c(0xbe)](_0x3dac92);}}for(const [_0x25a182,_0x94f9ef]of _0x8414bc){if(!_0x9a3974[_0x414e1c(_0x1a9438._0x2846d5)](_0x25a182)){const _0x12ec79={};_0x12ec79['type']=_0x574490['pLIha'],_0x12ec79['name']=_0x94f9ef[_0x414e1c(_0x1a9438._0x3d4707)],_0x12ec79['newSignature']=_0x94f9ef[_0x414e1c(_0x1a9438._0x5ebf03)],_0x301bee[_0x414e1c(0xbe)](_0x12ec79);}}for(const [_0x355047,_0x43e821]of _0x8414bc){const _0x2a327b=_0x9a3974['get'](_0x355047);if(_0x2a327b&&_0x574490[_0x414e1c(0xb1)](_0x2a327b[_0x414e1c(0xdf)],_0x43e821[_0x414e1c(_0x1a9438._0x5b84d8)])){const _0x1bb74b={};_0x1bb74b['type']=_0x414e1c(0xd4),_0x1bb74b['name']=_0x43e821['name'],_0x1bb74b['oldSignature']=_0x2a327b['signature'],_0x1bb74b['newSignature']=_0x43e821[_0x414e1c(0xdf)],_0x301bee[_0x414e1c(_0x1a9438._0x4380cd)](_0x1bb74b);}}return _0x301bee;}function buildSmartContext(_0x168e47,_0x565ac2,_0x25c467=0x64){const _0x5ccad6={_0x3032ee:0xe5,_0x719919:0xa3,_0x21a4d1:0xd1,_0x1b0443:0xb8,_0x1af829:0xd6,_0x2d2222:0xcd,_0x3fef41:0xb9,_0x3c4091:0xbb,_0x392447:0xb9,_0x3c1f65:0xc6,_0x3a2bd8:0xb0,_0x14d2dc:0xbe,_0x12e67d:0xa9,_0x321586:0xd2,_0x459dca:0xdf,_0x3bc14c:0xe6,_0x3ca29a:0xa4,_0x21655a:0xcf,_0x15d717:0xc7},_0x6a0131=_0x61a3a6,_0x39be5b={};_0x39be5b[_0x6a0131(0xd8)]=function(_0x56eb51,_0x510d2d){return _0x56eb51<_0x510d2d;},_0x39be5b[_0x6a0131(_0x5ccad6._0x3032ee)]='import\x20',_0x39be5b['hwVmV']='from\x20',_0x39be5b['Yrhof']=_0x6a0131(_0x5ccad6._0x719919),_0x39be5b[_0x6a0131(_0x5ccad6._0x21a4d1)]='use\x20',_0x39be5b['hGorM']=_0x6a0131(_0x5ccad6._0x1b0443),_0x39be5b['CyoPn']=function(_0x739fc5,_0x3c6568){return _0x739fc5>_0x3c6568;},_0x39be5b['pioQT']=_0x6a0131(0xd0),_0x39be5b['jmJjP']='//\x20──\x20Imports\x20──',_0x39be5b[_0x6a0131(0xa9)]='//\x20──\x20Exported\x20Declarations\x20──',_0x39be5b[_0x6a0131(_0x5ccad6._0x1af829)]=function(_0x249647,_0x224d57){return _0x249647-_0x224d57;};const _0x5ae783=_0x39be5b,_0x4cd6c8=_0x168e47[_0x6a0131(_0x5ccad6._0x2d2222)]('\x0a');if(_0x4cd6c8[_0x6a0131(0xe6)]<=_0x25c467)return _0x168e47;const _0x3045e7=[],_0x37fe9e=[];let _0x145344=0x0;for(let _0x51523e=0x0;_0x5ae783['ZZEXo'](_0x51523e,_0x4cd6c8[_0x6a0131(0xe6)]);_0x51523e++){const _0x4a9179=_0x4cd6c8[_0x51523e]['trim']();(_0x4a9179[_0x6a0131(_0x5ccad6._0x3fef41)](_0x5ae783['OThJo'])||_0x4a9179['startsWith'](_0x5ae783['hwVmV'])||_0x4a9179[_0x6a0131(_0x5ccad6._0x3fef41)](_0x5ae783[_0x6a0131(0xd3)])||_0x4a9179[_0x6a0131(_0x5ccad6._0x3fef41)]('const\x20')&&_0x4a9179['includes'](_0x5ae783['Yrhof'])||_0x4a9179['startsWith'](_0x5ae783['DnFgK'])||_0x4a9179['startsWith'](_0x6a0131(0xc1))||_0x4a9179[_0x6a0131(0xb9)](_0x5ae783['hGorM']))&&(_0x37fe9e[_0x6a0131(0xbe)](_0x4cd6c8[_0x51523e]),_0x145344=_0x51523e);if(_0x5ae783['CyoPn'](_0x51523e,0x14)&&_0x4a9179&&!_0x4a9179['startsWith'](_0x5ae783[_0x6a0131(_0x5ccad6._0x3c4091)])&&!_0x4a9179[_0x6a0131(_0x5ccad6._0x392447)]('from')&&!_0x4a9179[_0x6a0131(0xb9)]('//')&&!_0x4a9179['startsWith']('#')&&!_0x4a9179['startsWith']('*')&&!_0x4a9179['startsWith']('/*'))break;}_0x5ae783[_0x6a0131(_0x5ccad6._0x3c1f65)](_0x37fe9e['length'],0x0)&&(_0x3045e7['push'](_0x5ae783[_0x6a0131(_0x5ccad6._0x3a2bd8)]),_0x3045e7[_0x6a0131(_0x5ccad6._0x14d2dc)](..._0x37fe9e),_0x3045e7[_0x6a0131(0xbe)](''));const _0x4915c3=extractSignatures(_0x168e47,_0x565ac2)['filter'](_0x25ff9b=>_0x25ff9b['exported']);if(_0x4915c3['length']>0x0){_0x3045e7[_0x6a0131(_0x5ccad6._0x14d2dc)](_0x5ae783[_0x6a0131(_0x5ccad6._0x12e67d)]);for(const _0x55ab3e of _0x4915c3){_0x3045e7['push'](_0x55ab3e[_0x6a0131(0xdf)]+_0x6a0131(0xdb)+_0x55ab3e['line']);}_0x3045e7[_0x6a0131(0xbe)]('');}const _0x238225=extractSignatures(_0x168e47,_0x565ac2)[_0x6a0131(0xd9)](_0x4889ca=>!_0x4889ca[_0x6a0131(0xc9)]);if(_0x238225[_0x6a0131(0xe6)]>0x0){_0x3045e7['push'](_0x6a0131(_0x5ccad6._0x321586));for(const _0x7c485c of _0x238225){_0x3045e7[_0x6a0131(0xbe)](_0x7c485c[_0x6a0131(_0x5ccad6._0x459dca)]+'\x20\x20//\x20L'+_0x7c485c['line']);}_0x3045e7[_0x6a0131(0xbe)]('');}const _0x2597de=_0x5ae783['seOmW'](_0x5ae783[_0x6a0131(_0x5ccad6._0x1af829)](_0x4cd6c8[_0x6a0131(_0x5ccad6._0x3bc14c)],_0x145344),0x1);return _0x3045e7[_0x6a0131(_0x5ccad6._0x14d2dc)](_0x6a0131(_0x5ccad6._0x3ca29a)+_0x2597de+_0x6a0131(_0x5ccad6._0x21655a)),_0x3045e7['push'](_0x6a0131(0xe1)+_0x4cd6c8['length']+_0x6a0131(_0x5ccad6._0x15d717)),_0x3045e7[_0x6a0131(0xaa)]('\x0a');}
1
+ "use strict";
2
+ /**
3
+ * Semantic context extractor — structural code analysis for AI prompts.
4
+ * Extracts function/class/type signatures, compares changes, builds smart context.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.extractSignatures = extractSignatures;
8
+ exports.diffSignatures = diffSignatures;
9
+ exports.buildSmartContext = buildSmartContext;
10
+ const LANG_PATTERNS = {
11
+ typescript: {
12
+ patterns: [
13
+ { type: "function", regex: /^(export\s+)?(async\s+)?function\s+(\w+)\s*(<[^>]*>)?\s*\([^)]*\)/gm },
14
+ { type: "class", regex: /^(export\s+)?(abstract\s+)?class\s+(\w+)(\s+extends\s+\w+)?(\s+implements\s+[\w,\s]+)?/gm },
15
+ { type: "interface", regex: /^(export\s+)?interface\s+(\w+)(\s+extends\s+[\w,\s]+)?/gm },
16
+ { type: "type", regex: /^(export\s+)?type\s+(\w+)\s*(<[^>]*>)?\s*=/gm },
17
+ { type: "variable", regex: /^(export\s+)?(const|let)\s+(\w+)\s*[=:]/gm },
18
+ ],
19
+ },
20
+ dart: {
21
+ patterns: [
22
+ { type: "class", regex: /^(abstract\s+)?class\s+(\w+)(\s+extends\s+\w+)?(\s+with\s+[\w,\s]+)?(\s+implements\s+[\w,\s]+)?/gm },
23
+ { type: "function", regex: /^\s*(static\s+)?(Future<[^>]+>|void|String|int|double|bool|List<[^>]+>|Map<[^>]+>|Set<[^>]+>|\w+\??)\s+(\w+)\s*\([^)]*\)/gm },
24
+ { type: "variable", regex: /^\s*(static\s+)?(final|const|late\s+final)\s+(\w+\??)\s+(\w+)/gm },
25
+ ],
26
+ },
27
+ python: {
28
+ patterns: [
29
+ { type: "function", regex: /^(async\s+)?def\s+(\w+)\s*\([^)]*\)(\s*->\s*\w+)?/gm },
30
+ { type: "class", regex: /^class\s+(\w+)(\([^)]*\))?/gm },
31
+ { type: "variable", regex: /^(\w+)\s*:\s*\w+\s*=/gm },
32
+ ],
33
+ },
34
+ go: {
35
+ patterns: [
36
+ { type: "function", regex: /^func\s+(\([^)]+\)\s+)?(\w+)\s*\([^)]*\)(\s*\([^)]*\)|\s*\w+)?/gm },
37
+ { type: "interface", regex: /^type\s+(\w+)\s+interface/gm },
38
+ { type: "type", regex: /^type\s+(\w+)\s+struct/gm },
39
+ ],
40
+ },
41
+ rust: {
42
+ patterns: [
43
+ { type: "function", regex: /^(pub\s+)?(async\s+)?fn\s+(\w+)\s*(<[^>]*>)?\s*\([^)]*\)(\s*->\s*[\w<>&]+)?/gm },
44
+ { type: "class", regex: /^(pub\s+)?struct\s+(\w+)/gm },
45
+ { type: "interface", regex: /^(pub\s+)?trait\s+(\w+)/gm },
46
+ { type: "type", regex: /^(pub\s+)?enum\s+(\w+)/gm },
47
+ ],
48
+ },
49
+ java: {
50
+ patterns: [
51
+ { type: "class", regex: /^(public\s+)?(abstract\s+)?class\s+(\w+)(\s+extends\s+\w+)?(\s+implements\s+[\w,\s]+)?/gm },
52
+ { type: "interface", regex: /^(public\s+)?interface\s+(\w+)(\s+extends\s+[\w,\s]+)?/gm },
53
+ { type: "function", regex: /^\s*(public|protected|private)?\s*(static\s+)?([\w<>\[\]]+)\s+(\w+)\s*\([^)]*\)/gm },
54
+ ],
55
+ },
56
+ cpp: {
57
+ patterns: [
58
+ { type: "class", regex: /^(class|struct)\s+(\w+)/gm },
59
+ { type: "function", regex: /^(virtual\s+)?(static\s+)?([\w:*&<>]+)\s+(\w+)\s*\([^)]*\)/gm },
60
+ ],
61
+ },
62
+ ruby: {
63
+ patterns: [
64
+ { type: "class", regex: /^class\s+(\w+)(\s*<\s*\w+)?/gm },
65
+ { type: "function", regex: /^\s*def\s+(self\.)?(\w+[?!]?)\s*(\([^)]*\))?/gm },
66
+ ],
67
+ },
68
+ };
69
+ // Map file extensions / language names to pattern keys
70
+ function getLangKey(lang) {
71
+ const map = {
72
+ ts: "typescript", tsx: "typescript", typescript: "typescript", javascript: "typescript", js: "typescript",
73
+ dart: "dart", flutter: "dart",
74
+ py: "python", python: "python",
75
+ go: "go",
76
+ rs: "rust", rust: "rust",
77
+ java: "java", kotlin: "java",
78
+ cpp: "cpp", "c++": "cpp", c: "cpp", h: "cpp", hpp: "cpp",
79
+ rb: "ruby", ruby: "ruby",
80
+ };
81
+ return map[lang.toLowerCase()] || "typescript"; // fallback to TS patterns
82
+ }
83
+ // ── Signature Extraction ────────────────────────────────────────────
84
+ /**
85
+ * Extract function/class/type signatures from source code.
86
+ */
87
+ function extractSignatures(content, lang) {
88
+ const langKey = getLangKey(lang);
89
+ const langPatterns = LANG_PATTERNS[langKey];
90
+ if (!langPatterns)
91
+ return [];
92
+ const lines = content.split("\n");
93
+ const signatures = [];
94
+ const seen = new Set();
95
+ for (const { type, regex } of langPatterns.patterns) {
96
+ // Reset regex state
97
+ regex.lastIndex = 0;
98
+ let match;
99
+ while ((match = regex.exec(content)) !== null) {
100
+ const matchLine = content.substring(0, match.index).split("\n").length;
101
+ const fullLine = lines[matchLine - 1]?.trim() || match[0].trim();
102
+ const exported = /^export\s/.test(fullLine) || /^pub\s/.test(fullLine);
103
+ // Extract name (last capturing group that looks like a name)
104
+ let name = "";
105
+ for (let i = match.length - 1; i >= 1; i--) {
106
+ if (match[i] && /^\w+$/.test(match[i])) {
107
+ name = match[i];
108
+ break;
109
+ }
110
+ }
111
+ if (!name)
112
+ name = fullLine.split(/[\s(<{=]/)[1] || "unknown";
113
+ const key = `${type}:${name}`;
114
+ if (seen.has(key))
115
+ continue;
116
+ seen.add(key);
117
+ signatures.push({
118
+ type,
119
+ name,
120
+ signature: fullLine,
121
+ exported,
122
+ line: matchLine,
123
+ });
124
+ }
125
+ }
126
+ return signatures.sort((a, b) => a.line - b.line);
127
+ }
128
+ // ── Signature Diff ──────────────────────────────────────────────────
129
+ /**
130
+ * Compare signatures between old and new file content.
131
+ * Returns structural changes (added/removed/modified declarations).
132
+ */
133
+ function diffSignatures(oldContent, newContent, lang) {
134
+ const oldSigs = extractSignatures(oldContent, lang);
135
+ const newSigs = extractSignatures(newContent, lang);
136
+ const oldMap = new Map(oldSigs.map((s) => [`${s.type}:${s.name}`, s]));
137
+ const newMap = new Map(newSigs.map((s) => [`${s.type}:${s.name}`, s]));
138
+ const changes = [];
139
+ // Removed
140
+ for (const [key, sig] of oldMap) {
141
+ if (!newMap.has(key)) {
142
+ changes.push({ type: "removed", name: sig.name, oldSignature: sig.signature });
143
+ }
144
+ }
145
+ // Added
146
+ for (const [key, sig] of newMap) {
147
+ if (!oldMap.has(key)) {
148
+ changes.push({ type: "added", name: sig.name, newSignature: sig.signature });
149
+ }
150
+ }
151
+ // Modified
152
+ for (const [key, newSig] of newMap) {
153
+ const oldSig = oldMap.get(key);
154
+ if (oldSig && oldSig.signature !== newSig.signature) {
155
+ changes.push({
156
+ type: "modified",
157
+ name: newSig.name,
158
+ oldSignature: oldSig.signature,
159
+ newSignature: newSig.signature,
160
+ });
161
+ }
162
+ }
163
+ return changes;
164
+ }
165
+ // ── Smart Context Builder ───────────────────────────────────────────
166
+ /**
167
+ * Build a smart context summary of a file for AI prompts.
168
+ * Short files (<100 lines) are passed through as-is.
169
+ * Longer files get: imports + exported signatures + body summary.
170
+ */
171
+ function buildSmartContext(content, lang, maxLines = 100) {
172
+ const lines = content.split("\n");
173
+ // Short files: return as-is
174
+ if (lines.length <= maxLines)
175
+ return content;
176
+ const parts = [];
177
+ const importLines = [];
178
+ let lastImportLine = 0;
179
+ // Collect imports
180
+ for (let i = 0; i < lines.length; i++) {
181
+ const line = lines[i].trim();
182
+ if (line.startsWith("import ") ||
183
+ line.startsWith("from ") ||
184
+ line.startsWith("require(") ||
185
+ line.startsWith("const ") && line.includes("require(") ||
186
+ line.startsWith("use ") ||
187
+ line.startsWith("#include") ||
188
+ line.startsWith("package ")) {
189
+ importLines.push(lines[i]);
190
+ lastImportLine = i;
191
+ }
192
+ // Stop scanning after a non-import, non-blank line beyond the header
193
+ if (i > 20 && line && !line.startsWith("import") && !line.startsWith("from") && !line.startsWith("//") && !line.startsWith("#") && !line.startsWith("*") && !line.startsWith("/*")) {
194
+ break;
195
+ }
196
+ }
197
+ if (importLines.length > 0) {
198
+ parts.push("// ── Imports ──");
199
+ parts.push(...importLines);
200
+ parts.push("");
201
+ }
202
+ // Collect exported signatures
203
+ const sigs = extractSignatures(content, lang).filter((s) => s.exported);
204
+ if (sigs.length > 0) {
205
+ parts.push("// ── Exported Declarations ──");
206
+ for (const sig of sigs) {
207
+ parts.push(`${sig.signature} // L${sig.line}`);
208
+ }
209
+ parts.push("");
210
+ }
211
+ // All signatures (non-exported)
212
+ const privateSigs = extractSignatures(content, lang).filter((s) => !s.exported);
213
+ if (privateSigs.length > 0) {
214
+ parts.push("// ── Internal Declarations ──");
215
+ for (const sig of privateSigs) {
216
+ parts.push(`${sig.signature} // L${sig.line}`);
217
+ }
218
+ parts.push("");
219
+ }
220
+ const bodyLines = lines.length - lastImportLine - 1;
221
+ parts.push(`// ... (${bodyLines} lines of implementation omitted)`);
222
+ parts.push(`// Total: ${lines.length} lines`);
223
+ return parts.join("\n");
224
+ }