#
tokens: 132200/50000 1/593 files (page 435/436)
lines: on (toggle) GitHub
raw markdown copy reset
This is page 435 of 436. Use http://codebase.md/tosin2013/mcp-adr-analysis-server?lines=true&page={x} to view the full context.

# Directory Structure

```
├── .commitlintrc.json
├── .editorconfig
├── .eslintrc.json
├── .github
│   ├── AUTO-RELEASE-GUIDE.md
│   ├── auto-release.config.json
│   ├── dependabot.yml
│   ├── release-drafter.yml
│   └── workflows
│       ├── ai-release-notes.yml
│       ├── auto-release-on-merge.yml
│       ├── build.yml
│       ├── codeql-analysis.yml
│       ├── dependabot-auto-release.yml
│       ├── dependencies.yml
│       ├── deploy-docusaurus.yml
│       ├── lint.yml
│       ├── publish.yml
│       ├── release-drafter.yml
│       ├── security-scanning.yml
│       ├── test.yml
│       ├── update-dashboard.yml
│       └── validate-patterns.yml
├── .gitignore
├── .gitleaks.toml
├── .husky
│   ├── pre-commit
│   └── pre-push
├── .npm-cache
│   ├── _cacache
│   │   ├── content-v2
│   │   │   └── sha512
│   │   │       ├── 03
│   │   │       │   └── aa
│   │   │       │       └── 7fa6effa7f205c0354d1cff1aa5983d58a996b7ed716da0642f6aefd9e0342280791fd7de070475740797828d5d5fb7c20209d423e4250dc81ccea572cc8
│   │   │       ├── 04
│   │   │       │   └── 72
│   │   │       │       └── 7f10aaee348a897ff41a86fc704195caca0390db9ea6c9e37f130f931dc01ae6af8f8f24d330c78d402e03670e40c1fbde96c52b03a07aecd28ca970dbcd
│   │   │       ├── 05
│   │   │       │   └── 1e
│   │   │       │       └── 43b4d472f80b30589102c80d7baa1503bebac267acd73827e4418e734a66fde815546e9540bf4dd6a5c8dcc2d0b088b6c800dc7781e6c739c5d89f5107a3
│   │   │       ├── 06
│   │   │       │   ├── 36
│   │   │       │   │   └── ac5238b13c5752f8d2a4ca9732c8de4f9a0f373a5b2dd3e73abc6a2fd1d8b04c4a3a9a076a551ea1c5c12016e87842b02ced173ef4ab8627d4d50a3d19ce
│   │   │       │   └── ce
│   │   │       │       └── 31fb3fed118c646f6e00945cceb9a34fecdd5adcad388f7f5669a78f520f94152c7b9705050d2b75271ad435ef9a02ef0076d755fb4a971560ee12af01aa
│   │   │       ├── 07
│   │   │       │   └── 9c
│   │   │       │       └── 64367edfde90cc006ec5f3bb7de4729249d8a6109e6623a81d91a3352eae9898510906396501c4ade6c1218f61a2a89bbd181585d158fc7f4821631e91b3
│   │   │       ├── 0a
│   │   │       │   └── e5
│   │   │       │       └── 1eac2045db1c8aebb0151acc0ca1816a3be8edf3c55498ca5db667c882c91dcdb2d06b3275d5f2f7b2d3a899ac30a2eda148d0b6de8a8b7bab545b939c25
│   │   │       ├── 0c
│   │   │       │   ├── 4b
│   │   │       │   │   └── d5d99176af6ffadd5fad2bc850beb4766469f5d2cac76d7be24e572fecaa73c3c8d688d4ea6d58233b7218f11c6bace505f153cc410172b18618bf4619c7
│   │   │       │   └── f7
│   │   │       │       └── b9a5515a02c8a749a57a42343a81d89e7560dc4426d4ba241f41adb099657bfb10bd6c6ba5188f3e4dd466a059003da05793c0ab01b9e56362129e2278ed
│   │   │       ├── 0d
│   │   │       │   ├── 45
│   │   │       │   │   └── 89af7f942e9e335e6a25fd266415fdc91ac4bdfd222ff98dd1b7ddff5233e90e99250797f57abe0edcf3886d4b9427715782ab5ed90ed2ad4eb302ac24f3
│   │   │       │   ├── 6b
│   │   │       │   │   └── 4980e8d959c39aa171daa68623bfec5c3d968e5d78a0d9d2773930f4d67dd7e0916e81dbf5740ca364b6e316d1866355a0a728d2f4ab857acfe89a0fbc3d
│   │   │       │   ├── a8
│   │   │       │   │   └── 60c4a2eb1b2e30279d36798085e5e115a314910a1d1d21efb968601a78bfac7b2cca627390009fa368b3d36ef75f0f53bb7ab05a745704f5440c96bb70e2
│   │   │       │   └── c4
│   │   │       │       └── 630c2ba32bf90293f7147bc5f3f194a99bc992de634da6d6be8c6080e944840df92d94dbe6d7e22e67d7937036cd938d411f0a471de5be37594a0b3e333b
│   │   │       ├── 0e
│   │   │       │   └── 84
│   │   │       │       └── ba988a9e094e474eedc514f9cc47bab77688bad0caf4ecd3b9661705bc3adc6f0a83799741b7753ef2ac98f307f4b80126e8caa67cdd487afd1facf842d5
│   │   │       ├── 11
│   │   │       │   └── 3c
│   │   │       │       └── d5f5465209faebee25f63e9010bca5a554329ecb0d2da692e3f85001c26a19be9576bd25986d6d89965521d8cf21826a95862f6846645a97866ddaebc8f7
│   │   │       ├── 13
│   │   │       │   └── fe
│   │   │       │       └── 41ffc9210c7229cb80999a03c1c4ea99e9c57b3bad67b57950b352fd0d5e2c8599a3dac95f26e215279550e4c24123b4bf4164476ce6d5eea9277a2ce45e
│   │   │       ├── 14
│   │   │       │   └── 98
│   │   │       │       └── 584680da89ab5f12450af072a589c9aeff7486143e75ab78ad2831a8493cac4090677ce7315391b19e113513ab2807be8c6d3d0c06d9ca26e5f2031fbde9
│   │   │       ├── 15
│   │   │       │   ├── d5
│   │   │       │   │   └── 9bc5ffd5b08ba922af15c5bede73eff1e4e91ea1fe37ecfd69c1b77566679c911d4211fb42c58b3967095cd58dcbc24f20436f4130241e1de1468365610d
│   │   │       │   ├── e7
│   │   │       │   │   └── 70d1a66f921ca7a0f625039597acc080326fa7496759b7a973250ece93c4ba43e56c1e61e94569dd55127c05ed196e47cf7392d1607fb95ebcd770478b45
│   │   │       │   └── f2
│   │   │       │       └── a8e7b707e5e9518303c730748c6ee0a0140aac2c0c1c360e3a7e09c3973c78a2d38f23929df83daee2fe7aea3568f9a19705d2f5ce53d3a701c0498f3264
│   │   │       ├── 16
│   │   │       │   ├── 1f
│   │   │       │   │   └── 6b18dd0ca08e191543727c554d538cbd2d4cfddeef7fd0afb22e00366f04688f133c254d43cafbcc05a6e764f060316444009bd4da38d5ceaf8bac552097
│   │   │       │   ├── 40
│   │   │       │   │   └── 4cc03faa6c641e32ed5c3879ee181eb1e32ccf8e1a3c6a9e56b5b109dbaba6860a955db85e90a5103be85910bd6f53dd9adf01f0769d0701ca80505e620e
│   │   │       │   ├── 76
│   │   │       │   │   └── 62b03e9b3ac2ad016d1c2e26de5d25f280e9f820e5333eb411c7320ad87d8fd403b83797bb1f53c0ae988397e083c5a2c30338d5f551502047d079ad6620
│   │   │       │   └── 90
│   │   │       │       └── c3f63e1e16b74a41b3552260bcd4e17f30731bcbc70d5170b5b885b1514c6949190b345113994f940dd20289e16008cca66d9f36df967a08025e6ddc15d7
│   │   │       ├── 17
│   │   │       │   ├── a7
│   │   │       │   │   └── a82deef4e79206e8790cdfaf87f07ccfde91a8387651bafd6d2097ee237b48abea1f9d4c29dbfbf95578912441b579fa6312bc2cf178543fe8a663fecb7e
│   │   │       │   └── e3
│   │   │       │       └── 35b4b84efa695068e5aca44f16b2d83ecfa3f0c7045df2843c21771e5b3f7691f0266a54d17f4123ae8b907a8ed0b2c10f7c29f4e41e0886cd4af5643fef
│   │   │       ├── 18
│   │   │       │   ├── 17
│   │   │       │   │   └── 2c6f66933d8224db098964aaebb84a14c275ad10bda78ae0d6066b062e3f676c3acc3457d01605912d328043e2b8af2affafa904fb4205724e71d0189edd
│   │   │       │   └── cc
│   │   │       │       └── 46c566c580d2b56df24eb14f496c62d30cc42ea9879071b0028c9404d1cca53c7f27e7b05b92922605872b322b7e9109391143c39757ff9cee0c5ee96bd4
│   │   │       ├── 1c
│   │   │       │   └── fc
│   │   │       │       └── 29188ce4976f265b266a1b9da38aa0c9d76c1a3f5d4f6b5946a22c9490812e30b04fd2878afc2f3d7ac6d7af1b24cb9c1eedd7ddf14e7c9e6d128005a957
│   │   │       ├── 1d
│   │   │       │   └── 38
│   │   │       │       └── 605604f39c56109b865b34b66e0bfeb2f6b04d676074fbc378d1983d84cf2c58603121897c729da17ba39321fc7831535a0670947ab1bc2b11455a98dbc8
│   │   │       ├── 1e
│   │   │       │   └── 93
│   │   │       │       └── 21f3ea1a86621d3ae4b968528a63a3f2a20f8535a655fd7c893aaedbe18170b051dee7261f75b21a948e24def5369d20ea97b62c92652c787b11ac9a883c
│   │   │       ├── 1f
│   │   │       │   └── 1b
│   │   │       │       └── e177266c2b98bff3d459b4e608fa2437800ac9b4dd6e69f1b8cde4c8435319f627ca5417a0c62131c11ab8ddab308c01bbcdded77501b31478037d52a2c4
│   │   │       ├── 20
│   │   │       │   └── de
│   │   │       │       └── b0e0f4f8d27d6a4f04764ae0520cf3dd978c855f06065f84e0e7591f6e4fb14688f083a26c0ab279d66799273bce2f96abdf74c0a9d6db9b290a7443aaa6
│   │   │       ├── 21
│   │   │       │   └── c8
│   │   │       │       └── 4d7fa74de2d1e8305227ffb384f0b599d7d63aabfebb0667fabe719112ff1149b0556fd2cf27111c9f0adcc17ea2c52bda886a2898052fbb8612c57ad583
│   │   │       ├── 22
│   │   │       │   ├── 5d
│   │   │       │   │   └── 3e6e813bc3f5de6d41f2063ae813e0db072391191f4a2a6213cdb47b3324386a4a4e4583ff6666e102bd031bb466981aa83a765dcb6425bda8c9d90039f6
│   │   │       │   └── df
│   │   │       │       └── bd43e119bfcdc65fadc88ec5d0e51220fc5160d3683f632fbe344309e1ee65344c0125a61caa86902199070998d5fa2046a296ce310a76bda954f2ab7ecc
│   │   │       ├── 23
│   │   │       │   └── 7d
│   │   │       │       └── 11c9d3be6e79f63d0cedbe8db9b6cc0f1fec050637a1546b666a0914efcc8c7704f055fd76c2700e17e01e3fc4b637cc43fb950f6c686451f3f2bd3fa6c1
│   │   │       ├── 24
│   │   │       │   ├── 6e
│   │   │       │   │   └── 701d2dbef953d94fc775ac26e8374d60c74e5e221e452dab052146a41e5b65eaa638e4bba6b2be1ff23951e04fd0d7e3481dc3290517fc4f227d48d0063f
│   │   │       │   └── 91
│   │   │       │       └── 3565ad4d45f0f351efc14f7d18e388db111fd7528201d413f939472e5a090b71720982f2cd78636067b5fdb154787e13b0198bd5a97b086d7db432edb8c0
│   │   │       ├── 25
│   │   │       │   └── 31
│   │   │       │       └── 7df54ffa5c88c2068d30aa4539b0ad7482561edbb31146c7f0a22ab9cf338464b1d4dc0dca08c6b95ff6b37a4611089d0797023472b0174bfe5d1074f30e
│   │   │       ├── 27
│   │   │       │   ├── ba
│   │   │       │   │   └── 7ade1462023c35343130c355bb8b7efe07222b3963b95d0400cd9dd539c2f43cdc9bc297e657f374e73140cf043d512c84717eaddd43be2b96aa0503881f
│   │   │       │   └── cc
│   │   │       │       └── 7ff9f02546d7f9b76029a3c43c960234a1c7afcecf2b1219560c52a7796787359a0657587250b34bf3167b668259f47ba5b7bc63a8c09f7e808103fc5901
│   │   │       ├── 28
│   │   │       │   ├── 5a
│   │   │       │   │   └── 94f127c3ab2e4cf2543dcf54148bba1a2436a0fdb2befabecbbdd43c121d33494a8b14a0f401b1362d03d6063c01f93a0b7c5039ddfe45671cbbd31e006c
│   │   │       │   └── 86
│   │   │       │       └── 0b08226085f1d9c6a8d8044eeb132d0e06e4dde710874bbb47560bc22e4c7b4ad2286b1c0d5b784200b80452315f79193e306fd0c66a7fbed113105ded44
│   │   │       ├── 29
│   │   │       │   ├── af
│   │   │       │   │   └── bd4ebbadbfb1bc33a593e927a2456cfbf762b9a84a881841b35ca84013ac4e58063aa4f1fc53ef48637a0232fea4a9398bb2fed787fdb0d918a091e3ccb2
│   │   │       │   └── b9
│   │   │       │       └── b63de994402dfb4aa2bebf8c8c4e7f85ef10a2d1432f36a3fcc355a9b86f1d6c7a1d23df0f9cf31de30cf4450d8a753e0592af3c5c5d2740953da44fad5d
│   │   │       ├── 2b
│   │   │       │   └── c4
│   │   │       │       └── 318a283459760f3737be2a0420bf3bd97864683ea1b7d5e3552be33ccd92d13186a76151c06c0426cd1a9b440c2310ccbe2812d7bdd5a1189a3054915f04
│   │   │       ├── 2f
│   │   │       │   └── 43
│   │   │       │       └── aba62f2a1a9446fff35df87f74bc507ede21e7b9ed734921a634e38287518b27bad4295c15d87be28e9846412d949a15197b04bd560bf1608760afe7c6d4
│   │   │       ├── 32
│   │   │       │   ├── 42
│   │   │       │   │   └── 82c319574e0cfa085a09c77a42c27d3b18aa77ebe699caefeed8b9f656b0390dc7720999004840c14ddf31e708534102f90a261fe29ad728b72041dbf6f6
│   │   │       │   ├── 50
│   │   │       │   │   └── a0bf72bb8f50802b1bc27dcdcbb2b57cdcfc7bbb7a08fd31f5b0c86082afbed10fa778ad4970f5dd0917df0c0680c1f9ddcf6af8948357afa9178ccbe6c4
│   │   │       │   ├── 95
│   │   │       │   │   └── 043763a876d533c6f29097bd9c505ed14391221ec1af4ac546d226bd73945b5862f6088e02ec4a4f4bc513048a659e5cd988db95e7ac3e16e371cb7b72d9
│   │   │       │   └── fe
│   │   │       │       └── d03dc4f0f2db74f9cdcce912a7b1e396ece6a35e14ecbb79361548bf368e5efa879c26b1794557b4796dc917d1ce9eead2d58df006ed72fa7db186976806
│   │   │       ├── 35
│   │   │       │   └── 64
│   │   │       │       └── 36ff779dce8c7028d4aa782f582b6ea57d5f3314ae9c284778255b682c3024b33a7516328f5df85e55ab35fa0239880111b0ea824e974922956f42a65f18
│   │   │       ├── 36
│   │   │       │   └── a7
│   │   │       │       └── 29fade5c4c1f018a71646605e23099e2407d0fb14b76939d455216dd7de2af738002706dae427898ffcfa1d58bfa2b36b843b943ecf415d33d2889c13432
│   │   │       ├── 37
│   │   │       │   └── e3
│   │   │       │       └── 1e5d8a2aaf7a4e827f317f244f44437b8076a42d88e1b07856193ddf58088be08900b74883c35e108a2126d9b137d1ce575f9ab416d000dc22b97fdfc152
│   │   │       ├── 38
│   │   │       │   └── e7
│   │   │       │       └── 210e087817609c84e5fde1c455aa1bf2edbdc015bfbfad05f2b309b39866a445f90c8285958df9cb5a4462adf2c47ee0f8cac556d7a797cf0b778c723328
│   │   │       ├── 39
│   │   │       │   └── b9
│   │   │       │       └── a7205e215cd83506a8671e681b0c44c5f1d2cf0a08195818e441f859a5bb3366762eaf90d49634dc0878a2e4b0b7279134c9e3bfd4b20cc87f94bc7420cb
│   │   │       ├── 3a
│   │   │       │   └── a9
│   │   │       │       └── 4b2189b9033e8e0452f291bf1628d8a260a95c48549720363efa716f86c7a0b0ce583f321496abdf76a10a5ae3c37b4b158a6ae3b60487d43a3f2dc91979
│   │   │       ├── 3c
│   │   │       │   └── 42
│   │   │       │       └── 06098e6d4a552de7472ac8c5df0b35fea0e3ea374bee1aa5b36dc276c6f9e4ce4ab8ea83a9cfb7506930c175f2026f8375e3e1804540f0d97576378b6fce
│   │   │       ├── 3d
│   │   │       │   ├── 70
│   │   │       │   │   └── 9e407e6f3f59d8bf9189580edf77bce75b0d73d1eaae1ea7f0c20e364f8f0fa94d555a9a24e394123b4417de5981f73d033b4512e2756c93bb197a62d026
│   │   │       │   └── f1
│   │   │       │       └── 792d00bfabe4a782198843daef29cf196e00d6be6021d201339cc4dff8375656be6fd60ee482860da519ccbdda237852e681b925604272bb81d8d6f4257c
│   │   │       ├── 3f
│   │   │       │   └── e5
│   │   │       │       └── 6ed6a5dfcde7628ab987382df1286018799b4f715f60efa5fec60d850f8b58811ef57b0300df9637b02cf7ce188dfddc1e7d1a495f4c81720c22d5f5cd40
│   │   │       ├── 40
│   │   │       │   └── 6c
│   │   │       │       └── 5d5813cf17bfca0a5e9bc1958f2a9dcb625db6c63d171adcb4846a4f33b0a08a831263cdf57fbfa19f97a06866a6aedab04b56eee9f213f453da1fe24f3c
│   │   │       ├── 41
│   │   │       │   └── 36
│   │   │       │       └── 2e0deb12d15b6e1cd36f321f828e5289e0b26272408c500aa3944dfe8fcc3e465469c325f76a91102861736d919da3b5cd1b5b576be6d0a8813b1c85d3db
│   │   │       ├── 42
│   │   │       │   └── 9f
│   │   │       │       └── 166d93817be6e5829b944fe970db185e2cff2ad286ad73d5299a27a61080b11af14b6261e6f50a30559187b499466d2e80eb227789589a77fd9c5639ce88
│   │   │       ├── 43
│   │   │       │   └── 46
│   │   │       │       └── b3719a32898bc593e5539cc01a560fbb1f2e869f334b88933568e90365a6817382299f68b60d5533d4631c22fb0bb778f3473fea6ca5e4a0fa752e1a66ba
│   │   │       ├── 45
│   │   │       │   └── b2
│   │   │       │       └── 514b85164059331d34f057298c4d4bfc12a6213a9f1d38ebe22e3dae82d4e25d1691412ec62c6c594cb2f58d684c7a84827f9ce671992a4e5f488987d771
│   │   │       ├── 47
│   │   │       │   └── 96
│   │   │       │       └── 71f6670946a78202c3ff887c52b9e731adf421cb47d1a5282140115de89f3a26448a89769a3059920fa60903de08c132f78ce0990db0b1eb376340ad1d6d
│   │   │       ├── 4b
│   │   │       │   └── b3
│   │   │       │       └── 88f6f6507f3628937e2977e64b60c8827c40969944b9fc4872e672a4c1f1af2c8c5088ebc1c912b8d3b98ae381869d5b789210d4c5ce3976fc52e02c6f36
│   │   │       ├── 4c
│   │   │       │   └── 28
│   │   │       │       └── 25551b7395f7d137144c132477e831812c9a5ebac15c80c543f4f644cc02a752cd65282817e6ef41982d9883e2cbf4c8190ee80516cd5597e269e2dfcf1b
│   │   │       ├── 50
│   │   │       │   └── e4
│   │   │       │       └── a1b0fc33ecdacc52a851eadd215a315dbaf3b36edbfbb680c7d7f848adf44d2030679c159dd02c094c6bd3a67815966c0609d3fdfd997fb55ac3a9cb98cd
│   │   │       ├── 51
│   │   │       │   └── c5
│   │   │       │       └── 5f55f68ae127389bb5f77544a81e8a3340604415e0c2fb3568d3ab7df317bc0b31d265905e90d5c7fadbb435a947a25709fd0006a92e3a1de7fb41704833
│   │   │       ├── 52
│   │   │       │   └── a9
│   │   │       │       └── 3e82c7f2c883d4ae09b0914cd26570a6eb14a5630f94eaff12e10cd6a445b42447a99e88451a3ec2585462a33a0df5de21124cecadbcace20fc819ef6f24
│   │   │       ├── 53
│   │   │       │   ├── 1e
│   │   │       │   │   └── 328065acbb673b8ac1567bc62ed5896e266a95871a8ad9c2d735003901c0b741f6c636933b7eed18f1bff3d7aa572e7171658bd685dddf84163d0cb982e9
│   │   │       │   └── 67
│   │   │       │       └── 3524cf804eb4a5a184fd2a5cb1c74ff43800a3b0b150bff1e03d9b5c17b20da7ccc388c7b4370b9f56d1a4fb68322457012d332d0f98728b420a950195db
│   │   │       ├── 54
│   │   │       │   └── 76
│   │   │       │       └── f38d9361ee93db65ec9e436476815c59fa45ad7ba18f8d2784b84e42a140d509f482d9bd8985073bcb5e2dd7695ae91e0d118e2b5d51c1f9a50dfa4209c5
│   │   │       ├── 56
│   │   │       │   └── cb
│   │   │       │       └── fb9056979bea6d1c3319ee2cda46c3fbd0682b5bd341346b30b7d39969504b944d123690eaf1ebbf5465f217dafb3346b32b75b2ece9585ecbb260b1731e
│   │   │       ├── 58
│   │   │       │   └── 42
│   │   │       │       └── e747c96d01e41476955b36960cdedd5179094ccd826e3c32a65468132a18f093f6db9655401ad49693f38cdbc20d31d5f978e8a69476ddea6b767c28d38e
│   │   │       ├── 59
│   │   │       │   ├── 01
│   │   │       │   │   └── 3c1d8e5428225103af34c913eae58ea0145d6932ee45bbf5014bef3d76912a96fcfe1006fa88d749cc57d159304cb378a7d177c01699fdac050cb048ff74
│   │   │       │   └── 8f
│   │   │       │       └── f74d4304d31dca3d875147110926f5d11d5e0fc8fa14b31b596bbf25c08b7045044785dd94f713ac71a4ff6137fcb825c8023789385055121ffb16d0fc5e
│   │   │       ├── 5f
│   │   │       │   └── 11
│   │   │       │       └── 407da4bcd54592ed39c7394f97f3b2fb205152456ead1fd34f89b2645e365d41703af669ef2540da0d08c99e450563440dac5d917f71eae214069883e9b1
│   │   │       ├── 61
│   │   │       │   └── 3d
│   │   │       │       └── 46a8f48bf24267db47637a5317eff713469fd8f70e48647bdfc504d51eb3aa6b6c8c97b8bf51f32a29153957b984c8a4eb5158095e13503d5086f0f04ba1
│   │   │       ├── 62
│   │   │       │   ├── 00
│   │   │       │   │   └── 697491cfc90d94139c7e8654977277a3cc0bc3d1bdb65363ae00ffbc3a79494fe3e358fc6d8261aa28a73e4604cceb753d80dd18ceb61cef5476593fe14c
│   │   │       │   └── 5c
│   │   │       │       └── 559b200fce09df6b6d7d026e684db52cfed15974235f7ee9b98206b82334f452e29f9e014f64e554b3aa61020003ec3bc31df28911e4b58c3e60efce4577
│   │   │       ├── 64
│   │   │       │   └── 19
│   │   │       │       └── a11350bd2dc3e81fd5d949dc223ed6cf1d944ec009cccbe90815056b9cc0b16380ae765cf78013a9ce29607348ce8116a24f7b0859fa4ca265b66abda8ad
│   │   │       ├── 68
│   │   │       │   ├── 64
│   │   │       │   │   └── f16e96e0f3f6f925f5351d74ab6c7df05d9b8b3c970d11c65014cc4bb37a12ce0b55bba9c53e46db18652f05c523295d98c81f56c7169ba3e1c41fdb5c45
│   │   │       │   └── c5
│   │   │       │       └── 933533de497fc54cbd70cd6feb0b322bac19a5400a287def6dcf6da202936e4d5adebd8d659df4e6ff66c732eb11074d53cd8357ae000135570a67d2f1b7
│   │   │       ├── 69
│   │   │       │   └── e3
│   │   │       │       └── 661e70716e2d92b746aee950550bb25716584b94e9ef20895e3cd9e2c943400a5ce6b4050463cfe90622b78878ee7ce97003e736d3ff239e0a3bc5cae0f0
│   │   │       ├── 6a
│   │   │       │   ├── 61
│   │   │       │   │   └── 84cabafdddcaf7f155acaf643b8e274cf2b3b0f6d4e3f2b3966012d50d977b74abcf00e70cd30d7e604cffd62539a3825d5075b7190dda35e960c0c092ff
│   │   │       │   └── 6a
│   │   │       │       └── 5357458344d33ab7d8a6c73b040d35996b0669cdf7100c5a0f6f2b6eb79633dccea6546372802233aecff1d2f8fb786751c173855c3e057ddcc36f9471da
│   │   │       ├── 6c
│   │   │       │   └── 1c
│   │   │       │       └── b3af5f9ea75ce4e15b9b784555895e7ddafbb69471360596393a7cde859a8e3a0a2037cd3e98db42a8f9219f6824949a8ea715a03e86134a78410aaa4e5d
│   │   │       ├── 6e
│   │   │       │   ├── 92
│   │   │       │   │   └── 31bead3789fe943705d9f874caef524b87800fbe75e7b4373a5ce5fc515ab85d039597b970a24d00bc897e6fcce00b0ddf49a55364ca403cf6a05db2a61d
│   │   │       │   └── e7
│   │   │       │       └── b01f332f60bdbd8dd7904d520b79c49a64a9edfd12568e8642179396eb467aeff1a648b06438533baa1d4f237cc536d25b6992f9790bb5bcb7daccec23e2
│   │   │       ├── 6f
│   │   │       │   └── a8
│   │   │       │       └── d2bf1bd59f2a6d0222e36e458b13f94e9d1e257d3b43025f9e502ed1672f9041673ac11cc8576084eb106e3260f1736a888a1b430990f934f38597b7d105
│   │   │       ├── 70
│   │   │       │   └── f1
│   │   │       │       └── 8d93b90989f0ea548b6fee279cc7109402a57c6d1c0466f79c2f19c2e8f4579e1a83507bf35f7ef365bc35cbc4d80a80ec4f9c3b0613e85884fcee89f2fe
│   │   │       ├── 72
│   │   │       │   └── a7
│   │   │       │       └── 9fb91b21d76a56c86b08a0128903d96e16ede6471080f8e459bc0e24b4b4b322e094b56571188b978a01303b9ff2c1614c67640418a5af9191b5cc33136a
│   │   │       ├── 74
│   │   │       │   └── d0
│   │   │       │       └── 2fb0045ff1cb4285d2d1716050b44ab3155593ae35372fabc4d5ad65d2240e88fa417fbf25e754d5f01cce0b1b10b94de1db3ae6db536dec534b31fe7771
│   │   │       ├── 75
│   │   │       │   ├── 10
│   │   │       │   │   └── 7bf2cacdfe5ea0a96ba56a1f52af17989f179d7481b7d3e18ea8affd3a52d5c8b8371cf9ebe92a8e59358e5ca4700b6786602919e7d34db9282f4aba6038
│   │   │       │   ├── a3
│   │   │       │   │   └── a3f7440c563aba907ae0516c81759a218da2b906da1989ec63393ec9b20606733d03c27756cf1662a0525a68327d5efde0804d2937381f608cfcc872f800
│   │   │       │   └── c2
│   │   │       │       └── 855f78e7d0ca486978e2b2846f7b12095442b36aaef3dab64ac5ff8c4abf5391d9879ac5389b695c2e88eb8ff14797c9a4e55c4c99803e7ed4643ffde829
│   │   │       ├── 76
│   │   │       │   └── 12
│   │   │       │       └── 9ff74dd4fcf41963a6e834db4019d59b1bce5601b8d3ff5c58a19202ec5018d3259aa4e05056c56b0e5e7c5bcebffded55a4c341b5157831a5df74cc9214
│   │   │       ├── 77
│   │   │       │   ├── 62
│   │   │       │   │   └── 562c28af999613488a207bd32c805099aede7bd418a47161989230b59219656d3783946a99d83f2f0fc13f9496bc58659b6fb3e59bcfd725857b2091d967
│   │   │       │   └── 97
│   │   │       │       └── 4b4ed1a5c47e3b8cfe73cd5529ab55029854420395ff865b9735647a32741aa3ff3502cd830ba2df80b1bdee0aa454c8bb96de2db8f016f005b47b479357
│   │   │       ├── 78
│   │   │       │   └── c0
│   │   │       │       └── 6b11b047b69af1116cdc8c7416a1601f7402d3acda0d1bbbde0aa3dec9b8a3e7e9e626c78a8e7787d83316de4dc12ccd9b73053f7beb7a485de0d521975b
│   │   │       ├── 79
│   │   │       │   ├── 7d
│   │   │       │   │   └── b6e1fca9606766d0dde9da715c03323e25af187d1cfbcf8495257703bdb476d278f0aae4bbc55483ad6db2767f1381b31619e334c12071e1d137366b7b2e
│   │   │       │   └── 89
│   │   │       │       └── b441606d52b0566561b4777f3a386030d7a67df793e2395a3607b6e35926c779d1a5e5ed1959aabae6438681448d7ac1080e407d2126d383f24af5d84264
│   │   │       ├── 7a
│   │   │       │   └── 58
│   │   │       │       └── dc8040e5127b3fec05c5a2c0792bfda708ce0fec540f90673f0d62f2e6b985116bd96b21ab8a4d5df7f4086399c9e1ff58b15bc1900ea42691e7f6b21275
│   │   │       ├── 7b
│   │   │       │   ├── 0a
│   │   │       │   │   └── d74434c0a805e5925eadfdf91758d021157f48f8290a970eb38c4c24f3a4523cac19af7c69051b28eb9e5aa9869fc2d9dba472e3eada05ce677ac5d569b5
│   │   │       │   └── 82
│   │   │       │       └── 092aa37cb3662a311779faa568fb5378b34db475209553248505bbac1d4bffff9f78e6a241a159fde805f205a1d1a978290d0783e32a55f8cf71a357e93f
│   │   │       ├── 7c
│   │   │       │   └── 95
│   │   │       │       └── e3148786596741652419f62b7050f594580fe637e4bd092b38980d4dd6846c59e026e8229584e8b17770b35ad310916bed3729e9d0fc0db589153a3e0b29
│   │   │       ├── 7d
│   │   │       │   ├── 3a
│   │   │       │   │   └── fed3ed3b4eb6ed9e6214fac0edb28d53c3f3a08072b0fbb5f07feb16409c5e200137afaff9f0ab664666d2288c52c18936c0f3f1be80ece3d7bab2b1ae1e
│   │   │       │   └── ea
│   │   │       │       └── bdbede422630fa52908016aa17d4f671f25457aa01d2536ea80bfb35a8e4181420bdef7176655b118af4cf701de6cabce22e2129e1876139552b6a053339
│   │   │       ├── 7e
│   │   │       │   └── c7
│   │   │       │       └── eb3b433157ae199e8cbcfe5d6f5488e31dadbd499cb2a8f8100708620dc696f3025cd96dd7595386c78337a09067bffcdd519208a75803792f7c1b33fc36
│   │   │       ├── 7f
│   │   │       │   ├── 24
│   │   │       │   │   └── 088460e1cdf73da4ada41fa3e5f5ce010c919f3243ea932220603b61c8d628360df0561a0930c875f564b8529ff528c3c556936c4f6ab75a65e7d8dd66ea
│   │   │       │   ├── 41
│   │   │       │   │   └── 45a4875c1e09fccdc3d26dfd5d45ebf0b74e3b60c9da889337bb6c3645ec2b07e7e86ffcde3d972b3b24282cc30eeda04875d2dc40810ae5d62390b9c6ad
│   │   │       │   └── 72
│   │   │       │       └── 9d5113edc958d59fe45617ba62bafb6c0cfc8e074e5fd0fd94df0768ab589726b5d3dcbf315addd14f7e6f4fd37eb139796bf15d7b27a9d3fb25c6f152bb
│   │   │       ├── 80
│   │   │       │   ├── 13
│   │   │       │   │   └── b20a2571ad76a461bb0810cfc3ee5ab35d5d27837b68b7ebba141ab227d0aebc3009ab0f979b11f9f2919bfa1980466cecf60f5319d18e8c6672ee5ce16e
│   │   │       │   └── e2
│   │   │       │       └── 879241f4307f0e5a82afac4d57ac9a294e7152edd7234c37cce8e9991e85f545996c735b8d146092668b171ca3639638f4b661454f0a895195085cf04fde
│   │   │       ├── 81
│   │   │       │   └── 34
│   │   │       │       └── 2159872524c81acd6fe2bfecfa09ae0309057356f3cd16746072e23309de6079f18391e5b666a924ddbd1848ec65924e38b515318909593644389af6a8f2
│   │   │       ├── 82
│   │   │       │   └── 06
│   │   │       │       └── 35fc6a4769192719292c0abf2b072d271c2aff9c6977daed1b00ca945ca4350ec4f88cd6d5c213ac83647a105b42f59605fcd1826144b5ee690a06d17cc6
│   │   │       ├── 84
│   │   │       │   ├── 79
│   │   │       │   │   └── 4d3a41a02d827d4087dcd49a2f9328190acc7549f0033f7d81c2886e36003dbaa4254da63c5adca84d9b69b4fdcc27aaa8ed08d91be06ec61f2855ed6a8b
│   │   │       │   └── b1
│   │   │       │       └── c971ecc90c5fac945891d7d8677fa7178bf6fccc23b853378d0d5209bb8150d0c7e968a5095df5ad6049e82a07d6bdc52cd310f81f211930b9c3e66c742a
│   │   │       ├── 87
│   │   │       │   ├── 51
│   │   │       │   │   └── c8274b42245cfba0f50963b50f4e0c1822647ef67eac0b1f19aef5f2be17651e402f82b24cde8aeddfb34c58b02a07ba6605fbc37f987cd1a4c706c553ed
│   │   │       │   └── 71
│   │   │       │       └── 5b8ac6b69ca18fc42a66f3d1e4df79412ec9da181bdcb50a2968148e5bfb88b3a1537b5013c809ca149af356cf6fa4676c4deef7585dd5e2522c93819a73
│   │   │       ├── 89
│   │   │       │   └── 83
│   │   │       │       └── 4ecc75316bff72be6a6ff571991467ee0999b790cdc344e13b9b699401301382e6f36f484e96b62191c8600c9ef62a15d3f2f7c2800e1b6ffef0db64cf8e
│   │   │       ├── 8a
│   │   │       │   ├── 4d
│   │   │       │   │   └── d9802f5d63f95855533ef8e212b1a6037a0d6d6f456d3f9b8bde8ba1d64a0639a50c0cfa5b1487a2e099058a659414f9fdd2c6cc34c5d000854e96760a24
│   │   │       │   └── 97
│   │   │       │       └── 1f9c6fe9e382d2b35525df2f2f42927626596f77609512fff85ab306c45b554a1645809137769b0f9d225c5dd00ecbfb1208bb9417a6fe6eed3f8ee575d8
│   │   │       ├── 8b
│   │   │       │   └── 24
│   │   │       │       └── 57649cc4cc2d8bfaf6bf56dd7d3ee5000820cbdc9b7a9a8699063ff5b0cc59d283f106057e573a80b237c49f1f7316aad99a7fa500c3467d74720661b904
│   │   │       ├── 8c
│   │   │       │   └── 28
│   │   │       │       └── bf40a50cdabd49bb96b727ae131f60394a9280821d0ba649f2a9d4389ba0c2574c49d871b5c40451c0d18f41f8b548b74b599d4e273e85e0e30104d88624
│   │   │       ├── 8d
│   │   │       │   └── 02
│   │   │       │       └── f79519e871a16dbb7574d094e8633ff8424356b30c628c368254d6518914cedc74032ec76ed59b66214bd5e323e9fabbd69b98f4cb44c6fd2eb572e8a34e
│   │   │       ├── 8f
│   │   │       │   ├── 45
│   │   │       │   │   └── bda0c24c37e625fa1587c9283016b66e926b7cd38cd4f86790f318b07d951687a9f63eb43e5f07d589e09df82b387ee6d19016db83ecd7126329377eef45
│   │   │       │   └── 77
│   │   │       │       └── d52e0bd3a39dbb6a7c98c893864d825b1bebe79d062f1349b99a691cd532be9f1029a6408b3082f4699e1d6e55423681928619be933138654ca4068320e2
│   │   │       ├── 90
│   │   │       │   ├── 0e
│   │   │       │   │   └── 56428355a38b7d94dc769103450b129e065e486db48d065d4cfed2e4c3d5829fe871341016e5087c81d86ceb70899e18c9db3416168a8f24fdac2b5015e4
│   │   │       │   └── 69
│   │   │       │       └── 067a0608750b0e6f85e3b1f33deeb5ec887681c1ca3e84523aea83b8b3d2d4f8f2c00b9a09ee485d395171921b2695ba54a8302f5f0d750a5b973fe8e41e
│   │   │       ├── 91
│   │   │       │   └── 11
│   │   │       │       └── 91670ddb2e5148483060c13480d5330114de89e865837ae6e60c4dc017edfec972fc8535aff2be6b90b6ea6176384633e4fc4cc79c2948df341fd5c1661c
│   │   │       ├── 92
│   │   │       │   └── bd
│   │   │       │       └── 17dbee98cbfbc9ccb60950f09911cf127d071ffb508e16802a6ae266ef8ba6421b5af4cee53491cfed0412def92f7062d051b5a9333c2b5d8c2b633b4728
│   │   │       ├── 94
│   │   │       │   └── 6e
│   │   │       │       └── ccd41785b69a3cbe6733bab9c3cb8311092f5d44d32d9d86157b712c156f3dc877209bed0d1511c6d366687506a1b17ccd1f1fb86fac924ce266825906fe
│   │   │       ├── 95
│   │   │       │   ├── 88
│   │   │       │   │   └── 86f66880d649a434abc280f67605abbb47711d06bfdea32cea11a9429704d0564033bbe4f9d5c883412b9525389f7f29fc9865f553762c9f263680b74248
│   │   │       │   └── cf
│   │   │       │       └── da6a19feb78fd2595fea726ba6623ca62ec59f37710b869995b9416382c391aeeb993d54b0010af2abe1c71af3bf488d8a557dba6f1f849fece133c83c85
│   │   │       ├── 97
│   │   │       │   ├── 2b
│   │   │       │   │   └── b13c6aff59f86b95e9b608bfd472751cd7372a280226043cee918ed8e45ff242235d928ebe7d12debe5c351e03324b0edfeb5d54218e34f04b71452a0add
│   │   │       │   └── 9b
│   │   │       │       └── 930ca6e7be7018e79ca9e2f88256e0094e45700f6042e4f4b7be887dc897ddb413ed3d5f1c7cab977e75d565d9d5a36a2335aab01309f3246a780e66ba06
│   │   │       ├── 98
│   │   │       │   ├── 9a
│   │   │       │   │   └── 68e84545cf186953b6927c75871a5e5f661d07ef805b585fa7c3a0c5be109626fd58145345d8bb858e94e1b66b59937dc1c3d4eb628c1c660dea5c352de7
│   │   │       │   └── ac
│   │   │       │       └── 864ad4b45e218c1f4de4d9f3b6c472c17387abd03684f2342e86b2ad5e72f68852c8c6e8ecce321554dbbecfb4675963f590d69a590ed55a1a6caef56aed
│   │   │       ├── 99
│   │   │       │   └── 98
│   │   │       │       └── 448f12378f9292ce130fc418d98bbf63a156f6d27e8eed850861153c0edcb5e811bad603432cc61b4f94549f2d43e8c48367de701b7ae30eca763af6018a
│   │   │       ├── 9b
│   │   │       │   ├── 3e
│   │   │       │   │   └── f67c86d00bc662f0c2cbed99d6642875488172be12158566b611303af794512f2efbf85a10234e59382d58b563f336d50407396c650a1f409d4af467e88e
│   │   │       │   ├── d6
│   │   │       │   │   └── 15ca4945a64c3bf495423b7131b87e3a97bee25d335e002733b2994ad038333639a7227df838fbdbb1c2c77dc3c1de199a53731445c081b4fd0c6973eade
│   │   │       │   └── d8
│   │   │       │       └── 13c11921cb696f08f7ba409a787771b54d81141e7fc5cc952dabd3231f8e9a9f5c0953e19da060b954ba1ff115fc16dfc3969b21029921b300cb6731c871
│   │   │       ├── a0
│   │   │       │   └── a9
│   │   │       │       └── db845c91217a54b9ecfc881326c846b89db8f820e432ba173fc32f6463bfd654f73020ef5503aebc3eef1190eefed06efa48b44e7b2c3d0a9434eb58b898
│   │   │       ├── a1
│   │   │       │   └── 16
│   │   │       │       └── 42c6790ed2f6bb0d8a2fa3d42ec39ae52b1f8c51fd99266c3eb50ad3f93da11c955666ddd334a871eb7e5d32df2d95fe4b411dc952edc2ec440075d2e4c7
│   │   │       ├── a2
│   │   │       │   └── 81
│   │   │       │       └── e7e49fbe8656a387fddebf50395ed76f90be5bde0d8da3e071dbaffa84d3fe80032b33ce9dc72a6feccd310b2b6c0ff2cb4e3b96afa5f64be198029a2977
│   │   │       ├── a3
│   │   │       │   └── 07
│   │   │       │       └── a03949db85191d4909f468f63cea33e3f1165e5851039ea92a6fdfe71c1a212684a0e979a2c59001a5d077f9627e64ac9808c3c23101d3e903dd678b2360
│   │   │       ├── a4
│   │   │       │   ├── c8
│   │   │       │   │   └── 4e7c50cf8aff6de638c85e41e8b169a44b241bbec80454d933d044476ee2e1d93ffb8f832aaa9cf9db715ef0c558f3d282e9287f41f4b6b0cf928e014373
│   │   │       │   └── d8
│   │   │       │       └── d31dae18a09757cdcfbf9ddfbba4eb2ced665dbc390b2319d6d3458cfe3931794c1bd7d09c8fd0990c0a836ac2b52e4c7a32da40824f2c2e9ad2828e9633
│   │   │       ├── a5
│   │   │       │   └── d9
│   │   │       │       └── d16d0e1c40b653ae71d75bbe980854d13737e87032bb5a41cab0335e2c19e80fdd1b630c2916090388deafd50c7901422926898f1dc9ee2272e2f790c246
│   │   │       ├── a6
│   │   │       │   ├── 45
│   │   │       │   │   └── 2e8a52ed9bc6f424126dd4d7da19cb119632aed03ca6dd744311f5edcc3b07a99242b1ac823c861dbc4ccb33ef1cc3f1b4a158438644851d2e6cc467b931
│   │   │       │   └── 5b
│   │   │       │       └── f44a23e04004f4fcb8c2d0c986b28a3fb1da52e95e13a4e500c4ee09dc39ef9cb2da2279cd87d8625354a51a00a3b11bf49cdf53bd7f69591a959d91fd93
│   │   │       ├── a7
│   │   │       │   ├── 32
│   │   │       │   │   └── 6ad76b4469a221aa36f3a42baffceca9258fc13dabcea1f9be75b69bf8c1cb6a3cb6efbfb594b9ba245706805e5eb2427a9aab868ab857636183ffcbbc52
│   │   │       │   ├── 7f
│   │   │       │   │   └── 3b7e7150102a863fe3f0c7edf01b5ebed441e1c485f1b97a3ac58ab37da80e535b9cde6231a3b7f09c4b2f1b566035d0610bfe0557ac9ae62216f1c01a50
│   │   │       │   └── d8
│   │   │       │       └── ff298663e8ee2d918a19a0a00435a7537ce757a337e6dd8597e213c9e56d4ce61b5be30c4b719c5054fed981c51f78a88f5389a1922dab4dcf5248e83c4c
│   │   │       ├── aa
│   │   │       │   └── 90
│   │   │       │       └── 80bd197db2db8e1ef78ab27ec79dc251befe74d6a21a70acd094effe2f0c5cf7ed2adb02f2bf80dfbedf34fc33e7da9a8e06c25d0e2a205c647df8ebf047
│   │   │       ├── ab
│   │   │       │   ├── 20
│   │   │       │   │   └── 87e36d5840f4b65850f10e37ed7dcd5947958a433573aaca789fd3369108553a8fc1c9a845a143497e5e7c90e70419f43fffbc1e1530e19beb2cf0473183
│   │   │       │   └── 90
│   │   │       │       └── a0dc68efd52e822d9d3b85754d0fdfcbf354308c8deba163bd0d9a25aa2ff3ffa91a4f516c78729887b3f82207b16c569db31b0fcfda64172e02808adf01
│   │   │       ├── ac
│   │   │       │   ├── 1c
│   │   │       │   │   └── 7865a5ac22a0bb027fcfbce2f71d4397d8847e951d782302ffd6e7dc65b329403a8408bddfe2410655ebc3a9e60ba4322b2930e6d32a039078654b548e94
│   │   │       │   ├── 51
│   │   │       │   │   └── e187fe9d41cda368bfed295f36e4ae7ad00117f4fd4cabc1ae41877ea3efc3cb5e620033fcab4d2b81c9906697165c165c9eb06d09c3f255e6bb627c3839
│   │   │       │   └── d5
│   │   │       │       └── 1ada8215399d75d02c07b0f09d6312f36af582cf44d1c5602926e26a7c8ec08371d2d44f9d457f4118c891f13f54ee29cc1f09f193c8a7148fddf9901d61
│   │   │       ├── ad
│   │   │       │   └── 48
│   │   │       │       └── d0a32ede8194fd5d855704ad637bd724067369eeacd164e84b431e51704a767421a55e8fa6bfabdfec09b82e29847050492086734867e04ea73d402acf4b
│   │   │       ├── af
│   │   │       │   └── 39
│   │   │       │       └── 5d2143741ba08238f96ddff36759c58c63b72cb2ace9b9d61da859fad9b26bb3996e4ff4755f8d512979dae21b107a1b67fbf120fa53187890dd08590d35
│   │   │       ├── b0
│   │   │       │   ├── 69
│   │   │       │   │   └── ef6f9766ac968a119f8b0c8a60baf757ddb0e5125966bf8fc2950f5ac1c98266b971e63432c8c58533990123e13234e0830e22a4f22974cdeb97dd9960ff
│   │   │       │   ├── c0
│   │   │       │   │   └── 6287fba94763d8f3bc9319dc82b1dcedef258efaf60c010e7ed197574d26380855104a640b6e1789895d846c1f52d4eb20267e7c0f1fc6687bdb0502bf99
│   │   │       │   ├── c4
│   │   │       │   │   └── 86eae8813cc26b7dfb5c095299e8d9b392c4d3b26e95a0736a0e93e14e5a532b33da47ecb9f8c6756f22a21ea62399d17e15f3c3819ecaa7043faa2e8914
│   │   │       │   └── da
│   │   │       │       └── 8dedbdab711791e11403743c443259923b3cfd3c763ac2b6dac038489319c7af46f4e0247e6e42be79aea56dc8e06bb9181ea26bdf8bfe4ff5e3ceb61c32
│   │   │       ├── b3
│   │   │       │   ├── 1a
│   │   │       │   │   └── 7f56449634bc6e62aad466db2af6562e57fda7258e005182788e3cd7642e657eb8cc865a4aaa3e607779c9076547a315a3328ee124b9c3d889af9f2a814b
│   │   │       │   ├── dc
│   │   │       │   │   └── 2c7145ba3c560a768d1533825be8d86c4f0afbf5ab6f4e664f0cd18f995a035188194d8495b01f2313f3cfdabbe528a40ef97c4127901e9e647b28e19f5a
│   │   │       │   └── eb
│   │   │       │       └── 39f998983a92db61bac89488a0adce33ed82cc1956815b337a97ee86515ad142f4d3d45ad1e332c7c5713591623b4b4017b0fd21eaaabe2843c2c69fbeb9
│   │   │       ├── b4
│   │   │       │   └── fb
│   │   │       │       └── 863930d065d0bb76f5651b3768e84387f4152d72303c3bd9761825cfa8c81d4e2c9c938025b8679f319c4b8d611f9626ba4d029f8475dc6ff586fe5979fd
│   │   │       ├── b5
│   │   │       │   ├── 37
│   │   │       │   │   └── cf317838766ab773d9617270de8511dd367bf7467f2b2288457a4bda388fdd00f3b1dc6a77e57848299423f08c9195f61ce16ae9d89f77798b9bc8cc57dd
│   │   │       │   └── 8e
│   │   │       │       └── ec56dd722fda33231be66ed379aad987da4ad770109f8c488280a18baae9c91ef82f646d8f725da843791b7190116f50461077642f371818ef329d59627a
│   │   │       ├── b6
│   │   │       │   ├── 3c
│   │   │       │   │   └── 0ce5ec4c83a046448fa43664e7b4db2f7594b55fc045612ead9c9da1747d2457133afde559db1cbe16a4ad496bd89ad7c53032c8c6eae8ac7c0329f0f3e5
│   │   │       │   └── 47
│   │   │       │       └── c51185189afee296af509cd342d0b1db64f8e4429ebd9b6a73eb6e59d67b5aa459b73c785beab5152061562876c7b4f09cfd2d913c0d1fa4e78814d23d63
│   │   │       ├── b7
│   │   │       │   ├── 63
│   │   │       │   │   └── 839645c14329fb8e497a4cd6b0fccb55115bc819e9490c21b8d4e92afcac14b090704385d566c1c055490ae2606fddec22012dcf1ae516b98d81a0ae1953
│   │   │       │   └── 85
│   │   │       │       └── 3df3088c6764797e7a179e32a80030fa7cbf022fef63c8c7f3ec5a65aa06d7ca593d705bde0d7b806cf0f7f944fdb66541229b42fe8d10525f7d39c896ce
│   │   │       ├── b8
│   │   │       │   └── 24
│   │   │       │       └── 3c28a65d120aeac2fb2d4de11c5f6593118bb868cbc14a7c4c3c8c10a707a0d9b55ff09e592f29a2f3f2075cf6d3db5a2a9d1edbf4e9dce27ae4e5b903a1
│   │   │       ├── b9
│   │   │       │   └── e1
│   │   │       │       └── 1ea67ba3a6a79eda8e5a2189ef1d4e82d00e3630d76c2037aacb907276b92e0b947566e5059e6dbb11e1491a8107250827dee95e46f9935da2607d76ede2
│   │   │       ├── bb
│   │   │       │   └── cc
│   │   │       │       └── 7c0db6fc0e8b37e0cecdf29e1ee0017ef818b50fe96af9d9110af2e2e50b9bfdd23be59ed84c85c17b30382db2084a5cbe11c9f4e5f7687f3670ab23afa6
│   │   │       ├── bc
│   │   │       │   └── 5b
│   │   │       │       └── f1455b099cabb9d8a6727135517bc28c43a223700d02c2cea588290de796c471d64d7cc6c97b7b6483d75b3fc88fedce342dbef7bafbcd492b7596a3134a
│   │   │       ├── be
│   │   │       │   └── 60
│   │   │       │       └── c3d7e8b035532cd971773988d125be5d9f3a7a698705b0a413fd08f7a91ae9efbbfab450561406f519cbe50fd85e2505f8be0a06dad1cc9e82b0c5a61a1e
│   │   │       ├── bf
│   │   │       │   └── 18
│   │   │       │       └── 54cb827c9727b28a71fb033975a5d778dc6261647fed3f6c1e37c4e7b506e5398f80d176d3f03264d7fa023ee38eca0fc96bbe7bac6d028077160bc39f30
│   │   │       ├── c0
│   │   │       │   ├── 0c
│   │   │       │   │   └── 6be3097ad962bee4229c4963415041ba3e48c57906c8c41a44937e26387be6882937d0d4ecc066ddbb4d152f7b2470c4b1448494dbb0a965e9876f6159f1
│   │   │       │   ├── 16
│   │   │       │   │   └── e9bfe3507ed1c3746f3a41cd292325e4e48477b4cf157749d62ca0dc5fc9cd9f89d714e170b0abaac36a2403fd43fe6a5a0249aeca776b3c94d80cd66d17
│   │   │       │   └── 1f
│   │   │       │       └── 0e75de3b862a4efcce4709d870b00fe43a864938289e23df5d43fe767ff3b8e2581e0eaa4feccf7d226fea861e9fa9f59a0e0470e42d2929412aaca5ae8a
│   │   │       ├── c1
│   │   │       │   ├── 2f
│   │   │       │   │   └── a1020252851d0a844bcf240adfb8f54dd7e1f3d6dd18ea7e632eb1906e46f8bab80f13fd11bdefb590c075bffa16807826e1621c57e8bb176a53563fb689
│   │   │       │   └── ae
│   │   │       │       └── d88f25067cd667808fefb4ad141c037e9600c2c413c2ca55571a9d33bb9f45cf96a21ad3576aadc3848a2fd3adcca2b07e55fb9f2e1dc9945d8a7532b7c6
│   │   │       ├── c5
│   │   │       │   ├── 23
│   │   │       │   │   └── 32519743bdedde63440ebffface305fc949686914dfcc2075cb850df6d2d7e4880f9d2c802eb2a8dc6d157eb74cb4442d5b2280cc8b486369e7e83e7d1bc
│   │   │       │   └── b6
│   │   │       │       └── c21f9742614e53f0b704861ba1ec727cf075ee5b7aac237634cce64529f6441dca5688753f271ce4eb6f41aec69bfe63221d0b62f7030ffbce3944f7b756
│   │   │       ├── c6
│   │   │       │   └── 4a
│   │   │       │       └── 67867eda208dceb36587eb399998dfd962207f9a25345a6c58e4d905c66c7330b2808b28d74afa4d79e91cf4d17769eb04d23d57f905b347b51db9143e02
│   │   │       ├── c7
│   │   │       │   ├── 94
│   │   │       │   │   └── 4bf58da9e7e4a1dc3dfc161f62fe243964af9ee31b9745dfe919b3380f5ded828fcc1b06edb5493c7a6cad72bd58633058b3e6a99d49e00431587e98cfb9
│   │   │       │   └── 9c
│   │   │       │       └── 4fab30e96ea730f3dd6b17884ae570f6a995a64029b6f853539b45c9fb64aa09540c15d496b4035a767b9b922f6c61c05ad88cba5a2e82f1cfa0a26c605a
│   │   │       ├── c9
│   │   │       │   ├── 0f
│   │   │       │   │   └── 42a371464ab760d591f588236bbdb498921141ee5849b2f5dfe4ce0e73fcdf4490c75edbfc83d0ca321b2b502c8ec705d8e66dc9414c5792531d550ebe2d
│   │   │       │   └── b0
│   │   │       │       └── 7244d7a1418095d97556fee24a89d1a3715b1b33d5845c4d53389f9dbcc6f9de8e2f983971f95732a5a2b90f1bd0d170d34359cf7dd294eb7a72f30a3002
│   │   │       ├── ca
│   │   │       │   ├── 87
│   │   │       │   │   └── 4a20524d4b42f751277b655d217ceeb1056a3c4319403050c7c8ff0667257b3a951e95ddd1ce7934cf7d1593e4af44057aa38fdfc44c54b3b33453189c66
│   │   │       │   ├── 97
│   │   │       │   │   └── 66254fd36c16f2d83c626eebfb64b5b706cd5012633b9c78c400d7e88492ef1345d5ba38ac9f5a8f25c67183ea83b9cb2bf9b3fa7cb0f5acf4b702127b11
│   │   │       │   ├── c4
│   │   │       │   │   └── fc9a1762c562ba1f0de2d55d80791a99e567d78351b8de6aa86253369dceb7f3c16ae63717cabe6646ca9588bc7f18961da0bd1b7d70fc9e617e667fc8a3
│   │   │       │   ├── d4
│   │   │       │   │   └── 080544005e733d3410ee04a580ae76e113c7c96cf6c46ef911e81db70436e4c5e31aeee0c4390aa643707d5df971f8f640d2b3cbbe2d6ba72d998a391b9d
│   │   │       │   └── ee
│   │   │       │       └── 294450a70a4b84bf3b89e152404c8f083f74a4ba786211b0155a743137bbf8eae432a8c53c73d6901f31714e573a3eade2972c4440e3a31bf1c8e3cbd1eb
│   │   │       ├── cb
│   │   │       │   └── 86
│   │   │       │       └── 2d309376a857f6fcfc38277e510b28f343876db7c89627103f93c9e61d4b32837103654fad9dfc59b28e3c41256aa36b70d43f5ca9e1d686c000cb8d04f3
│   │   │       ├── cd
│   │   │       │   └── b0
│   │   │       │       └── 7dac22404f5adb8e25436f686a2851cd60bc60b64f0d511c59dc86700f717a36dc5b5d94029e74a2d4b931f880e885d3e5169db6db05402c885e64941212
│   │   │       ├── cf
│   │   │       │   └── 87
│   │   │       │       └── aa26f7e236714c1c822f5cfdc2639ef2d9626ce60dafdd7d339bd984264ae436fe2b0f1bbeb20f4987c1245f27aa06407b48e71ba28f5d315aa1cab00222
│   │   │       ├── d0
│   │   │       │   └── d2
│   │   │       │       └── 50e0b14552e5a413b3b17f486d04a4baccb9248c11fe84cd6e93b360ef4e51791f26fee7a576ecb50c1a343f20573ca567040e9806553de0c0465eb4810b
│   │   │       ├── d1
│   │   │       │   └── 1f
│   │   │       │       └── 629116faebc1c1ed00f14f5be4a6e501b6a739dd8c80c0cc0679414a4688d8fcd58abdd67ef5462d45f1a686a35b4644d256931b9b28578a9145bf671bfc
│   │   │       ├── d2
│   │   │       │   └── b1
│   │   │       │       └── 60fd18f643ad8d0a6eb68d9c34417edadeccfa402414d0ba5974dac95fc6f2446686553a9bad6f630282001f2310aac369799f356204a2cceb79597ab43f
│   │   │       ├── d3
│   │   │       │   └── 40
│   │   │       │       └── 2ad23a9449077c89d8b4bbd6bf341d1ea1cf3711c191c9e4bb1f529d607c1f16c85709b8afcbcf0beb01181c36cd694b424413bfb590016508a7b4c3b0d2
│   │   │       ├── d5
│   │   │       │   └── 41
│   │   │       │       └── 16457ea39ce036cb81f959ccd9e3880e3a34c49a5aafd6e356e0600910ee7e6dab82061bfcb2763ae48c39fd5392fe084a37d82bd8a8e72cac6bb2fa0c57
│   │   │       ├── d9
│   │   │       │   └── d1
│   │   │       │       └── df4e80a3fe9cdc6b60a4ef6e0e6792f4115aebdde1d136c1bf6f7c5024b036859a55092f7d6cb017fa19b52075c3127cd4e9bcb9cffe4c218efde3f6bc35
│   │   │       ├── dc
│   │   │       │   ├── 17
│   │   │       │   │   └── a5b7ab5d73c6cf800b5b72676d349962ad5a139846f97b6802f783e7930116f6323a0801d47a81bce6d8d63f95aabaa7dabe832d330886e0ff76e9928ab9
│   │   │       │   ├── d6
│   │   │       │   │   └── 84b678e2efff1539dd12f7425ef76630d3778113ad0ec39e45589e122824507d3a7094f30c0542a0834a23f485fdd982d6bb91213f5ace9f249af4b49c6c
│   │   │       │   └── e4
│   │   │       │       └── b3dd369c516cb85ad397577f03820c31a2a24ae3e78390d325e59fcc2596a850f68fe3ff657fcd715cc7b523645e4c0a6dbdead95296cf638c16c16c8be6
│   │   │       ├── df
│   │   │       │   └── b6
│   │   │       │       └── 709849a279c02c19b1b4bdb6a81743d23ca14c40b8bdadcd835424e4c0b6afdfccc3f9421aa8be1837a5e111d4d5533ded5d7cf3f22830beb9a31bd60bfd
│   │   │       ├── e0
│   │   │       │   ├── 95
│   │   │       │   │   └── faac46ad404be59a053cd30672abd453f7a1d925af3cabc869d2905df8badccde0c8e28eae03633ebafc678151e8e0886bf2e89b5f11fafbbd3384016b57
│   │   │       │   └── a5
│   │   │       │       └── adbacd54192a2fe66c7b8f4ab78998b920ad0f70a69c47dd0de48302d7e4d32f017f420d92a8080765b0e0ed11759d04da6c85f6e30d6f992c8e0ff3a427
│   │   │       ├── e1
│   │   │       │   └── 71
│   │   │       │       └── f77479e68534ec1a2b93d8fc47c7a1399a534f50e98fda4e5c47d2d7210a51a869c271f2732f74df3aba4c3cbc0a5e2d47cc03390b056afb8d95767b0a3c
│   │   │       ├── e2
│   │   │       │   └── c4
│   │   │       │       └── e4fe3527435943bfd91bc759cde394aca00a43c56f218ca2ca7079c787d9df45510df525beca552336f5420cfef8c523690fcbf9a7a349c955ad6587cf58
│   │   │       ├── e6
│   │   │       │   ├── 31
│   │   │       │   │   └── c208522e3a132e9adde8101848478efcfdbd9d9dedef1a3498f8528e2e3bd63e9b03c11b1b689f80ef79cc3007e9d8113692b75d99b6cc8fd4fc524f3f15
│   │   │       │   └── 6e
│   │   │       │       └── 2740aa7ead945bd3d2cd1f9f463380714e1f76e75ff295b2886e97bb4e91b17c9fbd92fe812e42c15c88e3b296e06e720136a948db7b519d3593d2c9d423
│   │   │       ├── e7
│   │   │       │   ├── c4
│   │   │       │   │   └── bd403a86d17c76ed8c0f4adf5f2718af8d8978df6602c1f0cc7d9fbbd5102a52b65e7fb2eb2906772c72cec024b814b341a653f9df7671f3de5278e087bc
│   │   │       │   └── c9
│   │   │       │       └── 66c4a480e013722f3f871cc53394e129834f4557e7afe9931edef262860771ce073067c5681043e600b0991bd2e6a9f56834c30aa6db48613546eae0d8ec
│   │   │       ├── ea
│   │   │       │   └── 6a
│   │   │       │       └── e08b4fd9ee6e6504f13f3cdc682341d990770d134d9cb9eea062db05dbdeedec59beac621234d04aec080e7ecc761a0cb5ba6fb176d12a4c594e1affe34d
│   │   │       ├── eb
│   │   │       │   └── fb
│   │   │       │       └── f002c3c2e7371e2c96b7c632a51ed57545731aaaf1d2a2f7e4e81436dbbe703688886d65cad4a0e67a70677a5dd18e30f11710b5405773110be17ec09295
│   │   │       ├── ec
│   │   │       │   └── 0e
│   │   │       │       └── 92f634a09bf4beecc76d34349bf8853ce7dbd0a89fd002d71841c7c50ba5bc452e08c4864395d2d1d31a82159e830b2ad02e32cfb31b5335c8798d503894
│   │   │       ├── ee
│   │   │       │   └── 49
│   │   │       │       └── 3ab8e198f724a0085b11b91a655b3be3884c2e946f3bea97e78d0c6a681240714969dcdd72aceb7b61030166cc6fa29f911b0e7421e8623ee1acfbba21fb
│   │   │       ├── ef
│   │   │       │   ├── 17
│   │   │       │   │   └── 5c6ad83bfd4fbbf94772a23db3a1db48f47fc8228a6aa3e60e21c64eab59c9c1758167da7cc62bb99655e57a40db66471aefd6bf7e8cc46105c8038b16e8
│   │   │       │   └── 20
│   │   │       │       └── 10a43d94309ccb8b50eabfba856273db68fc7b65f14ae8f888c50e0f7e418fc8dca5d94831f9afee994a2798aaa384ce039df6ccbdd5faa2d5eaf37b2841
│   │   │       ├── f0
│   │   │       │   └── e4
│   │   │       │       └── a5493e3c7cf613ac0c16fb8ab8e0f240eec72decd3f67282dbb7528a041e4f509299294bd218553aa13f8255c4410e359acc0da417ab748ddb7f9e84870c
│   │   │       ├── f3
│   │   │       │   └── 3f
│   │   │       │       └── 5f545883735913820f7b9388c4bb8f5506d3a5342991621e9eb2d29c70ead7e24ed11fd239488463723f922bd375fd8cb1aeaf5d0118c7475cb516a11090
│   │   │       ├── f5
│   │   │       │   └── 3f
│   │   │       │       └── 548d6debd145b973543b193c25969b57c21bd8984cc587331f67d1fb1505adfae65e3e364f8c13ff5b5644c99d6dc065a89b9ff9e9317894f72a8e70c772
│   │   │       ├── f6
│   │   │       │   └── bf
│   │   │       │       └── b28bdfa6814df700a723e886d3f684423bbf16ae24a3eadfdc17c0d605927d68e18f393103bdd503cf51702a29bb4175b0987aad7479d125f840c441b8e9
│   │   │       ├── f8
│   │   │       │   └── 6d
│   │   │       │       └── ad94b9e6993772c5d9a05196731ca28aab1cec43bc63c70e16720eeb8905183896317bf54f03b08ead598d1c8574e8fd07f97f2344e801d4d99bb9997ac1
│   │   │       ├── fb
│   │   │       │   └── 07
│   │   │       │       └── 5b4f51db21cf13bb2531a41b5bb56490f2bdef064219525582fbc6edb0ace29922fb8613e7bf811cccabea9bf8bf817f3504b3cad598254fc5d28abfb7e4
│   │   │       ├── fc
│   │   │       │   └── cc
│   │   │       │       └── 2b4a058cdaf75b3dad8ffb7f2072d0d69160ad6b6cdddabfd348d4defb96799baa61adc2ad9c254944e9c3286516534e61c34ffd2bc242537aa40b056d5a
│   │   │       ├── fe
│   │   │       │   ├── 32
│   │   │       │   │   └── 99a0ca70d05f06470978fde2d138f03771f717b4b0293f44332e6513fc7b8f0995b207b218f59acc78ac363bf9c522a3d00773d533d6989b4177d760170d
│   │   │       │   ├── 37
│   │   │       │   │   └── c4c0d0dd41504236f8e41a2b7887aa4c3b3abc6c7928a6ae39f1d3edda5323c7e781414a2164d1bd03b0ed3bf3b9ba449bc6e68d1973231e2720c32eab41
│   │   │       │   └── b1
│   │   │       │       └── 5e0a934941b852663195c0ef51155df13ea6e71114bc326210cc2b43ff397a82926e57f6cc2ee37dda81b717b77ca031071d1aee8d25cd52bf1fa639ed2b
│   │   │       └── ff
│   │   │           └── 2e
│   │   │               └── ed24a00b559d653f3799641f636279adacbeddd0ddb3928ae28b96bbafb7611e4588b8b4f36696733092cad5d9984605ff34273889aad33b717b052d9cfc
│   │   └── index-v5
│   │       ├── 00
│   │       │   ├── b0
│   │       │   │   └── a5285b1dd41927c25a437d6e06e180ad401616f52c278cd64474969fb3e1
│   │       │   └── df
│   │       │       └── 216782e75230fb7e8d7057093e134da919f2d56aa9db5f6f7258b3b537d3
│   │       ├── 01
│   │       │   ├── 3c
│   │       │   │   └── 9305c09d5789a41fefc7aa0cd3a8a3813243d247f506487c2f66e9ff5971
│   │       │   ├── 85
│   │       │   │   └── ac002ce9e68821cd39a876c92f3e1be8caeddcf6419d6bc324f70d32b4e9
│   │       │   └── a9
│   │       │       └── b0d0d67beda769e84926f207549943c0bc17abbf66bc20099aaa1bb51736
│   │       ├── 02
│   │       │   └── 3d
│   │       │       └── 7ff49953c213d0e9070efaadaaf3c5ec6740893a6f3704b4f14e805bcfa2
│   │       ├── 03
│   │       │   └── 48
│   │       │       └── 75977735688016c583178c5e6055c5d811bf783ee09da9fe4b1137891c98
│   │       ├── 04
│   │       │   └── bb
│   │       │       └── e70e70e0cbc9b00841927b0c23c58d97f21063208f3e872c3e04db58c13b
│   │       ├── 06
│   │       │   ├── 5a
│   │       │   │   └── 98f8c4232b39b6ac68023a0bc186c128dffdec812a144648c26dac71f91a
│   │       │   └── 5e
│   │       │       └── 2009163f0b101c063269056e566eec4bbc4ec9c8e69f769867337a8ed57b
│   │       ├── 07
│   │       │   └── 2f
│   │       │       └── c26409f0f3f5f0a9723c9865acfaf682ce8a5f593e491d912d58f53f9ae7
│   │       ├── 08
│   │       │   └── b9
│   │       │       └── 8c0c17709bc08fb63e5f0c39c65b93c80c9663f548e949eb55cb434a357a
│   │       ├── 09
│   │       │   └── 8b
│   │       │       └── 0ac0d0ead7b0eee61d826bc69cca1c7d40e187e8282c876253d740b9e9f0
│   │       ├── 0a
│   │       │   ├── 08
│   │       │   │   └── 7555feef8088d2832129af7ce022f6637283712a9ecd731e4a9ef4932c14
│   │       │   ├── 2c
│   │       │   │   └── 10ae97cc0ddca9e23bc5e1c1a10c38f60b99fa734eb5749276bb78987586
│   │       │   └── a2
│   │       │       └── 6a45098c63203072b3c3abfd9346c85ac9bc463e9506bc2bdf17478905a3
│   │       ├── 0d
│   │       │   └── b3
│   │       │       └── 097d1aa2272aa0a4559d84bc3e8aa1b5438104f60d0a303dd8cf4a4919e2
│   │       ├── 0f
│   │       │   └── f7
│   │       │       └── ef3ad5111001a610f814d854d1ce9853e9d6d710a41430d086d07a0986cb
│   │       ├── 10
│   │       │   └── 17
│   │       │       └── fba3d249f38fffb6e9b99fc904d81622ca3edbd864d546795aece3329bb4
│   │       ├── 11
│   │       │   ├── 42
│   │       │   │   └── 63f22fbcf0c21b1e268e7098ba936a48f7ddd6c06761a6c5b4a5fe434ebf
│   │       │   └── d4
│   │       │       └── 2f9f9df8a204a306e5baed8f658a43e437792315d561c5eb0315c7a97d50
│   │       ├── 16
│   │       │   └── cb
│   │       │       └── 5a69d7ce799d5fc7d26a2056473c94a7bb373b72395bb56a9b740dffd152
│   │       ├── 1c
│   │       │   └── 65
│   │       │       └── 74c26755259935f238329c24af2f3305f57b1107f720cc0082e513d83ebb
│   │       ├── 1d
│   │       │   └── 59
│   │       │       └── c56cdb49f40694dc6b984bd43ff53d96f6ea1dbb06ee467a00e4a697e664
│   │       ├── 1f
│   │       │   └── 85
│   │       │       └── 3e0b21cc5deb10a0dc51ed6dace9f5ae0f08f66b5c064b262517165cfa2f
│   │       ├── 27
│   │       │   └── ef
│   │       │       └── 452a94b385f28d524a6fd9178863fe32cc70bc3d94033a3dda9c91b2e128
│   │       ├── 2b
│   │       │   ├── 0f
│   │       │   │   └── b8787add1f0675f7298f5d4e498f1c0091c7438fd73df02d649bbcc9c1ce
│   │       │   └── 2e
│   │       │       └── aa61c0bc2734278e23d60eeeab1fd752744ea5536b3ba08b35b3a667d229
│   │       ├── 2d
│   │       │   ├── 80
│   │       │   │   └── b5e9ca2e40744e7fa089861626d2a29c62363c01729964f4cf0c3e8ee632
│   │       │   └── f4
│   │       │       └── 9196d70f82f15d107105ed433fd462721c91b1594984d87b54d57730cb20
│   │       ├── 2e
│   │       │   └── 5e
│   │       │       └── 52bb770674006416c55571d38721a1575036bc260e9debd40db850bc0b20
│   │       ├── 2f
│   │       │   └── 2c
│   │       │       └── 2a12420aab34889ed2c64b80f9b722e2e90e139a130f13e34a1c7a0e1e29
│   │       ├── 31
│   │       │   ├── 7a
│   │       │   │   └── 9c96d52885c2170f2365ba2c1bb1035008b9daa92b20f4c5e52f16b85113
│   │       │   └── ca
│   │       │       └── a8c3ab0670811a3887ede187dcd3856d14272349a18f6844f7c8007cc05e
│   │       ├── 33
│   │       │   ├── 19
│   │       │   │   └── a311e591a2b51610ed276fe9968065a74c2f19efd7f917616967040ce127
│   │       │   └── f9
│   │       │       └── 071d7d949ade71febc395082397753f9a225031462df3ac9c8ff4104bbad
│   │       ├── 34
│   │       │   ├── 05
│   │       │   │   └── 127f37b0ff3cd9c76b1497b5838d265a8a2b7ef495b7f9841f5d4665ba67
│   │       │   └── 9e
│   │       │       └── 35f5913aa7a542b3357025e12a2a126c13ab15a9bfbb40721b56f89ecb48
│   │       ├── 35
│   │       │   ├── 45
│   │       │   │   └── acc6960018d880bf033f23b050a6c442be8b02eb6cd96e01c7ef7b61b640
│   │       │   └── fd
│   │       │       └── 45154839db33174def1653b1ca377b1d2a65a4c4e56564fe11d85b67a96e
│   │       ├── 38
│   │       │   ├── 04
│   │       │   │   └── a49ce7d19c6d98ec2d5f259e71f17a5727961200c4cf22a88e33ff7bbe5c
│   │       │   └── 36
│   │       │       └── 08fcd3ee98bd9b00bb28cc7d417209f374feb4bb23f9093fdab5ff57857b
│   │       ├── 3a
│   │       │   ├── 10
│   │       │   │   └── 33ebb16ca229c4cbdad65ac0947fbeb3765befe98674faa960578851637f
│   │       │   ├── 21
│   │       │   │   └── 946df9356ae372c19a7700e322d8d0276a406143c7375ce22124fad7dfcd
│   │       │   └── 46
│   │       │       └── 4a802da9ee2134f8f76df15df8ddd2d0f2b05e7de9b1d7e01669c4278824
│   │       ├── 3c
│   │       │   └── f6
│   │       │       └── 26a7f7dccb969c764b8bdecb3667023c64bc1159e674fbeeca633c54964c
│   │       ├── 3d
│   │       │   └── 2f
│   │       │       └── f8441bbef005e18fb70c8e8654894abf17ac44b2140cfd60f172246d894f
│   │       ├── 3e
│   │       │   └── 49
│   │       │       └── fc9a5a5b33508297834c9a4acf4d4de5b46348df8093fa7d0a6f82aba3d5
│   │       ├── 3f
│   │       │   ├── 3a
│   │       │   │   └── 2f0714110028b8f228c7c95100ea873c5a00ea03a97ed1d1f555cd404e1f
│   │       │   └── 55
│   │       │       └── a551d4620944369d858a04648adf3994a33934840d738144392e51784ac1
│   │       ├── 40
│   │       │   ├── 17
│   │       │   │   └── 8828f1bc3c004a75e5f93ab594b7418ca18ac8660a28916cc6e51643994d
│   │       │   └── 1e
│   │       │       └── 89f0b89d2ca92cd54ff481086fdd599c67170ea69eb9b22d37e34638d25e
│   │       ├── 42
│   │       │   └── 8b
│   │       │       └── c02d827ace565a38508b184eec46432a592ba2550cdb1930cd90b866d766
│   │       ├── 43
│   │       │   ├── 5f
│   │       │   │   └── 110819c5903563df1824b2214749ef7781289e80d4a600347e3901aac1c4
│   │       │   └── b0
│   │       │       └── 1da35d6e384e0146648258aa5ea61333fd10d6d00300adf4aac974f6d1e2
│   │       ├── 44
│   │       │   └── 10
│   │       │       └── 7cf4f1b3974687000c3e81a7b9d017adb6b8416e32f27309b764b12b8be5
│   │       ├── 45
│   │       │   └── 2e
│   │       │       └── 93eac58d3d5aa3f5721ac09fa7c3b814ccb98bc5000550243f4497f78a67
│   │       ├── 46
│   │       │   └── 98
│   │       │       └── 3144eac06844196da14c933cccc766b529c8917a7efc1c6c79bba5651a6e
│   │       ├── 47
│   │       │   └── 12
│   │       │       └── 2b0123c780f4536fbd0b803d54bb573a256230046b95fd342da9df92dc8d
│   │       ├── 48
│   │       │   ├── 7f
│   │       │   │   └── 4f4a841cc66ee33998620da1f4f341e422d9ebb37bb00178f3707927db1b
│   │       │   ├── ae
│   │       │   │   ├── 1499701156e55c38f37c319e42d8ee632f62ee16e676fb96bf268dc03e39
│   │       │   │   └── f6dae96ac72c3518cd54e6a1cf5ac3bc59c80cfdc62d65a101a0cb67304a
│   │       │   └── dd
│   │       │       └── 8c8b3dd9e0048fc9974197e48fdfa5ceb084560780473574323b9bfdebd4
│   │       ├── 4e
│   │       │   ├── 45
│   │       │   │   └── 17bdb2bc7c0f1b72ba954a40424fb4a9ef5929f88e922704c80b3d264ccc
│   │       │   └── be
│   │       │       └── da18b216664b1e58df4ffd6782d77f3c28a3f61355544535ff7704cc1b2d
│   │       ├── 50
│   │       │   ├── 85
│   │       │   │   └── a29f2ec233233dedaf6d110ada83bf22af3e52848fda04a91b64f889f53a
│   │       │   └── bb
│   │       │       └── 1a5b513e51544ef3ffcb8dade26b2fd155f2f50104e8ac073030a9d119ee
│   │       ├── 51
│   │       │   └── 89
│   │       │       └── 3d02d342de41905761accac02260bce79c49652be9e6066da254d77ba04d
│   │       ├── 52
│   │       │   ├── 20
│   │       │   │   └── 702ec5d12a1e111e2534ce89eb0f33f79fe3ffee0e80a428299cdaa0d007
│   │       │   ├── a2
│   │       │   │   └── ba77c6a126c66982a48c1fb49ac1ca7f841619a89a1f0fc5de3512a4b7f0
│   │       │   └── bd
│   │       │       └── 1b45d5168ed8296f6d5d5167fe2f8076e2cd5e5d67d2766935784d3e798d
│   │       ├── 53
│   │       │   └── e1
│   │       │       └── 0dc9829fd62522b01d70c6eff1025e862877619ba63ab3f1445df0451b8c
│   │       ├── 56
│   │       │   ├── 4b
│   │       │   │   └── 859813b09e1e5020654bf65fb2f19970c51f08f788d3c4f2ea5137051e1e
│   │       │   ├── 71
│   │       │   │   └── fa4fe23b6bc134c60d26da3033c87003fb50204af907f8ec32c9a7c9e48c
│   │       │   └── 9b
│   │       │       └── 5bc545281ee1f49775ff8b0f2921a08251d503d559ff3f999be9886f1712
│   │       ├── 57
│   │       │   └── b7
│   │       │       └── 2772f8c4daa4b31074e03545f8e473b547e88ef3141501fe2a54e1abdfc4
│   │       ├── 58
│   │       │   ├── 92
│   │       │   │   └── 5799a11997482f78a71307f2134a84b508b74d7faa3535d40d26c6261638
│   │       │   └── f0
│   │       │       └── 4fe556f104b09be642895a82afa463fe560d9a0dc8f507efeef825a6905e
│   │       ├── 5b
│   │       │   └── 42
│   │       │       └── b4487d788874a06f49235360174f1ba8832e8f6a83cb8533883b8fa09f4b
│   │       ├── 5d
│   │       │   ├── 58
│   │       │   │   └── 39fdc57612a04067ef7ec1c141646752e6563b84430cd56ba1df2434de91
│   │       │   └── ad
│   │       │       └── 1cb61ae613816d5f049cd87dd24009e364126f73726b1f8eab2350fec505
│   │       ├── 60
│   │       │   └── df
│   │       │       └── 89f1345cb5849d888a2cce2e6d6ddc0014eb3d6722956a06241f6e7f3d58
│   │       ├── 63
│   │       │   └── d3
│   │       │       └── bb861348e4b5fc53b62454cd498b01af8a51c93c0ebb3f9ca712ca253566
│   │       ├── 69
│   │       │   ├── 33
│   │       │   │   └── b968e19e42cda755b43c4bd1e354056b2be0e8ff44896e82e4bc9fdb6322
│   │       │   ├── 7f
│   │       │   │   └── ee4d73554ca4b3320cb01b422b9a9d45f388513d8fd2ccf4df9187578ce1
│   │       │   └── 97
│   │       │       └── dc07bc0d29ed2880b0e39905e8bc8a24a0344155c90a7ca65c8093d51295
│   │       ├── 6a
│   │       │   ├── 86
│   │       │   │   └── 14653864a77b7c8644710834018401ea9fd5653744bbbea2201a6af48a9f
│   │       │   └── a7
│   │       │       └── 23f89bea37ae703ce622e7188ccb889113f1d355f754c11544a1caec4cc6
│   │       ├── 6d
│   │       │   ├── 40
│   │       │   │   └── 0b02ee474cc305b6d0da00248cfa61780731440b4f237c6251314258b9bd
│   │       │   ├── 61
│   │       │   │   └── c9e7e8446341cea439547eb023fbf47c954ba932e6944a3fd50413c1e861
│   │       │   └── 65
│   │       │       └── 05c74d488e52e860b9de3668e482a62f5796264d2bf9f2700cf9423add5e
│   │       ├── 6e
│   │       │   └── 9e
│   │       │       └── 2004cc0984629401a6a3d3fa16900d49ac70112df7a8c515ec028b34c59d
│   │       ├── 6f
│   │       │   └── 9f
│   │       │       └── 4244544732d3e784c8fd360e0ea256a943488c53a834da3d0ddf3e83af9b
│   │       ├── 73
│   │       │   ├── c1
│   │       │   │   └── d8bbb109a8fa2903d912518bf54776b7794c8f6f0a759234283c3c2eefab
│   │       │   └── e2
│   │       │       └── 434e6cce71a37629e1945f6d35d5e52c1e34aa88ef24d1915846c72775f1
│   │       ├── 77
│   │       │   ├── 59
│   │       │   │   └── 986079464467eb2c4f1c178bf1c9fa9179b3c8384bd1eff68534419250ea
│   │       │   └── d8
│   │       │       └── 4c73393b4c86b064a434ecae7c4c202784cc49493fdc99469a7dc797494b
│   │       ├── 79
│   │       │   └── 0e
│   │       │       └── e6e294a39cc9407b6358b7284df63feda5d4f96e51519630d06219175167
│   │       ├── 7a
│   │       │   ├── 05
│   │       │   │   └── 8c39e8b9b5af7db5ea9983334f3ee2532aae9b7973de1dbb581781947ed3
│   │       │   ├── 1d
│   │       │   │   └── aa5b15d3f974ebd32c44778518e0984265598aa1e2dddc4ded4feb2a11b1
│   │       │   └── 23
│   │       │       └── df8deeb6de869825106ce68786ba9e16686f20a8b4f1c626c9635a5bc8da
│   │       ├── 7b
│   │       │   └── 1d
│   │       │       └── 314b6515b77b62a66c8a2ac140ac4a6926135c5866837fddded37acb1acf
│   │       ├── 7c
│   │       │   ├── 20
│   │       │   │   └── cba9852dc5e0811d9e6e24e74108bf7727a0c2730516ec8f41a08f13116b
│   │       │   └── 9a
│   │       │       └── 13a1f5cfe2738ebf2558b3fc8173e47bffd478a46c35ee5e0fc6e72e511d
│   │       ├── 7d
│   │       │   └── e8
│   │       │       └── 5446c5cdae0493e4ad3b10347b77c8df4b17b5fbe14834f5c6b06faa9f95
│   │       ├── 7f
│   │       │   ├── d5
│   │       │   │   └── 36068d8df17b31ccdbeedbb62ae94e354f6d768324e0dd6578917b8ecc16
│   │       │   └── f6
│   │       │       └── 5e3925b158405271b2f44be4d1ecbb5c60b3b7da87819ce03956b759b051
│   │       ├── 83
│   │       │   └── ef
│   │       │       └── aff47278d7ef72e864717a2bb5e09eca947c1b761d2a3f590af1b5f1b379
│   │       ├── 85
│   │       │   ├── 20
│   │       │   │   └── 71a0d0584d5ae3631b6b48b18785908616327f10115d683585b05072ca1b
│   │       │   ├── d3
│   │       │   │   └── 1b45f9b1e17b38c211d236888c737ca95cd5b9ca0e42c51cff12aece643f
│   │       │   └── d8
│   │       │       └── 7da2d1eaa517a5e80f7a1a8d7dee184babfd49523097c7b2ea907d755944
│   │       ├── 86
│   │       │   └── df
│   │       │       └── f30ac40daf6afa3c806cd525ffbf33eaad06c5f38e08f7ce9428a303241e
│   │       ├── 87
│   │       │   └── eb
│   │       │       └── ab402da37b8ea447b0cac7c54cf3452aae056ac8c63514cb6730629409a8
│   │       ├── 89
│   │       │   ├── 0b
│   │       │   │   └── e2ba88ed525834b932f3ddb5624a540e279742a3c6851ec4ee466890a5ed
│   │       │   ├── 0c
│   │       │   │   └── 98d70e9e25b9a23c255f11b8acd5d9ebed836d0004871577846f3bc3f03f
│   │       │   ├── 39
│   │       │   │   └── d7518a088b510f892a8355a21e2971328f68a8ef26d1962bbcfc70c84725
│   │       │   └── 58
│   │       │       └── 62a9a2b49fd26f8d788adbe5cc377e776463c3a01839945896d96fa48d4f
│   │       ├── 8a
│   │       │   ├── e9
│   │       │   │   └── f78a927b119d27ece8b731dfde1470b48159f26c89ce35d5fe0fc80122ed
│   │       │   └── ea
│   │       │       └── a9d2d6ff75cba71d63171f51aa258a77d99513740280af3884c1dea1f7cd
│   │       ├── 8b
│   │       │   ├── 4c
│   │       │   │   └── 6c0c483d470762dc61c704d8d07e1edd6421400f274c32ea22f543bfdb16
│   │       │   ├── d9
│   │       │   │   └── 617f84454e0342f885f6cbdd2661990c9060f183e29553e39e0506dbd847
│   │       │   └── ee
│   │       │       └── c2ea22c4bf9c5ddcd0333850e543442de3364478847c7ebc382b1ff3a70d
│   │       ├── 8c
│   │       │   └── 9a
│   │       │       └── e014072a08e7ba0b90a6897c5737bc438be37650b0470bfd7c0b83e18e23
│   │       ├── 8e
│   │       │   ├── 58
│   │       │   │   └── 1ce1355f39c75fa063f8dc1c958c11d57446438253b206afc18efb9f28c9
│   │       │   └── ff
│   │       │       └── fc9a834a298aa364d38f286bfc395217fe0559c9b322231ff5f6265ba504
│   │       ├── 91
│   │       │   └── 08
│   │       │       └── 56fc6b8aa67287e6e60a90a5e8bd6500ef9e97a317a38b324cca616a7d25
│   │       ├── 93
│   │       │   └── 31
│   │       │       └── 9f96e29572a9b3bd880f19dde2e443b99ec81a4258f3e56ce1c4fff64852
│   │       ├── 94
│   │       │   ├── 07
│   │       │   │   └── a7c22ba183764c0c27f706d74812444c27c14a97fc43669b7dd7c32a717f
│   │       │   └── 49
│   │       │       └── 0c8e6bfaa289aa93424dc1f6f28b3decc9f59cb08be977c3040f7d244ac3
│   │       ├── 96
│   │       │   ├── 7c
│   │       │   │   └── 454eb1ff3ec3546d35165170f771ff1c65f055203c5ab9f907e6af7067a8
│   │       │   └── c5
│   │       │       └── cfd4f290453cd7201716a3217433fe76e994d06ad3a598a6ab5772d5280f
│   │       ├── 98
│   │       │   └── fe
│   │       │       └── c68a85433f7c743aa9b9427fb21be6fd8c25f9e7893bd5cf65537496008d
│   │       ├── 9a
│   │       │   ├── 76
│   │       │   │   └── 06192603daebdeebec6ad6e070357bb297b864354a3998c359fa50ad570b
│   │       │   └── bc
│   │       │       └── 143ae50ba22ddec235347ed6a62762b673eddb52cb1939aea401679de36b
│   │       ├── 9d
│   │       │   └── 0d
│   │       │       └── cb301e666cb1b3f23405c9a023a97e35e0b646458b0dc07d4e4c45f072d2
│   │       ├── 9e
│   │       │   └── 24
│   │       │       └── 74490f75d8dec7ba5051c2fb1e3119fa15abb79366ea7664e5fbb2977153
│   │       ├── 9f
│   │       │   └── 43
│   │       │       └── 3636172cbc03abf2262c921f9f71572e6b049aa3db8c65d166bcfe5aca5f
│   │       ├── a1
│   │       │   └── 78
│   │       │       └── ee48142ac207e21a1a2eac9ca7111587ce699eebdc565abb3dfe976abf96
│   │       ├── a2
│   │       │   ├── 60
│   │       │   │   └── ea4e9555df962e8a55d27858ec6e935db7b0356b46d10718029046780c27
│   │       │   ├── 68
│   │       │   │   └── b7b4c1f69b4b4ff6c19e7de1b75dfa3eefbab3d36b6ce4ef15d6f64afb9c
│   │       │   └── b5
│   │       │       └── f2c35332a5ab256ee9271034e3b3b301ece6931e6e92531ca0bd8c08fe9a
│   │       ├── a3
│   │       │   └── 50
│   │       │       └── b739b1f6f936987c26973cec93f36482ed240ab90158c0d04899bab0de13
│   │       ├── a4
│   │       │   └── b7
│   │       │       └── a7cebac941d6c47ac2f6fde93c17edf93f4ae4aa6b051499d8f2ffeab614
│   │       ├── a5
│   │       │   ├── 87
│   │       │   │   └── bc838260e09216f01f45e48f0f96cb7691d978001a792540928b1153baa5
│   │       │   └── b8
│   │       │       └── 454c882933ab15d532e2493b0bd7ce7019f1caca2abb46f076ca0855330b
│   │       ├── a6
│   │       │   └── 54
│   │       │       └── c1733144b73a0422b1daf6390b4562d52ec887d209b643d8b0b789a2e4b1
│   │       ├── a7
│   │       │   └── 04
│   │       │       └── d0646f5e87aed79d9f0ad28e40eff59b4872fd92336c436b29f7280a9d3a
│   │       ├── a9
│   │       │   ├── 92
│   │       │   │   └── c230215c94371d341f1b38927e5f481994a870132101fd50efb0449f27c2
│   │       │   └── f7
│   │       │       └── 4c2a9fe6575921726a5579be73ddb2a3e8a7abbbb66a28c50ca8deaeccc5
│   │       ├── aa
│   │       │   └── cb
│   │       │       └── eb7e78deaaf4e5eba36039b514bbe6541a5e440f56bda5447a6a0c81f2aa
│   │       ├── ab
│   │       │   └── f0
│   │       │       └── 041961d523d853b40e4e55be33fe676651a97b630d01af1b06b28abc5697
│   │       ├── ac
│   │       │   ├── 5d
│   │       │   │   └── bac3965880e0e18bc7d1e21519c9073430f53c69821d54a4aeb5c313357f
│   │       │   └── 86
│   │       │       └── c0732592365d753d382502d91754a3c88f8b20e22cc25a0327beb9429687
│   │       ├── ad
│   │       │   ├── 5c
│   │       │   │   └── 217f4a9502eed2896935b005b187e4713d93ba3dc76eff284b00a1a8b92a
│   │       │   └── 7c
│   │       │       └── cc598261aa7c1f089fdcd0478664f8f5c80f8f02f241f08e3be264a9e616
│   │       ├── ae
│   │       │   └── 78
│   │       │       └── cedd14d309b153583ec33b511626642a5b2cecfae082a664e1e6a368bc97
│   │       ├── af
│   │       │   └── 8a
│   │       │       └── d90cfcd33a9895fbbb880406407aee65cd5b37556b94baafb95ba5cb93dd
│   │       ├── b0
│   │       │   └── 4a
│   │       │       └── c18a99a2710b49b5a3a1121226be4940f623f8ba056f8108a634ed347da9
│   │       ├── b1
│   │       │   ├── 4a
│   │       │   │   └── 6796e751962cdc0f1d356f7c34ae7e66a41858d769156329b5bd4379d591
│   │       │   └── 8f
│   │       │       └── 5767f914aa664f32503df614481bac973784e2bcd2b8af02e84faabe168d
│   │       ├── b2
│   │       │   └── 53
│   │       │       └── a51760f3239bd143eb2f11ec8f083702e47b0ca67ac04a9a45e7336f6cde
│   │       ├── b3
│   │       │   └── 63
│   │       │       └── f693e1cbbd8c651339dc83ea677e236d61935b81de6396cb4847fd5b08e4
│   │       ├── b4
│   │       │   └── d4
│   │       │       └── aa802aaebfa5cce97b6f2e688062d965ef9940c20866c45eb34a72b47d05
│   │       ├── b7
│   │       │   ├── 38
│   │       │   │   └── 992d3e6c01fc9098d137f7dbccfcaa5f5124ba9c487e582e6e0d83f99d30
│   │       │   └── fe
│   │       │       └── e66fb9a38a1ef7da481d041bc0dd117c0c2bddfa61bcf516da1e1486c290
│   │       ├── bd
│   │       │   └── e8
│   │       │       └── 7741857e809594830141a639d3d54110945a88bb85691de2f9dc97402c84
│   │       ├── be
│   │       │   ├── a3
│   │       │   │   └── c0779c8e0be92c748c91a7dad4e6f0fe57ba0158b6bb1bcfddd8fc56c934
│   │       │   └── f0
│   │       │       └── 1030b67d1c2d501a0e14ff9aea82addbf8b2e760ef58a5be510d7b4bad3c
│   │       ├── bf
│   │       │   ├── 03
│   │       │   │   └── d5dd5fa44593b3e2d24e270c89a4ebe5809a69837946acbe11b5f9ab29d0
│   │       │   └── 7c
│   │       │       └── 375aec77f76404d91225e72006a0105b2a6ec04bb02cfa365ebcd4a0232b
│   │       ├── c0
│   │       │   └── 83
│   │       │       └── 1295af917239a2fbe94404f49d472949b2a2519701a35e8dc9841f02ae34
│   │       ├── c1
│   │       │   ├── 3e
│   │       │   │   └── 4c4d082623156529b4fa73601a4ac92e33a6b20f963f1096cee31b6d9010
│   │       │   └── 8c
│   │       │       └── e4e9afe177a9d6771d71fe96d51887f262a8fede9d9d3e06ca7ddcf20990
│   │       ├── c2
│   │       │   └── d9
│   │       │       └── 7fb959fc2a833b8e68b8306a1b7d4cd5f15c8b4e0c9d6b46a6765796482e
│   │       ├── c3
│   │       │   └── c6
│   │       │       └── be9e8d92e3e1f8898fedbe33cae4e67f0352de1b0d48fee9cb29ecc1d6ab
│   │       ├── c4
│   │       │   ├── 11
│   │       │   │   └── bf2dd5bf2d9b9006f82aeedaffc7f69ad64358a9a08afe81cbcdca1766f2
│   │       │   ├── 68
│   │       │   │   └── b71baf5025326649162df1bd325b5637dd1e72f59a32177b49318d5efeac
│   │       │   ├── ac
│   │       │   │   └── 4511be3eecea50ee9cadc09a612f9be8598d7b29d5c8b1253c75fa283cc5
│   │       │   └── ca
│   │       │       └── df46b5b6c6148487b1afb20084da52f2838a08143f9b0ebd217d2a229e9a
│   │       ├── ca
│   │       │   ├── 98
│   │       │   │   └── 29ae16b7b413d7a609c6beba2ab22ac51a8f88aa3c3a36759292907ce3ac
│   │       │   └── f8
│   │       │       └── 5fdf8973f1896e77c07a4919f6166c6a04ef8354c5efb0156670a06d24e3
│   │       ├── cb
│   │       │   └── c7
│   │       │       └── 8dc870ee1a760dfda5ed1c13aec5056dae100cec5c9af892474d802a65b0
│   │       ├── cc
│   │       │   ├── 25
│   │       │   │   └── 0a0ad2d0308b6807a70e488194992de068d68b749910eee4847c38629984
│   │       │   ├── 60
│   │       │   │   └── ca5eb4c028e64ab99a3a71e5e6cff685d49a0052a23f473310db7d984f23
│   │       │   └── fb
│   │       │       └── 96cd6e2c34dfd1fc2a68d5b85c353ec81fec75a8e0856070c12777141d13
│   │       ├── d0
│   │       │   ├── 12
│   │       │   │   └── 0e893a332c0e07c4e6ad382322604cf61f86ba7822a3e02b24d4105846cb
│   │       │   ├── 39
│   │       │   │   └── f3ea46b7a48d1b108681523c9e802f48f2779894068bc9b984863ca18939
│   │       │   ├── 57
│   │       │   │   └── 3aa5d94761ad382e1a1acc61203736494009e20422bce1dd1433666dd012
│   │       │   └── f3
│   │       │       └── 570007f66e0a594c21201eb3e8f15d7a4d92bcb97b59246e5b7194b3b290
│   │       ├── d1
│   │       │   ├── 34
│   │       │   │   └── dd11aca2ddd3aeb854849cd81cab78174fc5ea935c0fd552de94684f90a8
│   │       │   ├── 3b
│   │       │   │   └── 5d145862c809774efedb998cae0b11c4062b94265112f8db93a55edb929e
│   │       │   └── 91
│   │       │       └── 1ea8e1c5735aa7333775abaea09cba50e98296556053fba7d4dd227c6732
│   │       ├── d2
│   │       │   ├── 3c
│   │       │   │   └── 9b2e81a9ef349bd31c3c94f1c2d4040643ee96b8128c972db597415d555c
│   │       │   └── 53
│   │       │       └── 0423c306fc66318eb336eeb4033781a7b495f0aa3ba92eec00f34069f13e
│   │       ├── d4
│   │       │   ├── 42
│   │       │   │   └── dcecd9ea33544599eb1e71ac0fd23e843f4caf0dd35ae634e5a1e2bca450
│   │       │   ├── 8f
│   │       │   │   └── 715a86aa779da41ab634b8f3191069d4b2966a3c5b47cb739ab6a9b93aec
│   │       │   └── a2
│   │       │       └── 61ef4c73c2a4a1a021b2b9d9d54cd0acbea9f5e44cebff230278f27bd92a
│   │       ├── d5
│   │       │   └── f4
│   │       │       └── 0913a74f5e223a4fe6108493dd3b03c2d47259df459926160659513c9ad3
│   │       ├── d6
│   │       │   ├── 3c
│   │       │   │   └── 3fd6a899c59ae533d9a5bb44570ada1eddb5802483d3e7812df2c207a7e1
│   │       │   ├── 47
│   │       │   │   └── 2d4e4b363564f0b3d6e59012bb07573fb947a866841f5259a96439aa3964
│   │       │   └── 4d
│   │       │       └── 95351bd7b1c4630fa6590049d83b56ced950f5f2fd281f27e28527249cee
│   │       ├── d7
│   │       │   └── 98
│   │       │       └── 895bffa858148e74eb0bae5ede536d11e4eb6ba643223069874bea4f6498
│   │       ├── d8
│   │       │   ├── 62
│   │       │   │   └── fa9d7982c1af34cc1664c1504cdcf5728bee5cbfba341507a5c033098737
│   │       │   └── f2
│   │       │       └── dfd78c09b8752f2fd7100ea4a9f64cec29a053d57d72983420eb853b3e6a
│   │       ├── dc
│   │       │   ├── 47
│   │       │   │   └── 9e3985de44e70129e4e28c25bdc69a204acabcbdd5962cf5109db4ca7aa5
│   │       │   └── 8a
│   │       │       └── 4dc2a1bdf5b195e99648a945ce742de5f6d0b1aac410a6fe3e7155933cc7
│   │       ├── e1
│   │       │   └── 53
│   │       │       └── 4da55a553f57b5ef4eb84d567d8d4fbd67732c8c090da290c199e0ac2ed4
│   │       ├── e3
│   │       │   └── c5
│   │       │       └── ad2fd86fe0c1b9f233d92c25e56b1a582b8425b52db4767f8d72410c021f
│   │       ├── e4
│   │       │   └── f2
│   │       │       └── 0b57f65571788559ed93ba6d26cacaac21da8e4adfe374787669e431e875
│   │       ├── e6
│   │       │   ├── 37
│   │       │   │   └── c9e69f5074e9a22c766ffcc622280d4e580d2ee0238f670f28199487dd44
│   │       │   └── f1
│   │       │       └── aa87087a727f6fb26b60b78c06c2b830f509c809c7b1752ab1bcab0a15af
│   │       ├── e7
│   │       │   ├── 40
│   │       │   │   └── 70186a6ceaad19b6b11ac1bccf00fa5e038b8151d455127f9868f0051d57
│   │       │   ├── 6f
│   │       │   │   └── 6df2d13a4e315af18cce3e1c8a09c911262fc54f57e6fc47d361ddcf408d
│   │       │   ├── 9e
│   │       │   │   └── 9df988403d9266b9610bf520678520e200090b726c2ea164a0fe727500ba
│   │       │   ├── a3
│   │       │   │   └── 60cfc8947cb925b4deffc13cf15258a667e1653daa12cf0001b2e0083bfb
│   │       │   └── e9
│   │       │       └── d2369beb18730dc4f30e1c9dcdf5bf16ac9bd28dec641b81ff8e8616e7fc
│   │       ├── e9
│   │       │   ├── 6e
│   │       │   │   └── ba29811d787f0fd92ce7f4bc3a6827dc6d66c47153d50683c80d6e7a9a6f
│   │       │   ├── 9a
│   │       │   │   └── b309e8b758264ef32fd578a2928ad1ac4a3241e8c570a5c275e121dd7ee1
│   │       │   ├── bf
│   │       │   │   └── 0bfc4abc982e4aecac42d77dbded146ef0ce46649865b55d62144af5a96d
│   │       │   ├── cb
│   │       │   │   └── b6d58aac267a95803951157a42d29db6c17ef57c66eb59c48684c280e4e8
│   │       │   └── df
│   │       │       └── 500f6d65c0cf35c0f7c0635f953b37393168aa27cb55c7b0ce3399c0d7f2
│   │       ├── ec
│   │       │   ├── 87
│   │       │   │   └── d81e1e7b2d776e609dbfaa2175a5825c0a63a9bcc70fdb5694b81e7f4fc3
│   │       │   └── 8e
│   │       │       └── 97eeecddd26637708519813d42ee2a5ec256bd4831ffa02269e8993e19b7
│   │       ├── ed
│   │       │   └── 40
│   │       │       └── e67da4ad085eef0344d8e253e4455423e0efc042d3898be0a399d1a76b79
│   │       ├── ee
│   │       │   ├── 3d
│   │       │   │   └── 1ab77d088759d13cd44eab2a2f7764233b7908340d97282d9765e014f29c
│   │       │   ├── 60
│   │       │   │   └── 850558038dbacbcba5202b181a0a0c4f947405cf3682df3e1c20dec79137
│   │       │   └── 7a
│   │       │       └── ee0e1b8bea3f05c1b42f1fe4a17fdc2aa37be14405f4e293de10bd30eb80
│   │       ├── f1
│   │       │   ├── 53
│   │       │   │   └── 8aee994a2b5c701755cdc5660748a90199cf48437f5f93fdd0572344f2f1
│   │       │   └── a1
│   │       │       └── 1de8ff1c9230508fdf1c71b3faa1a9d2aade80a7e0b0d4daa6f4040d8ba2
│   │       ├── f3
│   │       │   ├── 2c
│   │       │   │   └── 80267cf9b394a43404ccabe3e574f5fd89b769b43be625b75ff9b1b4a2ee
│   │       │   ├── 8b
│   │       │   │   └── 4a6b7b0714b6f1c94fff48ad31ee18cb6aa93ed63612067b4de30efd43f8
│   │       │   └── f5
│   │       │       └── d11839881d6df2061b642074ebfaf84ce0d4b1d8e227ad335d364cf6a913
│   │       ├── f4
│   │       │   └── 47
│   │       │       └── 8cb011f7e5de40eae9588617e8f3bce662a0ba2d60796b559a420b44783a
│   │       ├── f6
│   │       │   └── c7
│   │       │       └── c2aee6453a94a772577d770a438f34805af27cbf0c7a776b19d6850307b5
│   │       ├── f9
│   │       │   └── 82
│   │       │       └── 228120d240455dd412cb68cbe2007319fbf91d96bb998e7f24c45faadc0b
│   │       ├── fa
│   │       │   ├── 88
│   │       │   │   └── 31cbd6ca584e75edf3642c6f8b079c1f2b5eca1d7b2780ce2e86c24f1e84
│   │       │   └── a1
│   │       │       └── dd9e9a25a0a13875f496dfc7b415ddc641f6b30648050accc001be4635ee
│   │       ├── fb
│   │       │   └── fc
│   │       │       └── 6282476d454ca3b17e0ba6cf70a4b6a87142bd8f3139517d572b2f9911a4
│   │       ├── fc
│   │       │   └── ee
│   │       │       └── fc3e1dd6706bd557d2840d92ff10cdd6928b92fb8c46d2195dfbd8d4b2be
│   │       ├── fd
│   │       │   └── 60
│   │       │       └── 528c5445a438483b66270e6a4dddfa6e9bdcceb2b998cb6f7580d23ceb1b
│   │       └── ff
│   │           ├── 9f
│   │           │   └── 48b5354df0d5feb3420245101c38efe5fb13f171ce2093c16eeb4ba41c7e
│   │           └── d6
│   │               └── 9ea5f7eac400baceca422723dd933d7c505c100130f066f787943d1ac679
│   └── _update-notifier-last-checked
├── .pre-commit-config.yaml
├── .pre-commit-setup.md
├── .prettierrc.json
├── .tmp
│   └── temp-1758247471070.ts
├── archive
│   └── ebook
│       └── enterprise_architecture_mcp_ebook.pdf
├── async-fix-verification-summary.md
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── custom
│   ├── dir
│   │   └── adr-0001-complete-decision.md
│   └── research
│       ├── dir
│       │   └── perform_research_test_research_001.md
│       └── README.md
├── debug_test.js
├── docker-compose.docs.yml
├── docs
│   ├── .dockerignore
│   ├── .gitignore
│   ├── .vitepress
│   │   └── config.js
│   ├── adrs
│   │   ├── adr-0001-integration-test-decision.md
│   │   ├── adr-0001-test-decision.md
│   │   ├── adr-001-mcp-protocol-implementation-strategy.md
│   │   ├── adr-002-ai-integration-and-advanced-prompting-strategy.md
│   │   ├── adr-003-memory-centric-architecture.md
│   │   ├── adr-004-security-and-content-masking-strategy.md
│   │   ├── adr-005-testing-and-quality-assurance-strategy.md
│   │   ├── adr-006-tree-sitter-integration-strategy.md
│   │   ├── adr-007-cicd-pipeline-strategy.md
│   │   ├── adr-008-development-workflow-strategy.md
│   │   ├── adr-009-package-distribution-strategy.md
│   │   ├── adr-validated-patterns-framework.md
│   │   └── README.md
│   ├── api-styles.css
│   ├── CODE_OF_CONDUCT.md
│   ├── community
│   │   ├── .github
│   │   │   ├── ISSUE_TEMPLATE
│   │   │   │   ├── bug_report.yml
│   │   │   │   └── feature_request.yml
│   │   │   └── PULL_REQUEST_TEMPLATE.md
│   │   ├── CODE_OF_CONDUCT.md
│   │   ├── CONTRIBUTING.md
│   │   ├── README-library.md
│   │   └── SECURITY.md
│   ├── configuration.md
│   ├── context
│   │   ├── README.md
│   │   └── research
│   │       ├── latest.md
│   │       ├── perform-research-2025-10-20T15-31-34-312Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-314Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-316Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-318Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-319Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-321Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-323Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-326Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-328Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-329Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-331Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-332Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-335Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-336Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-338Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-340Z.md
│   │       ├── perform-research-2025-10-20T15-31-34-342Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-479Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-481Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-482Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-484Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-486Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-487Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-489Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-491Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-492Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-494Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-495Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-497Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-501Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-503Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-504Z.md
│   │       ├── perform-research-2025-10-20T15-38-18-505Z.md
│   │       └── perform-research-2025-10-20T15-38-18-507Z.md
│   ├── CONTRIBUTING.md
│   ├── CONVERSION_CHECKLIST.md
│   ├── DEPENDABOT.md
│   ├── DEPLOYMENT_GUIDE.md
│   ├── development.md
│   ├── diataxis-index.md
│   ├── DOCKER_SETUP.md
│   ├── DOCKER_TEST_SUCCESS.txt
│   ├── docker-compose.yml
│   ├── Dockerfile
│   ├── DOCUMENTATION_IMPROVEMENT_PLAN.md
│   ├── DOCUMENTATION-UPDATE-PLAN.md
│   ├── DOCUSAURUS_MIGRATION.md
│   ├── DOCUSAURUS_QUICKSTART.md
│   ├── docusaurus.config.js
│   ├── explanation
│   │   ├── adr-philosophy.md
│   │   ├── ai-architecture-concepts.md
│   │   ├── ai-workflow-concepts.md
│   │   ├── ape-framework-design.md
│   │   ├── architecture-overview.md
│   │   ├── context-file-tool-coverage.md
│   │   ├── index.md
│   │   ├── knowledge-generation-framework-design.md
│   │   ├── knowledge-graph.md
│   │   ├── mcp-architecture-flow.md
│   │   ├── mcp-concepts.md
│   │   ├── performance-design.md
│   │   ├── prompt-engineering.md
│   │   ├── reflexion-framework-design.md
│   │   ├── security-philosophy.md
│   │   ├── self-learning-architecture.md
│   │   ├── server-architecture.md
│   │   └── tool-design.md
│   ├── how-to
│   │   ├── deploy-to-production.md
│   │   └── index.md
│   ├── how-to-guides
│   │   ├── ape-implementation-strategy.md
│   │   ├── ape-usage-guide.md
│   │   ├── bootstrap-architecture-docs.md
│   │   ├── cicd-integration.md
│   │   ├── contribute.md
│   │   ├── custom-rules.md
│   │   ├── deploy-your-own-server.md
│   │   ├── deployment-readiness.md
│   │   ├── dynamic-pattern-configuration-system.md
│   │   ├── firecrawl-setup.md
│   │   ├── generate-adrs-from-prd.md
│   │   ├── getting-started-workflow-guidance.md
│   │   ├── hybrid-dag-bootstrap-design.md
│   │   ├── installation-guide.md
│   │   ├── interactive-adr-planning.md
│   │   ├── knowledge-generation-usage-guide.md
│   │   ├── large-team-scaling.md
│   │   ├── llm-context-file-configuration.md
│   │   ├── mcp-client-compatibility.md
│   │   ├── migrate-existing-adrs.md
│   │   ├── performance-testing.md
│   │   ├── prd-to-adrs.md
│   │   ├── progress-tracking.md
│   │   ├── prompting-guide.md
│   │   ├── reflexion-implementation-strategy.md
│   │   ├── reflexion-usage-guide.md
│   │   ├── research-integration.md
│   │   ├── security-analysis.md
│   │   ├── server-context-file.md
│   │   ├── testing-guide.md
│   │   ├── tool-context-documentation-plan.md
│   │   ├── tool-development.md
│   │   ├── troubleshooting.md
│   │   ├── using-validated-patterns-with-live-sources.md
│   │   ├── validated-patterns-implementation.md
│   │   └── work-with-existing-adrs.md
│   ├── ide-rules
│   │   ├── additional-workflows.md
│   │   ├── command-structure.md
│   │   ├── environment-validation-workflow.md
│   │   ├── ide-specific
│   │   │   ├── cursor
│   │   │   │   └── cursor-rules-template.md
│   │   │   ├── jetbrains
│   │   │   │   └── jetbrains-rules-template.md
│   │   │   ├── vscode
│   │   │   │   └── vscode-rules-template.md
│   │   │   └── windsurf
│   │   │       └── windsurf-rules-template.md
│   │   ├── quickstart-guide.md
│   │   ├── README.md
│   │   ├── standalone-usage.md
│   │   └── universal-workflows.md
│   ├── index.md
│   ├── LOGO_DESIGN_PROMPT.md
│   ├── Makefile
│   ├── mcp-planning-tool-usage.md
│   ├── MIGRATION_GUIDE.md
│   ├── nginx.conf
│   ├── notes
│   │   ├── DEVELOPER_GUIDANCE.md
│   │   ├── knowledge-graph.md
│   │   ├── media
│   │   │   ├── 01-first-steps.md
│   │   │   ├── diataxis-index.md
│   │   │   ├── install-rhel.sh
│   │   │   ├── LICENSE
│   │   │   ├── mcp-client-config.md
│   │   │   ├── mcp-concepts.md
│   │   │   ├── performance-design.md
│   │   │   ├── security-philosophy.md
│   │   │   └── troubleshooting.md
│   │   ├── performance-design.md
│   │   ├── prompt-engineering.md
│   │   ├── README.md
│   │   ├── RESEARCH-DRIVEN-ARCHITECTURE.md
│   │   ├── RESEARCH-DRIVEN-INTEGRATION-ANALYSIS.md
│   │   ├── research-driven-workflow.md
│   │   ├── research-integration.md
│   │   ├── technical-debt
│   │   │   └── LINT_CLEANUP_PLAN.md
│   │   ├── tool-design.md
│   │   └── USER_GUIDANCE.md
│   ├── package-lock.json
│   ├── package.json
│   ├── public
│   │   └── logo.png
│   ├── QUICK_START.md
│   ├── README_SCRIPTS.md
│   ├── README-library.md
│   ├── README.md
│   ├── reference
│   │   ├── analysis-tools.md
│   │   ├── api-documentation.md
│   │   ├── api-reference-updated.md
│   │   ├── api-reference.md
│   │   ├── comprehensive-api-reference.md
│   │   ├── environment-config.md
│   │   ├── generation-tools.md
│   │   ├── index.md
│   │   ├── mcp-client-config.md
│   │   ├── security-tools.md
│   │   ├── usage-examples.md
│   │   └── validation-tools.md
│   ├── release-dashboard.md
│   ├── research
│   │   ├── perform_research_research_000.md
│   │   ├── perform_research_research_001.md
│   │   ├── perform_research_research_002.md
│   │   ├── perform_research_research_003.md
│   │   ├── perform_research_research_004.md
│   │   ├── perform_research_research_005.md
│   │   ├── perform_research_research_006.md
│   │   ├── perform_research_research_007.md
│   │   ├── perform_research_research_008.md
│   │   ├── perform_research_research_009.md
│   │   ├── perform_research_research_010.md
│   │   ├── perform_research_research_011.md
│   │   ├── perform_research_research_012.md
│   │   ├── perform_research_research_013.md
│   │   ├── perform_research_research_014.md
│   │   ├── perform_research_research_015.md
│   │   ├── perform_research_research_016.md
│   │   ├── perform_research_research_017.md
│   │   ├── perform_research_research_018.md
│   │   ├── perform_research_research_019.md
│   │   ├── perform_research_research_020.md
│   │   ├── perform_research_research_021.md
│   │   ├── perform_research_research_022.md
│   │   ├── perform_research_research_023.md
│   │   ├── perform_research_research_024.md
│   │   ├── perform_research_research_025.md
│   │   ├── perform_research_research_026.md
│   │   ├── perform_research_research_027.md
│   │   ├── perform_research_research_028.md
│   │   ├── perform_research_research_029.md
│   │   ├── perform_research_research_030.md
│   │   ├── perform_research_research_031.md
│   │   ├── perform_research_research_032.md
│   │   ├── perform_research_research_033.md
│   │   ├── perform_research_research_034.md
│   │   ├── perform_research_research_035.md
│   │   ├── perform_research_research_036.md
│   │   ├── perform_research_research_037.md
│   │   ├── perform_research_research_038.md
│   │   ├── perform_research_research_039.md
│   │   ├── perform_research_research_040.md
│   │   ├── perform_research_research_041.md
│   │   ├── perform_research_research_042.md
│   │   ├── perform_research_research_043.md
│   │   ├── perform_research_research_044.md
│   │   ├── perform_research_research_045.md
│   │   ├── perform_research_research_046.md
│   │   ├── perform_research_research_047.md
│   │   ├── perform_research_research_048.md
│   │   ├── perform_research_research_049.md
│   │   ├── perform_research_test_research__________001.md
│   │   ├── perform_research_test_research_001.md
│   │   ├── perform_research_test_research_002.md
│   │   ├── perform_research_test_unicode.md
│   │   └── README.md
│   ├── SECURITY.md
│   ├── setup-docusaurus.sh
│   ├── setup-website.sh
│   ├── sidebars.js
│   ├── sitemap.xml
│   ├── src
│   │   └── css
│   │       └── custom.css
│   ├── static
│   │   └── img
│   │       ├── logo.png
│   │       └── og-image.png
│   ├── technical.md
│   ├── TESTING_GUIDE.md
│   ├── TODO_MANAGEMENT_FIX.md
│   ├── tsconfig.json
│   ├── tutorials
│   │   ├── 01-first-steps.md
│   │   ├── 02-existing-projects.md
│   │   ├── 03-advanced-analysis.md
│   │   ├── index.md
│   │   ├── security-focused-workflow.md
│   │   └── team-collaboration.md
│   ├── VERSION_MANAGEMENT.md
│   └── WEBSITE_SETUP.md
├── eslint.config.js
├── jest.config.js
├── LICENSE
├── LLM_CONTEXT.md
├── Makefile
├── mcp-inspector-config.json
├── mcp-test-results.json
├── package-lock.json
├── package.json
├── patterns
│   ├── CONTRIBUTING.md
│   ├── infrastructure
│   │   ├── aws.yaml
│   │   ├── firebase.yaml
│   │   ├── kubernetes.yaml
│   │   └── openshift.yaml
│   ├── README.md
│   └── schema.json
├── README.md
├── RELEASE_NOTES_v2.0.22.md
├── reports
│   ├── comprehensive-validation_20251003_185155.json
│   ├── link-summary_20251003_185121.json
│   ├── link-validation_20250922_151241.txt
│   ├── link-validation_20250922_151242.txt
│   ├── link-validation_20251003_184136.txt
│   ├── link-validation_20251003_184141.txt
│   ├── link-validation_20251003_184945.txt
│   ├── link-validation_20251003_185000.txt
│   ├── link-validation_20251003_185121.txt
│   └── markdown-validation_20251003_185155.txt
├── sample-project
│   ├── docs
│   │   └── adrs
│   │       ├── 001-database-architecture.md
│   │       ├── 002-api-authentication.md
│   │       └── 003-legacy-data-migration.md
│   └── README.md
├── scripts
│   ├── ai-release-notes.ts
│   ├── check-docs-links.sh
│   ├── check-duplicate-links.ts
│   ├── cleanup-template-docs.sh
│   ├── docs-workflow.sh
│   ├── fix-broken-links.py
│   ├── fix-docs-accuracy.sh
│   ├── fix-docs-content-accuracy.sh
│   ├── install-rhel.sh
│   ├── pre-commit-check.sh
│   ├── pre-commit-checklist.sh
│   ├── remove-duplicate-docs.sh
│   ├── sync-tags-to-npm.sh
│   ├── test-advanced-prompting.sh
│   ├── test-infrastructure.sh
│   ├── test-mcp-functionality.sh
│   ├── test-mcp-logging.ts
│   ├── test-mcp-server.sh
│   ├── test-node-compatibility.js
│   ├── test-npm-package.sh
│   ├── test-release-integration.sh
│   ├── validate-build.js
│   ├── validate-docs.sh
│   └── validate-links-with-sitemap.ts
├── SECURITY.md
├── src
│   ├── config
│   │   └── ai-config.ts
│   ├── index.ts
│   ├── prompts
│   │   ├── adr-suggestion-prompts.ts
│   │   ├── analysis-prompts.ts
│   │   ├── deployment-analysis-prompts.ts
│   │   ├── environment-analysis-prompts.ts
│   │   ├── index.ts
│   │   ├── research-integration-prompts.ts
│   │   ├── research-question-prompts.ts
│   │   ├── rule-generation-prompts.ts
│   │   ├── security-prompts.ts
│   │   └── validated-pattern-prompts.ts
│   ├── resources
│   │   ├── adr-by-id-resource.ts
│   │   ├── code-quality-resource.ts
│   │   ├── deployment-history-resource.ts
│   │   ├── deployment-status-resource.ts
│   │   ├── environment-analysis-resource.ts
│   │   ├── index.ts
│   │   ├── memory-snapshots-resource.ts
│   │   ├── pattern-base-code-by-platform-resource.ts
│   │   ├── pattern-by-name-resource.ts
│   │   ├── pattern-sources-by-platform-resource.ts
│   │   ├── project-metrics-resource.ts
│   │   ├── project-status-resource.ts
│   │   ├── research-by-topic-resource.ts
│   │   ├── research-index-resource.ts
│   │   ├── resource-cache.ts
│   │   ├── resource-router.ts
│   │   ├── rule-by-id-resource.ts
│   │   ├── rule-catalog-resource.ts
│   │   ├── rule-generation-resource.ts
│   │   ├── technology-by-name-resource.ts
│   │   ├── todo-by-id-resource.ts
│   │   ├── todo-list-resource.ts
│   │   ├── validated-pattern-by-platform-resource.ts
│   │   └── validated-patterns-catalog-resource.ts
│   ├── templates
│   │   └── domain-knowledge-templates.ts
│   ├── tools
│   │   ├── adr-bootstrap-validation-tool.ts
│   │   ├── adr-suggestion-tool.ts
│   │   ├── adr-validation-tool.ts
│   │   ├── bootstrap-validation-loop-tool.ts
│   │   ├── content-masking-tool.ts
│   │   ├── conversation-memory-tool.ts
│   │   ├── deployment-analysis-tool.ts
│   │   ├── deployment-guidance-tool.ts
│   │   ├── deployment-readiness-tool.ts
│   │   ├── environment-analysis-tool.ts
│   │   ├── expand-analysis-tool.ts
│   │   ├── get-server-context-tool.ts
│   │   ├── interactive-adr-planning-tool.ts
│   │   ├── llm-cloud-management-tool.ts
│   │   ├── llm-database-management-tool.ts
│   │   ├── llm-web-search-tool.ts
│   │   ├── mcp-planning-tool.ts
│   │   ├── memory-loading-tool.ts
│   │   ├── perform-research-tool.ts
│   │   ├── research-integration-tool.ts
│   │   ├── research-question-tool.ts
│   │   ├── review-existing-adrs-tool.ts
│   │   ├── rule-generation-tool.ts
│   │   ├── smart-git-push-tool-v2.ts
│   │   ├── smart-git-push-tool.ts
│   │   ├── tool-chain-orchestrator.ts
│   │   └── troubleshoot-guided-workflow-tool.ts
│   ├── types
│   │   ├── ape-framework.ts
│   │   ├── conversation-context.ts
│   │   ├── conversation-memory.ts
│   │   ├── enhanced-errors.ts
│   │   ├── index.ts
│   │   ├── knowledge-generation.ts
│   │   ├── knowledge-graph-schemas.ts
│   │   ├── memory-entities.ts
│   │   ├── reflexion-framework.ts
│   │   ├── state-reinforcement.ts
│   │   ├── tiered-response.ts
│   │   ├── tool-arguments.ts
│   │   └── tool-context.ts
│   └── utils
│       ├── actual-file-operations.ts
│       ├── adr-discovery.ts
│       ├── adr-knowledge-initializer.ts
│       ├── adr-suggestions.ts
│       ├── ai-executor.ts
│       ├── apply-cot-enhancement.ts
│       ├── automatic-prompt-engineering.ts
│       ├── cache.ts
│       ├── chain-of-thought-template.ts
│       ├── conditional-request.ts
│       ├── config.ts
│       ├── content-masking.ts
│       ├── context-document-manager.ts
│       ├── conversation-memory-manager.ts
│       ├── dag-executor.ts
│       ├── deployment-analysis.ts
│       ├── deployment-type-registry.ts
│       ├── directory-compat.ts
│       ├── dynamic-deployment-intelligence.ts
│       ├── enhanced-logging.ts
│       ├── environment-analysis.ts
│       ├── environment-capability-registry.ts
│       ├── file-system.ts
│       ├── file-system.ts.backup
│       ├── gitleaks-detector.ts
│       ├── index.ts
│       ├── interactive-approval.ts
│       ├── json-safe.ts
│       ├── knowledge-generation.ts
│       ├── knowledge-graph-manager.ts
│       ├── llm-artifact-detector.ts
│       ├── location-filter.ts
│       ├── mcp-response-validator.ts
│       ├── memory-entity-manager.ts
│       ├── memory-health-scoring.ts
│       ├── memory-migration-manager.ts
│       ├── memory-relationship-mapper.ts
│       ├── memory-rollback-manager.ts
│       ├── memory-transformation.ts
│       ├── monitoring.ts
│       ├── output-masking.ts
│       ├── pattern-contribution-helper.ts
│       ├── pattern-loader.ts
│       ├── pattern-research-utility.ts
│       ├── pattern-to-dag-converter.ts
│       ├── platform-detector.ts
│       ├── prompt-composition.ts
│       ├── prompt-execution.ts
│       ├── reflexion.ts
│       ├── release-readiness-detector.ts
│       ├── research-documentation.ts
│       ├── research-integration.ts
│       ├── research-orchestrator.ts
│       ├── research-questions.ts
│       ├── resource-versioning.ts
│       ├── ripgrep-wrapper.ts
│       ├── root-manager.ts
│       ├── rule-format.ts
│       ├── rule-generation.ts
│       ├── server-context-generator.ts
│       ├── state-reinforcement-manager.ts
│       ├── tiered-response-manager.ts
│       ├── tree-sitter-analyzer.ts
│       └── validated-pattern-definitions.ts
├── test-results
│   └── junit.xml
├── tests
│   ├── __mocks__
│   │   ├── @tree-sitter-grammars
│   │   │   └── tree-sitter-hcl.ts
│   │   ├── tree-sitter-bash.ts
│   │   ├── tree-sitter-dockerfile.ts
│   │   ├── tree-sitter-javascript.ts
│   │   ├── tree-sitter-json.ts
│   │   ├── tree-sitter-python.ts
│   │   ├── tree-sitter-typescript.ts
│   │   ├── tree-sitter-yaml.ts
│   │   └── tree-sitter.ts
│   ├── ape.test.ts
│   ├── cache-architecture-analysis.md
│   ├── cache.test.ts
│   ├── config
│   │   └── ai-config.test.ts
│   ├── config.test.ts
│   ├── index.test.ts
│   ├── integration
│   │   ├── hybrid-dag-kubernetes.test.ts
│   │   ├── memory-migration-integration.test.ts
│   │   ├── memory-migration-simple.test.ts
│   │   ├── memory-system-integration.test.ts
│   │   └── smart-code-linking.test.ts
│   ├── knowledge-generation.test.ts
│   ├── mcp-server.test.ts
│   ├── performance
│   │   └── memory-performance.test.ts
│   ├── performance-effectiveness.test.ts
│   ├── prompts
│   │   ├── deployment-analysis-prompts.test.ts
│   │   ├── environment-analysis-prompts.test.ts
│   │   ├── research-integration-prompts.test.ts
│   │   ├── research-question-prompts.test.ts
│   │   ├── rule-generation-prompts.test.ts
│   │   └── security-prompts.test.ts
│   ├── README.md
│   ├── reflexion.test.ts
│   ├── research-integration-tool.test.ts
│   ├── research-question-tool.test.ts
│   ├── resources
│   │   ├── code-quality-resource.test.ts
│   │   └── deployment-history-resource.test.ts
│   ├── setup.ts
│   ├── smart-git-push-release-readiness.test.ts
│   ├── smart-git-push-v2.test.ts
│   ├── smart-git-push.test.ts
│   ├── smoke.test.ts
│   ├── templates
│   │   └── domain-knowledge-templates.test.ts
│   ├── tools
│   │   ├── adr-bootstrap-validation-tool.test.ts
│   │   ├── adr-suggestion-tool.test.ts
│   │   ├── adr-validation-tool.test.ts
│   │   ├── bootstrap-validation-loop-tool.test.ts
│   │   ├── content-masking-tool.test.ts
│   │   ├── deployment-analysis-tool.test.ts
│   │   ├── deployment-guidance-tool.test.ts
│   │   ├── deployment-readiness-tool.test.ts
│   │   ├── environment-analysis-tool.test.ts
│   │   ├── interactive-adr-planning-tool.test.ts
│   │   ├── mcp-planning-tool.test.ts
│   │   ├── memory-loading-tool.test.ts
│   │   ├── perform-research-tool.test.ts
│   │   ├── perform-research-tool.test.ts.backup
│   │   ├── research-integration-tool.test.ts
│   │   ├── review-existing-adrs-tool.test.ts
│   │   ├── rule-generation-tool.test.ts
│   │   ├── smart-git-push-tool-v2.test.ts
│   │   ├── smart-git-push-tool.test.ts
│   │   ├── tool-chain-orchestrator.test.ts
│   │   └── troubleshoot-guided-workflow-tool.test.ts
│   ├── types
│   │   └── conversation-context.test.ts
│   ├── types.test.ts
│   ├── utils
│   │   ├── adr-knowledge-initializer.test.ts
│   │   ├── advanced-prompting-test-utils.ts
│   │   ├── ai-executor.test.ts
│   │   ├── conditional-request.test.ts
│   │   ├── context-document-manager.test.ts
│   │   ├── deployment-analysis.test.ts
│   │   ├── environment-capability-registry.test.ts
│   │   ├── file-system.test.ts
│   │   ├── find-related-code.test.ts
│   │   ├── gitleaks-detector.test.ts
│   │   ├── interactive-approval.test.ts
│   │   ├── llm-artifact-detector.test.ts
│   │   ├── location-filter.test.ts
│   │   ├── mcp-response-validator.test.ts
│   │   ├── memory-entity-manager.test.ts
│   │   ├── memory-relationship-mapper.test.ts
│   │   ├── memory-rollback-manager.test.ts
│   │   ├── memory-transformation.test.ts
│   │   ├── monitoring-smoke.test.ts
│   │   ├── monitoring.test.ts
│   │   ├── output-masking.test.ts
│   │   ├── pattern-loader.test.ts
│   │   ├── pattern-validation.test.ts
│   │   ├── prompt-composition.test.ts
│   │   ├── prompt-execution.test.ts
│   │   ├── release-readiness-detector.test.ts
│   │   ├── research-documentation.test.ts
│   │   ├── research-integration.test.ts
│   │   ├── research-orchestrator.test.ts
│   │   ├── research-questions.test.ts
│   │   ├── resource-versioning.test.ts
│   │   ├── rule-format.test.ts
│   │   ├── rule-generation.test.ts
│   │   ├── test-config.ts
│   │   ├── test-helpers.test.ts
│   │   ├── test-helpers.ts
│   │   ├── test-infrastructure.test.ts
│   │   ├── test-infrastructure.ts
│   │   ├── tree-sitter-analyzer.test.ts
│   │   └── tree-sitter-jest-integration.test.ts
│   └── version.test.ts
├── tsconfig.json
└── typedoc.json
```

# Files

--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------

```typescript
   1 | #!/usr/bin/env node
   2 | 
   3 | /**
   4 |  * MCP ADR Analysis Server
   5 |  * Main entry point for the Model Context Protocol server
   6 |  *
   7 |  * This server provides Tools, Resources, and Prompts for analyzing
   8 |  * Architectural Decision Records and project architecture.
   9 |  */
  10 | 
  11 | import { Server } from '@modelcontextprotocol/sdk/server/index.js';
  12 | import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
  13 | import {
  14 |   CallToolRequestSchema,
  15 |   ListToolsRequestSchema,
  16 |   ListResourcesRequestSchema,
  17 |   ReadResourceRequestSchema,
  18 |   ListPromptsRequestSchema,
  19 |   GetPromptRequestSchema,
  20 |   type CallToolResult,
  21 | } from '@modelcontextprotocol/sdk/types.js';
  22 | 
  23 | import { readFileSync } from 'fs';
  24 | import { join } from 'path';
  25 | import { getCurrentDirCompat } from './utils/directory-compat.js';
  26 | import { McpAdrError } from './types/index.js';
  27 | import { CONVERSATION_CONTEXT_SCHEMA } from './types/conversation-context.js';
  28 | import {
  29 |   maskMcpResponse,
  30 |   createMaskingConfig,
  31 |   type MaskingConfig,
  32 | } from './utils/output-masking.js';
  33 | import {
  34 |   loadConfig,
  35 |   validateProjectPath,
  36 |   createLogger,
  37 |   printConfigSummary,
  38 |   type ServerConfig,
  39 | } from './utils/config.js';
  40 | import { KnowledgeGraphManager } from './utils/knowledge-graph-manager.js';
  41 | import { StateReinforcementManager } from './utils/state-reinforcement-manager.js';
  42 | import { ConversationMemoryManager } from './utils/conversation-memory-manager.js';
  43 | import { MemoryEntityManager } from './utils/memory-entity-manager.js';
  44 | import { RootManager } from './utils/root-manager.js';
  45 | import { ServerContextGenerator } from './utils/server-context-generator.js';
  46 | import { type ToolContext, createNoOpContext } from './types/tool-context.js';
  47 | import {
  48 |   type GetWorkflowGuidanceArgs,
  49 |   type GetArchitecturalContextArgs,
  50 |   type GetDevelopmentGuidanceArgs,
  51 |   type GenerateAdrFromDecisionArgs,
  52 |   type ValidateRulesArgs,
  53 |   type CreateRuleSetArgs,
  54 |   type ToolChainOrchestratorArgs,
  55 |   type ReadFileArgs,
  56 |   type WriteFileArgs,
  57 |   type AnalyzeProjectEcosystemArgs,
  58 |   type ArchitecturalDomain,
  59 |   type AnalyzeContentSecurityArgs,
  60 |   type GenerateContentMaskingArgs,
  61 |   type ConfigureCustomPatternsArgs,
  62 |   type ApplyBasicContentMaskingArgs,
  63 |   type ValidateContentMaskingArgs,
  64 |   type ActionArgs,
  65 |   type TodoManagementV2Args,
  66 |   type GenerateArchitecturalKnowledgeFunction,
  67 |   type ExecuteWithReflexionFunction,
  68 |   type RetrieveRelevantMemoriesFunction,
  69 |   type CreateToolReflexionConfigFunction,
  70 | } from './types/tool-arguments.js';
  71 | 
  72 | /**
  73 |  * Get version from package.json
  74 |  */
  75 | function getPackageVersion(): string {
  76 |   try {
  77 |     // Handle both Jest environment and normal execution
  78 |     const currentDir = getCurrentDirCompat();
  79 | 
  80 |     // Strategy 1: Try multiple possible locations for package.json
  81 |     const possiblePaths = [
  82 |       join(currentDir, 'package.json'),
  83 |       join(currentDir, '..', 'package.json'),
  84 |       join(currentDir, '..', '..', 'package.json'),
  85 |       join(process.cwd(), 'package.json'),
  86 |     ];
  87 | 
  88 |     for (const packageJsonPath of possiblePaths) {
  89 |       try {
  90 |         const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
  91 |         if (packageJson.name === 'mcp-adr-analysis-server') {
  92 |           return packageJson.version;
  93 |         }
  94 |       } catch {
  95 |         // Try next path
  96 |       }
  97 |     }
  98 | 
  99 |     // Strategy 2: Use process.env.npm_package_version if available (during npm scripts)
 100 |     if (process.env['npm_package_version']) {
 101 |       return process.env['npm_package_version'];
 102 |     }
 103 | 
 104 |     // Final fallback: Use generic version instead of hardcoded specific version
 105 |     // This prevents the need to update this code when version changes
 106 |     return 'unknown'; // Generic fallback - no longer tied to specific version
 107 |   } catch (error) {
 108 |     console.error('Error reading package.json:', error);
 109 |     return 'unknown'; // Generic fallback - no longer tied to specific version
 110 |   }
 111 | }
 112 | 
 113 | /**
 114 |  * Server configuration
 115 |  */
 116 | const SERVER_INFO = {
 117 |   name: 'mcp-adr-analysis-server',
 118 |   version: getPackageVersion(),
 119 |   description: 'MCP server for analyzing Architectural Decision Records and project architecture',
 120 | };
 121 | 
 122 | /**
 123 |  * Main server class
 124 |  */
 125 | export class McpAdrAnalysisServer {
 126 |   private server: Server;
 127 |   private maskingConfig: MaskingConfig;
 128 |   private config: ServerConfig;
 129 |   private logger: ReturnType<typeof createLogger>;
 130 |   private kgManager: KnowledgeGraphManager;
 131 |   private stateReinforcementManager: StateReinforcementManager;
 132 |   private conversationMemoryManager: ConversationMemoryManager;
 133 |   private memoryEntityManager: MemoryEntityManager;
 134 |   private rootManager: RootManager;
 135 |   private contextGenerator: ServerContextGenerator;
 136 | 
 137 |   constructor() {
 138 |     // Load and validate configuration
 139 |     this.config = loadConfig();
 140 |     this.logger = createLogger(this.config);
 141 |     this.kgManager = new KnowledgeGraphManager();
 142 |     this.stateReinforcementManager = new StateReinforcementManager(this.kgManager);
 143 |     this.conversationMemoryManager = new ConversationMemoryManager(this.kgManager);
 144 |     this.memoryEntityManager = new MemoryEntityManager();
 145 | 
 146 |     // Initialize root manager for file access control
 147 |     this.rootManager = new RootManager(this.config.projectPath, this.config.adrDirectory);
 148 | 
 149 |     // Initialize server context generator
 150 |     this.contextGenerator = new ServerContextGenerator();
 151 | 
 152 |     // Print configuration summary
 153 |     printConfigSummary(this.config);
 154 | 
 155 |     // Note: Validation will be done during startup
 156 | 
 157 |     this.server = new Server(SERVER_INFO, {
 158 |       capabilities: {
 159 |         tools: {},
 160 |         resources: {},
 161 |         prompts: {},
 162 |       },
 163 |     });
 164 | 
 165 |     this.maskingConfig = createMaskingConfig();
 166 |     this.setupHandlers();
 167 |   }
 168 | 
 169 |   /**
 170 |    * Validate configuration and project setup
 171 |    */
 172 |   private async validateConfiguration(): Promise<void> {
 173 |     try {
 174 |       await validateProjectPath(this.config.projectPath);
 175 |       this.logger.info(`Project path validated: ${this.config.projectPath}`);
 176 |     } catch (error: unknown) {
 177 |       const errorMessage = error instanceof Error ? error.message : String(error);
 178 |       this.logger.error(`Configuration validation failed: ${errorMessage}`);
 179 |       throw error;
 180 |     }
 181 |   }
 182 | 
 183 |   /**
 184 |    * Public health check method for testing
 185 |    */
 186 |   async healthCheck(): Promise<void> {
 187 |     await this.validateConfiguration();
 188 |     this.logger.info('Health check completed successfully');
 189 |   }
 190 | 
 191 |   /**
 192 |    * Setup MCP protocol handlers
 193 |    *
 194 |    * @description Configures all Model Context Protocol request handlers for the ADR Analysis Server.
 195 |    * Implements the complete MCP specification including tools, resources, and prompts.
 196 |    *
 197 |    * @private
 198 |    * @since 2.0.0
 199 |    * @category MCP Protocol
 200 |    */
 201 |   private setupHandlers(): void {
 202 |     /**
 203 |      * List Tools Handler - MCP Protocol Endpoint
 204 |      *
 205 |      * @description Returns the complete catalog of available tools for ADR analysis,
 206 |      * research, validation, and deployment operations. Each tool includes comprehensive
 207 |      * input schemas and descriptions for client integration.
 208 |      *
 209 |      * @returns {Promise<{tools: Array}>} Complete tool catalog with schemas
 210 |      *
 211 |      * @example
 212 |      * ```typescript
 213 |      * // MCP Client usage
 214 |      * const tools = await mcpClient.listTools();
 215 |      * console.log(tools.tools.length); // 20+ available tools
 216 |      *
 217 |      * // Find specific tool
 218 |      * const researchTool = tools.tools.find(t => t.name === 'perform_research');
 219 |      * console.log(researchTool.description); // Tool description
 220 |      * ```
 221 |      *
 222 |      * @mcp-endpoint
 223 |      * @category Tools
 224 |      */
 225 |     this.server.setRequestHandler(ListToolsRequestSchema, async () => {
 226 |       return {
 227 |         tools: [
 228 |           {
 229 |             name: 'analyze_project_ecosystem',
 230 |             description:
 231 |               'Comprehensive recursive project ecosystem analysis with advanced prompting techniques (Knowledge Generation + Reflexion)',
 232 |             inputSchema: {
 233 |               type: 'object',
 234 |               properties: {
 235 |                 projectPath: {
 236 |                   type: 'string',
 237 |                   description:
 238 |                     'Path to the project directory to analyze (optional, uses configured PROJECT_PATH if not provided)',
 239 |                 },
 240 |                 includePatterns: {
 241 |                   type: 'array',
 242 |                   items: { type: 'string' },
 243 |                   description: 'File patterns to include in analysis',
 244 |                 },
 245 |                 enhancedMode: {
 246 |                   type: 'boolean',
 247 |                   description:
 248 |                     'Enable advanced prompting features (Knowledge Generation + Reflexion)',
 249 |                   default: true,
 250 |                 },
 251 |                 knowledgeEnhancement: {
 252 |                   type: 'boolean',
 253 |                   description: 'Enable Knowledge Generation for technology-specific insights',
 254 |                   default: true,
 255 |                 },
 256 |                 learningEnabled: {
 257 |                   type: 'boolean',
 258 |                   description: 'Enable Reflexion learning from past analysis outcomes',
 259 |                   default: true,
 260 |                 },
 261 |                 technologyFocus: {
 262 |                   type: 'array',
 263 |                   items: { type: 'string' },
 264 |                   description:
 265 |                     'Specific technologies to focus analysis on (auto-detected if not provided)',
 266 |                 },
 267 |                 analysisDepth: {
 268 |                   type: 'string',
 269 |                   enum: ['basic', 'detailed', 'comprehensive'],
 270 |                   description: 'Depth of ecosystem analysis',
 271 |                   default: 'comprehensive',
 272 |                 },
 273 |                 includeEnvironment: {
 274 |                   type: 'boolean',
 275 |                   description:
 276 |                     'Automatically include comprehensive environment analysis (default: true)',
 277 |                   default: true,
 278 |                 },
 279 |                 recursiveDepth: {
 280 |                   type: 'string',
 281 |                   description: 'Depth of recursive project analysis',
 282 |                   enum: ['shallow', 'moderate', 'deep', 'comprehensive'],
 283 |                   default: 'comprehensive',
 284 |                 },
 285 |                 analysisScope: {
 286 |                   type: 'array',
 287 |                   items: { type: 'string' },
 288 |                   description:
 289 |                     'Specific analysis areas to focus on (e.g., ["security", "performance", "architecture", "dependencies"])',
 290 |                 },
 291 |                 conversationContext: CONVERSATION_CONTEXT_SCHEMA,
 292 |               },
 293 |               required: [],
 294 |             },
 295 |           },
 296 |           {
 297 |             name: 'get_architectural_context',
 298 |             description:
 299 |               'Get detailed architectural context for specific files or the entire project, automatically sets up ADR infrastructure if missing, and provides outcome-focused workflow for project success',
 300 |             inputSchema: {
 301 |               type: 'object',
 302 |               properties: {
 303 |                 filePath: {
 304 |                   type: 'string',
 305 |                   description:
 306 |                     'Specific file path to analyze (optional, analyzes entire project if not provided)',
 307 |                 },
 308 |                 includeCompliance: {
 309 |                   type: 'boolean',
 310 |                   description: 'Include compliance checks in the analysis',
 311 |                   default: true,
 312 |                 },
 313 |                 conversationContext: CONVERSATION_CONTEXT_SCHEMA,
 314 |               },
 315 |             },
 316 |           },
 317 |           {
 318 |             name: 'generate_adrs_from_prd',
 319 |             description:
 320 |               'Generate Architectural Decision Records from a Product Requirements Document with advanced prompting techniques (APE + Knowledge Generation)',
 321 |             inputSchema: {
 322 |               type: 'object',
 323 |               properties: {
 324 |                 prdPath: {
 325 |                   type: 'string',
 326 |                   description: 'Path to the PRD.md file',
 327 |                 },
 328 |                 outputDirectory: {
 329 |                   type: 'string',
 330 |                   description:
 331 |                     'Directory to output generated ADRs (optional, uses configured ADR_DIRECTORY if not provided)',
 332 |                 },
 333 |                 enhancedMode: {
 334 |                   type: 'boolean',
 335 |                   description: 'Enable advanced prompting features (APE + Knowledge Generation)',
 336 |                   default: true,
 337 |                 },
 338 |                 promptOptimization: {
 339 |                   type: 'boolean',
 340 |                   description: 'Enable Automatic Prompt Engineering for optimized ADR generation',
 341 |                   default: true,
 342 |                 },
 343 |                 knowledgeEnhancement: {
 344 |                   type: 'boolean',
 345 |                   description: 'Enable Knowledge Generation for domain-specific insights',
 346 |                   default: true,
 347 |                 },
 348 |                 prdType: {
 349 |                   type: 'string',
 350 |                   enum: [
 351 |                     'web-application',
 352 |                     'mobile-app',
 353 |                     'microservices',
 354 |                     'data-platform',
 355 |                     'api-service',
 356 |                     'general',
 357 |                   ],
 358 |                   description: 'Type of PRD for optimized knowledge generation',
 359 |                   default: 'general',
 360 |                 },
 361 |                 conversationContext: CONVERSATION_CONTEXT_SCHEMA,
 362 |               },
 363 |               required: ['prdPath'],
 364 |             },
 365 |           },
 366 |           {
 367 |             name: 'compare_adr_progress',
 368 |             description:
 369 |               'Compare TODO.md progress against ADRs and current environment to validate implementation status',
 370 |             inputSchema: {
 371 |               type: 'object',
 372 |               properties: {
 373 |                 todoPath: {
 374 |                   type: 'string',
 375 |                   description: 'Path to TODO.md file to analyze',
 376 |                   default: 'TODO.md',
 377 |                 },
 378 |                 adrDirectory: {
 379 |                   type: 'string',
 380 |                   description: 'Directory containing ADR files',
 381 |                   default: 'docs/adrs',
 382 |                 },
 383 |                 projectPath: {
 384 |                   type: 'string',
 385 |                   description: 'Path to project root for environment analysis',
 386 |                   default: '.',
 387 |                 },
 388 |                 environment: {
 389 |                   type: 'string',
 390 |                   enum: ['development', 'staging', 'production', 'testing', 'auto-detect'],
 391 |                   description:
 392 |                     'Target environment context for validation (auto-detect will infer from project structure)',
 393 |                   default: 'auto-detect',
 394 |                 },
 395 |                 environmentConfig: {
 396 |                   type: 'object',
 397 |                   description: 'Environment-specific configuration and requirements',
 398 |                   properties: {
 399 |                     requiredFiles: {
 400 |                       type: 'array',
 401 |                       items: { type: 'string' },
 402 |                       description: 'Files required for this environment',
 403 |                     },
 404 |                     requiredServices: {
 405 |                       type: 'array',
 406 |                       items: { type: 'string' },
 407 |                       description: 'Services that must be implemented for this environment',
 408 |                     },
 409 |                     securityLevel: {
 410 |                       type: 'string',
 411 |                       enum: ['low', 'medium', 'high', 'critical'],
 412 |                       description: 'Required security level for this environment',
 413 |                     },
 414 |                     performanceRequirements: {
 415 |                       type: 'object',
 416 |                       description: 'Performance requirements for this environment',
 417 |                     },
 418 |                   },
 419 |                 },
 420 |                 validationType: {
 421 |                   type: 'string',
 422 |                   enum: ['full', 'todo-only', 'adr-only', 'environment-only'],
 423 |                   description: 'Type of validation to perform',
 424 |                   default: 'full',
 425 |                 },
 426 |                 includeFileChecks: {
 427 |                   type: 'boolean',
 428 |                   description: 'Include file existence and implementation checks',
 429 |                   default: true,
 430 |                 },
 431 |                 includeRuleValidation: {
 432 |                   type: 'boolean',
 433 |                   description: 'Include architectural rule compliance validation',
 434 |                   default: true,
 435 |                 },
 436 |                 deepCodeAnalysis: {
 437 |                   type: 'boolean',
 438 |                   description:
 439 |                     'Perform deep code analysis to distinguish mock from production implementations',
 440 |                   default: true,
 441 |                 },
 442 |                 functionalValidation: {
 443 |                   type: 'boolean',
 444 |                   description:
 445 |                     'Validate that code actually functions according to ADR goals, not just exists',
 446 |                   default: true,
 447 |                 },
 448 |                 strictMode: {
 449 |                   type: 'boolean',
 450 |                   description:
 451 |                     'Enable strict validation mode with reality-check mechanisms against overconfident assessments',
 452 |                   default: true,
 453 |                 },
 454 |                 environmentValidation: {
 455 |                   type: 'boolean',
 456 |                   description: 'Enable environment-specific validation rules and checks',
 457 |                   default: true,
 458 |                 },
 459 |               },
 460 |             },
 461 |           },
 462 |           {
 463 |             name: 'analyze_content_security',
 464 |             description:
 465 |               'Analyze content for sensitive information using AI-powered detection with optional memory integration for security pattern learning',
 466 |             inputSchema: {
 467 |               type: 'object',
 468 |               properties: {
 469 |                 content: {
 470 |                   type: 'string',
 471 |                   description: 'Content to analyze for sensitive information',
 472 |                 },
 473 |                 contentType: {
 474 |                   type: 'string',
 475 |                   enum: ['code', 'documentation', 'configuration', 'logs', 'general'],
 476 |                   description: 'Type of content being analyzed',
 477 |                   default: 'general',
 478 |                 },
 479 |                 userDefinedPatterns: {
 480 |                   type: 'array',
 481 |                   items: { type: 'string' },
 482 |                   description: 'User-defined sensitive patterns to detect',
 483 |                 },
 484 |                 enableMemoryIntegration: {
 485 |                   type: 'boolean',
 486 |                   description:
 487 |                     'Enable memory entity storage for security pattern learning and institutional knowledge building',
 488 |                   default: true,
 489 |                 },
 490 |                 knowledgeEnhancement: {
 491 |                   type: 'boolean',
 492 |                   description:
 493 |                     'Enable Generated Knowledge Prompting for security and privacy expertise',
 494 |                   default: true,
 495 |                 },
 496 |                 enhancedMode: {
 497 |                   type: 'boolean',
 498 |                   description: 'Enable advanced prompting features',
 499 |                   default: true,
 500 |                 },
 501 |               },
 502 |               required: ['content'],
 503 |             },
 504 |           },
 505 |           {
 506 |             name: 'generate_content_masking',
 507 |             description: 'Generate masking instructions for detected sensitive content',
 508 |             inputSchema: {
 509 |               type: 'object',
 510 |               properties: {
 511 |                 content: {
 512 |                   type: 'string',
 513 |                   description: 'Content to mask',
 514 |                 },
 515 |                 detectedItems: {
 516 |                   type: 'array',
 517 |                   items: {
 518 |                     type: 'object',
 519 |                     properties: {
 520 |                       type: { type: 'string' },
 521 |                       content: { type: 'string' },
 522 |                       startPosition: { type: 'number' },
 523 |                       endPosition: { type: 'number' },
 524 |                       severity: { type: 'string' },
 525 |                     },
 526 |                   },
 527 |                   description: 'Detected sensitive items to mask',
 528 |                 },
 529 |                 maskingStrategy: {
 530 |                   type: 'string',
 531 |                   enum: ['full', 'partial', 'placeholder', 'environment'],
 532 |                   description: 'Strategy for masking content',
 533 |                   default: 'full',
 534 |                 },
 535 |               },
 536 |               required: ['content', 'detectedItems'],
 537 |             },
 538 |           },
 539 |           {
 540 |             name: 'configure_custom_patterns',
 541 |             description: 'Configure custom sensitive patterns for a project',
 542 |             inputSchema: {
 543 |               type: 'object',
 544 |               properties: {
 545 |                 projectPath: {
 546 |                   type: 'string',
 547 |                   description: 'Path to the project directory',
 548 |                 },
 549 |                 existingPatterns: {
 550 |                   type: 'array',
 551 |                   items: { type: 'string' },
 552 |                   description: 'Existing patterns to consider',
 553 |                 },
 554 |               },
 555 |               required: ['projectPath'],
 556 |             },
 557 |           },
 558 |           {
 559 |             name: 'apply_basic_content_masking',
 560 |             description: 'Apply basic content masking (fallback when AI is not available)',
 561 |             inputSchema: {
 562 |               type: 'object',
 563 |               properties: {
 564 |                 content: {
 565 |                   type: 'string',
 566 |                   description: 'Content to mask',
 567 |                 },
 568 |                 maskingStrategy: {
 569 |                   type: 'string',
 570 |                   enum: ['full', 'partial', 'placeholder'],
 571 |                   description: 'Strategy for masking content',
 572 |                   default: 'full',
 573 |                 },
 574 |               },
 575 |               required: ['content'],
 576 |             },
 577 |           },
 578 |           {
 579 |             name: 'validate_content_masking',
 580 |             description: 'Validate that content masking was applied correctly',
 581 |             inputSchema: {
 582 |               type: 'object',
 583 |               properties: {
 584 |                 originalContent: {
 585 |                   type: 'string',
 586 |                   description: 'Original content before masking',
 587 |                 },
 588 |                 maskedContent: {
 589 |                   type: 'string',
 590 |                   description: 'Content after masking',
 591 |                 },
 592 |               },
 593 |               required: ['originalContent', 'maskedContent'],
 594 |             },
 595 |           },
 596 |           {
 597 |             name: 'manage_cache',
 598 |             description: 'Manage MCP resource cache (clear, stats, cleanup)',
 599 |             inputSchema: {
 600 |               type: 'object',
 601 |               properties: {
 602 |                 action: {
 603 |                   type: 'string',
 604 |                   enum: ['clear', 'stats', 'cleanup', 'invalidate'],
 605 |                   description: 'Cache management action to perform',
 606 |                 },
 607 |                 key: {
 608 |                   type: 'string',
 609 |                   description: 'Specific cache key to invalidate (for invalidate action)',
 610 |                 },
 611 |               },
 612 |               required: ['action'],
 613 |             },
 614 |           },
 615 |           {
 616 |             name: 'configure_output_masking',
 617 |             description: 'Configure content masking for all MCP outputs',
 618 |             inputSchema: {
 619 |               type: 'object',
 620 |               properties: {
 621 |                 enabled: {
 622 |                   type: 'boolean',
 623 |                   description: 'Enable or disable output masking',
 624 |                 },
 625 |                 strategy: {
 626 |                   type: 'string',
 627 |                   enum: ['full', 'partial', 'placeholder', 'environment'],
 628 |                   description: 'Masking strategy to use',
 629 |                 },
 630 |                 customPatterns: {
 631 |                   type: 'array',
 632 |                   items: { type: 'string' },
 633 |                   description: 'Custom patterns to mask',
 634 |                 },
 635 |                 action: {
 636 |                   type: 'string',
 637 |                   enum: ['get', 'set', 'reset'],
 638 |                   description: 'Configuration action',
 639 |                   default: 'get',
 640 |                 },
 641 |               },
 642 |             },
 643 |           },
 644 |           {
 645 |             name: 'suggest_adrs',
 646 |             description:
 647 |               'Suggest architectural decisions with advanced prompting techniques (Knowledge Generation + Reflexion). TIP: Read @.mcp-server-context.md first for project history, patterns, and previous ADRs to ensure consistency.',
 648 |             inputSchema: {
 649 |               type: 'object',
 650 |               properties: {
 651 |                 projectPath: {
 652 |                   type: 'string',
 653 |                   description: 'Path to the project directory',
 654 |                   default: '.',
 655 |                 },
 656 |                 analysisType: {
 657 |                   type: 'string',
 658 |                   enum: ['implicit_decisions', 'code_changes', 'comprehensive'],
 659 |                   description: 'Type of analysis to perform',
 660 |                   default: 'comprehensive',
 661 |                 },
 662 |                 beforeCode: {
 663 |                   type: 'string',
 664 |                   description: 'Code before changes (for code_changes analysis)',
 665 |                 },
 666 |                 afterCode: {
 667 |                   type: 'string',
 668 |                   description: 'Code after changes (for code_changes analysis)',
 669 |                 },
 670 |                 changeDescription: {
 671 |                   type: 'string',
 672 |                   description: 'Description of the changes (for code_changes analysis)',
 673 |                 },
 674 |                 commitMessages: {
 675 |                   type: 'array',
 676 |                   items: { type: 'string' },
 677 |                   description: 'Related commit messages (for code_changes analysis)',
 678 |                 },
 679 |                 existingAdrs: {
 680 |                   type: 'array',
 681 |                   items: { type: 'string' },
 682 |                   description: 'List of existing ADR titles to avoid duplication',
 683 |                 },
 684 |                 enhancedMode: {
 685 |                   type: 'boolean',
 686 |                   description:
 687 |                     'Enable advanced prompting features (Knowledge Generation + Reflexion)',
 688 |                   default: true,
 689 |                 },
 690 |                 learningEnabled: {
 691 |                   type: 'boolean',
 692 |                   description: 'Enable Reflexion learning from past experiences',
 693 |                   default: true,
 694 |                 },
 695 |                 knowledgeEnhancement: {
 696 |                   type: 'boolean',
 697 |                   description: 'Enable Knowledge Generation for domain-specific insights',
 698 |                   default: true,
 699 |                 },
 700 |                 conversationContext: CONVERSATION_CONTEXT_SCHEMA,
 701 |               },
 702 |             },
 703 |           },
 704 |           {
 705 |             name: 'generate_adr_from_decision',
 706 |             description:
 707 |               'Generate a complete ADR from decision data. TIP: Reference @.mcp-server-context.md to align with existing architectural patterns and decisions.',
 708 |             inputSchema: {
 709 |               type: 'object',
 710 |               properties: {
 711 |                 decisionData: {
 712 |                   type: 'object',
 713 |                   properties: {
 714 |                     title: { type: 'string', description: 'Decision title' },
 715 |                     context: { type: 'string', description: 'Decision context and problem' },
 716 |                     decision: { type: 'string', description: 'The architectural decision' },
 717 |                     consequences: { type: 'string', description: 'Decision consequences' },
 718 |                     alternatives: {
 719 |                       type: 'array',
 720 |                       items: { type: 'string' },
 721 |                       description: 'Alternative approaches considered',
 722 |                     },
 723 |                     evidence: {
 724 |                       type: 'array',
 725 |                       items: { type: 'string' },
 726 |                       description: 'Supporting evidence for the decision',
 727 |                     },
 728 |                   },
 729 |                   required: ['title', 'context', 'decision', 'consequences'],
 730 |                 },
 731 |                 templateFormat: {
 732 |                   type: 'string',
 733 |                   enum: ['nygard', 'madr', 'custom'],
 734 |                   description: 'ADR template format to use',
 735 |                   default: 'nygard',
 736 |                 },
 737 |                 existingAdrs: {
 738 |                   type: 'array',
 739 |                   items: { type: 'string' },
 740 |                   description: 'List of existing ADRs for numbering and references',
 741 |                 },
 742 |                 adrDirectory: {
 743 |                   type: 'string',
 744 |                   description: 'Directory where ADRs are stored',
 745 |                   default: 'docs/adrs',
 746 |                 },
 747 |               },
 748 |               required: ['decisionData'],
 749 |             },
 750 |           },
 751 |           {
 752 |             name: 'generate_adr_bootstrap',
 753 |             description:
 754 |               "Generate bootstrap.sh and validate_bootstrap.sh scripts to ensure deployed code follows ADR requirements. **CRITICAL**: Before generating scripts, use WebFetch to query the base code repository (e.g., https://github.com/validatedpatterns/common for OpenShift) and authoritative pattern documentation (e.g., https://play.validatedpatterns.io/). Merge the base repository code into your project and have bootstrap.sh call the pattern's scripts rather than generating everything from scratch. This ensures compliance with validated deployment patterns.",
 755 |             inputSchema: {
 756 |               type: 'object',
 757 |               properties: {
 758 |                 projectPath: {
 759 |                   type: 'string',
 760 |                   description: 'Path to the project directory',
 761 |                   default: '.',
 762 |                 },
 763 |                 adrDirectory: {
 764 |                   type: 'string',
 765 |                   description: 'Directory where ADRs are stored',
 766 |                   default: 'docs/adrs',
 767 |                 },
 768 |                 outputPath: {
 769 |                   type: 'string',
 770 |                   description: 'Directory where to generate scripts',
 771 |                   default: '.',
 772 |                 },
 773 |                 scriptType: {
 774 |                   type: 'string',
 775 |                   enum: ['bootstrap', 'validate', 'both'],
 776 |                   description: 'Which scripts to generate',
 777 |                   default: 'both',
 778 |                 },
 779 |                 includeTests: {
 780 |                   type: 'boolean',
 781 |                   description: 'Include test execution in bootstrap',
 782 |                   default: true,
 783 |                 },
 784 |                 includeDeployment: {
 785 |                   type: 'boolean',
 786 |                   description: 'Include deployment steps in bootstrap',
 787 |                   default: true,
 788 |                 },
 789 |                 customValidations: {
 790 |                   type: 'array',
 791 |                   items: { type: 'string' },
 792 |                   description: 'Custom validation commands to include',
 793 |                 },
 794 |                 conversationContext: CONVERSATION_CONTEXT_SCHEMA,
 795 |               },
 796 |             },
 797 |           },
 798 |           {
 799 |             name: 'bootstrap_validation_loop',
 800 |             description:
 801 |               '**GUIDED EXECUTION MODE**: This tool guides you through an interactive, step-by-step deployment validation workflow. It does NOT execute commands internally - instead, it tells YOU what commands to run and processes the results iteratively. **Workflow**: (1) First call with iteration=0: Detects platform (OpenShift/K8s/Docker), validates environment connection, and requests human approval for target platform. (2) Subsequent calls: After running each command and reporting back with output, the tool provides next steps. **Environment Validation**: Before deployment, the tool verifies connection to the target platform (e.g., `oc status` for OpenShift, `kubectl cluster-info` for K8s) and requires explicit human confirmation. **Validated Patterns Integration**: Automatically identifies base code repositories (e.g., validatedpatterns/common for OpenShift) and guides you to merge them into your project. **Deployment Cleanup**: Supports CI/CD-style workflows with deployment teardown/restart guidance. **Call this tool iteratively**, passing previous command output back each time.',
 802 |             inputSchema: {
 803 |               type: 'object',
 804 |               properties: {
 805 |                 projectPath: {
 806 |                   type: 'string',
 807 |                   description: 'Path to the project directory',
 808 |                   default: '.',
 809 |                 },
 810 |                 adrDirectory: {
 811 |                   type: 'string',
 812 |                   description: 'Directory where ADRs are stored',
 813 |                   default: 'docs/adrs',
 814 |                 },
 815 |                 targetEnvironment: {
 816 |                   type: 'string',
 817 |                   enum: ['development', 'staging', 'production', 'testing'],
 818 |                   description: 'Target deployment environment',
 819 |                   default: 'development',
 820 |                 },
 821 |                 maxIterations: {
 822 |                   type: 'number',
 823 |                   description: 'Maximum validation/fix iterations',
 824 |                   default: 5,
 825 |                 },
 826 |                 autoFix: {
 827 |                   type: 'boolean',
 828 |                   description: 'Whether to generate auto-fix suggestions in guidance',
 829 |                   default: true,
 830 |                 },
 831 |                 updateAdrsWithLearnings: {
 832 |                   type: 'boolean',
 833 |                   description: 'Update ADRs with deployment learnings (non-sensitive)',
 834 |                   default: true,
 835 |                 },
 836 |                 currentIteration: {
 837 |                   type: 'number',
 838 |                   description:
 839 |                     'Current iteration number (0 for initial call, then increment). Used to track workflow progress.',
 840 |                   default: 0,
 841 |                 },
 842 |                 previousExecutionOutput: {
 843 |                   type: 'string',
 844 |                   description:
 845 |                     'Output from the previous command execution. Paste the stdout/stderr from running the command that was recommended in the previous iteration.',
 846 |                   default: '',
 847 |                 },
 848 |                 previousExecutionSuccess: {
 849 |                   type: 'boolean',
 850 |                   description:
 851 |                     'Whether the previous command execution succeeded (exit code 0). Set to true if command succeeded, false if it failed.',
 852 |                   default: false,
 853 |                 },
 854 |                 deploymentCleanupRequested: {
 855 |                   type: 'boolean',
 856 |                   description:
 857 |                     'Set to true to request deployment cleanup/teardown guidance (for CI/CD workflows that need to delete and restart deployments).',
 858 |                   default: false,
 859 |                 },
 860 |                 conversationContext: CONVERSATION_CONTEXT_SCHEMA,
 861 |               },
 862 |             },
 863 |           },
 864 |           {
 865 |             name: 'discover_existing_adrs',
 866 |             description: 'Discover and catalog existing ADRs in the project',
 867 |             inputSchema: {
 868 |               type: 'object',
 869 |               properties: {
 870 |                 adrDirectory: {
 871 |                   type: 'string',
 872 |                   description: 'Directory to search for ADRs',
 873 |                   default: 'docs/adrs',
 874 |                 },
 875 |                 includeContent: {
 876 |                   type: 'boolean',
 877 |                   description: 'Whether to include ADR content in analysis',
 878 |                   default: false,
 879 |                 },
 880 |               },
 881 |             },
 882 |           },
 883 |           {
 884 |             name: 'review_existing_adrs',
 885 |             description:
 886 |               'Review existing ADRs against actual code implementation with cloud/DevOps expertise. TIP: After review, call get_server_context to update @.mcp-server-context.md with findings.',
 887 |             inputSchema: {
 888 |               type: 'object',
 889 |               properties: {
 890 |                 adrDirectory: {
 891 |                   type: 'string',
 892 |                   description: 'Directory containing ADR files',
 893 |                   default: 'docs/adrs',
 894 |                 },
 895 |                 projectPath: {
 896 |                   type: 'string',
 897 |                   description: 'Path to the project directory',
 898 |                   default: '.',
 899 |                 },
 900 |                 specificAdr: {
 901 |                   type: 'string',
 902 |                   description: 'Specific ADR filename or title to review (optional)',
 903 |                 },
 904 |                 analysisDepth: {
 905 |                   type: 'string',
 906 |                   enum: ['basic', 'detailed', 'comprehensive'],
 907 |                   description: 'Depth of analysis to perform',
 908 |                   default: 'detailed',
 909 |                 },
 910 |                 includeTreeSitter: {
 911 |                   type: 'boolean',
 912 |                   description: 'Use tree-sitter for enhanced code analysis',
 913 |                   default: true,
 914 |                 },
 915 |                 generateUpdatePlan: {
 916 |                   type: 'boolean',
 917 |                   description: 'Generate action plan for updating non-compliant ADRs',
 918 |                   default: true,
 919 |                 },
 920 |                 conversationContext: CONVERSATION_CONTEXT_SCHEMA,
 921 |               },
 922 |             },
 923 |           },
 924 |           {
 925 |             name: 'validate_adr',
 926 |             description:
 927 |               'Validate an existing ADR against actual infrastructure reality using research-driven analysis. TIP: Compare findings against patterns in @.mcp-server-context.md for consistency checks.',
 928 |             inputSchema: {
 929 |               type: 'object',
 930 |               properties: {
 931 |                 adrPath: {
 932 |                   type: 'string',
 933 |                   description: 'Path to the ADR file to validate (relative or absolute)',
 934 |                 },
 935 |                 projectPath: {
 936 |                   type: 'string',
 937 |                   description: 'Path to the project directory',
 938 |                   default: '.',
 939 |                 },
 940 |                 adrDirectory: {
 941 |                   type: 'string',
 942 |                   description: 'Directory containing ADR files',
 943 |                   default: 'docs/adrs',
 944 |                 },
 945 |                 includeEnvironmentCheck: {
 946 |                   type: 'boolean',
 947 |                   description: 'Include live environment verification in validation',
 948 |                   default: true,
 949 |                 },
 950 |                 confidenceThreshold: {
 951 |                   type: 'number',
 952 |                   description: 'Minimum research confidence threshold (0-1)',
 953 |                   default: 0.6,
 954 |                 },
 955 |               },
 956 |               required: ['adrPath'],
 957 |             },
 958 |           },
 959 |           {
 960 |             name: 'validate_all_adrs',
 961 |             description: 'Validate all ADRs in a directory against actual infrastructure reality',
 962 |             inputSchema: {
 963 |               type: 'object',
 964 |               properties: {
 965 |                 projectPath: {
 966 |                   type: 'string',
 967 |                   description: 'Path to the project directory',
 968 |                   default: '.',
 969 |                 },
 970 |                 adrDirectory: {
 971 |                   type: 'string',
 972 |                   description: 'Directory containing ADR files',
 973 |                   default: 'docs/adrs',
 974 |                 },
 975 |                 includeEnvironmentCheck: {
 976 |                   type: 'boolean',
 977 |                   description: 'Include live environment verification in validation',
 978 |                   default: true,
 979 |                 },
 980 |                 minConfidence: {
 981 |                   type: 'number',
 982 |                   description: 'Minimum research confidence for validation (0-1)',
 983 |                   default: 0.6,
 984 |                 },
 985 |               },
 986 |             },
 987 |           },
 988 |           {
 989 |             name: 'incorporate_research',
 990 |             description: 'Incorporate research findings into architectural decisions',
 991 |             inputSchema: {
 992 |               type: 'object',
 993 |               properties: {
 994 |                 researchPath: {
 995 |                   type: 'string',
 996 |                   description: 'Path to research directory',
 997 |                   default: 'docs/research',
 998 |                 },
 999 |                 adrDirectory: {
1000 |                   type: 'string',
1001 |                   description: 'Path to ADR directory',
1002 |                   default: 'docs/adrs',
1003 |                 },
1004 |                 analysisType: {
1005 |                   type: 'string',
1006 |                   enum: [
1007 |                     'monitor',
1008 |                     'extract_topics',
1009 |                     'evaluate_impact',
1010 |                     'generate_updates',
1011 |                     'comprehensive',
1012 |                   ],
1013 |                   description: 'Type of research analysis to perform',
1014 |                   default: 'comprehensive',
1015 |                 },
1016 |                 existingTopics: {
1017 |                   type: 'array',
1018 |                   items: { type: 'string' },
1019 |                   description: 'Previously identified research topics',
1020 |                 },
1021 |                 researchTopics: {
1022 |                   type: 'array',
1023 |                   items: {
1024 |                     type: 'object',
1025 |                     properties: {
1026 |                       id: { type: 'string' },
1027 |                       title: { type: 'string' },
1028 |                       category: { type: 'string' },
1029 |                       keyFindings: { type: 'array', items: { type: 'string' } },
1030 |                       relevanceScore: { type: 'number' },
1031 |                     },
1032 |                   },
1033 |                   description: 'Research topics for impact evaluation',
1034 |                 },
1035 |                 adrId: {
1036 |                   type: 'string',
1037 |                   description: 'ADR ID for update generation',
1038 |                 },
1039 |                 updateType: {
1040 |                   type: 'string',
1041 |                   enum: ['content', 'status', 'consequences', 'alternatives', 'deprecation'],
1042 |                   description: 'Type of ADR update to generate',
1043 |                 },
1044 |                 researchFindings: {
1045 |                   type: 'array',
1046 |                   items: {
1047 |                     type: 'object',
1048 |                     properties: {
1049 |                       finding: { type: 'string' },
1050 |                       evidence: { type: 'array', items: { type: 'string' } },
1051 |                       impact: { type: 'string' },
1052 |                     },
1053 |                   },
1054 |                   description: 'Research findings for update generation',
1055 |                 },
1056 |               },
1057 |             },
1058 |           },
1059 |           {
1060 |             name: 'create_research_template',
1061 |             description: 'Create a research template file for documenting findings',
1062 |             inputSchema: {
1063 |               type: 'object',
1064 |               properties: {
1065 |                 title: {
1066 |                   type: 'string',
1067 |                   description: 'Title of the research',
1068 |                 },
1069 |                 category: {
1070 |                   type: 'string',
1071 |                   description: 'Research category',
1072 |                   default: 'general',
1073 |                 },
1074 |                 researchPath: {
1075 |                   type: 'string',
1076 |                   description: 'Path to research directory',
1077 |                   default: 'docs/research',
1078 |                 },
1079 |               },
1080 |               required: ['title'],
1081 |             },
1082 |           },
1083 |           {
1084 |             name: 'request_action_confirmation',
1085 |             description: 'Request confirmation before applying research-based changes',
1086 |             inputSchema: {
1087 |               type: 'object',
1088 |               properties: {
1089 |                 action: {
1090 |                   type: 'string',
1091 |                   description: 'Description of the action to be performed',
1092 |                 },
1093 |                 details: {
1094 |                   type: 'string',
1095 |                   description: 'Detailed information about the action',
1096 |                 },
1097 |                 impact: {
1098 |                   type: 'string',
1099 |                   enum: ['low', 'medium', 'high', 'critical'],
1100 |                   description: 'Impact level of the action',
1101 |                   default: 'medium',
1102 |                 },
1103 |               },
1104 |               required: ['action', 'details'],
1105 |             },
1106 |           },
1107 |           {
1108 |             name: 'generate_rules',
1109 |             description: 'Generate architectural rules from ADRs and code patterns',
1110 |             inputSchema: {
1111 |               type: 'object',
1112 |               properties: {
1113 |                 source: {
1114 |                   type: 'string',
1115 |                   enum: ['adrs', 'patterns', 'both'],
1116 |                   description: 'Source for rule generation',
1117 |                   default: 'both',
1118 |                 },
1119 |                 adrDirectory: {
1120 |                   type: 'string',
1121 |                   description: 'Directory containing ADR files',
1122 |                   default: 'docs/adrs',
1123 |                 },
1124 |                 projectPath: {
1125 |                   type: 'string',
1126 |                   description: 'Path to project for pattern analysis',
1127 |                   default: '.',
1128 |                 },
1129 |                 existingRules: {
1130 |                   type: 'array',
1131 |                   items: {
1132 |                     type: 'object',
1133 |                     properties: {
1134 |                       id: { type: 'string' },
1135 |                       name: { type: 'string' },
1136 |                       description: { type: 'string' },
1137 |                     },
1138 |                   },
1139 |                   description: 'Existing rules to avoid duplication',
1140 |                 },
1141 |                 outputFormat: {
1142 |                   type: 'string',
1143 |                   enum: ['json', 'yaml', 'both'],
1144 |                   description: 'Output format for rules',
1145 |                   default: 'json',
1146 |                 },
1147 |               },
1148 |             },
1149 |           },
1150 |           {
1151 |             name: 'validate_rules',
1152 |             description: 'Validate code against architectural rules',
1153 |             inputSchema: {
1154 |               type: 'object',
1155 |               properties: {
1156 |                 filePath: {
1157 |                   type: 'string',
1158 |                   description: 'Path to file to validate',
1159 |                 },
1160 |                 fileContent: {
1161 |                   type: 'string',
1162 |                   description: 'Content to validate (alternative to filePath)',
1163 |                 },
1164 |                 fileName: {
1165 |                   type: 'string',
1166 |                   description: 'Name of file being validated (when using fileContent)',
1167 |                 },
1168 |                 rules: {
1169 |                   type: 'array',
1170 |                   items: {
1171 |                     type: 'object',
1172 |                     properties: {
1173 |                       id: { type: 'string' },
1174 |                       name: { type: 'string' },
1175 |                       description: { type: 'string' },
1176 |                       pattern: { type: 'string' },
1177 |                       severity: { type: 'string' },
1178 |                       message: { type: 'string' },
1179 |                     },
1180 |                     required: ['id', 'name', 'pattern', 'severity', 'message'],
1181 |                   },
1182 |                   description: 'Rules to validate against',
1183 |                 },
1184 |                 validationType: {
1185 |                   type: 'string',
1186 |                   enum: ['file', 'function', 'component', 'module'],
1187 |                   description: 'Type of validation to perform',
1188 |                   default: 'file',
1189 |                 },
1190 |                 reportFormat: {
1191 |                   type: 'string',
1192 |                   enum: ['summary', 'detailed', 'json'],
1193 |                   description: 'Format for validation report',
1194 |                   default: 'detailed',
1195 |                 },
1196 |               },
1197 |               required: ['rules'],
1198 |             },
1199 |           },
1200 |           {
1201 |             name: 'create_rule_set',
1202 |             description: 'Create machine-readable rule set in JSON/YAML format',
1203 |             inputSchema: {
1204 |               type: 'object',
1205 |               properties: {
1206 |                 name: {
1207 |                   type: 'string',
1208 |                   description: 'Name of the rule set',
1209 |                 },
1210 |                 description: {
1211 |                   type: 'string',
1212 |                   description: 'Description of the rule set',
1213 |                   default: 'Generated architectural rule set',
1214 |                 },
1215 |                 adrRules: {
1216 |                   type: 'array',
1217 |                   items: { type: 'object' },
1218 |                   description: 'Rules extracted from ADRs',
1219 |                 },
1220 |                 patternRules: {
1221 |                   type: 'array',
1222 |                   items: { type: 'object' },
1223 |                   description: 'Rules generated from code patterns',
1224 |                 },
1225 |                 rules: {
1226 |                   type: 'array',
1227 |                   items: { type: 'object' },
1228 |                   description: 'Additional rules to include',
1229 |                 },
1230 |                 outputFormat: {
1231 |                   type: 'string',
1232 |                   enum: ['json', 'yaml', 'both'],
1233 |                   description: 'Output format for rule set',
1234 |                   default: 'json',
1235 |                 },
1236 |                 author: {
1237 |                   type: 'string',
1238 |                   description: 'Author of the rule set',
1239 |                   default: 'MCP ADR Analysis Server',
1240 |                 },
1241 |               },
1242 |               required: ['name'],
1243 |             },
1244 |           },
1245 |           {
1246 |             name: 'analyze_environment',
1247 |             description:
1248 |               'Analyze environment context and provide optimization recommendations with optional memory integration for environment snapshot tracking',
1249 |             inputSchema: {
1250 |               type: 'object',
1251 |               properties: {
1252 |                 projectPath: {
1253 |                   type: 'string',
1254 |                   description: 'Path to project directory',
1255 |                   default: '.',
1256 |                 },
1257 |                 adrDirectory: {
1258 |                   type: 'string',
1259 |                   description: 'Directory containing ADR files',
1260 |                   default: 'docs/adrs',
1261 |                 },
1262 |                 analysisType: {
1263 |                   type: 'string',
1264 |                   enum: [
1265 |                     'specs',
1266 |                     'containerization',
1267 |                     'requirements',
1268 |                     'compliance',
1269 |                     'comprehensive',
1270 |                   ],
1271 |                   description: 'Type of environment analysis to perform',
1272 |                   default: 'comprehensive',
1273 |                 },
1274 |                 currentEnvironment: {
1275 |                   type: 'object',
1276 |                   description: 'Current environment specifications (for compliance analysis)',
1277 |                 },
1278 |                 requirements: {
1279 |                   type: 'object',
1280 |                   description: 'Environment requirements (for compliance analysis)',
1281 |                 },
1282 |                 industryStandards: {
1283 |                   type: 'array',
1284 |                   items: { type: 'string' },
1285 |                   description: 'Industry standards to assess compliance against',
1286 |                 },
1287 |                 enableMemoryIntegration: {
1288 |                   type: 'boolean',
1289 |                   description:
1290 |                     'Enable memory entity storage for environment snapshot tracking and historical analysis',
1291 |                   default: true,
1292 |                 },
1293 |                 enableTrendAnalysis: {
1294 |                   type: 'boolean',
1295 |                   description:
1296 |                     'Enable analysis of environment changes over time using stored snapshots',
1297 |                   default: true,
1298 |                 },
1299 |               },
1300 |             },
1301 |           },
1302 |           {
1303 |             name: 'generate_research_questions',
1304 |             description:
1305 |               'Generate context-aware research questions and create research tracking system',
1306 |             inputSchema: {
1307 |               type: 'object',
1308 |               properties: {
1309 |                 analysisType: {
1310 |                   type: 'string',
1311 |                   enum: ['correlation', 'relevance', 'questions', 'tracking', 'comprehensive'],
1312 |                   description: 'Type of research analysis to perform',
1313 |                   default: 'comprehensive',
1314 |                 },
1315 |                 researchContext: {
1316 |                   type: 'object',
1317 |                   properties: {
1318 |                     topic: { type: 'string' },
1319 |                     category: { type: 'string' },
1320 |                     scope: { type: 'string' },
1321 |                     objectives: { type: 'array', items: { type: 'string' } },
1322 |                     constraints: { type: 'array', items: { type: 'string' } },
1323 |                     timeline: { type: 'string' },
1324 |                   },
1325 |                   description: 'Research context and objectives',
1326 |                 },
1327 |                 problems: {
1328 |                   type: 'array',
1329 |                   items: {
1330 |                     type: 'object',
1331 |                     properties: {
1332 |                       id: { type: 'string' },
1333 |                       description: { type: 'string' },
1334 |                       category: { type: 'string' },
1335 |                       severity: { type: 'string' },
1336 |                       context: { type: 'string' },
1337 |                     },
1338 |                   },
1339 |                   description: 'Problems to correlate with knowledge graph',
1340 |                 },
1341 |                 knowledgeGraph: {
1342 |                   type: 'object',
1343 |                   properties: {
1344 |                     technologies: { type: 'array', items: { type: 'object' } },
1345 |                     patterns: { type: 'array', items: { type: 'object' } },
1346 |                     adrs: { type: 'array', items: { type: 'object' } },
1347 |                     relationships: { type: 'array', items: { type: 'object' } },
1348 |                   },
1349 |                   description: 'Architectural knowledge graph',
1350 |                 },
1351 |                 relevantKnowledge: {
1352 |                   type: 'object',
1353 |                   properties: {
1354 |                     adrs: { type: 'array', items: { type: 'object' } },
1355 |                     patterns: { type: 'array', items: { type: 'object' } },
1356 |                     gaps: { type: 'array', items: { type: 'object' } },
1357 |                     opportunities: { type: 'array', items: { type: 'object' } },
1358 |                   },
1359 |                   description: 'Relevant knowledge for question generation',
1360 |                 },
1361 |                 researchQuestions: {
1362 |                   type: 'array',
1363 |                   items: {
1364 |                     type: 'object',
1365 |                     properties: {
1366 |                       id: { type: 'string' },
1367 |                       question: { type: 'string' },
1368 |                       type: { type: 'string' },
1369 |                       priority: { type: 'string' },
1370 |                       timeline: { type: 'string' },
1371 |                       methodology: { type: 'string' },
1372 |                     },
1373 |                   },
1374 |                   description: 'Research questions for task tracking',
1375 |                 },
1376 |                 currentProgress: {
1377 |                   type: 'array',
1378 |                   items: {
1379 |                     type: 'object',
1380 |                     properties: {
1381 |                       questionId: { type: 'string' },
1382 |                       status: { type: 'string' },
1383 |                       progress: { type: 'number' },
1384 |                       findings: { type: 'array', items: { type: 'string' } },
1385 |                       blockers: { type: 'array', items: { type: 'string' } },
1386 |                     },
1387 |                   },
1388 |                   description: 'Current research progress',
1389 |                 },
1390 |                 projectPath: {
1391 |                   type: 'string',
1392 |                   description: 'Path to project directory',
1393 |                   default: '.',
1394 |                 },
1395 |                 adrDirectory: {
1396 |                   type: 'string',
1397 |                   description: 'Directory containing ADR files',
1398 |                   default: 'docs/adrs',
1399 |                 },
1400 |               },
1401 |             },
1402 |           },
1403 |           {
1404 |             name: 'perform_research',
1405 |             description:
1406 |               'Perform research using cascading sources: project files → knowledge graph → environment resources → web search (fallback)',
1407 |             inputSchema: {
1408 |               type: 'object',
1409 |               properties: {
1410 |                 question: {
1411 |                   type: 'string',
1412 |                   description: 'The research question to answer',
1413 |                 },
1414 |                 projectPath: {
1415 |                   type: 'string',
1416 |                   description: 'Path to project directory',
1417 |                   default: '.',
1418 |                 },
1419 |                 adrDirectory: {
1420 |                   type: 'string',
1421 |                   description: 'Directory containing ADR files',
1422 |                   default: 'docs/adrs',
1423 |                 },
1424 |                 confidenceThreshold: {
1425 |                   type: 'number',
1426 |                   description: 'Minimum confidence threshold (0-1) before suggesting web search',
1427 |                   default: 0.6,
1428 |                   minimum: 0,
1429 |                   maximum: 1,
1430 |                 },
1431 |                 performWebSearch: {
1432 |                   type: 'boolean',
1433 |                   description: 'Enable web search recommendations when confidence is low',
1434 |                   default: true,
1435 |                 },
1436 |               },
1437 |               required: ['question'],
1438 |             },
1439 |           },
1440 |           {
1441 |             name: 'llm_web_search',
1442 |             description: 'LLM-managed web search using Firecrawl for cross-platform support',
1443 |             inputSchema: {
1444 |               type: 'object',
1445 |               properties: {
1446 |                 query: {
1447 |                   type: 'string',
1448 |                   description: 'The search query to execute',
1449 |                 },
1450 |                 maxResults: {
1451 |                   type: 'number',
1452 |                   description: 'Maximum results to return',
1453 |                   default: 5,
1454 |                   minimum: 1,
1455 |                   maximum: 20,
1456 |                 },
1457 |                 includeContent: {
1458 |                   type: 'boolean',
1459 |                   description: 'Include full content in results',
1460 |                   default: true,
1461 |                 },
1462 |                 llmInstructions: {
1463 |                   type: 'string',
1464 |                   description: 'LLM instructions for search optimization',
1465 |                 },
1466 |                 projectPath: {
1467 |                   type: 'string',
1468 |                   description: 'Path to project directory',
1469 |                   default: '.',
1470 |                 },
1471 |                 adrDirectory: {
1472 |                   type: 'string',
1473 |                   description: 'Directory containing ADR files',
1474 |                   default: 'docs/adrs',
1475 |                 },
1476 |               },
1477 |               required: ['query'],
1478 |             },
1479 |           },
1480 |           {
1481 |             name: 'llm_cloud_management',
1482 |             description: 'LLM-managed cloud provider operations with research-driven approach',
1483 |             inputSchema: {
1484 |               type: 'object',
1485 |               properties: {
1486 |                 provider: {
1487 |                   type: 'string',
1488 |                   enum: ['aws', 'azure', 'gcp', 'redhat', 'ubuntu', 'macos'],
1489 |                   description: 'Cloud provider to use',
1490 |                 },
1491 |                 action: {
1492 |                   type: 'string',
1493 |                   description: 'Action to perform',
1494 |                 },
1495 |                 parameters: {
1496 |                   type: 'object',
1497 |                   description: 'Action parameters',
1498 |                 },
1499 |                 llmInstructions: {
1500 |                   type: 'string',
1501 |                   description: 'LLM instructions for command generation',
1502 |                 },
1503 |                 researchFirst: {
1504 |                   type: 'boolean',
1505 |                   description: 'Research best approach first',
1506 |                   default: true,
1507 |                 },
1508 |                 projectPath: {
1509 |                   type: 'string',
1510 |                   description: 'Path to project directory',
1511 |                   default: '.',
1512 |                 },
1513 |                 adrDirectory: {
1514 |                   type: 'string',
1515 |                   description: 'Directory containing ADR files',
1516 |                   default: 'docs/adrs',
1517 |                 },
1518 |               },
1519 |               required: ['provider', 'action', 'llmInstructions'],
1520 |             },
1521 |           },
1522 |           {
1523 |             name: 'llm_database_management',
1524 |             description: 'LLM-managed database operations with research-driven approach',
1525 |             inputSchema: {
1526 |               type: 'object',
1527 |               properties: {
1528 |                 database: {
1529 |                   type: 'string',
1530 |                   enum: ['postgresql', 'mongodb', 'redis', 'mysql', 'mariadb'],
1531 |                   description: 'Database type to use',
1532 |                 },
1533 |                 action: {
1534 |                   type: 'string',
1535 |                   description: 'Database action to perform',
1536 |                 },
1537 |                 parameters: {
1538 |                   type: 'object',
1539 |                   description: 'Action parameters',
1540 |                 },
1541 |                 llmInstructions: {
1542 |                   type: 'string',
1543 |                   description: 'LLM instructions for command generation',
1544 |                 },
1545 |                 researchFirst: {
1546 |                   type: 'boolean',
1547 |                   description: 'Research best approach first',
1548 |                   default: true,
1549 |                 },
1550 |                 projectPath: {
1551 |                   type: 'string',
1552 |                   description: 'Path to project directory',
1553 |                   default: '.',
1554 |                 },
1555 |                 adrDirectory: {
1556 |                   type: 'string',
1557 |                   description: 'Directory containing ADR files',
1558 |                   default: 'docs/adrs',
1559 |                 },
1560 |               },
1561 |               required: ['database', 'action', 'llmInstructions'],
1562 |             },
1563 |           },
1564 |           {
1565 |             name: 'analyze_deployment_progress',
1566 |             description: 'Analyze deployment progress and verify completion with outcome rules',
1567 |             inputSchema: {
1568 |               type: 'object',
1569 |               properties: {
1570 |                 analysisType: {
1571 |                   type: 'string',
1572 |                   enum: ['tasks', 'cicd', 'progress', 'completion', 'comprehensive'],
1573 |                   description: 'Type of deployment analysis to perform',
1574 |                   default: 'comprehensive',
1575 |                 },
1576 |                 adrDirectory: {
1577 |                   type: 'string',
1578 |                   description: 'Directory containing ADR files',
1579 |                   default: 'docs/adrs',
1580 |                 },
1581 |                 todoPath: {
1582 |                   type: 'string',
1583 |                   description: 'Path to TODO.md file for task identification',
1584 |                   default: 'TODO.md',
1585 |                 },
1586 |                 cicdLogs: {
1587 |                   type: 'string',
1588 |                   description: 'CI/CD pipeline logs for analysis',
1589 |                 },
1590 |                 pipelineConfig: {
1591 |                   type: 'string',
1592 |                   description: 'CI/CD pipeline configuration',
1593 |                 },
1594 |                 deploymentTasks: {
1595 |                   type: 'array',
1596 |                   items: {
1597 |                     type: 'object',
1598 |                     properties: {
1599 |                       taskId: { type: 'string' },
1600 |                       taskName: { type: 'string' },
1601 |                       status: { type: 'string' },
1602 |                       progress: { type: 'number' },
1603 |                       category: { type: 'string' },
1604 |                       priority: { type: 'string' },
1605 |                       verificationCriteria: { type: 'array', items: { type: 'string' } },
1606 |                       expectedOutcome: { type: 'string' },
1607 |                     },
1608 |                   },
1609 |                   description: 'Deployment tasks for progress calculation',
1610 |                 },
1611 |                 outcomeRules: {
1612 |                   type: 'array',
1613 |                   items: {
1614 |                     type: 'object',
1615 |                     properties: {
1616 |                       ruleId: { type: 'string' },
1617 |                       description: { type: 'string' },
1618 |                       criteria: { type: 'array', items: { type: 'string' } },
1619 |                       verificationMethod: { type: 'string' },
1620 |                     },
1621 |                   },
1622 |                   description: 'Outcome rules for completion verification',
1623 |                 },
1624 |                 actualOutcomes: {
1625 |                   type: 'array',
1626 |                   items: {
1627 |                     type: 'object',
1628 |                     properties: {
1629 |                       taskId: { type: 'string' },
1630 |                       outcome: { type: 'string' },
1631 |                       evidence: { type: 'array', items: { type: 'string' } },
1632 |                       timestamp: { type: 'string' },
1633 |                     },
1634 |                   },
1635 |                   description: 'Actual deployment outcomes',
1636 |                 },
1637 |                 cicdStatus: {
1638 |                   type: 'object',
1639 |                   description: 'CI/CD pipeline status data',
1640 |                 },
1641 |                 environmentStatus: {
1642 |                   type: 'object',
1643 |                   description: 'Environment status data',
1644 |                 },
1645 |               },
1646 |             },
1647 |           },
1648 |           {
1649 |             name: 'check_ai_execution_status',
1650 |             description:
1651 |               'Check AI execution configuration and status for debugging prompt-only mode issues',
1652 |             inputSchema: {
1653 |               type: 'object',
1654 |               properties: {},
1655 |               required: [],
1656 |             },
1657 |           },
1658 |           {
1659 |             name: 'get_workflow_guidance',
1660 |             description:
1661 |               'Get intelligent workflow guidance and tool recommendations based on your goals and project context to achieve expected outcomes efficiently',
1662 |             inputSchema: {
1663 |               type: 'object',
1664 |               properties: {
1665 |                 goal: {
1666 |                   type: 'string',
1667 |                   description:
1668 |                     'What you want to accomplish (e.g., "analyze new project", "document existing decisions", "security audit", "modernize legacy system")',
1669 |                 },
1670 |                 projectContext: {
1671 |                   type: 'string',
1672 |                   description:
1673 |                     'Current state of your project (e.g., "new project", "existing project with ADRs", "legacy codebase", "greenfield development")',
1674 |                   enum: [
1675 |                     'new_project',
1676 |                     'existing_with_adrs',
1677 |                     'existing_without_adrs',
1678 |                     'legacy_codebase',
1679 |                     'greenfield',
1680 |                     'maintenance_mode',
1681 |                     'unknown',
1682 |                   ],
1683 |                 },
1684 |                 availableAssets: {
1685 |                   type: 'array',
1686 |                   items: { type: 'string' },
1687 |                   description:
1688 |                     'What assets you already have (e.g., ["PRD.md", "existing ADRs", "codebase", "documentation", "test suite"])',
1689 |                 },
1690 |                 timeframe: {
1691 |                   type: 'string',
1692 |                   description: 'Available time/effort level',
1693 |                   enum: [
1694 |                     'quick_analysis',
1695 |                     'thorough_review',
1696 |                     'comprehensive_audit',
1697 |                     'ongoing_process',
1698 |                   ],
1699 |                 },
1700 |                 primaryConcerns: {
1701 |                   type: 'array',
1702 |                   items: { type: 'string' },
1703 |                   description:
1704 |                     'Main areas of concern (e.g., ["security", "performance", "maintainability", "scalability", "compliance"])',
1705 |                 },
1706 |               },
1707 |               required: ['goal', 'projectContext'],
1708 |             },
1709 |           },
1710 |           {
1711 |             name: 'get_development_guidance',
1712 |             description:
1713 |               'Get comprehensive development guidance that translates architectural decisions and workflow recommendations into specific coding tasks, implementation patterns, and development roadmap',
1714 |             inputSchema: {
1715 |               type: 'object',
1716 |               properties: {
1717 |                 developmentPhase: {
1718 |                   type: 'string',
1719 |                   description: 'Current development phase',
1720 |                   enum: [
1721 |                     'planning',
1722 |                     'setup',
1723 |                     'implementation',
1724 |                     'testing',
1725 |                     'deployment',
1726 |                     'maintenance',
1727 |                     'refactoring',
1728 |                   ],
1729 |                 },
1730 |                 adrsToImplement: {
1731 |                   type: 'array',
1732 |                   items: { type: 'string' },
1733 |                   description:
1734 |                     'List of ADR titles or file paths that need to be implemented in code',
1735 |                 },
1736 |                 technologyStack: {
1737 |                   type: 'array',
1738 |                   items: { type: 'string' },
1739 |                   description:
1740 |                     'Current technology stack (e.g., ["TypeScript", "React", "Node.js", "PostgreSQL", "Docker"])',
1741 |                 },
1742 |                 currentProgress: {
1743 |                   type: 'string',
1744 |                   description: 'What has already been implemented or current state of development',
1745 |                 },
1746 |                 teamContext: {
1747 |                   type: 'object',
1748 |                   properties: {
1749 |                     size: {
1750 |                       type: 'string',
1751 |                       enum: ['solo', 'small_team', 'medium_team', 'large_team'],
1752 |                     },
1753 |                     experienceLevel: {
1754 |                       type: 'string',
1755 |                       enum: ['junior', 'mixed', 'senior', 'expert'],
1756 |                     },
1757 |                   },
1758 |                 },
1759 |                 timeline: {
1760 |                   type: 'string',
1761 |                   description: 'Development timeline or deadline constraints',
1762 |                 },
1763 |                 focusAreas: {
1764 |                   type: 'array',
1765 |                   items: { type: 'string' },
1766 |                   description:
1767 |                     'Specific areas to focus on (e.g., ["API design", "database schema", "testing strategy", "deployment pipeline"])',
1768 |                 },
1769 |               },
1770 |               required: ['developmentPhase'],
1771 |             },
1772 |           },
1773 |           {
1774 |             name: 'list_roots',
1775 |             description:
1776 |               'List available file system roots that can be accessed. Use this to discover what directories are available before reading files.',
1777 |             inputSchema: {
1778 |               type: 'object',
1779 |               properties: {},
1780 |             },
1781 |           },
1782 |           {
1783 |             name: 'read_directory',
1784 |             description:
1785 |               'List files and folders in a directory. Use this to explore the file structure within accessible roots.',
1786 |             inputSchema: {
1787 |               type: 'object',
1788 |               properties: {
1789 |                 path: {
1790 |                   type: 'string',
1791 |                   description:
1792 |                     'Directory path to list (relative to project root or absolute within roots)',
1793 |                 },
1794 |               },
1795 |               required: ['path'],
1796 |             },
1797 |           },
1798 |           {
1799 |             name: 'read_file',
1800 |             description: 'Read contents of a file',
1801 |             inputSchema: {
1802 |               type: 'object',
1803 |               properties: {
1804 |                 path: {
1805 |                   type: 'string',
1806 |                   description: 'Path to the file to read',
1807 |                 },
1808 |               },
1809 |               required: ['path'],
1810 |             },
1811 |           },
1812 |           {
1813 |             name: 'write_file',
1814 |             description: 'Write content to a file',
1815 |             inputSchema: {
1816 |               type: 'object',
1817 |               properties: {
1818 |                 path: {
1819 |                   type: 'string',
1820 |                   description: 'Path to the file to write',
1821 |                 },
1822 |                 content: {
1823 |                   type: 'string',
1824 |                   description: 'Content to write to the file',
1825 |                 },
1826 |               },
1827 |               required: ['path', 'content'],
1828 |             },
1829 |           },
1830 |           {
1831 |             name: 'list_directory',
1832 |             description: 'List contents of a directory',
1833 |             inputSchema: {
1834 |               type: 'object',
1835 |               properties: {
1836 |                 path: {
1837 |                   type: 'string',
1838 |                   description: 'Path to the directory to list',
1839 |                 },
1840 |               },
1841 |               required: ['path'],
1842 |             },
1843 |           },
1844 |           {
1845 |             name: 'generate_deployment_guidance',
1846 |             description:
1847 |               'Generate deployment guidance and instructions from ADRs with environment-specific configurations',
1848 |             inputSchema: {
1849 |               type: 'object',
1850 |               properties: {
1851 |                 adrDirectory: {
1852 |                   type: 'string',
1853 |                   default: 'docs/adrs',
1854 |                   description: 'Directory containing ADR files',
1855 |                 },
1856 |                 environment: {
1857 |                   type: 'string',
1858 |                   enum: ['development', 'staging', 'production', 'all'],
1859 |                   default: 'production',
1860 |                   description: 'Target deployment environment',
1861 |                 },
1862 |                 format: {
1863 |                   type: 'string',
1864 |                   enum: ['markdown', 'scripts', 'structured', 'all'],
1865 |                   default: 'markdown',
1866 |                   description: 'Output format for guidance',
1867 |                 },
1868 |                 projectPath: {
1869 |                   type: 'string',
1870 |                   description:
1871 |                     'Project root path (optional, uses configured PROJECT_PATH if not provided)',
1872 |                 },
1873 |                 includeScripts: {
1874 |                   type: 'boolean',
1875 |                   default: true,
1876 |                   description: 'Generate deployment scripts',
1877 |                 },
1878 |                 includeConfigs: {
1879 |                   type: 'boolean',
1880 |                   default: true,
1881 |                   description: 'Generate configuration files',
1882 |                 },
1883 |                 includeValidation: {
1884 |                   type: 'boolean',
1885 |                   default: true,
1886 |                   description: 'Include validation and health checks',
1887 |                 },
1888 |                 technologyFilter: {
1889 |                   type: 'array',
1890 |                   items: {
1891 |                     type: 'string',
1892 |                     enum: [
1893 |                       'containerization',
1894 |                       'database',
1895 |                       'web-server',
1896 |                       'cache',
1897 |                       'message-queue',
1898 |                       'monitoring',
1899 |                       'security',
1900 |                       'ci-cd',
1901 |                       'infrastructure',
1902 |                     ],
1903 |                   },
1904 |                   description: 'Filter by specific technology categories',
1905 |                 },
1906 |                 customRequirements: {
1907 |                   type: 'array',
1908 |                   items: { type: 'string' },
1909 |                   description: 'Additional custom requirements',
1910 |                 },
1911 |                 includeRollback: {
1912 |                   type: 'boolean',
1913 |                   default: true,
1914 |                   description: 'Include rollback procedures',
1915 |                 },
1916 |                 generateFiles: {
1917 |                   type: 'boolean',
1918 |                   default: false,
1919 |                   description: 'Actually generate files (vs just guidance)',
1920 |                 },
1921 |               },
1922 |               required: [],
1923 |             },
1924 |           },
1925 |           {
1926 |             name: 'smart_git_push',
1927 |             description:
1928 |               'AI-driven security-focused git push with credential detection, file filtering, and deployment metrics tracking. Tests should be run by calling AI and results provided.',
1929 |             inputSchema: {
1930 |               type: 'object',
1931 |               properties: {
1932 |                 branch: {
1933 |                   type: 'string',
1934 |                   description:
1935 |                     'Target branch for push (optional, uses current branch if not specified)',
1936 |                 },
1937 |                 message: {
1938 |                   type: 'string',
1939 |                   description: 'Commit message (optional, commits staged files if provided)',
1940 |                 },
1941 |                 testResults: {
1942 |                   type: 'object',
1943 |                   description:
1944 |                     'Test results from AI-executed tests (required for proper deployment tracking)',
1945 |                   properties: {
1946 |                     success: {
1947 |                       type: 'boolean',
1948 |                       description: 'Whether all tests passed',
1949 |                     },
1950 |                     testsRun: {
1951 |                       type: 'number',
1952 |                       description: 'Total number of tests executed',
1953 |                     },
1954 |                     testsPassed: {
1955 |                       type: 'number',
1956 |                       description: 'Number of tests that passed',
1957 |                     },
1958 |                     testsFailed: {
1959 |                       type: 'number',
1960 |                       description: 'Number of tests that failed',
1961 |                     },
1962 |                     duration: {
1963 |                       type: 'number',
1964 |                       description: 'Test execution duration in seconds',
1965 |                     },
1966 |                     command: {
1967 |                       type: 'string',
1968 |                       description: 'Test command that was executed by AI',
1969 |                     },
1970 |                     output: {
1971 |                       type: 'string',
1972 |                       description: 'Test execution output',
1973 |                     },
1974 |                     failureDetails: {
1975 |                       type: 'array',
1976 |                       items: { type: 'string' },
1977 |                       description: 'Details of test failures',
1978 |                     },
1979 |                     testTypes: {
1980 |                       type: 'object',
1981 |                       description: 'Results broken down by test type (unit, integration, etc.)',
1982 |                       additionalProperties: {
1983 |                         type: 'object',
1984 |                         properties: {
1985 |                           passed: { type: 'number' },
1986 |                           failed: { type: 'number' },
1987 |                         },
1988 |                       },
1989 |                     },
1990 |                   },
1991 |                   required: ['success', 'testsRun', 'testsPassed', 'testsFailed'],
1992 |                 },
1993 |                 skipSecurity: {
1994 |                   type: 'boolean',
1995 |                   default: false,
1996 |                   description: 'Skip security scanning (NOT RECOMMENDED)',
1997 |                 },
1998 |                 dryRun: {
1999 |                   type: 'boolean',
2000 |                   default: false,
2001 |                   description: 'Show what would be pushed without actually pushing',
2002 |                 },
2003 |                 projectPath: {
2004 |                   type: 'string',
2005 |                   description: 'Path to project directory (defaults to current working directory)',
2006 |                 },
2007 |                 forceUnsafe: {
2008 |                   type: 'boolean',
2009 |                   default: false,
2010 |                   description: 'Override security blocks and test failures (DANGEROUS)',
2011 |                 },
2012 |               },
2013 |             },
2014 |           },
2015 |           {
2016 |             name: 'deployment_readiness',
2017 |             description:
2018 |               'Comprehensive deployment readiness validation with test failure tracking, deployment history analysis, and hard blocking for unsafe deployments. Integrates with smart_git_push for deployment gating.',
2019 |             inputSchema: {
2020 |               type: 'object',
2021 |               properties: {
2022 |                 operation: {
2023 |                   type: 'string',
2024 |                   enum: [
2025 |                     'check_readiness',
2026 |                     'validate_production',
2027 |                     'test_validation',
2028 |                     'deployment_history',
2029 |                     'full_audit',
2030 |                     'emergency_override',
2031 |                   ],
2032 |                   description: 'Type of deployment readiness check to perform',
2033 |                 },
2034 |                 projectPath: {
2035 |                   type: 'string',
2036 |                   description: 'Path to project directory (defaults to current working directory)',
2037 |                 },
2038 |                 targetEnvironment: {
2039 |                   type: 'string',
2040 |                   enum: ['staging', 'production', 'integration'],
2041 |                   default: 'production',
2042 |                   description: 'Target deployment environment',
2043 |                 },
2044 |                 strictMode: {
2045 |                   type: 'boolean',
2046 |                   default: true,
2047 |                   description: 'Enable strict validation (recommended for production)',
2048 |                 },
2049 |                 allowMockCode: {
2050 |                   type: 'boolean',
2051 |                   default: false,
2052 |                   description: 'Allow mock code in deployment (NOT RECOMMENDED)',
2053 |                 },
2054 |                 productionCodeThreshold: {
2055 |                   type: 'number',
2056 |                   default: 85,
2057 |                   description: 'Minimum production code quality score (0-100)',
2058 |                 },
2059 |                 mockCodeMaxAllowed: {
2060 |                   type: 'number',
2061 |                   default: 0,
2062 |                   description: 'Maximum mock code indicators allowed',
2063 |                 },
2064 |                 maxTestFailures: {
2065 |                   type: 'number',
2066 |                   default: 0,
2067 |                   description: 'Maximum test failures allowed (0 = zero tolerance)',
2068 |                 },
2069 |                 requireTestCoverage: {
2070 |                   type: 'number',
2071 |                   default: 80,
2072 |                   description: 'Minimum test coverage percentage required',
2073 |                 },
2074 |                 blockOnFailingTests: {
2075 |                   type: 'boolean',
2076 |                   default: true,
2077 |                   description: 'Block deployment if tests are failing',
2078 |                 },
2079 |                 testSuiteRequired: {
2080 |                   type: 'array',
2081 |                   items: { type: 'string' },
2082 |                   default: [],
2083 |                   description: 'Required test suites that must pass',
2084 |                 },
2085 |                 maxRecentFailures: {
2086 |                   type: 'number',
2087 |                   default: 2,
2088 |                   description: 'Maximum recent deployment failures allowed',
2089 |                 },
2090 |                 deploymentSuccessThreshold: {
2091 |                   type: 'number',
2092 |                   default: 80,
2093 |                   description: 'Minimum deployment success rate required (%)',
2094 |                 },
2095 |                 blockOnRecentFailures: {
2096 |                   type: 'boolean',
2097 |                   default: true,
2098 |                   description: 'Block if recent deployments failed',
2099 |                 },
2100 |                 rollbackFrequencyThreshold: {
2101 |                   type: 'number',
2102 |                   default: 20,
2103 |                   description: 'Maximum rollback frequency allowed (%)',
2104 |                 },
2105 |                 requireAdrCompliance: {
2106 |                   type: 'boolean',
2107 |                   default: true,
2108 |                   description: 'Require ADR compliance validation',
2109 |                 },
2110 |                 integrateTodoTasks: {
2111 |                   type: 'boolean',
2112 |                   default: true,
2113 |                   description: 'Auto-create blocking tasks for issues',
2114 |                 },
2115 |                 updateHealthScoring: {
2116 |                   type: 'boolean',
2117 |                   default: true,
2118 |                   description: 'Update project health scores',
2119 |                 },
2120 |                 triggerSmartGitPush: {
2121 |                   type: 'boolean',
2122 |                   default: false,
2123 |                   description: 'Trigger smart git push validation',
2124 |                 },
2125 |                 emergencyBypass: {
2126 |                   type: 'boolean',
2127 |                   default: false,
2128 |                   description: 'Emergency bypass for critical fixes',
2129 |                 },
2130 |                 businessJustification: {
2131 |                   type: 'string',
2132 |                   description:
2133 |                     'Business justification for overrides (required for emergency_override)',
2134 |                 },
2135 |                 approvalRequired: {
2136 |                   type: 'boolean',
2137 |                   default: true,
2138 |                   description: 'Require approval for overrides',
2139 |                 },
2140 |                 enableMemoryIntegration: {
2141 |                   type: 'boolean',
2142 |                   description:
2143 |                     'Enable memory entity storage for deployment assessment tracking and historical analysis',
2144 |                   default: true,
2145 |                 },
2146 |                 migrateExistingHistory: {
2147 |                   type: 'boolean',
2148 |                   description: 'Migrate existing JSON-based deployment history to memory entities',
2149 |                   default: true,
2150 |                 },
2151 |               },
2152 |               required: ['operation'],
2153 |             },
2154 |           },
2155 |           {
2156 |             name: 'troubleshoot_guided_workflow',
2157 |             description:
2158 |               'Structured failure analysis and test plan generation with memory integration for troubleshooting session tracking and intelligent ADR/research suggestion capabilities - provide JSON failure info to get specific test commands',
2159 |             inputSchema: {
2160 |               type: 'object',
2161 |               properties: {
2162 |                 operation: {
2163 |                   type: 'string',
2164 |                   enum: ['analyze_failure', 'generate_test_plan', 'full_workflow'],
2165 |                   description: 'Type of troubleshooting operation',
2166 |                 },
2167 |                 failure: {
2168 |                   type: 'object',
2169 |                   properties: {
2170 |                     failureType: {
2171 |                       type: 'string',
2172 |                       enum: [
2173 |                         'test_failure',
2174 |                         'deployment_failure',
2175 |                         'build_failure',
2176 |                         'runtime_error',
2177 |                         'performance_issue',
2178 |                         'security_issue',
2179 |                         'other',
2180 |                       ],
2181 |                       description: 'Type of failure',
2182 |                     },
2183 |                     failureDetails: {
2184 |                       type: 'object',
2185 |                       properties: {
2186 |                         command: {
2187 |                           type: 'string',
2188 |                           description: 'Command that failed (optional)',
2189 |                         },
2190 |                         exitCode: {
2191 |                           type: 'number',
2192 |                           description: 'Exit code of failed process (optional)',
2193 |                         },
2194 |                         errorMessage: {
2195 |                           type: 'string',
2196 |                           description: 'Primary error message',
2197 |                         },
2198 |                         stackTrace: {
2199 |                           type: 'string',
2200 |                           description: 'Stack trace if available (optional)',
2201 |                         },
2202 |                         logOutput: {
2203 |                           type: 'string',
2204 |                           description: 'Relevant log output (optional)',
2205 |                         },
2206 |                         environment: {
2207 |                           type: 'string',
2208 |                           description: 'Environment where failure occurred (optional)',
2209 |                         },
2210 |                         timestamp: {
2211 |                           type: 'string',
2212 |                           description: 'When the failure occurred (optional)',
2213 |                         },
2214 |                         affectedFiles: {
2215 |                           type: 'array',
2216 |                           items: { type: 'string' },
2217 |                           description: 'Files involved in the failure (optional)',
2218 |                         },
2219 |                       },
2220 |                       required: ['errorMessage'],
2221 |                       description: 'Detailed failure information',
2222 |                     },
2223 |                     context: {
2224 |                       type: 'object',
2225 |                       properties: {
2226 |                         recentChanges: {
2227 |                           type: 'string',
2228 |                           description: 'Recent changes that might be related (optional)',
2229 |                         },
2230 |                         reproducible: {
2231 |                           type: 'boolean',
2232 |                           description: 'Whether the failure is reproducible (optional)',
2233 |                         },
2234 |                         frequency: {
2235 |                           type: 'string',
2236 |                           description: 'How often this failure occurs (optional)',
2237 |                         },
2238 |                         impact: {
2239 |                           type: 'string',
2240 |                           enum: ['low', 'medium', 'high', 'critical'],
2241 |                           description: 'Impact level of the failure (optional)',
2242 |                         },
2243 |                       },
2244 |                       description: 'Additional context about the failure (optional)',
2245 |                     },
2246 |                   },
2247 |                   required: ['failureType', 'failureDetails'],
2248 |                   description:
2249 |                     'Structured failure information (required for analyze_failure and generate_test_plan)',
2250 |                 },
2251 |                 projectPath: {
2252 |                   type: 'string',
2253 |                   description: 'Path to project directory (optional)',
2254 |                 },
2255 |                 adrDirectory: {
2256 |                   type: 'string',
2257 |                   description: 'ADR directory path',
2258 |                   default: 'docs/adrs',
2259 |                 },
2260 |                 todoPath: {
2261 |                   type: 'string',
2262 |                   description: 'Path to TODO.md file',
2263 |                   default: 'TODO.md',
2264 |                 },
2265 |                 enableMemoryIntegration: {
2266 |                   type: 'boolean',
2267 |                   description:
2268 |                     'Enable memory entity storage for troubleshooting session tracking and pattern recognition',
2269 |                   default: true,
2270 |                 },
2271 |                 enablePatternRecognition: {
2272 |                   type: 'boolean',
2273 |                   description: 'Enable automatic pattern recognition and failure classification',
2274 |                   default: true,
2275 |                 },
2276 |                 enableAdrSuggestion: {
2277 |                   type: 'boolean',
2278 |                   description: 'Enable automatic ADR suggestion based on recurring failures',
2279 |                   default: true,
2280 |                 },
2281 |                 enableResearchGeneration: {
2282 |                   type: 'boolean',
2283 |                   description:
2284 |                     'Enable automatic research question generation for persistent problems',
2285 |                   default: true,
2286 |                 },
2287 |                 conversationContext: CONVERSATION_CONTEXT_SCHEMA,
2288 |               },
2289 |               required: ['operation'],
2290 |             },
2291 |           },
2292 |           {
2293 |             name: 'smart_score',
2294 |             description:
2295 |               'Central coordination for project health scoring system - recalculate, sync, diagnose, optimize, and reset scores across all MCP tools',
2296 |             inputSchema: {
2297 |               type: 'object',
2298 |               properties: {
2299 |                 operation: {
2300 |                   type: 'string',
2301 |                   enum: [
2302 |                     'recalculate_scores',
2303 |                     'sync_scores',
2304 |                     'diagnose_scores',
2305 |                     'optimize_weights',
2306 |                     'reset_scores',
2307 |                     'get_score_trends',
2308 |                     'get_intent_scores',
2309 |                   ],
2310 |                   description: 'Smart scoring operation to perform',
2311 |                 },
2312 |                 projectPath: {
2313 |                   type: 'string',
2314 |                   description: 'Path to project directory',
2315 |                 },
2316 |                 components: {
2317 |                   type: 'array',
2318 |                   items: {
2319 |                     type: 'string',
2320 |                     enum: [
2321 |                       'task_completion',
2322 |                       'deployment_readiness',
2323 |                       'architecture_compliance',
2324 |                       'security_posture',
2325 |                       'code_quality',
2326 |                       'all',
2327 |                     ],
2328 |                   },
2329 |                   default: ['all'],
2330 |                   description: 'Score components to recalculate (for recalculate_scores operation)',
2331 |                 },
2332 |                 forceUpdate: {
2333 |                   type: 'boolean',
2334 |                   default: false,
2335 |                   description: 'Force update even if data is fresh',
2336 |                 },
2337 |                 updateSources: {
2338 |                   type: 'boolean',
2339 |                   default: true,
2340 |                   description: 'Trigger source tool updates before recalculating',
2341 |                 },
2342 |                 todoPath: {
2343 |                   type: 'string',
2344 |                   default: 'TODO.md',
2345 |                   description: 'Path to TODO.md file (for sync_scores operation)',
2346 |                 },
2347 |                 triggerTools: {
2348 |                   type: 'array',
2349 |                   items: {
2350 |                     type: 'string',
2351 |                     enum: [
2352 |                       'smart_git_push',
2353 |                       'compare_adr_progress',
2354 |                       'analyze_content_security',
2355 |                       'validate_rules',
2356 |                     ],
2357 |                   },
2358 |                   description: 'Tools to trigger for fresh data (for sync_scores operation)',
2359 |                 },
2360 |                 rebalanceWeights: {
2361 |                   type: 'boolean',
2362 |                   default: false,
2363 |                   description: 'Recalculate optimal scoring weights (for sync_scores operation)',
2364 |                 },
2365 |                 includeHistory: {
2366 |                   type: 'boolean',
2367 |                   default: true,
2368 |                   description: 'Include score history analysis (for diagnose_scores operation)',
2369 |                 },
2370 |                 checkDataFreshness: {
2371 |                   type: 'boolean',
2372 |                   default: true,
2373 |                   description:
2374 |                     'Validate data freshness across tools (for diagnose_scores operation)',
2375 |                 },
2376 |                 suggestImprovements: {
2377 |                   type: 'boolean',
2378 |                   default: true,
2379 |                   description:
2380 |                     'Provide score improvement suggestions (for diagnose_scores operation)',
2381 |                 },
2382 |                 analysisMode: {
2383 |                   type: 'string',
2384 |                   enum: ['current_state', 'historical_data', 'project_type'],
2385 |                   default: 'current_state',
2386 |                   description: 'Method for weight optimization (for optimize_weights operation)',
2387 |                 },
2388 |                 customWeights: {
2389 |                   type: 'object',
2390 |                   properties: {
2391 |                     taskCompletion: { type: 'number', minimum: 0, maximum: 1 },
2392 |                     deploymentReadiness: { type: 'number', minimum: 0, maximum: 1 },
2393 |                     architectureCompliance: { type: 'number', minimum: 0, maximum: 1 },
2394 |                     securityPosture: { type: 'number', minimum: 0, maximum: 1 },
2395 |                     codeQuality: { type: 'number', minimum: 0, maximum: 1 },
2396 |                   },
2397 |                   description: 'Custom weight overrides (for optimize_weights operation)',
2398 |                 },
2399 |                 previewOnly: {
2400 |                   type: 'boolean',
2401 |                   default: false,
2402 |                   description: 'Preview changes without applying (for optimize_weights operation)',
2403 |                 },
2404 |                 component: {
2405 |                   type: 'string',
2406 |                   enum: [
2407 |                     'task_completion',
2408 |                     'deployment_readiness',
2409 |                     'architecture_compliance',
2410 |                     'security_posture',
2411 |                     'code_quality',
2412 |                     'all',
2413 |                   ],
2414 |                   default: 'all',
2415 |                   description: 'Score component to reset (for reset_scores operation)',
2416 |                 },
2417 |                 preserveHistory: {
2418 |                   type: 'boolean',
2419 |                   default: true,
2420 |                   description: 'Preserve score history in backup (for reset_scores operation)',
2421 |                 },
2422 |                 recalculateAfterReset: {
2423 |                   type: 'boolean',
2424 |                   default: true,
2425 |                   description: 'Immediately recalculate after reset (for reset_scores operation)',
2426 |                 },
2427 |                 intentId: {
2428 |                   type: 'string',
2429 |                   description:
2430 |                     'Intent ID to get score trends for (for get_intent_scores operation)',
2431 |                 },
2432 |               },
2433 |               required: ['operation', 'projectPath'],
2434 |             },
2435 |           },
2436 |           {
2437 |             name: 'mcp_planning',
2438 |             description:
2439 |               'Enhanced project planning and workflow management tool - phase-based project management, team resource allocation, progress tracking, risk analysis, and executive reporting',
2440 |             inputSchema: {
2441 |               type: 'object',
2442 |               properties: {
2443 |                 operation: {
2444 |                   type: 'string',
2445 |                   enum: [
2446 |                     'create_project',
2447 |                     'manage_phases',
2448 |                     'track_progress',
2449 |                     'manage_resources',
2450 |                     'risk_analysis',
2451 |                     'generate_reports',
2452 |                   ],
2453 |                   description: 'Project planning operation to perform',
2454 |                 },
2455 |                 projectPath: {
2456 |                   type: 'string',
2457 |                   description: 'Project root path',
2458 |                 },
2459 |                 projectName: {
2460 |                   type: 'string',
2461 |                   description: 'Project name (for create_project operation)',
2462 |                 },
2463 |                 description: {
2464 |                   type: 'string',
2465 |                   description: 'Project description (for create_project operation)',
2466 |                 },
2467 |                 phases: {
2468 |                   type: 'array',
2469 |                   items: {
2470 |                     type: 'object',
2471 |                     properties: {
2472 |                       name: { type: 'string' },
2473 |                       duration: { type: 'string' },
2474 |                       dependencies: {
2475 |                         type: 'array',
2476 |                         items: { type: 'string' },
2477 |                         default: [],
2478 |                       },
2479 |                       milestones: {
2480 |                         type: 'array',
2481 |                         items: { type: 'string' },
2482 |                         default: [],
2483 |                       },
2484 |                     },
2485 |                     required: ['name', 'duration'],
2486 |                   },
2487 |                   description: 'Initial project phases (for create_project operation)',
2488 |                 },
2489 |                 team: {
2490 |                   type: 'array',
2491 |                   items: {
2492 |                     type: 'object',
2493 |                     properties: {
2494 |                       name: { type: 'string' },
2495 |                       role: { type: 'string' },
2496 |                       skills: {
2497 |                         type: 'array',
2498 |                         items: { type: 'string' },
2499 |                         default: [],
2500 |                       },
2501 |                       capacity: { type: 'string' },
2502 |                     },
2503 |                     required: ['name', 'role', 'capacity'],
2504 |                   },
2505 |                   default: [],
2506 |                   description: 'Team structure (for create_project operation)',
2507 |                 },
2508 |                 importFromAdrs: {
2509 |                   type: 'boolean',
2510 |                   default: true,
2511 |                   description: 'Import phases from existing ADRs (for create_project operation)',
2512 |                 },
2513 |                 importFromTodos: {
2514 |                   type: 'boolean',
2515 |                   default: true,
2516 |                   description: 'Import tasks from TODO system (for create_project operation)',
2517 |                 },
2518 |                 action: {
2519 |                   type: 'string',
2520 |                   enum: [
2521 |                     'list',
2522 |                     'create',
2523 |                     'update',
2524 |                     'delete',
2525 |                     'transition',
2526 |                     'add',
2527 |                     'remove',
2528 |                     'allocate',
2529 |                     'optimize',
2530 |                   ],
2531 |                   description: 'Management action (for manage_phases/manage_resources operations)',
2532 |                 },
2533 |                 phaseId: {
2534 |                   type: 'string',
2535 |                   description: 'Phase ID for phase operations',
2536 |                 },
2537 |                 phaseData: {
2538 |                   type: 'object',
2539 |                   properties: {
2540 |                     name: { type: 'string' },
2541 |                     description: { type: 'string' },
2542 |                     estimatedDuration: { type: 'string' },
2543 |                     dependencies: {
2544 |                       type: 'array',
2545 |                       items: { type: 'string' },
2546 |                     },
2547 |                     milestones: {
2548 |                       type: 'array',
2549 |                       items: { type: 'string' },
2550 |                     },
2551 |                     linkedAdrs: {
2552 |                       type: 'array',
2553 |                       items: { type: 'string' },
2554 |                     },
2555 |                   },
2556 |                   description: 'Phase data for create/update operations',
2557 |                 },
2558 |                 targetStatus: {
2559 |                   type: 'string',
2560 |                   enum: ['planning', 'active', 'completed', 'blocked', 'cancelled'],
2561 |                   description: 'Target status for phase transition',
2562 |                 },
2563 |                 reportType: {
2564 |                   type: 'string',
2565 |                   enum: [
2566 |                     'summary',
2567 |                     'detailed',
2568 |                     'gantt',
2569 |                     'milestones',
2570 |                     'risks',
2571 |                     'executive',
2572 |                     'status',
2573 |                     'health',
2574 |                     'team_performance',
2575 |                     'milestone_tracking',
2576 |                   ],
2577 |                   default: 'summary',
2578 |                   description: 'Type of progress report or generated report',
2579 |                 },
2580 |                 timeframe: {
2581 |                   type: 'string',
2582 |                   enum: [
2583 |                     'current',
2584 |                     'weekly',
2585 |                     'monthly',
2586 |                     'quarterly',
2587 |                     'week',
2588 |                     'month',
2589 |                     'quarter',
2590 |                     'project',
2591 |                   ],
2592 |                   default: 'current',
2593 |                   description: 'Time frame for reports and tracking',
2594 |                 },
2595 |                 includeVisuals: {
2596 |                   type: 'boolean',
2597 |                   default: true,
2598 |                   description: 'Include visual progress indicators',
2599 |                 },
2600 |                 updateTaskProgress: {
2601 |                   type: 'boolean',
2602 |                   default: true,
2603 |                   description: 'Sync progress from TODO system',
2604 |                 },
2605 |                 memberId: {
2606 |                   type: 'string',
2607 |                   description: 'Team member ID for resource operations',
2608 |                 },
2609 |                 memberData: {
2610 |                   type: 'object',
2611 |                   properties: {
2612 |                     name: { type: 'string' },
2613 |                     role: { type: 'string' },
2614 |                     skills: {
2615 |                       type: 'array',
2616 |                       items: { type: 'string' },
2617 |                     },
2618 |                     capacity: { type: 'string' },
2619 |                   },
2620 |                   description: 'Team member data for resource operations',
2621 |                 },
2622 |                 allocationData: {
2623 |                   type: 'object',
2624 |                   properties: {
2625 |                     phaseId: { type: 'string' },
2626 |                     allocation: {
2627 |                       type: 'number',
2628 |                       minimum: 0,
2629 |                       maximum: 100,
2630 |                     },
2631 |                   },
2632 |                   required: ['phaseId', 'allocation'],
2633 |                   description: 'Resource allocation data',
2634 |                 },
2635 |                 analysisType: {
2636 |                   type: 'string',
2637 |                   enum: ['automated', 'manual', 'comprehensive'],
2638 |                   default: 'comprehensive',
2639 |                   description: 'Type of risk analysis',
2640 |                 },
2641 |                 includeAdrRisks: {
2642 |                   type: 'boolean',
2643 |                   default: true,
2644 |                   description: 'Analyze risks from ADR complexity',
2645 |                 },
2646 |                 includeDependencyRisks: {
2647 |                   type: 'boolean',
2648 |                   default: true,
2649 |                   description: 'Analyze dependency chain risks',
2650 |                 },
2651 |                 includeResourceRisks: {
2652 |                   type: 'boolean',
2653 |                   default: true,
2654 |                   description: 'Analyze resource allocation risks',
2655 |                 },
2656 |                 generateMitigation: {
2657 |                   type: 'boolean',
2658 |                   default: true,
2659 |                   description: 'Generate mitigation strategies',
2660 |                 },
2661 |                 format: {
2662 |                   type: 'string',
2663 |                   enum: ['markdown', 'json', 'html'],
2664 |                   default: 'markdown',
2665 |                   description: 'Report output format',
2666 |                 },
2667 |                 includeCharts: {
2668 |                   type: 'boolean',
2669 |                   default: true,
2670 |                   description: 'Include progress charts and graphs',
2671 |                 },
2672 |               },
2673 |               required: ['operation', 'projectPath'],
2674 |             },
2675 |           },
2676 |           {
2677 |             name: 'interactive_adr_planning',
2678 |             description:
2679 |               'Interactive guided ADR planning and creation tool - walks users through structured decision-making process with research integration, option evaluation, and automatic ADR generation. TIP: Start by reading @.mcp-server-context.md to understand project context and previous decisions.',
2680 |             inputSchema: {
2681 |               type: 'object',
2682 |               properties: {
2683 |                 operation: {
2684 |                   type: 'string',
2685 |                   enum: [
2686 |                     'start_session',
2687 |                     'continue_session',
2688 |                     'provide_input',
2689 |                     'request_research',
2690 |                     'evaluate_options',
2691 |                     'make_decision',
2692 |                     'assess_impact',
2693 |                     'plan_implementation',
2694 |                     'generate_adr',
2695 |                     'update_todos',
2696 |                     'get_guidance',
2697 |                     'save_session',
2698 |                     'complete_session',
2699 |                   ],
2700 |                   description: 'Interactive planning operation to perform',
2701 |                 },
2702 |                 sessionId: {
2703 |                   type: 'string',
2704 |                   description:
2705 |                     'Planning session ID (required for all operations except start_session)',
2706 |                 },
2707 |                 input: {
2708 |                   type: 'string',
2709 |                   description: 'User input for the current phase (varies by phase)',
2710 |                 },
2711 |                 projectPath: {
2712 |                   type: 'string',
2713 |                   description: 'Project root path',
2714 |                 },
2715 |                 autoResearch: {
2716 |                   type: 'boolean',
2717 |                   default: true,
2718 |                   description: 'Automatically trigger research when needed',
2719 |                 },
2720 |                 generateTodos: {
2721 |                   type: 'boolean',
2722 |                   default: true,
2723 |                   description: 'Automatically generate TODO items from decisions',
2724 |                 },
2725 |               },
2726 |               required: ['operation', 'projectPath'],
2727 |             },
2728 |           },
2729 |           {
2730 |             name: 'memory_loading',
2731 |             description:
2732 |               'Advanced memory loading tool for the memory-centric architecture. Query, explore, and manage memory entities and relationships. Load ADRs into memory system and perform intelligent queries.',
2733 |             inputSchema: {
2734 |               type: 'object',
2735 |               properties: {
2736 |                 action: {
2737 |                   type: 'string',
2738 |                   enum: [
2739 |                     'load_adrs',
2740 |                     'query_entities',
2741 |                     'get_entity',
2742 |                     'find_related',
2743 |                     'get_intelligence',
2744 |                     'create_snapshot',
2745 |                   ],
2746 |                   description: 'Memory operation to perform',
2747 |                   default: 'query_entities',
2748 |                 },
2749 |                 query: {
2750 |                   type: 'object',
2751 |                   properties: {
2752 |                     entityTypes: {
2753 |                       type: 'array',
2754 |                       items: {
2755 |                         type: 'string',
2756 |                         enum: [
2757 |                           'architectural_decision',
2758 |                           'code_component',
2759 |                           'business_requirement',
2760 |                           'technical_constraint',
2761 |                           'quality_concern',
2762 |                           'implementation_pattern',
2763 |                           'environmental_factor',
2764 |                           'stakeholder_input',
2765 |                           'knowledge_artifact',
2766 |                           'decision_context',
2767 |                         ],
2768 |                       },
2769 |                       description: 'Filter by entity types',
2770 |                     },
2771 |                     tags: {
2772 |                       type: 'array',
2773 |                       items: { type: 'string' },
2774 |                       description: 'Filter by tags',
2775 |                     },
2776 |                     textQuery: {
2777 |                       type: 'string',
2778 |                       description: 'Full-text search query',
2779 |                     },
2780 |                     relationshipTypes: {
2781 |                       type: 'array',
2782 |                       items: {
2783 |                         type: 'string',
2784 |                         enum: [
2785 |                           'depends_on',
2786 |                           'influences',
2787 |                           'conflicts_with',
2788 |                           'implements',
2789 |                           'supersedes',
2790 |                           'relates_to',
2791 |                           'originated_from',
2792 |                           'impacts',
2793 |                           'constrains',
2794 |                         ],
2795 |                       },
2796 |                       description: 'Filter by relationship types',
2797 |                     },
2798 |                     confidenceThreshold: {
2799 |                       type: 'number',
2800 |                       minimum: 0,
2801 |                       maximum: 1,
2802 |                       description: 'Minimum confidence threshold',
2803 |                     },
2804 |                     relevanceThreshold: {
2805 |                       type: 'number',
2806 |                       minimum: 0,
2807 |                       maximum: 1,
2808 |                       description: 'Minimum relevance threshold',
2809 |                     },
2810 |                     timeRange: {
2811 |                       type: 'object',
2812 |                       properties: {
2813 |                         from: { type: 'string', description: 'Start date (ISO 8601)' },
2814 |                         to: { type: 'string', description: 'End date (ISO 8601)' },
2815 |                       },
2816 |                       description: 'Filter by time range',
2817 |                     },
2818 |                     contextFilters: {
2819 |                       type: 'object',
2820 |                       properties: {
2821 |                         projectPhase: { type: 'string', description: 'Project phase filter' },
2822 |                         businessDomain: { type: 'string', description: 'Business domain filter' },
2823 |                         technicalStack: {
2824 |                           type: 'array',
2825 |                           items: { type: 'string' },
2826 |                           description: 'Technical stack filter',
2827 |                         },
2828 |                         environmentalFactors: {
2829 |                           type: 'array',
2830 |                           items: { type: 'string' },
2831 |                           description: 'Environmental factors filter',
2832 |                         },
2833 |                       },
2834 |                       description: 'Context-based filters',
2835 |                     },
2836 |                     limit: {
2837 |                       type: 'number',
2838 |                       minimum: 1,
2839 |                       description: 'Maximum number of results',
2840 |                     },
2841 |                     sortBy: {
2842 |                       type: 'string',
2843 |                       enum: ['relevance', 'confidence', 'lastModified', 'created', 'accessCount'],
2844 |                       description: 'Sort field',
2845 |                       default: 'relevance',
2846 |                     },
2847 |                     includeRelated: {
2848 |                       type: 'boolean',
2849 |                       description: 'Include related entities and relationships',
2850 |                       default: false,
2851 |                     },
2852 |                     relationshipDepth: {
2853 |                       type: 'number',
2854 |                       minimum: 1,
2855 |                       maximum: 5,
2856 |                       description: 'Maximum relationship traversal depth',
2857 |                       default: 2,
2858 |                     },
2859 |                   },
2860 |                   description: 'Query parameters for entity search',
2861 |                 },
2862 |                 entityId: {
2863 |                   type: 'string',
2864 |                   description: 'Entity ID for get_entity and find_related actions',
2865 |                 },
2866 |                 maxDepth: {
2867 |                   type: 'number',
2868 |                   minimum: 1,
2869 |                   maximum: 5,
2870 |                   description: 'Maximum depth for relationship traversal (find_related action)',
2871 |                   default: 2,
2872 |                 },
2873 |                 forceReload: {
2874 |                   type: 'boolean',
2875 |                   description: 'Force reload of ADRs (load_adrs action)',
2876 |                   default: false,
2877 |                 },
2878 |               },
2879 |             },
2880 |           },
2881 |           {
2882 |             name: 'expand_analysis_section',
2883 |             description:
2884 |               'Retrieve full analysis content from tiered responses. Expand entire analysis or specific sections stored in memory. Use this when a tool returns a summary with an expandable ID.',
2885 |             inputSchema: {
2886 |               type: 'object',
2887 |               properties: {
2888 |                 expandableId: {
2889 |                   type: 'string',
2890 |                   description: 'ID of the expandable analysis (provided in tiered response)',
2891 |                 },
2892 |                 section: {
2893 |                   type: 'string',
2894 |                   description:
2895 |                     'Optional: Specific section to expand (omit to get full analysis). Available sections are listed in the tiered response.',
2896 |                 },
2897 |                 format: {
2898 |                   type: 'string',
2899 |                   enum: ['markdown', 'json'],
2900 |                   description: 'Output format (default: markdown)',
2901 |                   default: 'markdown',
2902 |                 },
2903 |               },
2904 |               required: ['expandableId'],
2905 |             },
2906 |           },
2907 |           {
2908 |             name: 'tool_chain_orchestrator',
2909 |             description:
2910 |               'AI-powered dynamic tool sequencing - intelligently analyze user requests and generate structured tool execution plans',
2911 |             inputSchema: {
2912 |               type: 'object',
2913 |               properties: {
2914 |                 userRequest: {
2915 |                   type: 'string',
2916 |                   description: 'User request to analyze and create tool execution plan for',
2917 |                 },
2918 |                 availableTools: {
2919 |                   type: 'array',
2920 |                   items: { type: 'string' },
2921 |                   description: 'List of available MCP tools to orchestrate',
2922 |                 },
2923 |                 executionMode: {
2924 |                   type: 'string',
2925 |                   enum: ['plan_only', 'plan_and_execute', 'validate_plan'],
2926 |                   description: 'Orchestration mode',
2927 |                   default: 'plan_only',
2928 |                 },
2929 |                 maxSteps: {
2930 |                   type: 'number',
2931 |                   description: 'Maximum number of steps in the execution plan',
2932 |                   default: 10,
2933 |                 },
2934 |                 allowParallel: {
2935 |                   type: 'boolean',
2936 |                   description: 'Allow parallel execution of independent steps',
2937 |                   default: true,
2938 |                 },
2939 |                 contextHints: {
2940 |                   type: 'array',
2941 |                   items: { type: 'string' },
2942 |                   description: 'Additional context hints for better plan generation',
2943 |                 },
2944 |               },
2945 |               required: ['userRequest'],
2946 |             },
2947 |           },
2948 |           {
2949 |             name: 'expand_memory',
2950 |             description:
2951 |               'Phase 3: Retrieve and expand stored content from a tiered response using its expandable ID',
2952 |             inputSchema: {
2953 |               type: 'object',
2954 |               properties: {
2955 |                 expandableId: {
2956 |                   type: 'string',
2957 |                   description: 'Expandable ID from a tiered response',
2958 |                 },
2959 |                 section: {
2960 |                   type: 'string',
2961 |                   description: 'Optional: specific section to expand',
2962 |                 },
2963 |                 includeContext: {
2964 |                   type: 'boolean',
2965 |                   description: 'Include related conversation context and knowledge graph state',
2966 |                   default: true,
2967 |                 },
2968 |               },
2969 |               required: ['expandableId'],
2970 |             },
2971 |           },
2972 |           {
2973 |             name: 'query_conversation_history',
2974 |             description: 'Phase 3: Search and retrieve conversation sessions based on filters',
2975 |             inputSchema: {
2976 |               type: 'object',
2977 |               properties: {
2978 |                 projectPath: {
2979 |                   type: 'string',
2980 |                   description: 'Filter by project path',
2981 |                 },
2982 |                 dateRange: {
2983 |                   type: 'object',
2984 |                   properties: {
2985 |                     start: { type: 'string', description: 'Start date (ISO 8601)' },
2986 |                     end: { type: 'string', description: 'End date (ISO 8601)' },
2987 |                   },
2988 |                   description: 'Filter by date range',
2989 |                 },
2990 |                 toolsUsed: {
2991 |                   type: 'array',
2992 |                   items: { type: 'string' },
2993 |                   description: 'Filter by tools used in the session',
2994 |                 },
2995 |                 keyword: {
2996 |                   type: 'string',
2997 |                   description: 'Search keyword in conversation turns',
2998 |                 },
2999 |                 limit: {
3000 |                   type: 'number',
3001 |                   description: 'Maximum number of sessions to return',
3002 |                   default: 10,
3003 |                 },
3004 |               },
3005 |             },
3006 |           },
3007 |           {
3008 |             name: 'get_conversation_snapshot',
3009 |             description:
3010 |               'Phase 3: Get current conversation context snapshot for resumption or analysis',
3011 |             inputSchema: {
3012 |               type: 'object',
3013 |               properties: {
3014 |                 recentTurnCount: {
3015 |                   type: 'number',
3016 |                   description: 'Number of recent turns to include',
3017 |                   default: 5,
3018 |                 },
3019 |               },
3020 |             },
3021 |           },
3022 |           {
3023 |             name: 'get_memory_stats',
3024 |             description: 'Phase 3: Get statistics about stored conversation memory',
3025 |             inputSchema: {
3026 |               type: 'object',
3027 |               properties: {},
3028 |             },
3029 |           },
3030 |           {
3031 |             name: 'get_server_context',
3032 |             description:
3033 |               "Generate a comprehensive context file showing the server's current state, memory, and capabilities. Creates .mcp-server-context.md that can be @ referenced in conversations for instant LLM awareness",
3034 |             inputSchema: {
3035 |               type: 'object',
3036 |               properties: {
3037 |                 writeToFile: {
3038 |                   type: 'boolean',
3039 |                   description: 'Whether to write the context to .mcp-server-context.md file',
3040 |                   default: true,
3041 |                 },
3042 |                 outputPath: {
3043 |                   type: 'string',
3044 |                   description: 'Custom output path for the context file',
3045 |                 },
3046 |                 includeDetailed: {
3047 |                   type: 'boolean',
3048 |                   description: 'Include detailed information',
3049 |                   default: true,
3050 |                 },
3051 |                 maxRecentItems: {
3052 |                   type: 'number',
3053 |                   description: 'Maximum number of recent items to show',
3054 |                   default: 5,
3055 |                 },
3056 |               },
3057 |             },
3058 |           },
3059 |         ],
3060 |       };
3061 |     });
3062 | 
3063 |     /**
3064 |      * Call Tool Handler - MCP Protocol Endpoint
3065 |      *
3066 |      * @description Executes specific tools with provided arguments. This is the core
3067 |      * execution endpoint that routes tool calls to their respective implementations.
3068 |      * Includes comprehensive error handling, argument validation, and response masking.
3069 |      *
3070 |      * @param {CallToolRequest} request - MCP tool execution request
3071 |      * @param {string} request.params.name - Tool name to execute
3072 |      * @param {Object} request.params.arguments - Tool-specific arguments
3073 |      *
3074 |      * @returns {Promise<CallToolResult>} Tool execution result with content and metadata
3075 |      *
3076 |      * @throws {McpAdrError} When tool execution fails or arguments are invalid
3077 |      *
3078 |      * @example
3079 |      * ```typescript
3080 |      * // Execute research tool
3081 |      * const result = await mcpClient.callTool('perform_research', {
3082 |      *   question: 'What authentication methods are used?',
3083 |      *   projectPath: '/path/to/project'
3084 |      * });
3085 |      *
3086 |      * console.log(result.content); // Research findings
3087 |      * ```
3088 |      *
3089 |      * @example
3090 |      * ```typescript
3091 |      * // Execute ADR validation
3092 |      * const validation = await mcpClient.callTool('validate_adr', {
3093 |      *   adrPath: 'docs/adrs/0001-auth-choice.md',
3094 |      *   includeEnvironmentCheck: true
3095 |      * });
3096 |      *
3097 |      * console.log(validation.isValid); // true/false
3098 |      * console.log(validation.findings); // Validation issues
3099 |      * ```
3100 |      *
3101 |      * @mcp-endpoint
3102 |      * @category Tools
3103 |      * @category Execution
3104 |      */
3105 |     this.server.setRequestHandler(CallToolRequestSchema, async request => {
3106 |       const { name, arguments: args } = request.params;
3107 | 
3108 |       // Create context for progress notifications and logging
3109 |       const context: ToolContext = {
3110 |         info: (message: string) => {
3111 |           this.logger.info(message);
3112 |           // Note: MCP progress notifications will be available in future SDK versions
3113 |           // For now, we log to server console for visibility
3114 |         },
3115 |         report_progress: (progress: number, total?: number) => {
3116 |           const percentage = total ? Math.round((progress / total) * 100) : progress;
3117 |           this.logger.info(`Progress: ${percentage}%${total ? ` (${progress}/${total})` : ''}`);
3118 |         },
3119 |         warn: (message: string) => {
3120 |           this.logger.warn(message);
3121 |         },
3122 |         error: (message: string) => {
3123 |           this.logger.error(message);
3124 |         },
3125 |       };
3126 | 
3127 |       try {
3128 |         let response: CallToolResult;
3129 |         const safeArgs = args || {};
3130 | 
3131 |         switch (name) {
3132 |           case 'analyze_project_ecosystem':
3133 |             response = await this.analyzeProjectEcosystem(
3134 |               safeArgs as unknown as AnalyzeProjectEcosystemArgs,
3135 |               context
3136 |             );
3137 |             break;
3138 |           case 'get_architectural_context':
3139 |             response = await this.getArchitecturalContext(
3140 |               safeArgs as unknown as GetArchitecturalContextArgs
3141 |             );
3142 |             break;
3143 |           case 'generate_adrs_from_prd':
3144 |             response = await this.generateAdrsFromPrd(safeArgs, context);
3145 |             break;
3146 |           case 'compare_adr_progress':
3147 |             response = await this.compareAdrProgress(safeArgs);
3148 |             break;
3149 |           case 'analyze_content_security':
3150 |             response = await this.analyzeContentSecurity(
3151 |               safeArgs as unknown as AnalyzeContentSecurityArgs
3152 |             );
3153 |             break;
3154 |           case 'generate_content_masking':
3155 |             response = await this.generateContentMasking(
3156 |               safeArgs as unknown as GenerateContentMaskingArgs
3157 |             );
3158 |             break;
3159 |           case 'configure_custom_patterns':
3160 |             response = await this.configureCustomPatterns(
3161 |               safeArgs as unknown as ConfigureCustomPatternsArgs
3162 |             );
3163 |             break;
3164 |           case 'apply_basic_content_masking':
3165 |             response = await this.applyBasicContentMasking(
3166 |               safeArgs as unknown as ApplyBasicContentMaskingArgs
3167 |             );
3168 |             break;
3169 |           case 'validate_content_masking':
3170 |             response = await this.validateContentMasking(
3171 |               safeArgs as unknown as ValidateContentMaskingArgs
3172 |             );
3173 |             break;
3174 |           case 'manage_cache':
3175 |             response = await this.manageCache(safeArgs);
3176 |             break;
3177 |           case 'configure_output_masking':
3178 |             response = await this.configureOutputMasking(safeArgs);
3179 |             break;
3180 |           case 'suggest_adrs':
3181 |             response = await this.suggestAdrs(safeArgs);
3182 |             break;
3183 |           case 'generate_adr_from_decision':
3184 |             response = await this.generateAdrFromDecision(
3185 |               safeArgs as unknown as GenerateAdrFromDecisionArgs
3186 |             );
3187 |             break;
3188 |           case 'generate_adr_bootstrap':
3189 |             response = await this.generateAdrBootstrap(safeArgs);
3190 |             break;
3191 |           case 'bootstrap_validation_loop':
3192 |             response = await this.bootstrapValidationLoop(safeArgs);
3193 |             break;
3194 |           case 'discover_existing_adrs':
3195 |             response = await this.discoverExistingAdrs(safeArgs, context);
3196 |             break;
3197 |           case 'review_existing_adrs':
3198 |             response = await this.reviewExistingAdrs(safeArgs);
3199 |             break;
3200 |           case 'validate_adr':
3201 |             response = await this.validateAdr(safeArgs);
3202 |             break;
3203 |           case 'validate_all_adrs':
3204 |             response = await this.validateAllAdrs(safeArgs);
3205 |             break;
3206 |           case 'incorporate_research':
3207 |             response = await this.incorporateResearch(safeArgs);
3208 |             break;
3209 |           case 'create_research_template':
3210 |             response = await this.createResearchTemplate(safeArgs);
3211 |             break;
3212 |           case 'request_action_confirmation':
3213 |             response = await this.requestActionConfirmation(safeArgs);
3214 |             break;
3215 |           case 'generate_rules':
3216 |             response = await this.generateRules(safeArgs);
3217 |             break;
3218 |           case 'validate_rules':
3219 |             response = await this.validateRules(safeArgs as unknown as ValidateRulesArgs);
3220 |             break;
3221 |           case 'create_rule_set':
3222 |             response = await this.createRuleSet(safeArgs as unknown as CreateRuleSetArgs);
3223 |             break;
3224 |           case 'analyze_environment':
3225 |             response = await this.analyzeEnvironment(safeArgs);
3226 |             break;
3227 |           case 'generate_research_questions':
3228 |             response = await this.generateResearchQuestions(safeArgs);
3229 |             break;
3230 |           case 'perform_research':
3231 |             response = await this.performResearch(safeArgs, context);
3232 |             break;
3233 |           case 'llm_web_search':
3234 |             response = await this.llmWebSearch(safeArgs);
3235 |             break;
3236 |           case 'llm_cloud_management':
3237 |             response = await this.llmCloudManagement(safeArgs);
3238 |             break;
3239 |           case 'llm_database_management':
3240 |             response = await this.llmDatabaseManagement(safeArgs);
3241 |             break;
3242 |           case 'analyze_deployment_progress':
3243 |             response = await this.analyzeDeploymentProgress(safeArgs);
3244 |             break;
3245 |           case 'check_ai_execution_status':
3246 |             response = await this.checkAIExecutionStatus(safeArgs);
3247 |             break;
3248 |           case 'get_workflow_guidance':
3249 |             response = await this.getWorkflowGuidance(
3250 |               safeArgs as unknown as GetWorkflowGuidanceArgs
3251 |             );
3252 |             break;
3253 |           case 'get_development_guidance':
3254 |             response = await this.getDevelopmentGuidance(
3255 |               safeArgs as unknown as GetDevelopmentGuidanceArgs
3256 |             );
3257 |             break;
3258 |           case 'list_roots':
3259 |             response = await this.listRoots();
3260 |             break;
3261 |           case 'read_directory':
3262 |             response = await this.readDirectory(safeArgs);
3263 |             break;
3264 |           case 'read_file':
3265 |             response = await this.readFile(safeArgs as unknown as ReadFileArgs);
3266 |             break;
3267 |           case 'write_file':
3268 |             response = await this.writeFile(safeArgs as unknown as WriteFileArgs);
3269 |             break;
3270 |           case 'list_directory':
3271 |             response = await this.listDirectory(safeArgs);
3272 |             break;
3273 |           case 'generate_deployment_guidance':
3274 |             response = await this.generateDeploymentGuidance(safeArgs);
3275 |             break;
3276 |           case 'smart_git_push':
3277 |             response = await this.smartGitPush(safeArgs);
3278 |             break;
3279 |           case 'deployment_readiness':
3280 |             response = await this.deploymentReadiness(safeArgs);
3281 |             break;
3282 |           case 'troubleshoot_guided_workflow':
3283 |             response = await this.troubleshootGuidedWorkflow(safeArgs);
3284 |             break;
3285 |           case 'smart_score':
3286 |             response = await this.smartScore(safeArgs);
3287 |             break;
3288 |           case 'mcp_planning':
3289 |             response = await this.mcpPlanning(safeArgs);
3290 |             break;
3291 |           case 'memory_loading':
3292 |             response = await this.memoryLoading(safeArgs);
3293 |             break;
3294 |           case 'expand_analysis_section':
3295 |             response = await this.expandAnalysisSection(safeArgs);
3296 |             break;
3297 |           case 'interactive_adr_planning':
3298 |             response = await this.interactiveAdrPlanning(safeArgs);
3299 |             break;
3300 |           case 'tool_chain_orchestrator':
3301 |             response = await this.toolChainOrchestrator(
3302 |               safeArgs as unknown as ToolChainOrchestratorArgs
3303 |             );
3304 |             break;
3305 |           case 'expand_memory':
3306 |             response = await this.expandMemory(safeArgs);
3307 |             break;
3308 |           case 'query_conversation_history':
3309 |             response = await this.queryConversationHistory(safeArgs);
3310 |             break;
3311 |           case 'get_conversation_snapshot':
3312 |             response = await this.getConversationSnapshot(safeArgs);
3313 |             break;
3314 |           case 'get_memory_stats':
3315 |             response = await this.getMemoryStats();
3316 |             break;
3317 |           case 'get_server_context':
3318 |             response = await this.getServerContext(safeArgs);
3319 |             break;
3320 |           default:
3321 |             throw new McpAdrError(`Unknown tool: ${name}`, 'UNKNOWN_TOOL');
3322 |         }
3323 | 
3324 |         // Track tool execution in knowledge graph
3325 |         await this.trackToolExecution(name, args, response, true);
3326 | 
3327 |         // Apply state reinforcement (Phase 2: Context Decay Mitigation) and content masking
3328 |         // Also record conversation turn (Phase 3: Structured External Memory)
3329 |         return await this.enrichResponseWithStateReinforcement(response, name, args);
3330 |       } catch (error) {
3331 |         // Track failed execution
3332 |         await this.trackToolExecution(
3333 |           name,
3334 |           args,
3335 |           {},
3336 |           false,
3337 |           error instanceof Error ? error.message : String(error)
3338 |         );
3339 | 
3340 |         if (error instanceof McpAdrError) {
3341 |           throw error;
3342 |         }
3343 |         throw new McpAdrError(
3344 |           `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`,
3345 |           'TOOL_EXECUTION_ERROR'
3346 |         );
3347 |       }
3348 |     });
3349 | 
3350 |     /**
3351 |      * List Resources Handler - MCP Protocol Endpoint
3352 |      *
3353 |      * @description Returns available resources for client access including the
3354 |      * architectural knowledge graph and project analysis data. Resources provide
3355 |      * read-only access to server-managed data structures.
3356 |      *
3357 |      * @returns {Promise<{resources: Array}>} Available resources with URIs and descriptions
3358 |      *
3359 |      * @example
3360 |      * ```typescript
3361 |      * // List available resources
3362 |      * const resources = await mcpClient.listResources();
3363 |      * console.log(resources.resources.length); // Available resources
3364 |      *
3365 |      * // Find knowledge graph resource
3366 |      * const kgResource = resources.resources.find(r =>
3367 |      *   r.uri === 'adr://architectural_knowledge_graph'
3368 |      * );
3369 |      * console.log(kgResource.name); // "Architectural Knowledge Graph"
3370 |      * ```
3371 |      *
3372 |      * @mcp-endpoint
3373 |      * @category Resources
3374 |      */
3375 |     this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
3376 |       return {
3377 |         resources: [
3378 |           // Existing resources (refactored to return data)
3379 |           {
3380 |             uri: 'adr://architectural_knowledge_graph',
3381 |             name: 'Architectural Knowledge Graph',
3382 |             description:
3383 |               'Complete architectural knowledge graph with technologies, patterns, and relationships',
3384 |             mimeType: 'application/json',
3385 |           },
3386 |           {
3387 |             uri: 'adr://analysis_report',
3388 |             name: 'Analysis Report',
3389 |             description: 'Comprehensive project analysis report with metrics and recommendations',
3390 |             mimeType: 'application/json',
3391 |           },
3392 |           {
3393 |             uri: 'adr://adr_list',
3394 |             name: 'ADR List',
3395 |             description: 'List of all Architectural Decision Records with status and metadata',
3396 |             mimeType: 'application/json',
3397 |           },
3398 |           // NEW Phase 1 Resources
3399 |           {
3400 |             uri: 'adr://todo_list',
3401 |             name: 'Todo List',
3402 |             description: 'Current project task list with status, priorities, and dependencies',
3403 |             mimeType: 'application/json',
3404 |           },
3405 |           {
3406 |             uri: 'adr://research_index',
3407 |             name: 'Research Index',
3408 |             description: 'Index of all research documents and findings with metadata',
3409 |             mimeType: 'application/json',
3410 |           },
3411 |           {
3412 |             uri: 'adr://rule_catalog',
3413 |             name: 'Rule Catalog',
3414 |             description: 'Catalog of all architectural and validation rules from ADRs and code',
3415 |             mimeType: 'application/json',
3416 |           },
3417 |           {
3418 |             uri: 'adr://rule_generation',
3419 |             name: 'Rule Generation',
3420 |             description:
3421 |               'AI-powered rule generation from ADRs and code patterns. Supports query parameters: ?operation=generate|validate|create_set, ?source=adrs|patterns|both, ?knowledge=true|false, ?enhanced=true|false, ?format=json|yaml|both, ?comprehensive=true|false',
3422 |             mimeType: 'application/json',
3423 |           },
3424 |           {
3425 |             uri: 'adr://project_status',
3426 |             name: 'Project Status',
3427 |             description: 'Current project status and health metrics aggregated from all sources',
3428 |             mimeType: 'application/json',
3429 |           },
3430 |           // NEW Phase 2 Templated Resources
3431 |           {
3432 |             uri: 'adr://adr/{id}',
3433 |             name: 'ADR by ID',
3434 |             description: 'Individual Architectural Decision Record by ID or title match',
3435 |             mimeType: 'application/json',
3436 |           },
3437 |           {
3438 |             uri: 'adr://research/{topic}',
3439 |             name: 'Research by Topic',
3440 |             description: 'Research documents filtered by topic with full content',
3441 |             mimeType: 'application/json',
3442 |           },
3443 |           {
3444 |             uri: 'adr://todo/{task_id}',
3445 |             name: 'Todo by Task ID',
3446 |             description:
3447 |               'Individual task details by ID or title match with dependencies and history',
3448 |             mimeType: 'application/json',
3449 |           },
3450 |           {
3451 |             uri: 'adr://rule/{rule_id}',
3452 |             name: 'Rule by ID',
3453 |             description:
3454 |               'Individual architectural rule by ID or name match with violations and usage stats',
3455 |             mimeType: 'application/json',
3456 |           },
3457 |           // NEW Phase 3 Advanced Resources
3458 |           {
3459 |             uri: 'adr://deployment_status',
3460 |             name: 'Deployment Status',
3461 |             description:
3462 |               'Current deployment state with health checks, build status, and readiness score',
3463 |             mimeType: 'application/json',
3464 |           },
3465 |           {
3466 |             uri: 'adr://environment_analysis',
3467 |             name: 'Environment Analysis',
3468 |             description:
3469 |               'System environment details including platform, dependencies, and capabilities',
3470 |             mimeType: 'application/json',
3471 |           },
3472 |           {
3473 |             uri: 'adr://memory_snapshots',
3474 |             name: 'Memory Snapshots',
3475 |             description:
3476 |               'Knowledge graph snapshots with statistics, insights, and relationship data',
3477 |             mimeType: 'application/json',
3478 |           },
3479 |           {
3480 |             uri: 'adr://project_metrics',
3481 |             name: 'Project Metrics',
3482 |             description:
3483 |               'Code metrics and quality scores including codebase stats, quality assessment, and git metrics',
3484 |             mimeType: 'application/json',
3485 |           },
3486 |           {
3487 |             uri: 'adr://technology/{name}',
3488 |             name: 'Technology by Name',
3489 |             description:
3490 |               'Individual technology analysis by name with usage, relationships, and adoption status',
3491 |             mimeType: 'application/json',
3492 |           },
3493 |           {
3494 |             uri: 'adr://pattern/{name}',
3495 |             name: 'Pattern by Name',
3496 |             description:
3497 |               'Individual pattern analysis by name with quality metrics, relationships, and examples',
3498 |             mimeType: 'application/json',
3499 |           },
3500 |           // NEW Phase 4 Final Resources
3501 |           {
3502 |             uri: 'adr://deployment_history',
3503 |             name: 'Deployment History',
3504 |             description:
3505 |               'Historical deployment data with trends, failure analysis, and patterns. Supports query parameters: ?period=7d|30d|90d|1y|all, ?environment=production|staging|development|all, ?includeFailures=true|false, ?includeMetrics=true|false, ?format=summary|detailed',
3506 |             mimeType: 'application/json',
3507 |           },
3508 |           {
3509 |             uri: 'adr://code_quality',
3510 |             name: 'Code Quality',
3511 |             description:
3512 |               'Comprehensive code quality assessment with metrics, issues, and recommendations. Supports query parameters: ?scope=full|changes|critical, ?includeMetrics=true|false, ?includeRecommendations=true|false, ?threshold=0-100, ?format=summary|detailed',
3513 |             mimeType: 'application/json',
3514 |           },
3515 |           // NEW Phase 5 Validated Pattern Resources
3516 |           {
3517 |             uri: 'adr://validated_patterns',
3518 |             name: 'Validated Patterns Catalog',
3519 |             description:
3520 |               'Complete catalog of validated deployment patterns for different platforms (OpenShift, Kubernetes, Docker, Node.js, Python, MCP, A2A) with bill of materials, deployment phases, validation checks, and authoritative sources',
3521 |             mimeType: 'application/json',
3522 |           },
3523 |           {
3524 |             uri: 'adr://validated_pattern/{platform}',
3525 |             name: 'Validated Pattern by Platform',
3526 |             description:
3527 |               'Individual validated pattern by platform type (openshift, kubernetes, docker, nodejs, python, mcp, a2a) with complete bill of materials, deployment phases, validation checks, health checks, and authoritative sources for LLM research',
3528 |             mimeType: 'application/json',
3529 |           },
3530 |           {
3531 |             uri: 'adr://pattern_sources/{platform}',
3532 |             name: 'Pattern Authoritative Sources',
3533 |             description:
3534 |               'Authoritative documentation and repository sources for a specific platform pattern, prioritized by importance with query instructions for LLMs',
3535 |             mimeType: 'application/json',
3536 |           },
3537 |           {
3538 |             uri: 'adr://pattern_base_code/{platform}',
3539 |             name: 'Pattern Base Code Repository',
3540 |             description:
3541 |               'Base code repository information for a platform pattern including URL, integration instructions, required files, and script entrypoint',
3542 |             mimeType: 'application/json',
3543 |           },
3544 |         ],
3545 |       };
3546 |     });
3547 | 
3548 |     /**
3549 |      * Read Resource Handler - MCP Protocol Endpoint
3550 |      *
3551 |      * @description Reads specific resource content by URI. Provides access to
3552 |      * architectural knowledge graphs, project analysis data, and other server-managed
3553 |      * resources with appropriate content masking applied.
3554 |      *
3555 |      * @param {ReadResourceRequest} request - MCP resource read request
3556 |      * @param {string} request.params.uri - Resource URI to read
3557 |      *
3558 |      * @returns {Promise<ReadResourceResult>} Resource content with metadata
3559 |      *
3560 |      * @throws {McpAdrError} When resource URI is invalid or access fails
3561 |      *
3562 |      * @example
3563 |      * ```typescript
3564 |      * // Read knowledge graph resource
3565 |      * const kgData = await mcpClient.readResource(
3566 |      *   'adr://architectural_knowledge_graph'
3567 |      * );
3568 |      * console.log(kgData.contents); // Knowledge graph JSON
3569 |      * ```
3570 |      *
3571 |      * @mcp-endpoint
3572 |      * @category Resources
3573 |      */
3574 |     this.server.setRequestHandler(ReadResourceRequestSchema, async request => {
3575 |       const { uri } = request.params;
3576 | 
3577 |       try {
3578 |         const response = await this.readResource(uri);
3579 |         return await this.applyOutputMasking(response);
3580 |       } catch (error) {
3581 |         if (error instanceof McpAdrError) {
3582 |           throw error;
3583 |         }
3584 |         throw new McpAdrError(
3585 |           `Resource reading failed: ${error instanceof Error ? error.message : String(error)}`,
3586 |           'RESOURCE_ERROR'
3587 |         );
3588 |       }
3589 |     });
3590 | 
3591 |     /**
3592 |      * List Prompts Handler - MCP Protocol Endpoint
3593 |      *
3594 |      * @description Returns available prompt templates for ADR analysis, research,
3595 |      * and architectural decision support. Prompts can be executed directly or
3596 |      * used as templates for custom implementations.
3597 |      *
3598 |      * @returns {Promise<{prompts: Array}>} Available prompt templates with metadata
3599 |      *
3600 |      * @example
3601 |      * ```typescript
3602 |      * // List available prompts
3603 |      * const prompts = await mcpClient.listPrompts();
3604 |      * console.log(prompts.prompts.length); // Available prompt templates
3605 |      *
3606 |      * // Find ADR analysis prompt
3607 |      * const adrPrompt = prompts.prompts.find(p =>
3608 |      *   p.name === 'adr_analysis_prompt'
3609 |      * );
3610 |      * console.log(adrPrompt.description); // Prompt description
3611 |      * ```
3612 |      *
3613 |      * @mcp-endpoint
3614 |      * @category Prompts
3615 |      */
3616 |     this.server.setRequestHandler(ListPromptsRequestSchema, async () => {
3617 |       const { allPrompts } = await import('./prompts/index.js');
3618 | 
3619 |       return {
3620 |         prompts: allPrompts.map(prompt => ({
3621 |           name: prompt.name,
3622 |           description: prompt.description,
3623 |           arguments: prompt.arguments,
3624 |         })),
3625 |       };
3626 |     });
3627 | 
3628 |     /**
3629 |      * Get Prompt Handler - MCP Protocol Endpoint
3630 |      *
3631 |      * @description Executes specific prompt templates with provided arguments.
3632 |      * Returns formatted prompts ready for AI execution or further processing.
3633 |      * Supports dynamic argument injection and template customization.
3634 |      *
3635 |      * @param {GetPromptRequest} request - MCP prompt execution request
3636 |      * @param {string} request.params.name - Prompt template name
3637 |      * @param {Object} request.params.arguments - Template-specific arguments
3638 |      *
3639 |      * @returns {Promise<GetPromptResult>} Formatted prompt with metadata
3640 |      *
3641 |      * @throws {McpAdrError} When prompt template is not found or arguments are invalid
3642 |      *
3643 |      * @example
3644 |      * ```typescript
3645 |      * // Execute ADR analysis prompt
3646 |      * const prompt = await mcpClient.getPrompt('adr_analysis_prompt', {
3647 |      *   adrPath: 'docs/adrs/0001-auth.md',
3648 |      *   projectContext: 'microservices architecture'
3649 |      * });
3650 |      *
3651 |      * console.log(prompt.messages); // Formatted prompt messages
3652 |      * ```
3653 |      *
3654 |      * @example
3655 |      * ```typescript
3656 |      * // Execute research prompt
3657 |      * const researchPrompt = await mcpClient.getPrompt('research_question_prompt', {
3658 |      *   domain: 'authentication',
3659 |      *   complexity: 'advanced'
3660 |      * });
3661 |      *
3662 |      * console.log(researchPrompt.messages[0].content); // Research prompt
3663 |      * ```
3664 |      *
3665 |      * @mcp-endpoint
3666 |      * @category Prompts
3667 |      * @category Execution
3668 |      */
3669 |     this.server.setRequestHandler(GetPromptRequestSchema, async request => {
3670 |       const { name, arguments: args } = request.params;
3671 | 
3672 |       try {
3673 |         const { allPrompts } = await import('./prompts/index.js');
3674 |         const prompt = allPrompts.find(p => p.name === name);
3675 | 
3676 |         if (!prompt) {
3677 |           throw new McpAdrError(`Unknown prompt: ${name}`, 'UNKNOWN_PROMPT');
3678 |         }
3679 | 
3680 |         // Simple template rendering (replace {{variable}} with values)
3681 |         let renderedTemplate = prompt.template;
3682 |         if (args) {
3683 |           for (const [key, value] of Object.entries(args)) {
3684 |             const regex = new RegExp(`{{${key}}}`, 'g');
3685 |             renderedTemplate = renderedTemplate.replace(regex, String(value));
3686 |           }
3687 |         }
3688 | 
3689 |         const response = {
3690 |           description: prompt.description,
3691 |           messages: [
3692 |             {
3693 |               role: 'user',
3694 |               content: {
3695 |                 type: 'text',
3696 |                 text: renderedTemplate,
3697 |               },
3698 |             },
3699 |           ],
3700 |         };
3701 | 
3702 |         return await this.applyOutputMasking(response);
3703 |       } catch (error) {
3704 |         if (error instanceof McpAdrError) {
3705 |           throw error;
3706 |         }
3707 |         throw new McpAdrError(
3708 |           `Prompt execution failed: ${error instanceof Error ? error.message : String(error)}`,
3709 |           'PROMPT_EXECUTION_ERROR'
3710 |         );
3711 |       }
3712 |     });
3713 |   }
3714 | 
3715 |   /**
3716 |    * Tool implementations
3717 |    */
3718 |   private async checkAIExecutionStatus(_args: Record<string, unknown>): Promise<CallToolResult> {
3719 |     try {
3720 |       const { getAIExecutionStatus } = await import('./utils/prompt-execution.js');
3721 |       const status = getAIExecutionStatus();
3722 | 
3723 |       return {
3724 |         content: [
3725 |           {
3726 |             type: 'text',
3727 |             text: `# AI Execution Status Diagnostic
3728 | 
3729 | ## Current Configuration
3730 | - **AI Execution Enabled**: ${status.isEnabled ? '✅ YES' : '❌ NO'}
3731 | - **Has API Key**: ${status.hasApiKey ? '✅ YES' : '❌ NO'}
3732 | - **Execution Mode**: ${status.executionMode}
3733 | - **AI Model**: ${status.model}
3734 | 
3735 | ${
3736 |   status.reason
3737 |     ? `## ⚠️ Issue Detected
3738 | **Problem**: ${status.reason}
3739 | 
3740 | ## Solution
3741 | ${
3742 |   !status.hasApiKey
3743 |     ? `
3744 | 1. Get an OpenRouter API key from https://openrouter.ai/keys
3745 | 2. Add it to your MCP configuration:
3746 |    \`\`\`json
3747 |    {
3748 |      "mcpServers": {
3749 |        "adr-analysis": {
3750 |          "command": "mcp-adr-analysis-server",
3751 |          "env": {
3752 |            "OPENROUTER_API_KEY": "your_api_key_here",
3753 |            "EXECUTION_MODE": "full",
3754 |            "AI_MODEL": "anthropic/claude-3-sonnet"
3755 |          }
3756 |        }
3757 |      }
3758 |    }
3759 |    \`\`\`
3760 | 3. Restart your MCP client (Claude Desktop, etc.)
3761 | `
3762 |     : status.executionMode !== 'full'
3763 |       ? `
3764 | 1. Update your MCP configuration to set EXECUTION_MODE to "full":
3765 |    \`\`\`json
3766 |    {
3767 |      "mcpServers": {
3768 |        "adr-analysis": {
3769 |          "env": {
3770 |            "EXECUTION_MODE": "full"
3771 |          }
3772 |        }
3773 |      }
3774 |    }
3775 |    \`\`\`
3776 | 2. Restart your MCP client
3777 | `
3778 |       : ''
3779 | }`
3780 |     : `## ✅ Configuration Looks Good!
3781 | 
3782 | AI execution is properly configured. Tools should return actual results instead of prompts.
3783 | 
3784 | If you're still seeing prompts instead of results, try:
3785 | 1. Restart your MCP client
3786 | 2. Check your OpenRouter API key has sufficient credits
3787 | 3. Verify network connectivity to OpenRouter.ai`
3788 | }
3789 | 
3790 | ## Environment Variables Expected
3791 | - **OPENROUTER_API_KEY**: Your OpenRouter API key
3792 | - **EXECUTION_MODE**: Set to "full" for AI execution
3793 | - **AI_MODEL**: AI model to use (optional, defaults to claude-3-sonnet)
3794 | 
3795 | ## Testing
3796 | After fixing the configuration, try calling \`suggest_adrs\` - it should return actual ADR suggestions instead of prompts.
3797 | `,
3798 |           },
3799 |         ],
3800 |       };
3801 |     } catch (error) {
3802 |       return {
3803 |         content: [
3804 |           {
3805 |             type: 'text',
3806 |             text: `# AI Execution Status Check Failed
3807 | 
3808 | **Error**: ${error instanceof Error ? error.message : String(error)}
3809 | 
3810 | This diagnostic tool helps identify why tools return prompts instead of actual results.
3811 | 
3812 | ## Manual Check
3813 | Verify these environment variables are set in your MCP configuration:
3814 | - OPENROUTER_API_KEY
3815 | - EXECUTION_MODE=full
3816 | - AI_MODEL (optional)
3817 | `,
3818 |           },
3819 |         ],
3820 |       };
3821 |     }
3822 |   }
3823 | 
3824 |   private async getWorkflowGuidance(args: GetWorkflowGuidanceArgs): Promise<CallToolResult> {
3825 |     const {
3826 |       goal,
3827 |       projectContext,
3828 |       availableAssets = [],
3829 |       timeframe = 'thorough_review',
3830 |       primaryConcerns = [],
3831 |     } = args;
3832 | 
3833 |     try {
3834 |       const workflowPrompt = `
3835 | # Workflow Guidance & Tool Recommendation System
3836 | 
3837 | ## User Context Analysis
3838 | - **Goal**: ${goal}
3839 | - **Project Context**: ${projectContext}
3840 | - **Available Assets**: ${availableAssets.length > 0 ? availableAssets.join(', ') : 'None specified'}
3841 | - **Timeframe**: ${timeframe}
3842 | - **Primary Concerns**: ${primaryConcerns.length > 0 ? primaryConcerns.join(', ') : 'General analysis'}
3843 | 
3844 | ## Available MCP Tools (24 Total)
3845 | 
3846 | ### 🎯 **Core Analysis Tools** (AI-Powered ✅)
3847 | 1. **analyze_project_ecosystem** - Comprehensive technology and pattern detection
3848 | 2. **get_architectural_context** - Generate intelligent architectural insights + ADR setup
3849 | 3. **generate_adrs_from_prd** - Convert requirements to structured ADRs
3850 | 4. **analyze_content_security** - Detect sensitive information patterns
3851 | 
3852 | ### 📋 **ADR Management Tools** (AI-Powered ✅)
3853 | 5. **suggest_adrs** - Auto-suggest ADRs from implicit decisions
3854 | 6. **generate_adr_from_decision** - Create ADRs from specific decisions
3855 | 7. **discover_existing_adrs** - Intelligent ADR discovery and analysis
3856 | 
3857 | ### 🔍 **Research & Documentation Tools** (AI-Powered ✅)
3858 | 8. **generate_research_questions** - Create context-aware research questions
3859 | 9. **incorporate_research** - Integrate research findings into decisions
3860 | 10. **create_research_template** - Generate research documentation templates
3861 | 
3862 | ### 🛡️ **Security & Compliance Tools** (AI-Powered ✅)
3863 | 11. **generate_content_masking** - Intelligent content masking and protection
3864 | 12. **configure_custom_patterns** - Customize security and masking settings
3865 | 13. **apply_basic_content_masking** - Basic content masking (fallback)
3866 | 14. **validate_content_masking** - Validate masking effectiveness
3867 | 
3868 | ### 🏗️ **Rule & Governance Tools** (AI-Powered ✅)
3869 | 16. **generate_rules** - Extract architectural rules from ADRs
3870 | 17. **validate_rules** - Validate code against architectural rules
3871 | 18. **create_rule_set** - Create comprehensive rule management systems
3872 | 
3873 | ### 🚀 **Deployment & Environment Tools** (AI-Powered ✅)
3874 | 19. **analyze_environment** - Environment analysis and optimization
3875 | 20. **analyze_deployment_progress** - Deployment tracking and verification
3876 | 
3877 | ### ⚙️ **Utility & Management Tools**
3878 | 21. **manage_cache** - Cache management and optimization
3879 | 22. **configure_output_masking** - Configure global output masking
3880 | 23. **request_action_confirmation** - Interactive user confirmation workflows
3881 | 24. **get_workflow_guidance** - This tool - intelligent workflow advisor
3882 | 
3883 | ## Workflow Recommendation Instructions
3884 | 
3885 | Based on the user's goal, project context, available assets, timeframe, and concerns, provide:
3886 | 
3887 | ### 1. **Recommended Tool Sequence**
3888 | Provide a step-by-step workflow with:
3889 | - **Tool Name**: Exact tool to call
3890 | - **Purpose**: Why this tool is needed
3891 | - **Expected Outcome**: What it will deliver
3892 | - **Parameters**: Suggested parameters for the tool call
3893 | - **Success Criteria**: How to know it worked
3894 | 
3895 | ### 2. **Alternative Workflows**
3896 | Provide 2-3 alternative approaches based on:
3897 | - Different time constraints
3898 | - Different priorities
3899 | - Different starting points
3900 | 
3901 | ### 3. **Expected Timeline & Effort**
3902 | For each recommended workflow:
3903 | - **Estimated Time**: How long each step takes
3904 | - **Effort Level**: Low/Medium/High effort required
3905 | - **Dependencies**: Which steps must be completed first
3906 | 
3907 | ### 4. **Success Metrics**
3908 | Define how to measure success:
3909 | - **Immediate Indicators**: Quick wins and early signals
3910 | - **Progress Milestones**: Key checkpoints
3911 | - **Final Outcomes**: Ultimate success criteria
3912 | 
3913 | ### 5. **Common Pitfalls & Tips**
3914 | - **What to Avoid**: Common mistakes in this workflow
3915 | - **Pro Tips**: Best practices for maximum effectiveness
3916 | - **Troubleshooting**: What to do if steps fail
3917 | 
3918 | ## Common Workflow Patterns
3919 | 
3920 | ### **New Project Setup**
3921 | 1. analyze_project_ecosystem → 2. get_architectural_context → 3. suggest_adrs → 4. generate_adr_from_decision
3922 | 
3923 | ### **Existing Project Analysis**
3924 | 1. discover_existing_adrs → 2. get_architectural_context → 3. validate_rules
3925 | 
3926 | ### **Security Audit**
3927 | 1. analyze_content_security → 2. generate_content_masking → 3. configure_custom_patterns → 4. validate_content_masking
3928 | 
3929 | ### **PRD to Implementation**
3930 | 1. generate_adrs_from_prd → 2. analyze_deployment_progress
3931 | 
3932 | ### **Legacy Modernization**
3933 | 1. analyze_project_ecosystem → 2. get_architectural_context → 3. suggest_adrs → 4. generate_rules → 5. validate_rules
3934 | 
3935 | ## Output Format
3936 | 
3937 | Provide a comprehensive workflow guide that includes:
3938 | 
3939 | 1. **🎯 Recommended Primary Workflow** (step-by-step with tool calls)
3940 | 2. **🔄 Alternative Approaches** (2-3 different paths)
3941 | 3. **⏱️ Timeline & Effort Estimates** (realistic expectations)
3942 | 4. **📊 Success Metrics** (how to measure progress)
3943 | 5. **💡 Pro Tips & Best Practices** (maximize effectiveness)
3944 | 6. **⚠️ Common Pitfalls** (what to avoid)
3945 | 
3946 | Make the guidance **actionable, specific, and outcome-focused** so the user can immediately start executing the recommended workflow.
3947 | `;
3948 | 
3949 |       // Execute the workflow guidance with AI if enabled
3950 |       const { executePromptWithFallback, formatMCPResponse } = await import(
3951 |         './utils/prompt-execution.js'
3952 |       );
3953 |       const executionResult = await executePromptWithFallback(
3954 |         workflowPrompt,
3955 |         'Analyze the user context and provide intelligent workflow guidance with specific tool recommendations.',
3956 |         {
3957 |           temperature: 0.1,
3958 |           maxTokens: 6000,
3959 |           systemPrompt: `You are an expert workflow advisor for the MCP ADR Analysis Server.
3960 | Your role is to analyze user goals and project context, then recommend the optimal sequence of tools to achieve their objectives efficiently.
3961 | Provide specific, actionable guidance with clear tool sequences, expected outcomes, and success criteria.
3962 | Focus on practical workflows that deliver measurable results.`,
3963 |         }
3964 |       );
3965 | 
3966 |       if (executionResult.isAIGenerated) {
3967 |         // AI execution successful - return actual workflow guidance
3968 |         return formatMCPResponse({
3969 |           ...executionResult,
3970 |           content: `# Workflow Guidance & Tool Recommendations
3971 | 
3972 | ## Your Context
3973 | - **Goal**: ${goal}
3974 | - **Project Context**: ${projectContext}
3975 | - **Available Assets**: ${availableAssets.length > 0 ? availableAssets.join(', ') : 'None specified'}
3976 | - **Timeframe**: ${timeframe}
3977 | - **Primary Concerns**: ${primaryConcerns.length > 0 ? primaryConcerns.join(', ') : 'General analysis'}
3978 | 
3979 | ## AI-Generated Workflow Guidance
3980 | 
3981 | ${executionResult.content}
3982 | 
3983 | ## Quick Reference: Available Tools
3984 | 
3985 | **Core Analysis**: analyze_project_ecosystem, get_architectural_context, generate_adrs_from_prd, analyze_content_security
3986 | **ADR Management**: suggest_adrs, generate_adr_from_decision, discover_existing_adrs
3987 | **Security**: generate_content_masking, configure_custom_patterns, validate_content_masking
3988 | **Governance**: generate_rules, validate_rules, create_rule_set
3989 | **Environment**: analyze_environment, analyze_deployment_progress
3990 | **Utilities**: manage_cache, configure_output_masking, check_ai_execution_status
3991 | 
3992 | ## Next Steps
3993 | 
3994 | 1. **Start with the recommended primary workflow** above
3995 | 2. **Call the first tool** with the suggested parameters
3996 | 3. **Review the results** and proceed to the next step
3997 | 4. **Track progress** using the success metrics provided
3998 | 5. **Adjust as needed** based on your specific findings
3999 | 
4000 | This guidance is tailored to your specific context and goals for maximum effectiveness!
4001 | `,
4002 |         });
4003 |       } else {
4004 |         // Fallback to prompt-only mode
4005 |         return {
4006 |           content: [
4007 |             {
4008 |               type: 'text',
4009 |               text: workflowPrompt,
4010 |             },
4011 |           ],
4012 |         };
4013 |       }
4014 |     } catch (error) {
4015 |       throw new McpAdrError(
4016 |         `Failed to generate workflow guidance: ${error instanceof Error ? error.message : String(error)}`,
4017 |         'WORKFLOW_ERROR'
4018 |       );
4019 |     }
4020 |   }
4021 | 
4022 |   private async getDevelopmentGuidance(args: GetDevelopmentGuidanceArgs): Promise<CallToolResult> {
4023 |     const {
4024 |       developmentPhase,
4025 |       adrsToImplement = [],
4026 |       technologyStack = [],
4027 |       currentProgress = '',
4028 |       teamContext = { size: 'small_team', experienceLevel: 'mixed' },
4029 |       timeline = '',
4030 |       focusAreas = [],
4031 |     } = args;
4032 | 
4033 |     try {
4034 |       // Use actual ADR discovery if ADRs are specified
4035 |       let adrAnalysisPrompt = '';
4036 | 
4037 |       if (adrsToImplement.length > 0) {
4038 |         const { getAdrDirectoryPath } = await import('./utils/config.js');
4039 |         const { discoverAdrsInDirectory } = await import('./utils/adr-discovery.js');
4040 |         const absoluteAdrPath = getAdrDirectoryPath(this.config);
4041 | 
4042 |         const discoveryResult = await discoverAdrsInDirectory(
4043 |           absoluteAdrPath,
4044 |           true,
4045 |           this.config.projectPath
4046 |         );
4047 | 
4048 |         // Filter ADRs to only those specified for implementation
4049 |         const targetAdrs = discoveryResult.adrs.filter(adr =>
4050 |           adrsToImplement.some(
4051 |             (target: string) =>
4052 |               adr.title.toLowerCase().includes(target.toLowerCase()) ||
4053 |               adr.filename.toLowerCase().includes(target.toLowerCase())
4054 |           )
4055 |         );
4056 | 
4057 |         adrAnalysisPrompt = `
4058 | ## ADR Analysis for Implementation
4059 | 
4060 | **ADRs to Implement**: ${adrsToImplement.join(', ')}
4061 | **ADR Directory**: ${absoluteAdrPath}
4062 | **Found ${targetAdrs.length} matching ADRs**
4063 | 
4064 | ${targetAdrs
4065 |   .map(
4066 |     adr => `
4067 | ### ${adr.title}
4068 | - **File**: ${adr.filename}
4069 | - **Status**: ${adr.status}
4070 | - **Context**: ${adr.context}
4071 | - **Decision**: ${adr.decision}
4072 | - **Consequences**: ${adr.consequences}
4073 | `
4074 |   )
4075 |   .join('\n')}
4076 | `;
4077 |       }
4078 | 
4079 |       const developmentPrompt = `
4080 | # Development Guidance & Implementation Roadmap
4081 | 
4082 | ## Development Context
4083 | - **Development Phase**: ${developmentPhase}
4084 | - **Technology Stack**: ${technologyStack.length > 0 ? technologyStack.join(', ') : 'Not specified'}
4085 | - **Current Progress**: ${currentProgress || 'Starting fresh'}
4086 | - **Team Size**: ${teamContext.size}
4087 | - **Team Experience**: ${teamContext.experienceLevel}
4088 | - **Timeline**: ${timeline || 'Not specified'}
4089 | - **Focus Areas**: ${focusAreas.length > 0 ? focusAreas.join(', ') : 'General development'}
4090 | 
4091 | ${adrAnalysisPrompt}
4092 | 
4093 | ## Development Guidance Instructions
4094 | 
4095 | Based on the development context, ADRs to implement, and technology stack, provide comprehensive development guidance including:
4096 | 
4097 | ### 1. **Implementation Roadmap**
4098 | Create a detailed development plan with:
4099 | - **Phase-by-Phase Breakdown**: Logical development phases
4100 | - **Task Prioritization**: Order tasks by dependencies and impact
4101 | - **Milestone Definition**: Clear checkpoints and deliverables
4102 | - **Risk Assessment**: Potential blockers and mitigation strategies
4103 | 
4104 | ### 2. **Code Structure & Architecture**
4105 | Provide specific guidance on:
4106 | - **Project Structure**: How to organize code files and directories
4107 | - **Module Architecture**: How to structure components/modules
4108 | - **Design Patterns**: Which patterns to use and where
4109 | - **Code Organization**: Separation of concerns and layering
4110 | 
4111 | ### 3. **Implementation Patterns & Best Practices**
4112 | For each technology in the stack, provide:
4113 | - **Framework-Specific Patterns**: Best practices for the chosen frameworks
4114 | - **API Design**: How to structure APIs and endpoints
4115 | - **Data Layer**: Database schema and data access patterns
4116 | - **State Management**: How to handle application state
4117 | - **Error Handling**: Consistent error handling strategies
4118 | 
4119 | ### 4. **ADR-to-Code Translation**
4120 | For each ADR to implement:
4121 | - **Implementation Tasks**: Specific coding tasks derived from the ADR
4122 | - **Code Examples**: Pseudo-code or pattern examples
4123 | - **Integration Points**: How this ADR affects other parts of the system
4124 | - **Validation Criteria**: How to verify the ADR is properly implemented
4125 | 
4126 | ### 5. **Testing Strategy**
4127 | Comprehensive testing approach:
4128 | - **Unit Testing**: What to test and how
4129 | - **Integration Testing**: API and component integration tests
4130 | - **End-to-End Testing**: User workflow testing
4131 | - **Performance Testing**: Load and performance validation
4132 | - **Security Testing**: Security validation approaches
4133 | 
4134 | ### 6. **Development Workflow**
4135 | Team-specific guidance:
4136 | - **Git Workflow**: Branching strategy and code review process
4137 | - **CI/CD Pipeline**: Automated testing and deployment
4138 | - **Code Quality**: Linting, formatting, and quality gates
4139 | - **Documentation**: What to document and how
4140 | 
4141 | ### 7. **Quality Gates & Checkpoints**
4142 | Define success criteria:
4143 | - **Code Quality Metrics**: Coverage, complexity, maintainability
4144 | - **Performance Benchmarks**: Response times, throughput targets
4145 | - **Security Checkpoints**: Security validation at each phase
4146 | - **Architectural Compliance**: Adherence to ADR decisions
4147 | 
4148 | ### 8. **Technology-Specific Implementation**
4149 | For each technology in the stack, provide:
4150 | - **Setup Instructions**: Environment and tooling setup
4151 | - **Configuration**: Framework and tool configuration
4152 | - **Optimization**: Performance and build optimization
4153 | - **Deployment**: Technology-specific deployment considerations
4154 | 
4155 | ## Expected Output Format
4156 | 
4157 | Provide a comprehensive development guide that includes:
4158 | 
4159 | ### 📋 **1. Development Roadmap**
4160 | - **Phase 1-N**: Logical development phases with tasks
4161 | - **Dependencies**: Task dependencies and critical path
4162 | - **Timeline**: Estimated effort and duration
4163 | - **Milestones**: Key deliverables and checkpoints
4164 | 
4165 | ### 🏗️ **2. Implementation Guide**
4166 | - **Code Structure**: Detailed project organization
4167 | - **Design Patterns**: Specific patterns to implement
4168 | - **API Design**: Endpoint structure and conventions
4169 | - **Data Architecture**: Database and data flow design
4170 | 
4171 | ### 🧪 **3. Testing & Quality Strategy**
4172 | - **Test Types**: Unit, integration, e2e testing approach
4173 | - **Quality Gates**: Code quality and performance criteria
4174 | - **Automation**: CI/CD and automated testing setup
4175 | 
4176 | ### 🚀 **4. Deployment & Operations**
4177 | - **Environment Setup**: Development, staging, production
4178 | - **Deployment Pipeline**: Automated deployment process
4179 | - **Monitoring**: Logging, metrics, and alerting
4180 | - **Maintenance**: Ongoing maintenance and updates
4181 | 
4182 | ### 📊 **5. Progress Tracking**
4183 | - **Success Metrics**: How to measure development progress
4184 | - **Quality Indicators**: Code quality and performance metrics
4185 | - **Milestone Validation**: How to verify milestone completion
4186 | - **Risk Monitoring**: Early warning signs and mitigation
4187 | 
4188 | ### 💡 **6. Team-Specific Recommendations**
4189 | Based on team size (${teamContext.size}) and experience (${teamContext.experienceLevel}):
4190 | - **Workflow Adaptations**: Process adjustments for team context
4191 | - **Skill Development**: Areas for team skill building
4192 | - **Tool Recommendations**: Development tools and practices
4193 | - **Communication**: Coordination and documentation practices
4194 | 
4195 | ## Integration with Architectural Decisions
4196 | 
4197 | Ensure all development guidance:
4198 | - **Aligns with ADRs**: Every recommendation supports architectural decisions
4199 | - **Maintains Consistency**: Consistent patterns across the codebase
4200 | - **Enables Evolution**: Flexible design for future changes
4201 | - **Supports Quality**: Built-in quality and maintainability
4202 | 
4203 | Make the guidance **actionable, specific, and immediately implementable** so developers can start coding with confidence and architectural alignment.
4204 | `;
4205 | 
4206 |       // Execute the development guidance with AI if enabled
4207 |       const { executePromptWithFallback, formatMCPResponse } = await import(
4208 |         './utils/prompt-execution.js'
4209 |       );
4210 |       const executionResult = await executePromptWithFallback(
4211 |         developmentPrompt,
4212 |         'Analyze the development context and provide comprehensive implementation guidance that translates architectural decisions into specific coding tasks and development roadmap.',
4213 |         {
4214 |           temperature: 0.1,
4215 |           maxTokens: 8000,
4216 |           systemPrompt: `You are an expert software development advisor specializing in translating architectural decisions into practical implementation guidance.
4217 | Your role is to bridge the gap between architectural planning and actual code development.
4218 | Provide specific, actionable development guidance with clear implementation steps, code patterns, and quality criteria.
4219 | Focus on practical guidance that ensures architectural decisions are properly implemented in code.
4220 | Consider team context, technology stack, and development phase to provide tailored recommendations.`,
4221 |         }
4222 |       );
4223 | 
4224 |       if (executionResult.isAIGenerated) {
4225 |         // AI execution successful - return actual development guidance
4226 |         return formatMCPResponse({
4227 |           ...executionResult,
4228 |           content: `# Development Guidance & Implementation Roadmap
4229 | 
4230 | ## Your Development Context
4231 | - **Development Phase**: ${developmentPhase}
4232 | - **Technology Stack**: ${technologyStack.length > 0 ? technologyStack.join(', ') : 'Not specified'}
4233 | - **Current Progress**: ${currentProgress || 'Starting fresh'}
4234 | - **Team Context**: ${teamContext.size} team with ${teamContext.experienceLevel} experience
4235 | - **Timeline**: ${timeline || 'Not specified'}
4236 | - **Focus Areas**: ${focusAreas.length > 0 ? focusAreas.join(', ') : 'General development'}
4237 | - **ADRs to Implement**: ${adrsToImplement.length > 0 ? adrsToImplement.join(', ') : 'None specified'}
4238 | 
4239 | ## AI-Generated Development Guidance
4240 | 
4241 | ${executionResult.content}
4242 | 
4243 | ## Integration with Workflow Tools
4244 | 
4245 | This development guidance works seamlessly with other MCP tools:
4246 | 
4247 | ### **Workflow Integration**
4248 | 1. **get_workflow_guidance** → Recommends architectural process
4249 | 2. **get_development_guidance** → Guides implementation (this tool)
4250 | 3. **validate_rules** → Ensures code follows architectural decisions
4251 | 4. **analyze_deployment_progress** → Tracks implementation progress
4252 | 
4253 | ### **Quality Assurance Tools**
4254 | - **generate_rules** → Extract coding standards from ADRs
4255 | - **validate_rules** → Validate code against architectural rules
4256 | - **analyze_content_security** → Security validation during development
4257 | 
4258 | ### **Documentation Tools**
4259 | - **discover_existing_adrs** → Reference existing architectural decisions
4260 | 
4261 | ## Next Steps: From Architecture to Code
4262 | 
4263 | 1. **📋 Review the Development Roadmap** above
4264 | 2. **🏗️ Set Up Project Structure** as recommended
4265 | 3. **🧪 Implement Testing Strategy** early in development
4266 | 4. **📊 Track Progress** using the success metrics provided
4267 | 5. **🔄 Iterate and Refine** based on implementation learnings
4268 | 
4269 | This guidance ensures your development work is **architecturally aligned**, **quality-focused**, and **efficiently executed**!
4270 | `,
4271 |         });
4272 |       } else {
4273 |         // Fallback to prompt-only mode
4274 |         return {
4275 |           content: [
4276 |             {
4277 |               type: 'text',
4278 |               text: developmentPrompt,
4279 |             },
4280 |           ],
4281 |         };
4282 |       }
4283 |     } catch (error) {
4284 |       throw new McpAdrError(
4285 |         `Failed to generate development guidance: ${error instanceof Error ? error.message : String(error)}`,
4286 |         'DEVELOPMENT_ERROR'
4287 |       );
4288 |     }
4289 |   }
4290 | 
4291 |   private async analyzeProjectEcosystem(
4292 |     args: AnalyzeProjectEcosystemArgs,
4293 |     context?: ToolContext
4294 |   ): Promise<CallToolResult> {
4295 |     const ctx = context || createNoOpContext();
4296 | 
4297 |     // Use configured project path if not provided in args
4298 |     const projectPath = args.projectPath || this.config.projectPath;
4299 |     const {
4300 |       includePatterns,
4301 |       enhancedMode = true,
4302 |       knowledgeEnhancement = true,
4303 |       learningEnabled = true,
4304 |       technologyFocus = [],
4305 |       analysisDepth = 'comprehensive',
4306 |       includeEnvironment = true,
4307 |       recursiveDepth = 'comprehensive',
4308 |       analysisScope = [],
4309 |       // conversationContext - TODO: implement context integration for ecosystem analysis
4310 |     } = args;
4311 | 
4312 |     this.logger.info(`Generating comprehensive ecosystem analysis for project at: ${projectPath}`);
4313 |     this.logger.info(
4314 |       `Analysis configuration - Depth: ${analysisDepth}, Recursive: ${recursiveDepth}, Environment: ${includeEnvironment}`
4315 |     );
4316 |     this.logger.info(
4317 |       `Enhancement features - Knowledge: ${knowledgeEnhancement}, Learning: ${learningEnabled}`
4318 |     );
4319 |     this.logger.info(
4320 |       `Analysis scope: ${analysisScope.length > 0 ? analysisScope.join(', ') : 'Full ecosystem analysis'}`
4321 |     );
4322 | 
4323 |     ctx.info(`🌐 Starting comprehensive ecosystem analysis: ${projectPath}`);
4324 |     ctx.report_progress(0, 100);
4325 | 
4326 |     try {
4327 |       ctx.info('📊 Phase 1: Analyzing project structure');
4328 |       ctx.report_progress(10, 100);
4329 | 
4330 |       // Import utilities dynamically to avoid circular dependencies
4331 |       const { analyzeProjectStructureCompat: analyzeProjectStructure } = await import(
4332 |         './utils/file-system.js'
4333 |       );
4334 | 
4335 |       // Initialize ADR knowledge base on first run
4336 |       ctx.info('📚 Phase 1.5: Initializing ADR knowledge base');
4337 |       ctx.report_progress(15, 100);
4338 | 
4339 |       try {
4340 |         const { initializeAdrKnowledgeBase, isAdrKnowledgeBaseInitialized } = await import(
4341 |           './utils/adr-knowledge-initializer.js'
4342 |         );
4343 | 
4344 |         const isInitialized = await isAdrKnowledgeBaseInitialized(this.kgManager);
4345 | 
4346 |         if (!isInitialized) {
4347 |           this.logger.info('First run detected - initializing ADR knowledge base');
4348 |           const initResult = await initializeAdrKnowledgeBase(
4349 |             this.kgManager,
4350 |             this.config.adrDirectory,
4351 |             projectPath
4352 |           );
4353 | 
4354 |           if (initResult.success) {
4355 |             this.logger.info(
4356 |               `✅ ADR knowledge base initialized with ${initResult.adrsIndexed} ADRs`
4357 |             );
4358 |             ctx.info(`📚 Indexed ${initResult.adrsIndexed} existing ADRs to knowledge base`);
4359 |           } else {
4360 |             this.logger.warn(
4361 |               `ADR knowledge base initialization completed with errors: ${initResult.errors.join(', ')}`
4362 |             );
4363 |           }
4364 |         } else {
4365 |           this.logger.info('ADR knowledge base already initialized - skipping');
4366 |         }
4367 |       } catch (error) {
4368 |         this.logger.warn('Failed to initialize ADR knowledge base:', error);
4369 |         // Don't fail the entire analysis if ADR initialization fails
4370 |       }
4371 | 
4372 |       // Import advanced prompting utilities if enhanced mode is enabled
4373 |       let generateArchitecturalKnowledge: GenerateArchitecturalKnowledgeFunction | null = null;
4374 |       let executeWithReflexion: ExecuteWithReflexionFunction | null = null;
4375 |       let retrieveRelevantMemories: RetrieveRelevantMemoriesFunction | null = null;
4376 |       let createToolReflexionConfig: CreateToolReflexionConfigFunction | null = null;
4377 | 
4378 |       if (enhancedMode) {
4379 |         if (knowledgeEnhancement) {
4380 |           const knowledgeModule = await import('./utils/knowledge-generation.js');
4381 |           generateArchitecturalKnowledge = knowledgeModule.generateArchitecturalKnowledge;
4382 |         }
4383 | 
4384 |         if (learningEnabled) {
4385 |           const reflexionModule = await import('./utils/reflexion.js');
4386 |           executeWithReflexion = reflexionModule.executeWithReflexion;
4387 |           retrieveRelevantMemories = reflexionModule.retrieveRelevantMemories;
4388 |           createToolReflexionConfig = reflexionModule.createToolReflexionConfig;
4389 |         }
4390 |       }
4391 | 
4392 |       // Step 1: Generate technology-specific knowledge if enabled
4393 |       ctx.info('🧠 Phase 2: Generating architectural knowledge');
4394 |       ctx.report_progress(25, 100);
4395 | 
4396 |       let knowledgeContext = '';
4397 |       if (enhancedMode && knowledgeEnhancement && generateArchitecturalKnowledge) {
4398 |         try {
4399 |           const knowledgeResult = await generateArchitecturalKnowledge(
4400 |             {
4401 |               projectPath,
4402 |               technologies: technologyFocus,
4403 |               patterns: [],
4404 |               projectType: 'ecosystem-analysis',
4405 |               existingAdrs: [],
4406 |             },
4407 |             {
4408 |               domains: this.getEcosystemAnalysisDomains(technologyFocus) as ArchitecturalDomain[],
4409 |               depth: analysisDepth === 'basic' ? 'basic' : 'intermediate',
4410 |               cacheEnabled: true,
4411 |             }
4412 |           );
4413 | 
4414 |           knowledgeContext = `
4415 | ## Technology-Specific Knowledge Enhancement
4416 | 
4417 | The following architectural knowledge has been generated to enhance ecosystem analysis:
4418 | 
4419 | ${knowledgeResult.prompt}
4420 | 
4421 | ---
4422 | `;
4423 |         } catch (error) {
4424 |           this.logger.warn('Knowledge generation failed:', error);
4425 |           knowledgeContext = '<!-- Knowledge generation unavailable -->\n';
4426 |         }
4427 |       }
4428 | 
4429 |       // Step 2: Retrieve relevant memories if learning is enabled
4430 |       let reflexionContext = '';
4431 |       if (enhancedMode && learningEnabled && retrieveRelevantMemories) {
4432 |         try {
4433 |           const memoryResult = await retrieveRelevantMemories(
4434 |             'ecosystem-analysis',
4435 |             { projectPath, analysisDepth, technologyFocus },
4436 |             { maxResults: 5, relevanceThreshold: 0.6 }
4437 |           );
4438 | 
4439 |           reflexionContext = `
4440 | ## Learning from Past Analyses
4441 | 
4442 | The following insights from past ecosystem analysis tasks will inform this analysis:
4443 | 
4444 | ${memoryResult.prompt}
4445 | 
4446 | ---
4447 | `;
4448 |         } catch (error) {
4449 |           this.logger.warn('Reflexion memory retrieval failed:', error);
4450 |           reflexionContext = '<!-- Learning context unavailable -->\n';
4451 |         }
4452 |       }
4453 | 
4454 |       // Step 3: Generate base project analysis prompt with recursive depth
4455 |       ctx.info('📁 Phase 3: Scanning project files and structure');
4456 |       ctx.report_progress(40, 100);
4457 | 
4458 |       const baseProjectAnalysisPrompt = await analyzeProjectStructure(projectPath);
4459 | 
4460 |       // Step 4: Generate environment analysis if enabled
4461 |       ctx.info('🔧 Phase 4: Analyzing environment and infrastructure');
4462 |       ctx.report_progress(55, 100);
4463 |       let environmentAnalysisContext = '';
4464 |       if (includeEnvironment) {
4465 |         try {
4466 |           this.logger.info('Including comprehensive environment analysis in ecosystem analysis');
4467 |           const { analyzeEnvironment } = await import('./tools/environment-analysis-tool.js');
4468 | 
4469 |           // Call environment analysis with comprehensive scope
4470 |           const environmentResult = await analyzeEnvironment({
4471 |             projectPath,
4472 |             adrDirectory: this.config.adrDirectory,
4473 |             analysisType: 'comprehensive',
4474 |           });
4475 | 
4476 |           // Extract environment analysis content
4477 |           if (environmentResult.content && environmentResult.content[0]) {
4478 |             environmentAnalysisContext = `
4479 | ## Integrated Environment Analysis
4480 | 
4481 | ${environmentResult.content[0].text}
4482 | 
4483 | ---
4484 | `;
4485 |           }
4486 |         } catch (error) {
4487 |           this.logger.warn('Environment analysis integration failed:', error);
4488 |           environmentAnalysisContext = `
4489 | ## Environment Analysis
4490 | <!-- Environment analysis unavailable: ${error instanceof Error ? error.message : 'Unknown error'} -->
4491 | 
4492 | ---
4493 | `;
4494 |         }
4495 |       }
4496 | 
4497 |       // Step 5: Apply Reflexion execution if learning is enabled
4498 |       ctx.info('🧪 Phase 5: Applying learning and reflexion');
4499 |       ctx.report_progress(70, 100);
4500 | 
4501 |       let enhancedAnalysisPrompt = baseProjectAnalysisPrompt.prompt + environmentAnalysisContext;
4502 |       if (enhancedMode && learningEnabled && executeWithReflexion && createToolReflexionConfig) {
4503 |         try {
4504 |           const reflexionConfig = createToolReflexionConfig('analyze_project_ecosystem', {
4505 |             reflectionDepth: analysisDepth === 'basic' ? 'basic' : 'detailed',
4506 |             evaluationCriteria: ['task-success', 'accuracy', 'completeness'],
4507 |             learningRate: 0.7,
4508 |           });
4509 | 
4510 |           const reflexionResult = await executeWithReflexion(
4511 |             {
4512 |               prompt:
4513 |                 baseProjectAnalysisPrompt.prompt + knowledgeContext + environmentAnalysisContext,
4514 |               instructions: baseProjectAnalysisPrompt.instructions,
4515 |               context: {
4516 |                 projectPath,
4517 |                 analysisDepth,
4518 |                 recursiveDepth,
4519 |                 technologyFocus,
4520 |                 includePatterns,
4521 |                 includeEnvironment,
4522 |                 analysisScope,
4523 |                 knowledgeEnhanced: knowledgeEnhancement,
4524 |                 learningEnabled: true,
4525 |               },
4526 |             },
4527 |             reflexionConfig
4528 |           );
4529 | 
4530 |           enhancedAnalysisPrompt = reflexionResult.prompt;
4531 |         } catch (error) {
4532 |           this.logger.warn('Reflexion execution failed:', error);
4533 |           enhancedAnalysisPrompt =
4534 |             baseProjectAnalysisPrompt.prompt + knowledgeContext + environmentAnalysisContext;
4535 |         }
4536 |       } else {
4537 |         enhancedAnalysisPrompt =
4538 |           baseProjectAnalysisPrompt.prompt + knowledgeContext + environmentAnalysisContext;
4539 |       }
4540 | 
4541 |       // Execute the analysis with AI if enabled, otherwise return prompt
4542 |       ctx.info('🤖 Phase 6: Executing AI-powered ecosystem analysis');
4543 |       ctx.report_progress(85, 100);
4544 | 
4545 |       const { executeEcosystemAnalysisPrompt, formatMCPResponse } = await import(
4546 |         './utils/prompt-execution.js'
4547 |       );
4548 |       const executionResult = await executeEcosystemAnalysisPrompt(
4549 |         enhancedAnalysisPrompt,
4550 |         baseProjectAnalysisPrompt.instructions,
4551 |         {
4552 |           temperature: 0.1,
4553 |           maxTokens: 6000,
4554 |         }
4555 |       );
4556 | 
4557 |       // Step 6: Record project structure to knowledge graph
4558 |       try {
4559 |         this.logger.info('Recording project structure to knowledge graph');
4560 | 
4561 |         const projectStructureSnapshot = {
4562 |           projectPath,
4563 |           analysisDepth,
4564 |           recursiveDepth,
4565 |           technologyFocus,
4566 |           analysisScope,
4567 |           includeEnvironment,
4568 |           timestamp: new Date().toISOString(),
4569 |           structureData: baseProjectAnalysisPrompt.context || {},
4570 |         };
4571 | 
4572 |         await this.kgManager.recordProjectStructure(projectStructureSnapshot);
4573 |         this.logger.info('✅ Project structure recorded to knowledge graph');
4574 |       } catch (kgError) {
4575 |         this.logger.warn('Failed to record project structure to knowledge graph:', kgError);
4576 |         // Don't fail the entire analysis if KG recording fails
4577 |       }
4578 | 
4579 |       ctx.info('✅ Ecosystem analysis completed successfully');
4580 |       ctx.report_progress(100, 100);
4581 | 
4582 |       // Return appropriate response based on execution result
4583 |       if (executionResult.isAIGenerated) {
4584 |         // AI execution successful - return actual analysis results
4585 |         return formatMCPResponse({
4586 |           ...executionResult,
4587 |           content: `# Comprehensive Project Ecosystem Analysis Results
4588 | 
4589 | ## Analysis Configuration
4590 | - **Project Path**: ${projectPath}
4591 | - **Analysis Depth**: ${analysisDepth}
4592 | - **Recursive Depth**: ${recursiveDepth}
4593 | - **Environment Analysis**: ${includeEnvironment ? '✅ Included' : '❌ Excluded'}
4594 | - **Analysis Scope**: ${analysisScope.length > 0 ? analysisScope.join(', ') : 'Full ecosystem analysis'}
4595 | 
4596 | ## Enhancement Features
4597 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled' : '❌ Disabled'}
4598 | - **Reflexion Learning**: ${enhancedMode && learningEnabled ? '✅ Enabled' : '❌ Disabled'}
4599 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled' : '❌ Disabled'}
4600 | - **Technology Focus**: ${technologyFocus.length > 0 ? technologyFocus.join(', ') : 'Auto-detect'}
4601 | - **Knowledge Graph**: ✅ Project structure recorded
4602 | 
4603 | ${knowledgeContext}
4604 | 
4605 | ${reflexionContext}
4606 | 
4607 | ## Comprehensive Ecosystem Analysis Results
4608 | 
4609 | ${executionResult.content}
4610 | 
4611 | ${
4612 |   includeEnvironment
4613 |     ? `
4614 | 
4615 | ## Environment Integration Summary
4616 | 
4617 | The analysis above includes comprehensive environment analysis covering:
4618 | - **Infrastructure Specifications**: Deployment and runtime environment details
4619 | - **Containerization**: Docker, Kubernetes, and container orchestration analysis
4620 | - **Environment Requirements**: Configuration and dependency requirements
4621 | - **Compliance Assessment**: Security and regulatory compliance evaluation
4622 | 
4623 | This integrated approach provides complete understanding of both codebase patterns AND operational environment.
4624 | `
4625 |     : ''
4626 | }
4627 | 
4628 | ## Next Steps: Complete Ecosystem Understanding
4629 | 
4630 | Based on the comprehensive analysis above:
4631 | 
4632 | ### **Immediate Actions**
4633 | 1. **Review Ecosystem Overview**: Examine the complete technology stack and environment context
4634 | 2. **Assess Integration Points**: Understand how code patterns relate to operational environment
4635 | 3. **Identify Critical Dependencies**: Focus on key dependencies between code and infrastructure
4636 | 
4637 | ### **Strategic Planning**
4638 | 4. **Address Architectural Issues**: Prioritize improvements based on both code and environment analysis
4639 | 5. **Plan Environment Optimization**: Optimize deployment and operational configurations
4640 | 6. **Update Documentation**: Document both architectural decisions and environment specifications
4641 | 
4642 | ### **Implementation Roadmap**
4643 | 7. **Implement Code Improvements**: Execute code-level architectural enhancements
4644 | 8. **Optimize Environment**: Improve infrastructure and deployment configurations
4645 | 9. **Monitor Integration**: Ensure code and environment changes work together effectively
4646 | 
4647 | This comprehensive ecosystem analysis provides the foundation for informed architectural and operational decisions.
4648 | `,
4649 |         });
4650 |       } else {
4651 |         // Fallback to prompt-only mode
4652 |         return {
4653 |           content: [
4654 |             {
4655 |               type: 'text',
4656 |               text: `# Comprehensive Project Ecosystem Analysis
4657 | 
4658 | This comprehensive analysis provides deep recursive project understanding with integrated environment analysis.
4659 | 
4660 | ## Analysis Configuration
4661 | - **Project Path**: ${projectPath}
4662 | - **Analysis Depth**: ${analysisDepth}
4663 | - **Recursive Depth**: ${recursiveDepth}
4664 | - **Environment Analysis**: ${includeEnvironment ? '✅ Included' : '❌ Excluded'}
4665 | - **Analysis Scope**: ${analysisScope.length > 0 ? analysisScope.join(', ') : 'Full ecosystem analysis'}
4666 | 
4667 | ## Enhancement Features
4668 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled' : '❌ Disabled'}
4669 | - **Reflexion Learning**: ${enhancedMode && learningEnabled ? '✅ Enabled' : '❌ Disabled'}
4670 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled' : '❌ Disabled'}
4671 | - **Technology Focus**: ${technologyFocus.length > 0 ? technologyFocus.join(', ') : 'Auto-detect'}
4672 | - **Include Patterns**: ${includePatterns?.length ? includePatterns.join(', ') : 'Default patterns'}
4673 | - **Knowledge Graph**: ✅ Project structure recorded
4674 | 
4675 | ${knowledgeContext}
4676 | 
4677 | ${reflexionContext}
4678 | 
4679 | ## Enhanced Analysis Prompt
4680 | 
4681 | ${enhancedAnalysisPrompt}
4682 | 
4683 | ## Enhanced Implementation Instructions
4684 | 
4685 | ${baseProjectAnalysisPrompt.instructions}
4686 | 
4687 | ### Enhancement-Specific Instructions
4688 | 
4689 | ${
4690 |   enhancedMode && knowledgeEnhancement
4691 |     ? `
4692 | #### Knowledge Enhancement
4693 | - Apply technology-specific knowledge to ecosystem analysis
4694 | - Use domain expertise to identify patterns and anti-patterns
4695 | - Leverage architectural best practices for technology stack evaluation
4696 | `
4697 |     : ''
4698 | }
4699 | 
4700 | ${
4701 |   enhancedMode && learningEnabled
4702 |     ? `
4703 | #### Learning Integration
4704 | - Apply lessons learned from past ecosystem analyses
4705 | - Use memory insights to improve pattern recognition accuracy
4706 | - Incorporate feedback from previous analysis outcomes
4707 | `
4708 |     : ''
4709 | }
4710 | 
4711 | ## Expected Enhanced Output
4712 | 
4713 | The enhanced analysis should provide:
4714 | 1. **Technology Stack Analysis** with domain knowledge context
4715 | 2. **Architectural Pattern Detection** informed by past experiences
4716 | 3. **Ecosystem Health Assessment** using learned evaluation criteria
4717 | 4. **Improvement Recommendations** based on domain best practices
4718 | 5. **Learning Insights** for future analysis improvement
4719 | 
4720 | ## Quality Assurance
4721 | 
4722 | - Ensure analysis leverages all available enhancement features
4723 | - Verify technology-specific knowledge is properly applied
4724 | - Confirm learning insights improve analysis accuracy
4725 | - Validate recommendations align with domain best practices`,
4726 |             },
4727 |           ],
4728 |         };
4729 |       }
4730 |     } catch (error) {
4731 |       throw new McpAdrError(
4732 |         `Failed to analyze project ecosystem: ${error instanceof Error ? error.message : String(error)}`,
4733 |         'ANALYSIS_ERROR'
4734 |       );
4735 |     }
4736 |   }
4737 | 
4738 |   private async getArchitecturalContext(
4739 |     args: GetArchitecturalContextArgs
4740 |   ): Promise<CallToolResult> {
4741 |     const { filePath, includeCompliance = true } = args;
4742 | 
4743 |     try {
4744 |       const {
4745 |         analyzeProjectStructureCompat: analyzeProjectStructure,
4746 |         fileExistsCompat: fileExists,
4747 |         ensureDirectoryCompat: ensureDirectory,
4748 |       } = await import('./utils/file-system.js');
4749 |       const path = await import('path');
4750 | 
4751 |       // Determine project path
4752 |       const projectPath = filePath
4753 |         ? filePath.split('/').slice(0, -1).join('/')
4754 |         : this.config.projectPath;
4755 |       const adrDirectory = path.join(projectPath, this.config.adrDirectory);
4756 | 
4757 |       // Generate prompts for ADR directory setup
4758 |       const adrDirectoryCheckPrompt = await fileExists(adrDirectory);
4759 |       const adrDirectorySetupPrompt = await ensureDirectory(adrDirectory);
4760 | 
4761 |       // Generate architectural analysis prompt
4762 |       const projectAnalysisPrompt = await analyzeProjectStructure(projectPath);
4763 | 
4764 |       const architecturalPrompt = `
4765 | # Architectural Context Analysis & Project Setup
4766 | 
4767 | ## Project Overview
4768 | **Project Path**: ${projectPath}
4769 | **Analysis Scope**: ${filePath ? `Specific file: ${filePath}` : 'Entire project'}
4770 | **ADR Directory**: ${this.config.adrDirectory}
4771 | **Include Compliance**: ${includeCompliance ? 'Yes' : 'No'}
4772 | 
4773 | ## 🚀 ADR Infrastructure Setup
4774 | 
4775 | This analysis will include setting up ADR infrastructure if needed:
4776 | 
4777 | ### ADR Directory Check
4778 | ${adrDirectoryCheckPrompt.prompt}
4779 | 
4780 | ### ADR Directory Setup (if needed)
4781 | ${adrDirectorySetupPrompt.prompt}
4782 | 
4783 | ## Comprehensive Project Analysis
4784 | 
4785 | ${projectAnalysisPrompt.prompt}
4786 | 
4787 | ## Enhanced Architectural Focus
4788 | 
4789 | Please provide a **comprehensive, outcome-focused analysis** including:
4790 | 
4791 | ### 1. Technology Stack & Infrastructure Analysis
4792 | - **Core Technologies**: Programming languages, frameworks, runtime environments
4793 | - **Dependencies**: Package managers, third-party libraries, version constraints
4794 | - **Build & Deployment**: CI/CD pipelines, build tools, deployment strategies
4795 | - **Data Layer**: Databases, caching, data storage and retrieval patterns
4796 | 
4797 | ### 2. Architectural Pattern & Design Analysis
4798 | - **System Architecture**: Monolith, microservices, serverless, hybrid patterns
4799 | - **Code Organization**: Module structure, separation of concerns, layering
4800 | - **API Design**: REST, GraphQL, RPC patterns and conventions
4801 | - **Data Flow**: Request/response cycles, event handling, state management
4802 | ${filePath ? `- **File-specific Context**: How ${filePath} fits into the overall architecture` : ''}
4803 | 
4804 | ### 3. Quality, Security & Performance Assessment
4805 | - **Code Quality**: Structure, naming, documentation, testing strategies
4806 | - **Security Implementation**: Authentication, authorization, data protection
4807 | - **Performance Patterns**: Caching, optimization, scalability considerations
4808 | - **Monitoring & Observability**: Logging, metrics, error tracking
4809 | 
4810 | ### 4. Architectural Decision Discovery & Documentation
4811 | - **Explicit Decisions**: Find existing documentation and decision records
4812 | - **Implicit Decisions**: Identify significant undocumented architectural choices
4813 | - **Technology Rationale**: Understand selection criteria and trade-offs
4814 | - **Evolution Path**: How the architecture has changed over time
4815 | 
4816 | ${
4817 |   includeCompliance
4818 |     ? `### 5. Compliance & Standards Assessment
4819 | - **Industry Standards**: Adherence to relevant industry standards and best practices
4820 | - **Security Compliance**: Security standards compliance (OWASP, SOC2, etc.)
4821 | - **Code Standards**: Coding standards and style guide compliance
4822 | - **Architectural Compliance**: Adherence to established architectural principles
4823 | - **Regulatory Requirements**: Any regulatory compliance requirements (GDPR, HIPAA, etc.)`
4824 |     : ''
4825 | }
4826 | 
4827 | ## Expected Output: Outcome-Focused Architectural Context
4828 | 
4829 | Provide a **comprehensive architectural context** with **clear project outcomes**:
4830 | 
4831 | ### 📋 **1. Executive Summary & Project Outcomes**
4832 | - **Current State**: What the project is and what it does
4833 | - **Architectural Maturity**: Assessment of current architectural practices
4834 | - **Key Strengths**: What's working well architecturally
4835 | - **Critical Gaps**: What needs immediate attention
4836 | - **Success Metrics**: How to measure architectural improvements
4837 | 
4838 | ### 🔧 **2. Technology & Infrastructure Inventory**
4839 | - **Technology Stack**: Complete inventory with versions and purposes
4840 | - **Infrastructure Components**: Deployment, monitoring, data storage
4841 | - **Dependencies**: Critical dependencies and potential risks
4842 | - **Tool Chain**: Development, testing, and deployment tools
4843 | 
4844 | ### 🏗️ **3. Architectural Patterns & Design Decisions**
4845 | - **System Design**: Overall architectural approach and patterns
4846 | - **Component Architecture**: How major components interact
4847 | - **Data Architecture**: How data flows and is managed
4848 | - **Integration Patterns**: How external systems are integrated
4849 | 
4850 | ### 📊 **4. Quality & Compliance Assessment**
4851 | - **Code Quality Score**: Assessment of current code quality
4852 | - **Security Posture**: Security implementation and gaps
4853 | - **Performance Profile**: Current performance characteristics
4854 | - **Maintainability Index**: How easy the system is to maintain and evolve
4855 | 
4856 | ### 🎯 **5. Outcome-Focused Action Plan**
4857 | Based on the analysis, provide a **clear workflow** with **projected outcomes**:
4858 | 
4859 | #### **Immediate Actions (Next 1-2 weeks)**
4860 | - **Priority 1**: Most critical architectural issues to address
4861 | - **Quick Wins**: Low-effort, high-impact improvements
4862 | - **Documentation**: Essential decisions that need immediate documentation
4863 | 
4864 | #### **Short-term Goals (Next 1-3 months)**
4865 | - **Architectural Improvements**: Planned enhancements with expected outcomes
4866 | - **Technical Debt**: Priority technical debt to address
4867 | - **Process Improvements**: Development workflow enhancements
4868 | 
4869 | #### **Long-term Vision (3-12 months)**
4870 | - **Strategic Architecture**: Long-term architectural evolution
4871 | - **Scalability Roadmap**: How to scale the system effectively
4872 | - **Innovation Opportunities**: Areas for architectural innovation
4873 | 
4874 | ### 📈 **6. Success Metrics & Outcomes**
4875 | Define **measurable outcomes** for architectural improvements:
4876 | 
4877 | - **Performance Metrics**: Response times, throughput, resource utilization
4878 | - **Quality Metrics**: Code coverage, bug rates, maintainability scores
4879 | - **Developer Experience**: Build times, deployment frequency, developer satisfaction
4880 | - **Business Impact**: Feature delivery speed, system reliability, cost efficiency
4881 | 
4882 | ### 🏗️ **7. ADR Infrastructure & Documentation Plan**
4883 | 
4884 | If ADR directory doesn't exist, also provide:
4885 | 
4886 | 1. **Create Directory Structure**:
4887 |    \`\`\`
4888 |    ${this.config.adrDirectory}/
4889 |    ├── 0001-record-architecture-decisions.md (template)
4890 |    ├── README.md (ADR process guide)
4891 |    └── template.md (ADR template)
4892 |    \`\`\`
4893 | 
4894 | 2. **Generate Initial ADRs** for discovered architectural decisions
4895 | 3. **Create ADR Process Guide** for the team
4896 | 4. **Establish ADR Workflow** for future decisions
4897 | 
4898 | ### 🔄 **8. Continuous Improvement Workflow**
4899 | Establish ongoing architectural governance:
4900 | 
4901 | - **Regular Reviews**: Monthly architectural health checks
4902 | - **Decision Documentation**: Process for documenting new architectural decisions
4903 | - **Compliance Monitoring**: Ongoing adherence to architectural standards
4904 | - **Evolution Planning**: Quarterly architectural roadmap updates
4905 | 
4906 | ## Next Steps: Grounded Project Workflow
4907 | 
4908 | After this analysis, follow this **outcome-focused workflow**:
4909 | 
4910 | 1. **📋 Review Analysis**: Examine the architectural context and recommendations
4911 | 2. **🎯 Set Priorities**: Choose 3-5 most impactful improvements based on outcomes
4912 | 3. **📝 Document Decisions**: Create ADRs for significant architectural choices
4913 | 4. **🔧 Implement Changes**: Execute improvements in priority order
4914 | 5. **📊 Measure Progress**: Track success metrics and outcomes
4915 | 6. **🔄 Iterate**: Regular reviews and continuous improvement
4916 | 
4917 | This approach ensures that architectural work is **grounded in measurable outcomes** and **aligned with project success**.
4918 | `;
4919 | 
4920 |       // Execute the analysis with AI if enabled, otherwise return prompt
4921 |       const { executeEcosystemAnalysisPrompt, formatMCPResponse } = await import(
4922 |         './utils/prompt-execution.js'
4923 |       );
4924 |       const executionResult = await executeEcosystemAnalysisPrompt(
4925 |         architecturalPrompt,
4926 |         projectAnalysisPrompt.instructions,
4927 |         {
4928 |           temperature: 0.1,
4929 |           maxTokens: 5000,
4930 |           systemPrompt: `You are a senior software architect specializing in architectural context analysis.
4931 | Analyze the provided project to understand its architectural patterns, design decisions, and structural organization.
4932 | Focus on providing actionable insights about the architecture that can guide development decisions.`,
4933 |         }
4934 |       );
4935 | 
4936 |       if (executionResult.isAIGenerated) {
4937 |         // AI execution successful - return actual analysis results
4938 |         return formatMCPResponse({
4939 |           ...executionResult,
4940 |           content: `# Architectural Context Analysis Results
4941 | 
4942 | ${filePath ? `## Target File: ${filePath}` : '## Project-wide Analysis'}
4943 | 
4944 | ## Project Information
4945 | - **Project Path**: ${projectPath}
4946 | - **Analysis Scope**: ${filePath ? 'File-specific' : 'Project-wide'}
4947 | - **ADR Directory**: ${this.config.adrDirectory}
4948 | 
4949 | ## ADR Infrastructure Setup
4950 | 
4951 | The analysis includes automatic ADR infrastructure setup:
4952 | 
4953 | ${adrDirectoryCheckPrompt.instructions}
4954 | 
4955 | ${adrDirectorySetupPrompt.instructions}
4956 | 
4957 | ## AI Analysis Results
4958 | 
4959 | ${executionResult.content}
4960 | 
4961 | ## Outcome-Focused Next Steps
4962 | 
4963 | Based on the architectural analysis, follow this **grounded workflow**:
4964 | 
4965 | ### **Immediate Actions (This Week)**
4966 | 1. **Review Analysis**: Examine the architectural context and recommendations above
4967 | 2. **Set Up ADRs**: Ensure ADR directory structure is created and ready
4968 | 3. **Identify Quick Wins**: Focus on low-effort, high-impact improvements
4969 | 
4970 | ### **Short-term Goals (Next Month)**
4971 | 4. **Document Key Decisions**: Create ADRs for the most significant architectural choices
4972 | 5. **Address Critical Issues**: Tackle the highest-priority architectural concerns
4973 | 6. **Establish Metrics**: Set up measurement for the success metrics identified
4974 | 
4975 | ### **Long-term Vision (Next Quarter)**
4976 | 7. **Implement Roadmap**: Execute the architectural improvement plan
4977 | 8. **Monitor Progress**: Track success metrics and adjust approach as needed
4978 | 9. **Continuous Improvement**: Establish regular architectural reviews
4979 | 
4980 | This **outcome-focused approach** ensures architectural work delivers **measurable value** and keeps the project **grounded in clear objectives**.
4981 | `,
4982 |         });
4983 |       } else {
4984 |         // Fallback to prompt-only mode
4985 |         return {
4986 |           content: [
4987 |             {
4988 |               type: 'text',
4989 |               text: architecturalPrompt,
4990 |             },
4991 |           ],
4992 |         };
4993 |       }
4994 |     } catch (error) {
4995 |       throw new McpAdrError(
4996 |         `Failed to get architectural context: ${error instanceof Error ? error.message : String(error)}`,
4997 |         'ANALYSIS_ERROR'
4998 |       );
4999 |     }
5000 |   }
5001 | 
5002 |   private async generateAdrsFromPrd(
5003 |     args: Record<string, unknown>,
5004 |     context?: ToolContext
5005 |   ): Promise<CallToolResult> {
5006 |     const ctx = context || createNoOpContext();
5007 | 
5008 |     const {
5009 |       prdPath,
5010 |       enhancedMode = true,
5011 |       promptOptimization = true,
5012 |       knowledgeEnhancement = true,
5013 |       prdType = 'general',
5014 |     } = args;
5015 |     const outputDirectory = args['outputDirectory'] || this.config.adrDirectory;
5016 | 
5017 |     this.logger.info(`Generating enhanced ADRs from PRD: ${prdPath} to ${outputDirectory}`);
5018 |     this.logger.info(
5019 |       `Enhancement features - APE: ${promptOptimization}, Knowledge: ${knowledgeEnhancement}, Type: ${prdType}`
5020 |     );
5021 | 
5022 |     ctx.info(`📝 Starting ADR generation from PRD: ${prdPath}`);
5023 |     ctx.report_progress(0, 100);
5024 | 
5025 |     try {
5026 |       ctx.info('📂 Phase 1: Validating PRD file');
5027 |       ctx.report_progress(10, 100);
5028 |       const { readFileContentCompat: readFileContent, fileExistsCompat: fileExists } = await import(
5029 |         './utils/file-system.js'
5030 |       );
5031 | 
5032 |       // Import advanced prompting utilities if enhanced mode is enabled
5033 |       // eslint-disable-next-line @typescript-eslint/no-explicit-any
5034 |       let generateArchitecturalKnowledge: any = null;
5035 |       // eslint-disable-next-line @typescript-eslint/no-explicit-any
5036 |       let optimizePromptWithAPE: any = null;
5037 |       // eslint-disable-next-line @typescript-eslint/no-explicit-any
5038 |       let createToolAPEConfig: any = null;
5039 | 
5040 |       if (enhancedMode) {
5041 |         if (knowledgeEnhancement) {
5042 |           const knowledgeModule = await import('./utils/knowledge-generation.js');
5043 |           generateArchitecturalKnowledge = knowledgeModule.generateArchitecturalKnowledge;
5044 |         }
5045 | 
5046 |         if (promptOptimization) {
5047 |           const apeModule = await import('./utils/automatic-prompt-engineering.js');
5048 |           optimizePromptWithAPE = apeModule.optimizePromptWithAPE;
5049 |           createToolAPEConfig = apeModule.createToolAPEConfig;
5050 |         }
5051 |       }
5052 | 
5053 |       // Generate file existence check prompt
5054 |       const fileExistsPrompt = await fileExists(prdPath as string);
5055 | 
5056 |       // Generate file content reading prompt
5057 |       const fileContentPrompt = await readFileContent(prdPath as string);
5058 | 
5059 |       ctx.info('📚 Phase 2: Reading PRD content');
5060 |       ctx.report_progress(25, 100);
5061 | 
5062 |       // Step 1: Generate domain-specific knowledge if enabled
5063 |       ctx.info('🧠 Phase 3: Generating domain knowledge');
5064 |       ctx.report_progress(40, 100);
5065 | 
5066 |       let knowledgeContext = '';
5067 |       if (enhancedMode && knowledgeEnhancement && generateArchitecturalKnowledge) {
5068 |         try {
5069 |           const knowledgeResult = await generateArchitecturalKnowledge(
5070 |             {
5071 |               projectPath: outputDirectory,
5072 |               technologies: [],
5073 |               patterns: [],
5074 |               projectType: prdType,
5075 |               existingAdrs: [],
5076 |             },
5077 |             {
5078 |               domains: this.getPrdTypeDomains(prdType as string),
5079 |               depth: 'intermediate',
5080 |               cacheEnabled: true,
5081 |             }
5082 |           );
5083 | 
5084 |           knowledgeContext = `
5085 | ## Domain-Specific Knowledge Enhancement
5086 | 
5087 | The following architectural knowledge has been generated to enhance PRD analysis and ADR creation:
5088 | 
5089 | ${knowledgeResult.prompt}
5090 | 
5091 | ---
5092 | `;
5093 |         } catch (error) {
5094 |           this.logger.warn('Knowledge generation failed:', error);
5095 |           knowledgeContext = '<!-- Knowledge generation unavailable -->\n';
5096 |         }
5097 |       }
5098 | 
5099 |       // Step 2: Create base ADR generation prompt
5100 |       ctx.info('📋 Phase 4: Creating base ADR prompts');
5101 |       ctx.report_progress(60, 100);
5102 | 
5103 |       const baseAdrPrompt = this.createBaseAdrPrompt(
5104 |         prdPath as string,
5105 |         outputDirectory as string,
5106 |         knowledgeContext
5107 |       );
5108 | 
5109 |       // Step 3: Apply APE optimization if enabled
5110 |       ctx.info('⚡ Phase 5: Optimizing prompts with APE');
5111 |       ctx.report_progress(75, 100);
5112 | 
5113 |       let finalAdrPrompt = baseAdrPrompt;
5114 |       if (enhancedMode && promptOptimization && optimizePromptWithAPE && createToolAPEConfig) {
5115 |         try {
5116 |           const apeConfig = createToolAPEConfig('generate_adrs_from_prd', {
5117 |             candidateCount: 5,
5118 |             evaluationCriteria: ['task-completion', 'clarity', 'specificity'],
5119 |             optimizationRounds: 2,
5120 |             qualityThreshold: 0.75,
5121 |           });
5122 | 
5123 |           const apeResult = await optimizePromptWithAPE(
5124 |             {
5125 |               prompt: baseAdrPrompt,
5126 |               instructions: 'Generate comprehensive ADRs from PRD analysis',
5127 |               context: {
5128 |                 prdPath,
5129 |                 outputDirectory,
5130 |                 prdType,
5131 |                 knowledgeEnhanced: knowledgeEnhancement,
5132 |               },
5133 |             },
5134 |             apeConfig
5135 |           );
5136 | 
5137 |           finalAdrPrompt = apeResult.prompt;
5138 |         } catch (error) {
5139 |           this.logger.warn('APE optimization failed:', error);
5140 |           finalAdrPrompt = baseAdrPrompt;
5141 |         }
5142 |       }
5143 | 
5144 |       // Generate comprehensive ADR creation prompt that includes file operations
5145 |       const adrPrompt = `
5146 | # Enhanced ADR Generation from PRD Request
5147 | 
5148 | This is a comprehensive prompt-driven ADR generation process enhanced with advanced prompting techniques.
5149 | 
5150 | ## Enhancement Status
5151 | - **APE Optimization**: ${enhancedMode && promptOptimization ? '✅ Enabled' : '❌ Disabled'}
5152 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled' : '❌ Disabled'}
5153 | - **PRD Type**: ${prdType}
5154 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled' : '❌ Disabled'}
5155 | 
5156 | ## Step 1: File Validation
5157 | ${fileExistsPrompt.prompt}
5158 | 
5159 | **Instructions**: First, execute the file existence check above. If the file does not exist, stop the process and report the error. Only proceed to Step 2 if the file exists.
5160 | 
5161 | ## Step 2: PRD Content Reading
5162 | ${fileContentPrompt.prompt}
5163 | 
5164 | **Instructions**: Execute the file reading operation above to obtain the PRD content. Use the content from this step for the enhanced ADR generation in Step 3.
5165 | 
5166 | ## Step 3: Enhanced ADR Generation
5167 | 
5168 | ${
5169 |   enhancedMode && promptOptimization
5170 |     ? `
5171 | ### APE-Optimized Analysis
5172 | This prompt has been optimized using Automatic Prompt Engineering for superior ADR generation quality.
5173 | The optimization focused on task completion, clarity, and specificity for PRD analysis.
5174 | 
5175 | `
5176 |     : ''
5177 | }
5178 | 
5179 | ${finalAdrPrompt}
5180 | 
5181 | ### File Creation Instructions
5182 | 
5183 | For each generated ADR, create a file creation prompt using the following pattern:
5184 | - **File Path**: ${outputDirectory}/[number]-[decision-title].md
5185 | - **Content**: The complete enhanced ADR markdown content
5186 | - **Action Confirmation**: Require user confirmation before creating files
5187 | - **Security Validation**: Ensure output directory is safe and authorized
5188 | 
5189 | ### Enhanced Quality Assurance
5190 | 
5191 | - Ensure each ADR leverages domain knowledge when available
5192 | - Verify decisions align with PRD type best practices
5193 | - Check that enhancement features are properly utilized
5194 | - Validate that ADR content exceeds baseline quality expectations
5195 | - Confirm all decisions are traceable back to PRD requirements with domain context
5196 | `;
5197 | 
5198 |       // Execute the ADR generation with AI if enabled, otherwise return prompt
5199 |       ctx.info('🤖 Phase 6: Executing AI-powered ADR generation');
5200 |       ctx.report_progress(90, 100);
5201 | 
5202 |       const { executeADRGenerationPrompt, formatMCPResponse } = await import(
5203 |         './utils/prompt-execution.js'
5204 |       );
5205 |       const executionResult = await executeADRGenerationPrompt(
5206 |         adrPrompt,
5207 |         'Generate comprehensive ADRs from PRD analysis with enhanced domain knowledge and optimization',
5208 |         {
5209 |           temperature: 0.1,
5210 |           maxTokens: 8000,
5211 |           systemPrompt: `You are an expert software architect who creates comprehensive Architectural Decision Records (ADRs) from Product Requirements Documents (PRDs).
5212 | Generate well-structured ADRs that follow best practices and include all necessary sections.
5213 | Focus on extracting architectural decisions from the PRD and creating actionable ADRs with clear reasoning.`,
5214 |         }
5215 |       );
5216 | 
5217 |       ctx.info('✅ ADR generation completed successfully');
5218 |       ctx.report_progress(100, 100);
5219 | 
5220 |       if (executionResult.isAIGenerated) {
5221 |         // AI execution successful - return actual ADR generation results
5222 |         return formatMCPResponse({
5223 |           ...executionResult,
5224 |           content: `# ADR Generation from PRD Results
5225 | 
5226 | ## Enhancement Features
5227 | - **APE Optimization**: ${enhancedMode && promptOptimization ? '✅ Enabled' : '❌ Disabled'}
5228 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled' : '❌ Disabled'}
5229 | - **PRD Type Optimization**: ${prdType}
5230 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled' : '❌ Disabled'}
5231 | 
5232 | ## Source Information
5233 | - **PRD Path**: ${prdPath}
5234 | - **Output Directory**: ${outputDirectory}
5235 | 
5236 | ## Generated ADRs
5237 | 
5238 | ${executionResult.content}
5239 | 
5240 | ## Next Steps
5241 | 
5242 | 1. **Review Generated ADRs**: Examine each ADR for completeness and accuracy
5243 | 2. **Save ADR Files**: Create individual .md files for each ADR in ${outputDirectory}
5244 | 3. **Update ADR Index**: Add new ADRs to your project's ADR catalog
5245 | 4. **Stakeholder Review**: Share ADRs with team for feedback and approval
5246 | 5. **Implementation Planning**: Create tasks for implementing the architectural decisions
5247 | 
5248 | ## File Creation Commands
5249 | 
5250 | To save the generated ADRs, create individual files in ${outputDirectory}:
5251 | 
5252 | \`\`\`bash
5253 | # Create ADR directory if it doesn't exist
5254 | mkdir -p ${outputDirectory}
5255 | 
5256 | # Save each ADR as a separate file (example)
5257 | # Replace [NUMBER] and [TITLE] with actual values from generated ADRs
5258 | # cat > "${outputDirectory}/001-example-decision.md" << 'EOF'
5259 | # [ADR content here]
5260 | # EOF
5261 | \`\`\`
5262 | `,
5263 |         });
5264 |       } else {
5265 |         // Fallback to prompt-only mode
5266 |         return {
5267 |           content: [
5268 |             {
5269 |               type: 'text',
5270 |               text: `# Enhanced ADR Generation from PRD: ${prdPath}
5271 | 
5272 | ## Advanced Prompt-Driven ADR Generation Process
5273 | 
5274 | This tool uses a 100% prompt-driven architecture enhanced with advanced prompting techniques:
5275 | 
5276 | ### Enhancement Features
5277 | - **APE Optimization**: ${enhancedMode && promptOptimization ? '✅ Enabled - Prompts optimized for superior quality' : '❌ Disabled'}
5278 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled - Domain knowledge enhanced analysis' : '❌ Disabled'}
5279 | - **PRD Type Optimization**: ${prdType} - Tailored for specific domain requirements
5280 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled - All advanced features active' : '❌ Disabled - Basic mode'}
5281 | 
5282 | ### Enhanced AI Agent Workflow
5283 | 
5284 | 1. **Validate PRD file existence** using secure file system operations
5285 | 2. **Read PRD content** safely with proper security validation
5286 | 3. **Apply domain knowledge** to enhance understanding (if enabled)
5287 | 4. **Generate optimized ADRs** using APE-enhanced prompts (if enabled)
5288 | 5. **Create enhanced ADR files** in the specified output directory: ${outputDirectory}
5289 | 
5290 | ## Execution Instructions
5291 | 
5292 | Please execute the following enhanced comprehensive prompt:
5293 | 
5294 | ${adrPrompt}
5295 | 
5296 | ## Advanced Features
5297 | 
5298 | ${
5299 |   enhancedMode && knowledgeEnhancement
5300 |     ? `
5301 | ### Knowledge Enhancement
5302 | - Domain-specific architectural knowledge has been generated
5303 | - PRD analysis is enhanced with ${prdType} domain expertise
5304 | - ADR decisions leverage domain best practices and patterns
5305 | `
5306 |     : ''
5307 | }
5308 | 
5309 | ${
5310 |   enhancedMode && promptOptimization
5311 |     ? `
5312 | ### APE Optimization
5313 | - Prompts have been automatically optimized for quality
5314 | - Enhanced evaluation criteria ensure superior ADR generation
5315 | - Optimization focused on task completion, clarity, and specificity
5316 | `
5317 |     : ''
5318 | }
5319 | 
5320 | ## Security and Validation
5321 | 
5322 | - All file operations include security validation
5323 | - Path traversal protection is enabled
5324 | - System directory access is prevented
5325 | - User confirmation is required for file creation
5326 | - Content validation ensures safe enhanced ADR generation
5327 | 
5328 | ## Expected Enhanced Workflow
5329 | 
5330 | 1. Execute file existence check for: ${prdPath}
5331 | 2. If file exists, read PRD content securely
5332 | 3. Apply domain knowledge to enhance PRD understanding
5333 | 4. Analyze PRD content using optimized prompts
5334 | 5. Generate domain-enhanced individual ADRs for each decision
5335 | 6. Create file creation prompts for each enhanced ADR
5336 | 7. Confirm with user before writing files to: ${outputDirectory}
5337 | 
5338 | The enhanced process maintains full traceability from PRD requirements to generated ADRs while providing superior quality through advanced prompting techniques and ensuring security and user control over file operations.`,
5339 |             },
5340 |           ],
5341 |         };
5342 |       }
5343 |     } catch (error) {
5344 |       throw new McpAdrError(
5345 |         `Failed to generate ADR prompts from PRD: ${error instanceof Error ? error.message : String(error)}`,
5346 |         'PROMPT_GENERATION_ERROR'
5347 |       );
5348 |     }
5349 |   }
5350 | 
5351 |   private async compareAdrProgress(args: Record<string, unknown>): Promise<CallToolResult> {
5352 |     const {
5353 |       todoPath = 'TODO.md',
5354 |       adrDirectory = this.config.adrDirectory,
5355 |       projectPath = this.config.projectPath,
5356 |       environment = 'auto-detect',
5357 |       environmentConfig = {},
5358 |       validationType = 'full',
5359 |       includeFileChecks = true,
5360 |       includeRuleValidation = true,
5361 |       deepCodeAnalysis = true,
5362 |       functionalValidation = true,
5363 |       strictMode = true,
5364 |       environmentValidation = true,
5365 |     } = args;
5366 | 
5367 |     const { getAdrDirectoryPath } = await import('./utils/config.js');
5368 |     const path = await import('path');
5369 | 
5370 |     // Resolve paths
5371 |     const absoluteTodoPath = path.resolve(projectPath as string, todoPath as string);
5372 |     const absoluteAdrPath = adrDirectory
5373 |       ? path.resolve(projectPath as string, adrDirectory as string)
5374 |       : getAdrDirectoryPath(this.config);
5375 | 
5376 |     this.logger.info(
5377 |       `Comparing ADR progress: TODO(${absoluteTodoPath}) vs ADRs(${absoluteAdrPath}) vs Environment(${projectPath}) [env: ${environment}]`
5378 |     );
5379 | 
5380 |     // Environment validation and auto-detection
5381 |     let detectedEnvironment = environment;
5382 |     let finalEnvironmentConfig = { ...(environmentConfig as Record<string, unknown>) };
5383 | 
5384 |     if (
5385 |       environmentValidation &&
5386 |       (validationType === 'full' || validationType === 'environment-only')
5387 |     ) {
5388 |       try {
5389 |         const envResult = await this.detectAndValidateEnvironment(
5390 |           projectPath as string,
5391 |           environment as string,
5392 |           environmentConfig as Record<string, unknown>
5393 |         );
5394 |         detectedEnvironment = envResult.detectedEnvironment;
5395 |         finalEnvironmentConfig = { ...finalEnvironmentConfig, ...envResult.environmentConfig };
5396 |         this.logger.info(`Environment detection result: ${detectedEnvironment}`);
5397 |       } catch (error) {
5398 |         this.logger.warn(
5399 |           `Environment detection failed: ${error instanceof Error ? error.message : String(error)}`
5400 |         );
5401 |       }
5402 |     }
5403 | 
5404 |     try {
5405 |       // Step 1: Read TODO.md file directly
5406 |       let todoContent = '';
5407 |       if (validationType === 'full' || validationType === 'todo-only') {
5408 |         try {
5409 |           const fs = await import('fs/promises');
5410 |           todoContent = await fs.readFile(absoluteTodoPath, 'utf-8');
5411 |         } catch (error) {
5412 |           this.logger.warn(
5413 |             `Could not read TODO.md file: ${error instanceof Error ? error.message : String(error)}`
5414 |           );
5415 |         }
5416 |       }
5417 | 
5418 |       // Step 2: Use actual project structure scanning
5419 |       let projectStructure = null;
5420 |       if (validationType === 'full' || validationType === 'environment-only') {
5421 |         try {
5422 |           const { scanProjectStructure } = await import('./utils/actual-file-operations.js');
5423 |           const includeContent = (deepCodeAnalysis as boolean) || (functionalValidation as boolean);
5424 |           projectStructure = await scanProjectStructure(projectPath as string, {
5425 |             readContent: includeContent,
5426 |             maxFileSize: includeContent ? 10000 : 0,
5427 |           });
5428 |         } catch (error) {
5429 |           this.logger.warn(
5430 |             `Could not scan project structure: ${error instanceof Error ? error.message : String(error)}`
5431 |           );
5432 |         }
5433 |       }
5434 | 
5435 |       // Perform actual analysis locally instead of relying on AI execution
5436 |       let discoveryResult: unknown = null;
5437 |       if (validationType === 'full' || validationType === 'adr-only') {
5438 |         const { discoverAdrsInDirectory } = await import('./utils/adr-discovery.js');
5439 |         discoveryResult = await discoverAdrsInDirectory(
5440 |           absoluteAdrPath as string,
5441 |           true,
5442 |           projectPath as string
5443 |         );
5444 |       }
5445 |       const analysis = await this.performLocalAdrProgressAnalysis({
5446 |         todoContent,
5447 |         todoPath: absoluteTodoPath,
5448 |         discoveredAdrs: (discoveryResult as { adrs?: unknown[] })?.adrs || [],
5449 |         adrDirectory: absoluteAdrPath,
5450 |         projectStructure: projectStructure || null,
5451 |         projectPath: projectPath as string,
5452 |         validationType: validationType as string,
5453 |         includeFileChecks: includeFileChecks as boolean,
5454 |         includeRuleValidation: includeRuleValidation as boolean,
5455 |         deepCodeAnalysis: deepCodeAnalysis as boolean,
5456 |         functionalValidation: functionalValidation as boolean,
5457 |         strictMode: strictMode as boolean,
5458 |         environment: detectedEnvironment as string,
5459 |         environmentConfig: finalEnvironmentConfig,
5460 |         environmentValidation: environmentValidation as boolean,
5461 |       });
5462 | 
5463 |       return {
5464 |         content: [
5465 |           {
5466 |             type: 'text',
5467 |             text: analysis,
5468 |           },
5469 |         ],
5470 |       };
5471 |     } catch (error) {
5472 |       throw new McpAdrError(
5473 |         `Failed to compare ADR progress: ${error instanceof Error ? error.message : String(error)}`,
5474 |         'VALIDATION_ERROR'
5475 |       );
5476 |     }
5477 |   }
5478 | 
5479 |   /**
5480 |    * Detect and validate environment context
5481 |    */
5482 |   private async detectAndValidateEnvironment(
5483 |     projectPath: string,
5484 |     environment: string,
5485 |     environmentConfig: Record<string, unknown>
5486 |   ): Promise<{ detectedEnvironment: string; environmentConfig: Record<string, unknown> }> {
5487 |     const path = await import('path');
5488 |     const fs = await import('fs/promises');
5489 | 
5490 |     let detectedEnvironment = environment;
5491 |     let finalConfig = { ...environmentConfig };
5492 | 
5493 |     if (environment === 'auto-detect') {
5494 |       // Auto-detect environment based on project structure
5495 |       try {
5496 |         // Check for environment indicator files
5497 |         const envFiles = [
5498 |           '.env.development',
5499 |           '.env.staging',
5500 |           '.env.production',
5501 |           '.env.test',
5502 |           'package.json',
5503 |           'docker-compose.yml',
5504 |           'Dockerfile',
5505 |         ];
5506 | 
5507 |         const existingFiles: string[] = [];
5508 |         for (const file of envFiles) {
5509 |           try {
5510 |             await fs.access(path.join(projectPath, file));
5511 |             existingFiles.push(file);
5512 |           } catch {
5513 |             // File doesn't exist, continue
5514 |           }
5515 |         }
5516 | 
5517 |         // Environment detection logic
5518 |         if (existingFiles.includes('.env.production') || existingFiles.includes('Dockerfile')) {
5519 |           detectedEnvironment = 'production';
5520 |         } else if (existingFiles.includes('.env.staging')) {
5521 |           detectedEnvironment = 'staging';
5522 |         } else if (existingFiles.includes('.env.test')) {
5523 |           detectedEnvironment = 'testing';
5524 |         } else {
5525 |           detectedEnvironment = 'development';
5526 |         }
5527 | 
5528 |         // Set environment-specific default configurations
5529 |         switch (detectedEnvironment) {
5530 |           case 'production':
5531 |             finalConfig = {
5532 |               securityLevel: 'critical',
5533 |               requiredFiles: ['package.json', 'README.md'],
5534 |               requiredServices: ['monitoring', 'logging'],
5535 |               performanceRequirements: { minUptime: 99.9 },
5536 |               ...finalConfig,
5537 |             };
5538 |             break;
5539 |           case 'staging':
5540 |             finalConfig = {
5541 |               securityLevel: 'high',
5542 |               requiredFiles: ['package.json'],
5543 |               requiredServices: ['testing', 'monitoring'],
5544 |               performanceRequirements: { minUptime: 95 },
5545 |               ...finalConfig,
5546 |             };
5547 |             break;
5548 |           case 'testing':
5549 |             finalConfig = {
5550 |               securityLevel: 'medium',
5551 |               requiredFiles: ['package.json'],
5552 |               requiredServices: ['testing'],
5553 |               performanceRequirements: {},
5554 |               ...finalConfig,
5555 |             };
5556 |             break;
5557 |           default: // development
5558 |             finalConfig = {
5559 |               securityLevel: 'medium',
5560 |               requiredFiles: ['package.json'],
5561 |               requiredServices: [],
5562 |               performanceRequirements: {},
5563 |               ...finalConfig,
5564 |             };
5565 |         }
5566 |       } catch (error) {
5567 |         this.logger.warn(
5568 |           `Environment auto-detection failed: ${error instanceof Error ? error.message : String(error)}`
5569 |         );
5570 |         detectedEnvironment = 'development'; // fallback
5571 |       }
5572 |     }
5573 | 
5574 |     return { detectedEnvironment, environmentConfig: finalConfig };
5575 |   }
5576 | 
5577 |   /**
5578 |    * Perform local ADR progress analysis without relying on AI execution
5579 |    */
5580 |   private async performLocalAdrProgressAnalysis(params: {
5581 |     todoContent: string;
5582 |     todoPath: string;
5583 |     discoveredAdrs: unknown[];
5584 |     adrDirectory: string;
5585 |     projectStructure: unknown;
5586 |     projectPath: string;
5587 |     validationType: string;
5588 |     includeFileChecks: boolean;
5589 |     includeRuleValidation: boolean;
5590 |     deepCodeAnalysis: boolean;
5591 |     functionalValidation: boolean;
5592 |     strictMode: boolean;
5593 |     environment: string;
5594 |     environmentConfig: unknown;
5595 |     environmentValidation: boolean;
5596 |   }): Promise<string> {
5597 |     const {
5598 |       todoContent,
5599 |       todoPath,
5600 |       discoveredAdrs,
5601 |       adrDirectory,
5602 |       projectStructure,
5603 |       projectPath,
5604 |       validationType,
5605 |       includeFileChecks,
5606 |       includeRuleValidation,
5607 |       deepCodeAnalysis,
5608 |       functionalValidation,
5609 |       strictMode,
5610 |       environment,
5611 |       environmentConfig,
5612 |       environmentValidation,
5613 |     } = params;
5614 | 
5615 |     const currentDate = new Date().toISOString().split('T')[0];
5616 | 
5617 |     // Parse TODO content to extract tasks
5618 |     const todoTasks = this.parseTodoTasks(todoContent);
5619 | 
5620 |     // Basic analysis
5621 |     const totalAdrs = discoveredAdrs.length;
5622 |     const totalTasks = todoTasks.length;
5623 |     const completedTasks = todoTasks.filter(task => task.completed).length;
5624 | 
5625 |     // Calculate alignment score (simplified, now environment-aware)
5626 |     const adrTaskMapping = this.mapTasksToAdrs(
5627 |       todoTasks,
5628 |       discoveredAdrs,
5629 |       environment,
5630 |       environmentConfig
5631 |     );
5632 |     const alignedTasks = adrTaskMapping.aligned.length;
5633 |     let alignmentScore = totalTasks > 0 ? Math.round((alignedTasks / totalTasks) * 100) : 0;
5634 | 
5635 |     // Environment-aware scoring adjustments
5636 |     if (environmentValidation && environmentConfig) {
5637 |       const envScore = this.calculateEnvironmentScore(
5638 |         projectStructure,
5639 |         environment,
5640 |         environmentConfig
5641 |       );
5642 |       alignmentScore = Math.round((alignmentScore + envScore) / 2); // Blend scores
5643 |     }
5644 | 
5645 |     // File existence checks
5646 |     let fileCheckResults = '';
5647 |     if (includeFileChecks && projectStructure) {
5648 |       fileCheckResults = this.performFileExistenceChecks(todoTasks, projectStructure);
5649 |     }
5650 | 
5651 |     // Environment compliance checks
5652 |     let environmentAnalysisResults = '';
5653 |     if (environmentValidation && environmentConfig) {
5654 |       environmentAnalysisResults = this.performEnvironmentComplianceAnalysis(
5655 |         projectStructure,
5656 |         environment,
5657 |         environmentConfig,
5658 |         strictMode
5659 |       );
5660 |     }
5661 | 
5662 |     // Mock vs Production analysis
5663 |     let mockAnalysisResults = '';
5664 |     if (deepCodeAnalysis && projectStructure) {
5665 |       mockAnalysisResults = this.performMockVsProductionAnalysis(projectStructure, strictMode);
5666 |     }
5667 | 
5668 |     return `# ADR Progress Validation Report
5669 | 
5670 | **Validation Date**: ${currentDate}
5671 | **Validation Type**: ${validationType}
5672 | **Project Path**: ${projectPath}
5673 | **TODO Path**: ${todoPath}
5674 | **ADR Directory**: ${adrDirectory}
5675 | **Environment**: ${environment}${environmentValidation ? ` (validation enabled)` : ''}
5676 | 
5677 | ## Summary
5678 | - **Total ADRs**: ${totalAdrs}
5679 | - **Total TODO Tasks**: ${totalTasks}
5680 | - **Completed Tasks**: ${completedTasks}
5681 | - **Alignment Score**: ${alignmentScore}%
5682 | - **Compliance Score**: ${Math.max(alignmentScore - 10, 0)}%
5683 | - **Environment**: ${environment}
5684 | 
5685 | ## Configuration
5686 | - **File Checks**: ${includeFileChecks ? 'Enabled' : 'Disabled'}
5687 | - **Rule Validation**: ${includeRuleValidation ? 'Enabled' : 'Disabled'}
5688 | - **Deep Code Analysis**: ${deepCodeAnalysis ? 'Enabled' : 'Disabled'}
5689 | - **Functional Validation**: ${functionalValidation ? 'Enabled' : 'Disabled'}
5690 | - **Strict Mode**: ${strictMode ? 'Enabled - High scrutiny for mock vs production' : 'Disabled'}
5691 | - **Environment Validation**: ${environmentValidation ? 'Enabled' : 'Disabled'}
5692 | 
5693 | ## Environment Context
5694 | - **Target Environment**: ${environment}
5695 | - **Security Level**: ${(environmentConfig as Record<string, unknown>)?.['securityLevel'] || 'Not specified'}
5696 | - **Required Files**: ${((environmentConfig as Record<string, unknown>)?.['requiredFiles'] as unknown[] | undefined)?.length || 0} files
5697 | - **Required Services**: ${((environmentConfig as Record<string, unknown>)?.['requiredServices'] as unknown[] | undefined)?.length || 0} services
5698 | 
5699 | ## ADR Discovery Results
5700 | ${
5701 |   totalAdrs > 0
5702 |     ? `Found ${totalAdrs} ADRs:\n${discoveredAdrs
5703 |         .map((adr, i) => {
5704 |           const adrRecord = adr as Record<string, unknown>;
5705 |           return `${i + 1}. **${adrRecord['title']}** (${adrRecord['status']}) - ${adrRecord['filename']}`;
5706 |         })
5707 |         .join('\n')}`
5708 |     : 'No ADRs found in the specified directory.'
5709 | }
5710 | 
5711 | ## TODO Task Analysis
5712 | ${
5713 |   totalTasks > 0
5714 |     ? `Found ${totalTasks} tasks:\n${todoTasks
5715 |         .map((task, i) => `${i + 1}. ${task.completed ? '✅' : '⏳'} ${task.title}`)
5716 |         .join('\n')}`
5717 |     : 'No tasks found in TODO.md file.'
5718 | }
5719 | 
5720 | ## Alignment Analysis
5721 | 
5722 | ### ✅ Properly Aligned Tasks
5723 | ${
5724 |   adrTaskMapping.aligned.length > 0
5725 |     ? adrTaskMapping.aligned
5726 |         .map(task => `- ${task.title}: Corresponds to ADR requirements`)
5727 |         .join('\n')
5728 |     : '- No aligned tasks identified'
5729 | }
5730 | 
5731 | ### ⚠️ Misaligned Tasks
5732 | ${
5733 |   adrTaskMapping.misaligned.length > 0
5734 |     ? adrTaskMapping.misaligned
5735 |         .map(task => `- ${task.title}: May not fully align with ADR specifications`)
5736 |         .join('\n')
5737 |     : '- No misaligned tasks identified'
5738 | }
5739 | 
5740 | ### ❌ Missing Tasks
5741 | ${
5742 |   adrTaskMapping.missing.length > 0
5743 |     ? adrTaskMapping.missing.map(gap => `- ${gap}: Required by ADRs but not in TODO`).join('\n')
5744 |     : '- No obvious missing tasks identified'
5745 | }
5746 | 
5747 | ## Implementation Status
5748 | 
5749 | ${fileCheckResults || '### File Existence Validation\n- File checks disabled or no project structure available'}
5750 | 
5751 | ${environmentAnalysisResults || ''}
5752 | 
5753 | ${mockAnalysisResults || ''}
5754 | 
5755 | ## Recommendations
5756 | 
5757 | ### High Priority Actions
5758 | ${
5759 |   alignmentScore < 70
5760 |     ? '1. **Improve ADR-TODO Alignment**: Review TODO tasks against ADR requirements\n2. **Add Missing Tasks**: Identify and add tasks required by ADRs'
5761 |     : '1. **Maintain Current Alignment**: Continue following ADR specifications'
5762 | }
5763 | ${
5764 |   completedTasks < totalTasks * 0.5
5765 |     ? '\n3. **Accelerate Implementation**: Focus on completing pending tasks'
5766 |     : ''
5767 | }
5768 | ${
5769 |   environmentValidation && environment === 'production' && alignmentScore < 90
5770 |     ? '\n4. **⚠️ Production Environment Warning**: Current alignment may not meet production requirements'
5771 |     : ''
5772 | }
5773 | 
5774 | ### Medium Priority Actions
5775 | 1. **Review Implementation Quality**: ${strictMode ? 'Strict mode analysis above shows' : 'Consider enabling strict mode for'} detailed quality assessment
5776 | 2. **Update Documentation**: Ensure TODO.md reflects current project state
5777 | ${
5778 |   environmentValidation
5779 |     ? `3. **Environment Compliance**: Ensure ${environment} environment requirements are met`
5780 |     : ''
5781 | }
5782 | 
5783 | ### Low Priority Actions
5784 | 1. **Optimize Workflow**: Consider tools for automated ADR-TODO synchronization
5785 | 2. **Regular Validation**: Schedule periodic ADR progress reviews
5786 | 
5787 | ## Next Steps
5788 | 1. Address high-priority alignment issues identified above
5789 | 2. ${totalTasks === 0 ? 'Create initial TODO.md from ADR requirements' : 'Update TODO.md with missing tasks'}
5790 | 3. ${includeFileChecks ? 'Verify implementation of completed tasks' : 'Enable file checks for detailed implementation verification'}
5791 | 4. ${includeRuleValidation ? 'Resolve architectural rule compliance violations' : 'Enable rule validation for compliance checking'}
5792 | \`\`\`
5793 | 
5794 | To re-run this validation with strict mode:
5795 | \`\`\`json
5796 | {
5797 |   "tool": "compare_adr_progress",
5798 |   "args": {
5799 |     "todoPath": "${todoPath}",
5800 |     "adrDirectory": "${adrDirectory}",
5801 |     "validationType": "full",
5802 |     "deepCodeAnalysis": true,
5803 |     "functionalValidation": true,
5804 |     "strictMode": true
5805 |   }
5806 | }
5807 | \`\`\`
5808 | `;
5809 |   }
5810 | 
5811 |   /**
5812 |    * Parse TODO.md content to extract tasks
5813 |    */
5814 |   private parseTodoTasks(
5815 |     todoContent: string
5816 |   ): Array<{ title: string; completed: boolean; description?: string }> {
5817 |     if (!todoContent) return [];
5818 | 
5819 |     const lines = todoContent.split('\n');
5820 |     const tasks: Array<{ title: string; completed: boolean; description?: string }> = [];
5821 | 
5822 |     for (const line of lines) {
5823 |       // Look for markdown checkbox patterns
5824 |       const taskMatch = line.match(/^\s*[-*]\s*\[([x\s])\]\s*(.+)$/i);
5825 |       if (taskMatch && taskMatch[1] && taskMatch[2]) {
5826 |         const checkbox = taskMatch[1];
5827 |         const title = taskMatch[2];
5828 |         tasks.push({
5829 |           title: title.trim(),
5830 |           completed: checkbox.toLowerCase() === 'x',
5831 |         });
5832 |       }
5833 |       // Also look for simple list items that might be tasks
5834 |       else if (line.match(/^\s*[-*]\s+\w+/)) {
5835 |         const title = line.replace(/^\s*[-*]\s+/, '').trim();
5836 |         if (title.length > 3) {
5837 |           // Avoid very short items
5838 |           tasks.push({
5839 |             title,
5840 |             completed: false,
5841 |           });
5842 |         }
5843 |       }
5844 |     }
5845 | 
5846 |     return tasks;
5847 |   }
5848 | 
5849 |   /**
5850 |    * Map TODO tasks to ADRs to identify alignment (now environment-aware)
5851 |    */
5852 |   private mapTasksToAdrs(
5853 |     tasks: Array<{ title: string; completed: boolean }>,
5854 |     adrs: unknown[],
5855 |     environment?: string,
5856 |     environmentConfig?: unknown
5857 |   ): {
5858 |     aligned: typeof tasks;
5859 |     misaligned: typeof tasks;
5860 |     missing: string[];
5861 |   } {
5862 |     const aligned: typeof tasks = [];
5863 |     const misaligned: typeof tasks = [];
5864 |     const missing: string[] = [];
5865 | 
5866 |     // Simple keyword matching for alignment detection
5867 |     const adrKeywords = adrs.flatMap(adr => {
5868 |       const adrRecord = adr as Record<string, unknown>;
5869 |       return [
5870 |         String(adrRecord['title'] || '').toLowerCase(),
5871 |         ...String(adrRecord['decision'] || '')
5872 |           .toLowerCase()
5873 |           .split(/\s+/)
5874 |           .filter((w: string) => w.length > 4),
5875 |         ...String(adrRecord['context'] || '')
5876 |           .toLowerCase()
5877 |           .split(/\s+/)
5878 |           .filter((w: string) => w.length > 4),
5879 |       ];
5880 |     });
5881 | 
5882 |     // Environment-specific keywords that should be prioritized
5883 |     const envKeywords: string[] = [];
5884 |     if (environment && environmentConfig) {
5885 |       if (environment === 'production') {
5886 |         envKeywords.push('deploy', 'production', 'monitoring', 'security', 'performance');
5887 |       } else if (environment === 'staging') {
5888 |         envKeywords.push('test', 'staging', 'integration', 'validation');
5889 |       } else if (environment === 'development') {
5890 |         envKeywords.push('setup', 'development', 'local', 'debug');
5891 |       }
5892 |     }
5893 | 
5894 |     for (const task of tasks) {
5895 |       const taskLower = task.title.toLowerCase();
5896 |       const firstWord = taskLower.split(' ')[0] || '';
5897 |       const hasKeywordMatch = adrKeywords.some(
5898 |         keyword => taskLower.includes(keyword) || keyword.includes(firstWord)
5899 |       );
5900 | 
5901 |       // Environment-aware alignment scoring
5902 |       const hasEnvKeywordMatch = envKeywords.some(keyword => taskLower.includes(keyword));
5903 | 
5904 |       if (hasKeywordMatch || hasEnvKeywordMatch) {
5905 |         aligned.push(task);
5906 |       } else {
5907 |         misaligned.push(task);
5908 |       }
5909 |     }
5910 | 
5911 |     // Identify potential missing tasks based on ADR content
5912 |     for (const adr of adrs) {
5913 |       const adrRecord = adr as Record<string, unknown>;
5914 |       if (adrRecord['status'] === 'accepted' && adrRecord['decision']) {
5915 |         const decisionWords = String(adrRecord['decision']).toLowerCase().split(/\s+/);
5916 |         const implementationWords = [
5917 |           'implement',
5918 |           'create',
5919 |           'build',
5920 |           'develop',
5921 |           'add',
5922 |           'setup',
5923 |           'configure',
5924 |         ];
5925 | 
5926 |         if (implementationWords.some(word => decisionWords.includes(word))) {
5927 |           const adrTitle = String(adrRecord['title'] || '');
5928 |           const adrFirstWord = adrTitle.toLowerCase().split(' ')[0] || '';
5929 |           const hasCorrespondingTask = tasks.some(task =>
5930 |             task.title.toLowerCase().includes(adrFirstWord)
5931 |           );
5932 | 
5933 |           if (!hasCorrespondingTask) {
5934 |             missing.push(`Implement ${adrTitle}`);
5935 |           }
5936 |         }
5937 |       }
5938 |     }
5939 | 
5940 |     // Environment-specific missing tasks
5941 |     if (environment && environmentConfig) {
5942 |       const envConfig = environmentConfig as Record<string, unknown>;
5943 |       if (envConfig['requiredFiles']) {
5944 |         for (const file of envConfig['requiredFiles'] as string[]) {
5945 |           const hasFileTask = tasks.some(task =>
5946 |             task.title.toLowerCase().includes(file.toLowerCase())
5947 |           );
5948 |           if (!hasFileTask) {
5949 |             missing.push(`Create ${file} for ${environment} environment`);
5950 |           }
5951 |         }
5952 |       }
5953 | 
5954 |       if (envConfig['requiredServices']) {
5955 |         for (const service of envConfig['requiredServices'] as string[]) {
5956 |           const hasServiceTask = tasks.some(task =>
5957 |             task.title.toLowerCase().includes(service.toLowerCase())
5958 |           );
5959 |           if (!hasServiceTask) {
5960 |             missing.push(`Setup ${service} service for ${environment}`);
5961 |           }
5962 |         }
5963 |       }
5964 |     }
5965 | 
5966 |     return { aligned, misaligned, missing };
5967 |   }
5968 | 
5969 |   /**
5970 |    * Check file existence for completed tasks
5971 |    */
5972 |   private performFileExistenceChecks(
5973 |     tasks: Array<{ title: string; completed: boolean }>,
5974 |     projectStructure: any
5975 |   ): string {
5976 |     if (!projectStructure) return '- Project structure not available';
5977 | 
5978 |     const allFiles = [
5979 |       ...(projectStructure.packageFiles || []),
5980 |       ...(projectStructure.configFiles || []),
5981 |       ...(projectStructure.buildFiles || []),
5982 |       ...(projectStructure.dockerFiles || []),
5983 |       ...(projectStructure.ciFiles || []),
5984 |       ...(projectStructure.scriptFiles || []),
5985 |     ];
5986 | 
5987 |     let results = '### File Existence Validation\n';
5988 |     let checkCount = 0;
5989 | 
5990 |     for (const task of tasks) {
5991 |       if (task.completed) {
5992 |         // Simple heuristic: look for files mentioned in task title
5993 |         const taskLower = task.title.toLowerCase();
5994 |         const mentionedFiles = allFiles.filter(
5995 |           file =>
5996 |             taskLower.includes(file.filename.toLowerCase()) ||
5997 |             taskLower.includes(file.filename.replace(/\.[^.]+$/, '').toLowerCase())
5998 |         );
5999 | 
6000 |         if (mentionedFiles.length > 0) {
6001 |           results += `- ✅ **${task.title}**: Found related files (${mentionedFiles.map(f => f.filename).join(', ')})\n`;
6002 |           checkCount++;
6003 |         } else if (
6004 |           taskLower.includes('file') ||
6005 |           taskLower.includes('create') ||
6006 |           taskLower.includes('implement')
6007 |         ) {
6008 |           results += `- ⚠️ **${task.title}**: No clearly related files found\n`;
6009 |           checkCount++;
6010 |         }
6011 |       }
6012 |     }
6013 | 
6014 |     if (checkCount === 0) {
6015 |       results += '- No file-related completed tasks to validate\n';
6016 |     }
6017 | 
6018 |     return results;
6019 |   }
6020 | 
6021 |   /**
6022 |    * Analyze code for mock vs production implementation
6023 |    */
6024 |   private performMockVsProductionAnalysis(projectStructure: any, strictMode: boolean): string {
6025 |     if (!projectStructure) return '';
6026 | 
6027 |     const codeFiles = [
6028 |       ...(projectStructure.buildFiles || []),
6029 |       ...(projectStructure.configFiles || []),
6030 |     ].filter(file => file.content && file.content !== '[Binary or unreadable file]');
6031 | 
6032 |     if (codeFiles.length === 0) return '';
6033 | 
6034 |     let results = '\n### Mock vs Production Code Analysis\n';
6035 |     let mockIndicators = 0;
6036 |     let productionIndicators = 0;
6037 | 
6038 |     const mockPatterns = [
6039 |       /TODO:/gi,
6040 |       /FIXME:/gi,
6041 |       /NotImplementedException/gi,
6042 |       /throw.*not.*implement/gi,
6043 |       /return.*mock/gi,
6044 |       /placeholder/gi,
6045 |       /stub/gi,
6046 |       /return\s+null;/gi,
6047 |       /return\s+""/gi,
6048 |       /return\s+\[\]/gi,
6049 |       /return\s+{}/gi,
6050 |     ];
6051 | 
6052 |     const productionPatterns = [
6053 |       /error\s+handling/gi,
6054 |       /try\s*{/gi,
6055 |       /catch\s*\(/gi,
6056 |       /validate/gi,
6057 |       /authentication/gi,
6058 |       /authorization/gi,
6059 |       /database/gi,
6060 |       /api/gi,
6061 |       /config/gi,
6062 |     ];
6063 | 
6064 |     for (const file of codeFiles.slice(0, 10)) {
6065 |       // Limit analysis to prevent overwhelming output
6066 |       const content = file.content;
6067 |       const fileMockCount = mockPatterns.reduce(
6068 |         (count, pattern) => count + (content.match(pattern) || []).length,
6069 |         0
6070 |       );
6071 |       const fileProdCount = productionPatterns.reduce(
6072 |         (count, pattern) => count + (content.match(pattern) || []).length,
6073 |         0
6074 |       );
6075 | 
6076 |       mockIndicators += fileMockCount;
6077 |       productionIndicators += fileProdCount;
6078 | 
6079 |       if (fileMockCount > 0 || fileProdCount > 2) {
6080 |         const status =
6081 |           fileMockCount > fileProdCount
6082 |             ? '❌ **Mock/Stub**'
6083 |             : fileProdCount > fileMockCount * 2
6084 |               ? '✅ **Production Ready**'
6085 |               : '⚠️ **Partial Implementation**';
6086 | 
6087 |         results += `- ${status}: ${file.filename} `;
6088 |         if (fileMockCount > 0) {
6089 |           results += `(${fileMockCount} mock indicators) `;
6090 |         }
6091 |         if (fileProdCount > 0) {
6092 |           results += `(${fileProdCount} production indicators)`;
6093 |         }
6094 |         results += '\n';
6095 |       }
6096 |     }
6097 | 
6098 |     results += `\n#### Overall Code Quality Assessment\n`;
6099 |     results += `- **Mock Indicators Found**: ${mockIndicators} instances\n`;
6100 |     results += `- **Production Indicators Found**: ${productionIndicators} instances\n`;
6101 | 
6102 |     if (strictMode) {
6103 |       const qualityScore =
6104 |         productionIndicators > mockIndicators * 2
6105 |           ? 'Good'
6106 |           : productionIndicators > mockIndicators
6107 |             ? 'Fair'
6108 |             : 'Needs Improvement';
6109 |       results += `- **Quality Assessment**: ${qualityScore}\n`;
6110 | 
6111 |       if (mockIndicators > 0) {
6112 |         results += `- **⚠️ Strict Mode Warning**: Found ${mockIndicators} potential mock/stub indicators\n`;
6113 |       }
6114 |     }
6115 | 
6116 |     return results;
6117 |   }
6118 | 
6119 |   /**
6120 |    * Calculate environment-specific compliance score
6121 |    */
6122 |   private calculateEnvironmentScore(
6123 |     projectStructure: any,
6124 |     environment: string,
6125 |     environmentConfig: any
6126 |   ): number {
6127 |     if (!projectStructure || !environmentConfig) return 0;
6128 | 
6129 |     let score = 100; // Start with perfect score
6130 | 
6131 |     // Check required files
6132 |     if (environmentConfig.requiredFiles) {
6133 |       const allFiles = [
6134 |         ...(projectStructure.packageFiles || []),
6135 |         ...(projectStructure.configFiles || []),
6136 |         ...(projectStructure.buildFiles || []),
6137 |         ...(projectStructure.dockerFiles || []),
6138 |         ...(projectStructure.ciFiles || []),
6139 |         ...(projectStructure.scriptFiles || []),
6140 |       ];
6141 | 
6142 |       const existingFiles = allFiles.map(f => f.filename);
6143 |       const missingFiles = environmentConfig.requiredFiles.filter(
6144 |         (file: string) => !existingFiles.includes(file)
6145 |       );
6146 | 
6147 |       // Deduct 10 points per missing required file
6148 |       score -= missingFiles.length * 10;
6149 |     }
6150 | 
6151 |     // Environment-specific penalties
6152 |     if (environment === 'production') {
6153 |       // Production requires higher standards
6154 |       if (!projectStructure.dockerFiles?.length) score -= 15;
6155 |       if (!projectStructure.ciFiles?.length) score -= 10;
6156 |     }
6157 | 
6158 |     return Math.max(score, 0);
6159 |   }
6160 | 
6161 |   /**
6162 |    * Perform environment compliance analysis
6163 |    */
6164 |   private performEnvironmentComplianceAnalysis(
6165 |     projectStructure: any,
6166 |     environment: string,
6167 |     environmentConfig: any,
6168 |     strictMode: boolean
6169 |   ): string {
6170 |     if (!projectStructure || !environmentConfig) {
6171 |       return '\n### Environment Compliance Analysis\n- Environment analysis disabled or no project structure available\n';
6172 |     }
6173 | 
6174 |     let results = '\n### Environment Compliance Analysis\n';
6175 | 
6176 |     // Required files analysis
6177 |     if (environmentConfig.requiredFiles) {
6178 |       results += `#### Required Files for ${environment} Environment\n`;
6179 |       const allFiles = [
6180 |         ...(projectStructure.packageFiles || []),
6181 |         ...(projectStructure.configFiles || []),
6182 |         ...(projectStructure.buildFiles || []),
6183 |         ...(projectStructure.dockerFiles || []),
6184 |         ...(projectStructure.ciFiles || []),
6185 |         ...(projectStructure.scriptFiles || []),
6186 |       ];
6187 | 
6188 |       const existingFiles = allFiles.map(f => f.filename);
6189 | 
6190 |       for (const requiredFile of environmentConfig.requiredFiles) {
6191 |         const exists = existingFiles.includes(requiredFile);
6192 |         results += `- ${exists ? '✅' : '❌'} **${requiredFile}**: ${exists ? 'Found' : 'Missing'}\n`;
6193 |       }
6194 |     }
6195 | 
6196 |     // Security level compliance
6197 |     if (environmentConfig.securityLevel) {
6198 |       results += `\n#### Security Level: ${environmentConfig.securityLevel}\n`;
6199 | 
6200 |       const securityIndicators = this.analyzeSecurityCompliance(
6201 |         projectStructure,
6202 |         environmentConfig.securityLevel
6203 |       );
6204 |       results += securityIndicators;
6205 |     }
6206 | 
6207 |     // Environment-specific recommendations
6208 |     results += `\n#### ${environment} Environment Recommendations\n`;
6209 |     switch (environment) {
6210 |       case 'production':
6211 |         results +=
6212 |           '- ⚠️ **Production Critical**: Ensure monitoring, logging, and backup strategies are implemented\n';
6213 |         results += '- 🔒 **Security**: Implement comprehensive security measures\n';
6214 |         results += '- 📊 **Performance**: Monitor and optimize for production workloads\n';
6215 |         if (strictMode) {
6216 |           results +=
6217 |             '- 🔍 **Strict Mode**: Enhanced validation enabled for production environment\n';
6218 |         }
6219 |         break;
6220 |       case 'staging':
6221 |         results += '- 🧪 **Testing**: Ensure comprehensive test coverage and validation\n';
6222 |         results += '- 📋 **Validation**: Implement environment parity checks\n';
6223 |         break;
6224 |       case 'development':
6225 |         results += '- 🛠️ **Development**: Focus on developer experience and debugging tools\n';
6226 |         results += '- 🔄 **Iteration**: Ensure fast feedback loops\n';
6227 |         break;
6228 |     }
6229 | 
6230 |     return results;
6231 |   }
6232 | 
6233 |   /**
6234 |    * Analyze security compliance based on security level
6235 |    */
6236 |   private analyzeSecurityCompliance(projectStructure: any, securityLevel: string): string {
6237 |     let results = '';
6238 | 
6239 |     const securityFiles = [
6240 |       ...(projectStructure.configFiles || []),
6241 |       ...(projectStructure.dockerFiles || []),
6242 |     ].filter(
6243 |       file =>
6244 |         file.filename.includes('security') ||
6245 |         file.filename.includes('auth') ||
6246 |         file.filename.includes('.env') ||
6247 |         file.filename === 'Dockerfile'
6248 |     );
6249 | 
6250 |     const hasSecurityConfig = securityFiles.length > 0;
6251 | 
6252 |     switch (securityLevel) {
6253 |       case 'critical':
6254 |         results += `- ${hasSecurityConfig ? '✅' : '❌'} **Critical Security**: ${hasSecurityConfig ? 'Security configuration found' : 'No security configuration detected'}\n`;
6255 |         if (!hasSecurityConfig) {
6256 |           results += '  - **Action Required**: Implement comprehensive security measures\n';
6257 |         }
6258 |         break;
6259 |       case 'high':
6260 |         results += `- ${hasSecurityConfig ? '✅' : '⚠️'} **High Security**: ${hasSecurityConfig ? 'Some security configuration found' : 'Limited security configuration'}\n`;
6261 |         break;
6262 |       case 'medium':
6263 |         results += `- ℹ️ **Medium Security**: Basic security measures recommended\n`;
6264 |         break;
6265 |       default:
6266 |         results += `- ℹ️ **Security Level**: ${securityLevel} (consider increasing for production)\n`;
6267 |     }
6268 | 
6269 |     return results;
6270 |   }
6271 | 
6272 |   /**
6273 |    * Content masking tool implementations
6274 |    */
6275 |   private async analyzeContentSecurity(args: AnalyzeContentSecurityArgs): Promise<CallToolResult> {
6276 |     const { analyzeContentSecurity } = await import('./tools/content-masking-tool.js');
6277 |     return await analyzeContentSecurity(args);
6278 |   }
6279 | 
6280 |   private async generateContentMasking(args: GenerateContentMaskingArgs): Promise<CallToolResult> {
6281 |     const { generateContentMasking } = await import('./tools/content-masking-tool.js');
6282 |     return await generateContentMasking(args);
6283 |   }
6284 | 
6285 |   private async configureCustomPatterns(
6286 |     args: ConfigureCustomPatternsArgs
6287 |   ): Promise<CallToolResult> {
6288 |     const { configureCustomPatterns } = await import('./tools/content-masking-tool.js');
6289 |     return await configureCustomPatterns(args);
6290 |   }
6291 | 
6292 |   private async applyBasicContentMasking(
6293 |     args: ApplyBasicContentMaskingArgs
6294 |   ): Promise<CallToolResult> {
6295 |     const { applyBasicContentMasking } = await import('./tools/content-masking-tool.js');
6296 |     return await applyBasicContentMasking(args);
6297 |   }
6298 | 
6299 |   private async validateContentMasking(args: ValidateContentMaskingArgs): Promise<CallToolResult> {
6300 |     const { validateContentMasking } = await import('./tools/content-masking-tool.js');
6301 |     return await validateContentMasking(args);
6302 |   }
6303 | 
6304 |   private async manageCache(args: Record<string, unknown>): Promise<CallToolResult> {
6305 |     const { action, key } = args;
6306 | 
6307 |     try {
6308 |       const { clearCache, getCacheStats, cleanupCache, invalidateCache } = await import(
6309 |         './utils/cache.js'
6310 |       );
6311 | 
6312 |       switch (action) {
6313 |         case 'clear': {
6314 |           const clearPrompt = await clearCache();
6315 |           return {
6316 |             content: [
6317 |               {
6318 |                 type: 'text',
6319 |                 text: `# Cache Clear Operation
6320 | 
6321 | ## AI Delegation Required
6322 | 
6323 | Please execute the following cache clearing operation:
6324 | 
6325 | ${clearPrompt.prompt}
6326 | 
6327 | ## Implementation Instructions
6328 | 
6329 | ${clearPrompt.instructions}
6330 | 
6331 | ## Expected Result
6332 | 
6333 | After successful execution, all cache entries will be removed while preserving the cache directory structure and metadata.json file.`,
6334 |               },
6335 |             ],
6336 |           };
6337 |         }
6338 | 
6339 |         case 'stats': {
6340 |           const statsPrompt = await getCacheStats();
6341 |           return {
6342 |             content: [
6343 |               {
6344 |                 type: 'text',
6345 |                 text: `# Cache Statistics Collection
6346 | 
6347 | ## AI Delegation Required
6348 | 
6349 | Please execute the following cache statistics collection operation:
6350 | 
6351 | ${statsPrompt.prompt}
6352 | 
6353 | ## Implementation Instructions
6354 | 
6355 | ${statsPrompt.instructions}
6356 | 
6357 | ## Expected Information
6358 | 
6359 | The AI agent will provide:
6360 | - **Total Entries**: Number of cache files
6361 | - **Total Size**: Combined size of all cache files
6362 | - **Oldest Entry**: Cache key of the oldest entry
6363 | - **Newest Entry**: Cache key of the newest entry
6364 | 
6365 | ## Cache Directory
6366 | \`.mcp-adr-cache/\`
6367 | 
6368 | ## Cache Types
6369 | - **Knowledge Graph**: Architectural analysis results (TTL: 1 hour)
6370 | - **Analysis Report**: Project analysis reports (TTL: 30 minutes)
6371 | - **ADR List**: ADR inventory and metadata (TTL: 15 minutes)
6372 | 
6373 | ## Management
6374 | Use \`manage_cache\` tool with different actions:
6375 | - \`clear\`: Remove all cache entries
6376 | - \`cleanup\`: Remove expired entries only
6377 | - \`invalidate\`: Remove specific cache entry`,
6378 |               },
6379 |             ],
6380 |           };
6381 |         }
6382 | 
6383 |         case 'cleanup': {
6384 |           const cleanupPrompt = await cleanupCache();
6385 |           return {
6386 |             content: [
6387 |               {
6388 |                 type: 'text',
6389 |                 text: `# Cache Cleanup Operation
6390 | 
6391 | ## AI Delegation Required
6392 | 
6393 | Please execute the following cache cleanup operation:
6394 | 
6395 | ${cleanupPrompt.prompt}
6396 | 
6397 | ## Implementation Instructions
6398 | 
6399 | ${cleanupPrompt.instructions}
6400 | 
6401 | ## Expected Result
6402 | 
6403 | The AI agent will remove expired cache entries and provide a count of cleaned files.`,
6404 |               },
6405 |             ],
6406 |           };
6407 |         }
6408 | 
6409 |         case 'invalidate': {
6410 |           if (!key) {
6411 |             throw new McpAdrError('Cache key is required for invalidate action', 'INVALID_INPUT');
6412 |           }
6413 | 
6414 |           const invalidatePrompt = await invalidateCache(key as string);
6415 |           return {
6416 |             content: [
6417 |               {
6418 |                 type: 'text',
6419 |                 text: `# Cache Invalidation Operation
6420 | 
6421 | ## AI Delegation Required
6422 | 
6423 | Please execute the following cache invalidation operation:
6424 | 
6425 | ${invalidatePrompt.prompt}
6426 | 
6427 | ## Implementation Instructions
6428 | 
6429 | ${invalidatePrompt.instructions}
6430 | 
6431 | ## Target Cache Entry
6432 | 
6433 | **Cache Key**: ${key}
6434 | 
6435 | The AI agent will safely remove the specified cache entry.`,
6436 |               },
6437 |             ],
6438 |           };
6439 |         }
6440 | 
6441 |         default:
6442 |           throw new McpAdrError(`Unknown cache action: ${action}`, 'INVALID_INPUT');
6443 |       }
6444 |     } catch (error) {
6445 |       throw new McpAdrError(
6446 |         `Cache management failed: ${error instanceof Error ? error.message : String(error)}`,
6447 |         'CACHE_ERROR'
6448 |       );
6449 |     }
6450 |   }
6451 | 
6452 |   private async configureOutputMasking(args: Record<string, unknown>): Promise<CallToolResult> {
6453 |     const { action = 'get', enabled, strategy, customPatterns } = args;
6454 | 
6455 |     try {
6456 |       const { validateMaskingConfig } = await import('./utils/output-masking.js');
6457 | 
6458 |       switch (action) {
6459 |         case 'get': {
6460 |           return {
6461 |             content: [
6462 |               {
6463 |                 type: 'text',
6464 |                 text: `# Current Output Masking Configuration
6465 | 
6466 | ## Settings
6467 | - **Enabled**: ${this.maskingConfig.enabled}
6468 | - **Strategy**: ${this.maskingConfig.strategy}
6469 | - **Custom Patterns**: ${this.maskingConfig.customPatterns?.length || 0} patterns
6470 | - **Skip Patterns**: ${this.maskingConfig.skipPatterns?.length || 0} patterns
6471 | 
6472 | ## Available Strategies
6473 | - **full**: Replace entire sensitive content with [REDACTED]
6474 | - **partial**: Show safe prefix/suffix, mask middle (e.g., sk-...****)
6475 | - **placeholder**: Replace with descriptive placeholders (e.g., <YOUR_API_KEY>)
6476 | - **environment**: Replace with environment variable references (e.g., \${API_KEY})
6477 | 
6478 | ## Configuration
6479 | Use \`configure_output_masking\` tool with:
6480 | - \`action: "set"\` to update configuration
6481 | - \`action: "reset"\` to restore defaults
6482 | 
6483 | ## Current Status
6484 | ${this.maskingConfig.enabled ? '✅ Output masking is ACTIVE' : '⚠️ Output masking is DISABLED'}
6485 | `,
6486 |               },
6487 |             ],
6488 |           };
6489 |         }
6490 | 
6491 |         case 'set': {
6492 |           const newConfig = { ...this.maskingConfig };
6493 | 
6494 |           if (typeof enabled === 'boolean') {
6495 |             newConfig.enabled = enabled;
6496 |           }
6497 | 
6498 |           if (
6499 |             strategy &&
6500 |             ['full', 'partial', 'placeholder', 'environment'].includes(strategy as string)
6501 |           ) {
6502 |             newConfig.strategy = strategy as 'full' | 'partial' | 'placeholder' | 'environment';
6503 |           }
6504 | 
6505 |           if (Array.isArray(customPatterns)) {
6506 |             newConfig.customPatterns = customPatterns;
6507 |           }
6508 | 
6509 |           const validation = validateMaskingConfig(newConfig);
6510 |           if (!validation.isValid) {
6511 |             throw new McpAdrError(
6512 |               `Invalid masking configuration: ${validation.errors.join(', ')}`,
6513 |               'INVALID_CONFIG'
6514 |             );
6515 |           }
6516 | 
6517 |           this.maskingConfig = newConfig;
6518 | 
6519 |           return {
6520 |             content: [
6521 |               {
6522 |                 type: 'text',
6523 |                 text: `✅ Output masking configuration updated successfully!
6524 | 
6525 | ## New Settings
6526 | - **Enabled**: ${newConfig.enabled}
6527 | - **Strategy**: ${newConfig.strategy}
6528 | - **Custom Patterns**: ${newConfig.customPatterns?.length || 0} patterns
6529 | 
6530 | ${
6531 |   newConfig.enabled
6532 |     ? '🔒 All MCP tool and resource outputs will now be masked according to the new configuration.'
6533 |     : '⚠️ Output masking is disabled. Sensitive information may be exposed in responses.'
6534 | }
6535 | `,
6536 |               },
6537 |             ],
6538 |           };
6539 |         }
6540 | 
6541 |         case 'reset': {
6542 |           const { createMaskingConfig } = await import('./utils/output-masking.js');
6543 |           this.maskingConfig = createMaskingConfig();
6544 | 
6545 |           return {
6546 |             content: [
6547 |               {
6548 |                 type: 'text',
6549 |                 text: `✅ Output masking configuration reset to defaults!
6550 | 
6551 | ## Default Settings
6552 | - **Enabled**: ${this.maskingConfig.enabled}
6553 | - **Strategy**: ${this.maskingConfig.strategy}
6554 | - **Custom Patterns**: ${this.maskingConfig.customPatterns?.length || 0} patterns
6555 | - **Skip Patterns**: ${this.maskingConfig.skipPatterns?.length || 0} patterns
6556 | 
6557 | 🔒 Default masking is now active for all outputs.
6558 | `,
6559 |               },
6560 |             ],
6561 |           };
6562 |         }
6563 | 
6564 |         default:
6565 |           throw new McpAdrError(`Unknown masking action: ${action}`, 'INVALID_INPUT');
6566 |       }
6567 |     } catch (error) {
6568 |       throw new McpAdrError(
6569 |         `Output masking configuration failed: ${error instanceof Error ? error.message : String(error)}`,
6570 |         'CONFIG_ERROR'
6571 |       );
6572 |     }
6573 |   }
6574 | 
6575 |   /**
6576 |    * Helper method to get domains based on PRD type
6577 |    */
6578 |   private getPrdTypeDomains(prdType: string): string[] {
6579 |     const domainMap: Record<string, string[]> = {
6580 |       'web-application': ['api-design', 'frontend-architecture', 'database-design', 'security'],
6581 |       'mobile-app': ['mobile-architecture', 'api-design', 'performance-optimization', 'security'],
6582 |       microservices: ['microservices', 'api-design', 'distributed-systems', 'database-design'],
6583 |       'data-platform': [
6584 |         'database-design',
6585 |         'data-architecture',
6586 |         'performance-optimization',
6587 |         'scalability',
6588 |       ],
6589 |       'api-service': ['api-design', 'microservices', 'security', 'performance-optimization'],
6590 |       general: ['api-design', 'database-design', 'security'],
6591 |     };
6592 | 
6593 |     return (
6594 |       domainMap[prdType] || domainMap['general'] || ['api-design', 'database-design', 'security']
6595 |     );
6596 |   }
6597 | 
6598 |   /**
6599 |    * Helper method to get domains for ecosystem analysis based on technology focus
6600 |    */
6601 |   private getEcosystemAnalysisDomains(technologyFocus: string[]): string[] {
6602 |     // Base domains for ecosystem analysis
6603 |     const baseDomains = ['api-design', 'database-design', 'security', 'performance-optimization'];
6604 | 
6605 |     // Technology-specific domain mapping
6606 |     const technologyDomainMap: Record<string, string[]> = {
6607 |       react: ['frontend-architecture', 'web-applications'],
6608 |       vue: ['frontend-architecture', 'web-applications'],
6609 |       angular: ['frontend-architecture', 'web-applications'],
6610 |       node: ['api-design', 'microservices'],
6611 |       express: ['api-design', 'web-applications'],
6612 |       fastify: ['api-design', 'performance-optimization'],
6613 |       nestjs: ['api-design', 'microservices'],
6614 |       spring: ['api-design', 'microservices'],
6615 |       django: ['api-design', 'web-applications'],
6616 |       flask: ['api-design', 'web-applications'],
6617 |       rails: ['api-design', 'web-applications'],
6618 |       laravel: ['api-design', 'web-applications'],
6619 |       docker: ['containerization', 'microservices'],
6620 |       kubernetes: ['containerization', 'distributed-systems'],
6621 |       mongodb: ['database-design', 'data-architecture'],
6622 |       postgresql: ['database-design', 'data-architecture'],
6623 |       mysql: ['database-design', 'data-architecture'],
6624 |       redis: ['database-design', 'performance-optimization'],
6625 |       elasticsearch: ['database-design', 'data-architecture'],
6626 |       kafka: ['distributed-systems', 'data-architecture'],
6627 |       rabbitmq: ['distributed-systems', 'microservices'],
6628 |       aws: ['cloud-architecture', 'scalability'],
6629 |       azure: ['cloud-architecture', 'scalability'],
6630 |       gcp: ['cloud-architecture', 'scalability'],
6631 |       terraform: ['infrastructure-as-code', 'cloud-architecture'],
6632 |       ansible: ['infrastructure-as-code', 'automation'],
6633 |       jenkins: ['ci-cd', 'automation'],
6634 |       'github-actions': ['ci-cd', 'automation'],
6635 |       'gitlab-ci': ['ci-cd', 'automation'],
6636 |     };
6637 | 
6638 |     // Collect domains based on technology focus
6639 |     const technologyDomains = new Set<string>();
6640 |     for (const tech of technologyFocus) {
6641 |       const techLower = tech.toLowerCase();
6642 |       const domains = technologyDomainMap[techLower];
6643 |       if (domains) {
6644 |         domains.forEach(domain => technologyDomains.add(domain));
6645 |       }
6646 |     }
6647 | 
6648 |     // Combine base domains with technology-specific domains
6649 |     const allDomains = [...baseDomains, ...Array.from(technologyDomains)];
6650 | 
6651 |     // Remove duplicates and limit to reasonable number
6652 |     const uniqueDomains = [...new Set(allDomains)];
6653 | 
6654 |     // Return up to 6 most relevant domains
6655 |     return uniqueDomains.slice(0, 6);
6656 |   }
6657 | 
6658 |   /**
6659 |    * Helper method to create base ADR generation prompt
6660 |    */
6661 |   private createBaseAdrPrompt(
6662 |     prdPath: string,
6663 |     outputDirectory: string,
6664 |     knowledgeContext: string
6665 |   ): string {
6666 |     return `
6667 | # Enhanced ADR Generation from PRD Request
6668 | 
6669 | This is a comprehensive prompt-driven ADR generation process enhanced with domain knowledge and optimized prompting.
6670 | 
6671 | ${knowledgeContext}
6672 | 
6673 | ## Step 1: File Validation
6674 | Please verify that the PRD file exists at: ${prdPath}
6675 | 
6676 | ## Step 2: PRD Content Reading
6677 | Read and analyze the PRD content from: ${prdPath}
6678 | 
6679 | ## Step 3: Enhanced ADR Generation and Creation
6680 | 
6681 | Once you have successfully read the PRD content, analyze it using the domain knowledge above and generate Architectural Decision Records (ADRs).
6682 | 
6683 | ### Enhanced Analysis Requirements
6684 | 
6685 | 1. **Extract Key Decisions**: Identify all architectural decisions implied or stated in the PRD
6686 | 2. **Apply Domain Knowledge**: Use the generated domain knowledge to enhance decision analysis
6687 | 3. **Decision Categorization**: Group decisions by:
6688 |    - Technology stack choices (informed by domain best practices)
6689 |    - Architectural patterns (leveraging domain-specific patterns)
6690 |    - Infrastructure decisions (considering domain requirements)
6691 |    - Security considerations (applying domain security knowledge)
6692 |    - Performance requirements (using domain performance insights)
6693 |    - Integration approaches (following domain integration patterns)
6694 | 
6695 | ### Enhanced ADR Generation Requirements
6696 | 
6697 | 1. **Follow ADR Format**: Use standard ADR template with domain-enhanced content
6698 | 2. **Number Sequentially**: Use format 001-decision-title.md, 002-next-decision.md, etc.
6699 | 3. **Output Directory**: Place ADRs in ${outputDirectory}/
6700 | 4. **Domain Context**: Include relevant domain knowledge in each ADR
6701 | 5. **File Creation**: Generate file creation prompts for each ADR
6702 | 
6703 | ### Enhanced ADR Template Format
6704 | 
6705 | \`\`\`markdown
6706 | # [Number]. [Title]
6707 | 
6708 | **Status**: [Proposed/Accepted/Deprecated/Superseded]
6709 | **Date**: [YYYY-MM-DD]
6710 | **Domain**: [Relevant domain from knowledge enhancement]
6711 | 
6712 | ## Context
6713 | [Describe the context and problem statement from PRD, enhanced with domain knowledge]
6714 | 
6715 | ## Decision
6716 | [Describe the architectural decision, informed by domain best practices]
6717 | 
6718 | ## Consequences
6719 | [Describe positive and negative consequences, considering domain-specific implications]
6720 | 
6721 | ## Domain Considerations
6722 | [Specific considerations from the domain knowledge that influenced this decision]
6723 | 
6724 | ## Implementation Plan
6725 | [Steps to implement this decision, leveraging domain expertise]
6726 | 
6727 | ## Related PRD Sections
6728 | [Reference specific sections from the PRD that led to this decision]
6729 | 
6730 | ## Domain References
6731 | [References to domain knowledge that informed this decision]
6732 | \`\`\`
6733 | 
6734 | ### Expected Enhanced Output
6735 | 
6736 | Please provide:
6737 | 1. **File Validation Results**: Confirmation that PRD file exists and is readable
6738 | 2. **PRD Content Summary**: Brief summary enhanced with domain context
6739 | 3. **Domain Analysis**: How domain knowledge applies to this PRD
6740 | 4. **Identified Decisions**: List of all architectural decisions with domain context
6741 | 5. **Generated ADRs**: Complete enhanced ADR content for each decision
6742 | 6. **File Creation Plan**: File names, directory structure, and creation order
6743 | 7. **Implementation Priority**: Recommended order considering domain best practices
6744 | 
6745 | ### Quality Assurance with Domain Enhancement
6746 | 
6747 | - Ensure each ADR leverages relevant domain knowledge
6748 | - Verify decisions align with domain best practices
6749 | - Check that domain considerations are properly documented
6750 | - Validate that ADR content is enhanced beyond basic analysis
6751 | `;
6752 |   }
6753 | 
6754 |   /**
6755 |    * ADR suggestion tool implementations
6756 |    */
6757 |   private async suggestAdrs(args: Record<string, unknown>): Promise<CallToolResult> {
6758 |     const { suggestAdrs } = await import('./tools/adr-suggestion-tool.js');
6759 |     return await suggestAdrs(args);
6760 |   }
6761 | 
6762 |   private async generateAdrFromDecision(
6763 |     args: GenerateAdrFromDecisionArgs
6764 |   ): Promise<CallToolResult> {
6765 |     const { generateAdrFromDecision } = await import('./tools/adr-suggestion-tool.js');
6766 |     return await generateAdrFromDecision(args);
6767 |   }
6768 | 
6769 |   private async generateAdrBootstrap(args: Record<string, unknown>): Promise<CallToolResult> {
6770 |     const { default: generateAdrBootstrapScripts } = await import(
6771 |       './tools/adr-bootstrap-validation-tool.js'
6772 |     );
6773 |     return await generateAdrBootstrapScripts(args);
6774 |   }
6775 | 
6776 |   private async bootstrapValidationLoop(args: Record<string, unknown>): Promise<CallToolResult> {
6777 |     const { default: bootstrapValidationLoop } = await import(
6778 |       './tools/bootstrap-validation-loop-tool.js'
6779 |     );
6780 |     return await bootstrapValidationLoop(args);
6781 |   }
6782 | 
6783 |   private async discoverExistingAdrs(
6784 |     args: Record<string, unknown>,
6785 |     context?: ToolContext
6786 |   ): Promise<CallToolResult> {
6787 |     const ctx = context || createNoOpContext();
6788 | 
6789 |     try {
6790 |       ctx.info('🔍 Starting ADR discovery process...');
6791 |       ctx.report_progress(0, 100);
6792 | 
6793 |       ctx.info('📂 Phase 1: Scanning ADR directory');
6794 |       ctx.report_progress(30, 100);
6795 | 
6796 |       const { discoverExistingAdrs } = await import('./tools/adr-suggestion-tool.js');
6797 | 
6798 |       ctx.info('📄 Phase 2: Analyzing ADR files');
6799 |       ctx.report_progress(60, 100);
6800 | 
6801 |       const result = await discoverExistingAdrs(args);
6802 | 
6803 |       ctx.info('✅ ADR discovery completed successfully');
6804 |       ctx.report_progress(100, 100);
6805 | 
6806 |       return result;
6807 |     } catch (error) {
6808 |       ctx.error?.(
6809 |         `❌ ADR discovery failed: ${error instanceof Error ? error.message : String(error)}`
6810 |       );
6811 |       throw error;
6812 |     }
6813 |   }
6814 | 
6815 |   private async reviewExistingAdrs(args: Record<string, unknown>): Promise<CallToolResult> {
6816 |     const { reviewExistingAdrs } = await import('./tools/review-existing-adrs-tool.js');
6817 |     return await reviewExistingAdrs(args);
6818 |   }
6819 | 
6820 |   /**
6821 |    * ADR validation tool implementations
6822 |    */
6823 |   private async validateAdr(args: Record<string, unknown>): Promise<CallToolResult> {
6824 |     const { validateAdr } = await import('./tools/adr-validation-tool.js');
6825 |     return await validateAdr(args as any);
6826 |   }
6827 | 
6828 |   private async validateAllAdrs(args: Record<string, unknown>): Promise<CallToolResult> {
6829 |     const { validateAllAdrs } = await import('./tools/adr-validation-tool.js');
6830 |     return await validateAllAdrs(args as any);
6831 |   }
6832 | 
6833 |   /**
6834 |    * Research integration tool implementations
6835 |    */
6836 |   private async incorporateResearch(args: Record<string, unknown>): Promise<CallToolResult> {
6837 |     const { incorporateResearch } = await import('./tools/research-integration-tool.js');
6838 |     return await incorporateResearch(args);
6839 |   }
6840 | 
6841 |   private async createResearchTemplate(args: Record<string, unknown>): Promise<CallToolResult> {
6842 |     const { createResearchTemplate } = await import('./tools/research-integration-tool.js');
6843 |     return await createResearchTemplate(args);
6844 |   }
6845 | 
6846 |   private async requestActionConfirmation(args: Record<string, unknown>): Promise<CallToolResult> {
6847 |     const { requestActionConfirmation } = await import('./tools/research-integration-tool.js');
6848 |     return await requestActionConfirmation(args as unknown as ActionArgs);
6849 |   }
6850 | 
6851 |   /**
6852 |    * Rule generation and validation tool implementations
6853 |    */
6854 |   private async generateRules(args: Record<string, unknown>): Promise<CallToolResult> {
6855 |     const { generateRules } = await import('./tools/rule-generation-tool.js');
6856 |     return await generateRules(args);
6857 |   }
6858 | 
6859 |   private async validateRules(args: ValidateRulesArgs): Promise<CallToolResult> {
6860 |     const { validateRules } = await import('./tools/rule-generation-tool.js');
6861 |     return await validateRules(args);
6862 |   }
6863 | 
6864 |   private async createRuleSet(args: CreateRuleSetArgs): Promise<CallToolResult> {
6865 |     const { createRuleSet } = await import('./tools/rule-generation-tool.js');
6866 |     return await createRuleSet(args);
6867 |   }
6868 | 
6869 |   /**
6870 |    * Environment analysis tool implementation
6871 |    */
6872 |   private async analyzeEnvironment(args: Record<string, unknown>): Promise<CallToolResult> {
6873 |     const { analyzeEnvironment } = await import('./tools/environment-analysis-tool.js');
6874 |     return await analyzeEnvironment(args);
6875 |   }
6876 | 
6877 |   /**
6878 |    * Research question generation tool implementation
6879 |    */
6880 |   private async generateResearchQuestions(args: Record<string, unknown>): Promise<CallToolResult> {
6881 |     const { generateResearchQuestions } = await import('./tools/research-question-tool.js');
6882 |     return await generateResearchQuestions(args);
6883 |   }
6884 | 
6885 |   /**
6886 |    * Perform research tool implementation
6887 |    */
6888 |   private async performResearch(
6889 |     args: Record<string, unknown>,
6890 |     context?: ToolContext
6891 |   ): Promise<CallToolResult> {
6892 |     const ctx = context || createNoOpContext();
6893 | 
6894 |     if (!('question' in args) || typeof args['question'] !== 'string') {
6895 |       throw new McpAdrError('Missing required parameter: question', 'INVALID_ARGUMENTS');
6896 |     }
6897 | 
6898 |     try {
6899 |       ctx.info('🔍 Starting research process...');
6900 |       ctx.report_progress(0, 100);
6901 | 
6902 |       ctx.info('📊 Phase 1: Initializing research framework');
6903 |       ctx.report_progress(10, 100);
6904 | 
6905 |       const { performResearch } = await import('./tools/perform-research-tool.js');
6906 | 
6907 |       ctx.info('📚 Phase 2: Executing research orchestration');
6908 |       ctx.report_progress(20, 100);
6909 | 
6910 |       const result = await performResearch(
6911 |         args as {
6912 |           question: string;
6913 |           projectPath?: string;
6914 |           adrDirectory?: string;
6915 |           confidenceThreshold?: number;
6916 |           performWebSearch?: boolean;
6917 |         },
6918 |         ctx // ✅ Pass context to tool function for progress updates
6919 |       );
6920 | 
6921 |       return result;
6922 |     } catch (error) {
6923 |       ctx.error?.(
6924 |         `❌ Research execution failed: ${error instanceof Error ? error.message : String(error)}`
6925 |       );
6926 |       throw new McpAdrError(
6927 |         `Failed to perform research: ${error instanceof Error ? error.message : String(error)}`,
6928 |         'RESEARCH_EXECUTION_ERROR'
6929 |       );
6930 |     }
6931 |   }
6932 | 
6933 |   /**
6934 |    * LLM web search tool implementation
6935 |    */
6936 |   private async llmWebSearch(
6937 |     args: Record<string, unknown>,
6938 |     context?: ToolContext
6939 |   ): Promise<CallToolResult> {
6940 |     const ctx = context || createNoOpContext();
6941 | 
6942 |     if (!('query' in args) || typeof args['query'] !== 'string') {
6943 |       throw new McpAdrError('Missing required parameter: query', 'INVALID_ARGUMENTS');
6944 |     }
6945 | 
6946 |     ctx.info('🌐 Starting LLM-managed web search...');
6947 |     ctx.report_progress(0, 100);
6948 | 
6949 |     const { llmWebSearch } = await import('./tools/llm-web-search-tool.js');
6950 |     return await llmWebSearch(
6951 |       args as {
6952 |         query: string;
6953 |         maxResults?: number;
6954 |         includeContent?: boolean;
6955 |         llmInstructions?: string;
6956 |         projectPath?: string;
6957 |         adrDirectory?: string;
6958 |       },
6959 |       ctx // ✅ Pass context to tool function for progress updates
6960 |     );
6961 |   }
6962 | 
6963 |   /**
6964 |    * LLM cloud management tool implementation
6965 |    */
6966 |   private async llmCloudManagement(
6967 |     args: Record<string, unknown>,
6968 |     context?: ToolContext
6969 |   ): Promise<CallToolResult> {
6970 |     const ctx = context || createNoOpContext();
6971 | 
6972 |     if (!('provider' in args) || !('action' in args) || !('llmInstructions' in args)) {
6973 |       throw new McpAdrError(
6974 |         'Missing required parameters: provider, action, llmInstructions',
6975 |         'INVALID_ARGUMENTS'
6976 |       );
6977 |     }
6978 | 
6979 |     ctx.info('🔧 Starting LLM-managed cloud operation...');
6980 |     ctx.report_progress(0, 100);
6981 | 
6982 |     const { llmCloudManagement } = await import('./tools/llm-cloud-management-tool.js');
6983 |     return await llmCloudManagement(
6984 |       args as {
6985 |         provider: 'aws' | 'azure' | 'gcp' | 'redhat' | 'ubuntu' | 'macos';
6986 |         action: string;
6987 |         parameters?: Record<string, any>;
6988 |         llmInstructions: string;
6989 |         researchFirst?: boolean;
6990 |         projectPath?: string;
6991 |         adrDirectory?: string;
6992 |       },
6993 |       ctx // ✅ Pass context to tool function for progress updates
6994 |     );
6995 |   }
6996 | 
6997 |   /**
6998 |    * LLM database management tool implementation
6999 |    */
7000 |   private async llmDatabaseManagement(
7001 |     args: Record<string, unknown>,
7002 |     context?: ToolContext
7003 |   ): Promise<CallToolResult> {
7004 |     const ctx = context || createNoOpContext();
7005 | 
7006 |     if (!('database' in args) || !('action' in args) || !('llmInstructions' in args)) {
7007 |       throw new McpAdrError(
7008 |         'Missing required parameters: database, action, llmInstructions',
7009 |         'INVALID_ARGUMENTS'
7010 |       );
7011 |     }
7012 | 
7013 |     ctx.info('🗄️ Starting LLM-managed database operation...');
7014 |     ctx.report_progress(0, 100);
7015 | 
7016 |     const { llmDatabaseManagement } = await import('./tools/llm-database-management-tool.js');
7017 |     return await llmDatabaseManagement(
7018 |       args as {
7019 |         database: 'postgresql' | 'mongodb' | 'redis' | 'mysql' | 'mariadb';
7020 |         action: string;
7021 |         parameters?: Record<string, any>;
7022 |         llmInstructions: string;
7023 |         researchFirst?: boolean;
7024 |         projectPath?: string;
7025 |         adrDirectory?: string;
7026 |       },
7027 |       ctx // ✅ Pass context to tool function for progress updates
7028 |     );
7029 |   }
7030 | 
7031 |   /**
7032 |    * Deployment analysis tool implementation
7033 |    */
7034 |   private async analyzeDeploymentProgress(args: Record<string, unknown>): Promise<CallToolResult> {
7035 |     const { analyzeDeploymentProgress } = await import('./tools/deployment-analysis-tool.js');
7036 |     return await analyzeDeploymentProgress(args);
7037 |   }
7038 | 
7039 |   /**
7040 |    * Apply content masking to MCP response
7041 |    */
7042 |   /**
7043 |    * Track memory operations performed by tools
7044 |    */
7045 |   private async trackMemoryOperations(
7046 |     toolName: string,
7047 |     parameters: any,
7048 |     result: any,
7049 |     success: boolean
7050 |   ): Promise<void> {
7051 |     try {
7052 |       // Check if memory integration was enabled and used
7053 |       if (parameters?.enableMemoryIntegration === false) {
7054 |         return; // Memory integration was explicitly disabled
7055 |       }
7056 | 
7057 |       // Extract memory operation information from result
7058 |       const memoryOps = this.extractMemoryOperations(toolName, parameters, result);
7059 | 
7060 |       if (memoryOps.length > 0) {
7061 |         // Store memory operation tracking in knowledge graph
7062 |         for (const op of memoryOps) {
7063 |           await this.kgManager.addMemoryExecution(
7064 |             toolName,
7065 |             op.action,
7066 |             op.entityType,
7067 |             success && op.success,
7068 |             op.details
7069 |           );
7070 |         }
7071 |       }
7072 |     } catch (error) {
7073 |       // Don't let memory tracking errors break execution
7074 |       console.error('[WARN] Memory operation tracking failed:', error);
7075 |     }
7076 |   }
7077 | 
7078 |   /**
7079 |    * Extract memory operation details from tool execution
7080 |    */
7081 |   private extractMemoryOperations(toolName: string, parameters: any, result: any): any[] {
7082 |     const operations: any[] = [];
7083 | 
7084 |     // Define memory-enabled tools and their expected operations
7085 |     const memoryEnabledTools = {
7086 |       analyze_content_security: {
7087 |         entityType: 'security_pattern',
7088 |         actions: ['store_pattern', 'analyze_institutional_security', 'track_evolution'],
7089 |       },
7090 |       analyze_environment: {
7091 |         entityType: 'environment_snapshot',
7092 |         actions: ['store_snapshot', 'analyze_trends', 'compare_configurations'],
7093 |       },
7094 |       deployment_readiness: {
7095 |         entityType: 'deployment_assessment',
7096 |         actions: ['store_assessment', 'migrate_history', 'analyze_patterns'],
7097 |       },
7098 |       troubleshoot_guided_workflow: {
7099 |         entityType: 'troubleshooting_session',
7100 |         actions: ['store_session', 'pattern_recognition', 'suggest_adrs', 'generate_research'],
7101 |       },
7102 |     };
7103 | 
7104 |     // Check if this tool supports memory operations
7105 |     const toolConfig = memoryEnabledTools[toolName as keyof typeof memoryEnabledTools];
7106 |     if (!toolConfig) {
7107 |       return operations; // Tool doesn't support memory operations
7108 |     }
7109 | 
7110 |     // Extract memory operation details from result
7111 |     if (result?.memoryIntegration) {
7112 |       const memoryInfo = result.memoryIntegration;
7113 | 
7114 |       // Pattern entity storage operation
7115 |       if (memoryInfo.entityStored || memoryInfo.patternStored) {
7116 |         operations.push({
7117 |           action: 'entity_storage',
7118 |           entityType: toolConfig.entityType,
7119 |           success: memoryInfo.storageSuccess !== false,
7120 |           details: {
7121 |             entityId: memoryInfo.entityId || memoryInfo.patternId,
7122 |             entityCount: memoryInfo.entityCount || 1,
7123 |             storageMethod: memoryInfo.storageMethod || 'standard',
7124 |           },
7125 |         });
7126 |       }
7127 | 
7128 |       // Historical analysis operation
7129 |       if (memoryInfo.historicalAnalysis || memoryInfo.trendAnalysis) {
7130 |         operations.push({
7131 |           action: 'historical_analysis',
7132 |           entityType: toolConfig.entityType,
7133 |           success: memoryInfo.analysisSuccess !== false,
7134 |           details: {
7135 |             analysisType: memoryInfo.analysisType || 'trend_analysis',
7136 |             entitiesAnalyzed: memoryInfo.entitiesAnalyzed || 0,
7137 |             insights: memoryInfo.insights || [],
7138 |           },
7139 |         });
7140 |       }
7141 | 
7142 |       // Evolution tracking operation
7143 |       if (memoryInfo.evolutionTracking) {
7144 |         operations.push({
7145 |           action: 'evolution_tracking',
7146 |           entityType: toolConfig.entityType,
7147 |           success: memoryInfo.evolutionSuccess !== false,
7148 |           details: {
7149 |             improvements: memoryInfo.improvements || [],
7150 |             degradations: memoryInfo.degradations || [],
7151 |             recommendations: memoryInfo.recommendations || [],
7152 |           },
7153 |         });
7154 |       }
7155 | 
7156 |       // Migration operation (for deployment readiness)
7157 |       if (memoryInfo.migrationCompleted) {
7158 |         operations.push({
7159 |           action: 'data_migration',
7160 |           entityType: toolConfig.entityType,
7161 |           success: memoryInfo.migrationSuccess !== false,
7162 |           details: {
7163 |             migratedRecords: memoryInfo.migratedRecords || 0,
7164 |             migrationMethod: memoryInfo.migrationMethod || 'json_to_memory',
7165 |           },
7166 |         });
7167 |       }
7168 |     }
7169 | 
7170 |     // If no specific memory integration info, infer from parameters
7171 |     if (operations.length === 0 && parameters?.enableMemoryIntegration !== false) {
7172 |       // Default assumption: entity was stored
7173 |       operations.push({
7174 |         action: 'entity_storage',
7175 |         entityType: toolConfig.entityType,
7176 |         success: true, // Assume success if no explicit info
7177 |         details: {
7178 |           entityCount: 1,
7179 |           storageMethod: 'inferred',
7180 |           note: 'Memory operation inferred from tool execution',
7181 |         },
7182 |       });
7183 |     }
7184 | 
7185 |     return operations;
7186 |   }
7187 | 
7188 |   /**
7189 |    * Track tool execution in knowledge graph
7190 |    */
7191 |   private async trackToolExecution(
7192 |     toolName: string,
7193 |     parameters: any,
7194 |     result: any,
7195 |     success: boolean,
7196 |     error?: string
7197 |   ): Promise<void> {
7198 |     try {
7199 |       // Extract intentId from metadata if available
7200 |       let intentId: string | undefined;
7201 | 
7202 |       if (result?.metadata?.intentId) {
7203 |         intentId = result.metadata.intentId;
7204 |       } else {
7205 |         // Check for active intents that might be related to this tool execution
7206 |         const activeIntents = await this.kgManager.getActiveIntents();
7207 |         if (activeIntents.length > 0) {
7208 |           // Use the most recent active intent
7209 |           const latestIntent = activeIntents[activeIntents.length - 1];
7210 |           if (latestIntent) {
7211 |             intentId = latestIntent.intentId;
7212 |           }
7213 |         }
7214 |       }
7215 | 
7216 |       // If no intent found, create a standalone execution record
7217 |       if (!intentId) {
7218 |         // Extract human request from conversation context if available
7219 |         let humanRequest = `Standalone tool execution: ${toolName}`;
7220 |         if (parameters?.conversationContext?.humanRequest) {
7221 |           humanRequest = parameters.conversationContext.humanRequest;
7222 |         }
7223 | 
7224 |         intentId = await this.kgManager.createIntent(
7225 |           humanRequest,
7226 |           [`Execute ${toolName}`, 'Complete tool operation'],
7227 |           'medium'
7228 |         );
7229 |       }
7230 | 
7231 |       // Determine tasks created/modified from tool operation
7232 |       const todoTasksCreated: string[] = [];
7233 |       const todoTasksModified: string[] = [];
7234 | 
7235 |       // Extract task information from result metadata
7236 |       if (result?.metadata) {
7237 |         if (result.metadata.tasksCreated) {
7238 |           todoTasksCreated.push(...result.metadata.tasksCreated);
7239 |         }
7240 |         if (result.metadata.tasksModified) {
7241 |           todoTasksModified.push(...result.metadata.tasksModified);
7242 |         }
7243 |         if (result.metadata.taskIds) {
7244 |           todoTasksModified.push(...result.metadata.taskIds);
7245 |         }
7246 |       }
7247 | 
7248 |       // Track memory operations if present
7249 |       await this.trackMemoryOperations(toolName, parameters, result, success);
7250 | 
7251 |       // Store execution in knowledge graph
7252 |       await this.kgManager.addToolExecution(
7253 |         intentId,
7254 |         toolName,
7255 |         parameters,
7256 |         result,
7257 |         success,
7258 |         todoTasksCreated,
7259 |         todoTasksModified,
7260 |         error
7261 |       );
7262 | 
7263 |       // If execution completed successfully, update intent status
7264 |       if (success && !error) {
7265 |         // Check if this might be the final tool in a chain
7266 |         const intent = await this.kgManager.getIntentById(intentId);
7267 |         if (intent && intent.currentStatus === 'executing') {
7268 |           // Simple heuristic: if tool is a "completion" type tool, mark intent as completed
7269 |           const completionTools = ['smart_git_push', 'generate_deployment_guidance', 'smart_score'];
7270 |           if (completionTools.includes(toolName)) {
7271 |             await this.kgManager.updateIntentStatus(intentId, 'completed');
7272 |           }
7273 |         }
7274 |       }
7275 |     } catch (trackingError) {
7276 |       // Don't let tracking errors break tool execution
7277 |       console.error('[WARN] Knowledge graph tracking failed:', trackingError);
7278 |     }
7279 |   }
7280 | 
7281 |   private async applyOutputMasking(response: any): Promise<any> {
7282 |     try {
7283 |       return await maskMcpResponse(response, this.maskingConfig);
7284 |     } catch (error) {
7285 |       // If masking fails, log warning and return original response
7286 |       // Log to stderr to avoid corrupting MCP protocol
7287 |       console.error('[WARN] Output masking failed:', error);
7288 |       return response;
7289 |     }
7290 |   }
7291 | 
7292 |   /**
7293 |    * Enrich response with state reinforcement and apply masking
7294 |    *
7295 |    * Implements Phase 2 of context decay mitigation by injecting
7296 |    * context reminders every N turns or when response exceeds token threshold.
7297 |    *
7298 |    * Phase 3 extension: Records conversation turns to structured external memory.
7299 |    */
7300 |   private async enrichResponseWithStateReinforcement(
7301 |     response: CallToolResult,
7302 |     toolName?: string,
7303 |     toolArgs?: any
7304 |   ): Promise<CallToolResult> {
7305 |     const startTime = Date.now();
7306 |     try {
7307 |       // Extract text content from response
7308 |       const textContent = response.content
7309 |         .filter((item): item is { type: 'text'; text: string } => item.type === 'text')
7310 |         .map(item => item.text)
7311 |         .join('\n\n');
7312 | 
7313 |       if (!textContent) {
7314 |         // No text content to enrich, just apply masking
7315 |         return await this.applyOutputMasking(response);
7316 |       }
7317 | 
7318 |       // Enrich with state reinforcement (Phase 2)
7319 |       const enriched = await this.stateReinforcementManager.enrichResponseWithContext(textContent);
7320 | 
7321 |       // Prepare final response
7322 |       let finalResponse: CallToolResult;
7323 | 
7324 |       // Replace text content with enriched version if context was injected
7325 |       if (enriched.contextInjected) {
7326 |         finalResponse = {
7327 |           ...response,
7328 |           content: response.content.map(item => {
7329 |             if (item.type === 'text') {
7330 |               return {
7331 |                 type: 'text',
7332 |                 text: enriched.enrichedContent,
7333 |               };
7334 |             }
7335 |             return item;
7336 |           }),
7337 |         };
7338 |       } else {
7339 |         finalResponse = response;
7340 |       }
7341 | 
7342 |       // Record conversation turn (Phase 3: Structured External Memory)
7343 |       if (toolName) {
7344 |         const duration = Date.now() - startTime;
7345 | 
7346 |         // Check if response has expandableId (from tiered response)
7347 |         const expandableIdMatch = textContent.match(/expandableId:\s*(\S+)/);
7348 |         const expandableId = expandableIdMatch ? expandableIdMatch[1] : undefined;
7349 | 
7350 |         await this.conversationMemoryManager.recordTurn(
7351 |           {
7352 |             type: 'tool_call',
7353 |             toolName,
7354 |             toolArgs,
7355 |           },
7356 |           {
7357 |             content: enriched.enrichedContent || textContent,
7358 |             tokenCount: enriched.tokenCount,
7359 |             contextInjected: enriched.contextInjected,
7360 |             ...(expandableId ? { expandableId } : {}),
7361 |           },
7362 |           {
7363 |             duration,
7364 |             cacheHit: false, // Could be enhanced to track cache hits
7365 |             errorOccurred: false,
7366 |           }
7367 |         );
7368 | 
7369 |         this.logger.debug(`Conversation turn recorded for ${toolName}`, 'McpAdrAnalysisServer', {
7370 |           turnNumber: enriched.turnNumber,
7371 |         });
7372 |       }
7373 | 
7374 |       // Apply masking to final response
7375 |       return await this.applyOutputMasking(finalResponse);
7376 |     } catch (error) {
7377 |       this.logger.error(
7378 |         'State reinforcement or conversation recording failed, returning original response',
7379 |         'McpAdrAnalysisServer',
7380 |         error instanceof Error ? error : undefined
7381 |       );
7382 |       // Fallback to just masking if enrichment fails
7383 |       return await this.applyOutputMasking(response);
7384 |     }
7385 |   }
7386 | 
7387 |   /**
7388 |    * Read MCP resource with prompt-driven caching
7389 |    */
7390 |   private async readResource(uri: string): Promise<any> {
7391 |     try {
7392 |       // Import resource router and templated resources (ensures routes are registered)
7393 |       const { resourceRouter } = await import('./resources/resource-router.js');
7394 | 
7395 |       // Import templated resources to register routes
7396 |       await import('./resources/adr-by-id-resource.js');
7397 |       await import('./resources/research-by-topic-resource.js');
7398 |       await import('./resources/todo-by-id-resource.js');
7399 |       await import('./resources/rule-by-id-resource.js');
7400 |       await import('./resources/technology-by-name-resource.js');
7401 |       await import('./resources/pattern-by-name-resource.js');
7402 |       await import('./resources/validated-pattern-by-platform-resource.js');
7403 |       await import('./resources/pattern-sources-by-platform-resource.js');
7404 |       await import('./resources/pattern-base-code-by-platform-resource.js');
7405 | 
7406 |       // Try routing first (handles templated resources)
7407 |       if (resourceRouter.canRoute(uri)) {
7408 |         const result = await resourceRouter.route(uri);
7409 | 
7410 |         return {
7411 |           contents: [
7412 |             {
7413 |               uri,
7414 |               mimeType: result.contentType,
7415 |               text: JSON.stringify(result.data, null, 2),
7416 |             },
7417 |           ],
7418 |           _meta: {
7419 |             lastModified: result.lastModified,
7420 |             etag: result.etag,
7421 |             cacheKey: result.cacheKey,
7422 |           },
7423 |         };
7424 |       }
7425 | 
7426 |       // Fall back to static resource handling
7427 |       // Parse URI to determine resource type and parameters
7428 |       const url = new globalThis.URL(uri);
7429 |       const resourceType = url.pathname.replace('/', '');
7430 |       const params = Object.fromEntries(url.searchParams.entries());
7431 | 
7432 |       switch (resourceType) {
7433 |         case 'architectural_knowledge_graph': {
7434 |           const { generateArchitecturalKnowledgeGraph } = await import('./resources/index.js');
7435 |           const projectPath = params['projectPath'] || process.cwd();
7436 | 
7437 |           // Generate resource directly (caching is now handled through AI delegation)
7438 |           const result = await generateArchitecturalKnowledgeGraph(projectPath);
7439 | 
7440 |           return {
7441 |             contents: [
7442 |               {
7443 |                 uri,
7444 |                 mimeType: result.contentType,
7445 |                 text: JSON.stringify(result.data, null, 2),
7446 |               },
7447 |             ],
7448 |           };
7449 |         }
7450 | 
7451 |         case 'analysis_report': {
7452 |           const { generateAnalysisReport } = await import('./resources/index.js');
7453 |           const projectPath = params['projectPath'] || process.cwd();
7454 |           const focusAreas = params['focusAreas'] ? params['focusAreas'].split(',') : undefined;
7455 | 
7456 |           // Generate resource directly (caching is now handled through AI delegation)
7457 |           const result = await generateAnalysisReport(projectPath, focusAreas);
7458 | 
7459 |           return {
7460 |             contents: [
7461 |               {
7462 |                 uri,
7463 |                 mimeType: result.contentType,
7464 |                 text: JSON.stringify(result.data, null, 2),
7465 |               },
7466 |             ],
7467 |           };
7468 |         }
7469 | 
7470 |         case 'adr_list': {
7471 |           const { generateAdrList } = await import('./resources/index.js');
7472 |           const { getAdrDirectoryPath } = await import('./utils/config.js');
7473 |           const path = await import('path');
7474 | 
7475 |           // Use absolute ADR path relative to project
7476 |           const absoluteAdrPath = params['adrDirectory']
7477 |             ? path.resolve(this.config.projectPath, params['adrDirectory'])
7478 |             : getAdrDirectoryPath(this.config);
7479 | 
7480 |           // Generate resource directly (caching is now handled through AI delegation)
7481 |           const result = await generateAdrList(absoluteAdrPath, this.config.projectPath);
7482 | 
7483 |           return {
7484 |             contents: [
7485 |               {
7486 |                 uri,
7487 |                 mimeType: result.contentType,
7488 |                 text: JSON.stringify(result.data, null, 2),
7489 |               },
7490 |             ],
7491 |           };
7492 |         }
7493 | 
7494 |         case 'todo_list': {
7495 |           const { generateTodoListResource } = await import('./resources/todo-list-resource.js');
7496 |           const result = await generateTodoListResource();
7497 | 
7498 |           return {
7499 |             contents: [
7500 |               {
7501 |                 uri,
7502 |                 mimeType: result.contentType,
7503 |                 text: JSON.stringify(result.data, null, 2),
7504 |               },
7505 |             ],
7506 |             _meta: {
7507 |               lastModified: result.lastModified,
7508 |               etag: result.etag,
7509 |               cacheKey: result.cacheKey,
7510 |             },
7511 |           };
7512 |         }
7513 | 
7514 |         case 'research_index': {
7515 |           const { generateResearchIndexResource } = await import(
7516 |             './resources/research-index-resource.js'
7517 |           );
7518 |           const result = await generateResearchIndexResource();
7519 | 
7520 |           return {
7521 |             contents: [
7522 |               {
7523 |                 uri,
7524 |                 mimeType: result.contentType,
7525 |                 text: JSON.stringify(result.data, null, 2),
7526 |               },
7527 |             ],
7528 |             _meta: {
7529 |               lastModified: result.lastModified,
7530 |               etag: result.etag,
7531 |               cacheKey: result.cacheKey,
7532 |             },
7533 |           };
7534 |         }
7535 | 
7536 |         case 'rule_catalog': {
7537 |           const { generateRuleCatalogResource } = await import(
7538 |             './resources/rule-catalog-resource.js'
7539 |           );
7540 |           const result = await generateRuleCatalogResource();
7541 | 
7542 |           return {
7543 |             contents: [
7544 |               {
7545 |                 uri,
7546 |                 mimeType: result.contentType,
7547 |                 text: JSON.stringify(result.data, null, 2),
7548 |               },
7549 |             ],
7550 |             _meta: {
7551 |               lastModified: result.lastModified,
7552 |               etag: result.etag,
7553 |               cacheKey: result.cacheKey,
7554 |             },
7555 |           };
7556 |         }
7557 | 
7558 |         case 'rule_generation': {
7559 |           const { generateRuleGenerationResource } = await import(
7560 |             './resources/rule-generation-resource.js'
7561 |           );
7562 |           const result = await generateRuleGenerationResource(undefined, url.searchParams);
7563 | 
7564 |           return {
7565 |             contents: [
7566 |               {
7567 |                 uri,
7568 |                 mimeType: result.contentType,
7569 |                 text: JSON.stringify(result.data, null, 2),
7570 |               },
7571 |             ],
7572 |             _meta: {
7573 |               lastModified: result.lastModified,
7574 |               etag: result.etag,
7575 |               cacheKey: result.cacheKey,
7576 |             },
7577 |           };
7578 |         }
7579 | 
7580 |         case 'project_status': {
7581 |           const { generateProjectStatusResource } = await import(
7582 |             './resources/project-status-resource.js'
7583 |           );
7584 |           const result = await generateProjectStatusResource();
7585 | 
7586 |           return {
7587 |             contents: [
7588 |               {
7589 |                 uri,
7590 |                 mimeType: result.contentType,
7591 |                 text: JSON.stringify(result.data, null, 2),
7592 |               },
7593 |             ],
7594 |             _meta: {
7595 |               lastModified: result.lastModified,
7596 |               etag: result.etag,
7597 |               cacheKey: result.cacheKey,
7598 |             },
7599 |           };
7600 |         }
7601 | 
7602 |         case 'deployment_status': {
7603 |           const { generateDeploymentStatusResource } = await import(
7604 |             './resources/deployment-status-resource.js'
7605 |           );
7606 |           const result = await generateDeploymentStatusResource(undefined, url.searchParams);
7607 | 
7608 |           return {
7609 |             contents: [
7610 |               {
7611 |                 uri,
7612 |                 mimeType: result.contentType,
7613 |                 text: JSON.stringify(result.data, null, 2),
7614 |               },
7615 |             ],
7616 |             _meta: {
7617 |               lastModified: result.lastModified,
7618 |               etag: result.etag,
7619 |               cacheKey: result.cacheKey,
7620 |             },
7621 |           };
7622 |         }
7623 | 
7624 |         case 'environment_analysis': {
7625 |           const { generateEnvironmentAnalysisResource } = await import(
7626 |             './resources/environment-analysis-resource.js'
7627 |           );
7628 |           const result = await generateEnvironmentAnalysisResource(undefined, url.searchParams);
7629 | 
7630 |           return {
7631 |             contents: [
7632 |               {
7633 |                 uri,
7634 |                 mimeType: result.contentType,
7635 |                 text: JSON.stringify(result.data, null, 2),
7636 |               },
7637 |             ],
7638 |             _meta: {
7639 |               lastModified: result.lastModified,
7640 |               etag: result.etag,
7641 |               cacheKey: result.cacheKey,
7642 |             },
7643 |           };
7644 |         }
7645 | 
7646 |         case 'memory_snapshots': {
7647 |           const { generateMemorySnapshotsResource } = await import(
7648 |             './resources/memory-snapshots-resource.js'
7649 |           );
7650 |           const result = await generateMemorySnapshotsResource(undefined, url.searchParams);
7651 | 
7652 |           return {
7653 |             contents: [
7654 |               {
7655 |                 uri,
7656 |                 mimeType: result.contentType,
7657 |                 text: JSON.stringify(result.data, null, 2),
7658 |               },
7659 |             ],
7660 |             _meta: {
7661 |               lastModified: result.lastModified,
7662 |               etag: result.etag,
7663 |               cacheKey: result.cacheKey,
7664 |             },
7665 |           };
7666 |         }
7667 | 
7668 |         case 'project_metrics': {
7669 |           const { generateProjectMetricsResource } = await import(
7670 |             './resources/project-metrics-resource.js'
7671 |           );
7672 |           const result = await generateProjectMetricsResource();
7673 | 
7674 |           return {
7675 |             contents: [
7676 |               {
7677 |                 uri,
7678 |                 mimeType: result.contentType,
7679 |                 text: JSON.stringify(result.data, null, 2),
7680 |               },
7681 |             ],
7682 |             _meta: {
7683 |               lastModified: result.lastModified,
7684 |               etag: result.etag,
7685 |               cacheKey: result.cacheKey,
7686 |             },
7687 |           };
7688 |         }
7689 | 
7690 |         case 'deployment_history': {
7691 |           const { generateDeploymentHistoryResource } = await import(
7692 |             './resources/deployment-history-resource.js'
7693 |           );
7694 |           const result = await generateDeploymentHistoryResource(undefined, url.searchParams);
7695 | 
7696 |           return {
7697 |             contents: [
7698 |               {
7699 |                 uri,
7700 |                 mimeType: result.contentType,
7701 |                 text: JSON.stringify(result.data, null, 2),
7702 |               },
7703 |             ],
7704 |             _meta: {
7705 |               lastModified: result.lastModified,
7706 |               etag: result.etag,
7707 |               cacheKey: result.cacheKey,
7708 |             },
7709 |           };
7710 |         }
7711 | 
7712 |         case 'code_quality': {
7713 |           const { generateCodeQualityResource } = await import(
7714 |             './resources/code-quality-resource.js'
7715 |           );
7716 |           const result = await generateCodeQualityResource(undefined, url.searchParams);
7717 | 
7718 |           return {
7719 |             contents: [
7720 |               {
7721 |                 uri,
7722 |                 mimeType: result.contentType,
7723 |                 text: JSON.stringify(result.data, null, 2),
7724 |               },
7725 |             ],
7726 |             _meta: {
7727 |               lastModified: result.lastModified,
7728 |               etag: result.etag,
7729 |               cacheKey: result.cacheKey,
7730 |             },
7731 |           };
7732 |         }
7733 | 
7734 |         case 'validated_patterns': {
7735 |           const { generateValidatedPatternsCatalogResource } = await import(
7736 |             './resources/validated-patterns-catalog-resource.js'
7737 |           );
7738 |           const result = await generateValidatedPatternsCatalogResource();
7739 | 
7740 |           return {
7741 |             contents: [
7742 |               {
7743 |                 uri,
7744 |                 mimeType: result.contentType,
7745 |                 text: JSON.stringify(result.data, null, 2),
7746 |               },
7747 |             ],
7748 |             _meta: {
7749 |               lastModified: result.lastModified,
7750 |               etag: result.etag,
7751 |               cacheKey: result.cacheKey,
7752 |             },
7753 |           };
7754 |         }
7755 | 
7756 |         default:
7757 |           throw new McpAdrError(`Unknown resource type: ${resourceType}`, 'UNKNOWN_RESOURCE');
7758 |       }
7759 |     } catch (error) {
7760 |       if (error instanceof McpAdrError) {
7761 |         throw error;
7762 |       }
7763 |       throw new McpAdrError(
7764 |         `Failed to read resource: ${error instanceof Error ? error.message : String(error)}`,
7765 |         'RESOURCE_ERROR'
7766 |       );
7767 |     }
7768 |   }
7769 | 
7770 |   /**
7771 |    * Start the server
7772 |    */
7773 |   async start(): Promise<void> {
7774 |     // Validate configuration before starting
7775 |     await this.validateConfiguration();
7776 | 
7777 |     // Initialize memory entity manager
7778 |     await this.memoryEntityManager.initialize();
7779 |     this.logger.info('Memory Entity Manager initialized', 'McpAdrAnalysisServer');
7780 | 
7781 |     // Initialize conversation memory manager (Phase 3: Structured External Memory)
7782 |     await this.conversationMemoryManager.initialize();
7783 |     this.logger.info('Phase 3 (Structured External Memory) initialized', 'McpAdrAnalysisServer');
7784 | 
7785 |     // Generate initial server context file
7786 |     try {
7787 |       await this.contextGenerator.writeContextFile(
7788 |         this.kgManager,
7789 |         this.memoryEntityManager,
7790 |         this.conversationMemoryManager
7791 |       );
7792 |       this.logger.info(
7793 |         'Server context file generated at .mcp-server-context.md',
7794 |         'McpAdrAnalysisServer'
7795 |       );
7796 |     } catch (error) {
7797 |       this.logger.warn('Failed to generate initial server context file', 'McpAdrAnalysisServer', {
7798 |         error: error instanceof Error ? error.message : String(error),
7799 |       });
7800 |     }
7801 | 
7802 |     const transport = new StdioServerTransport();
7803 |     await this.server.connect(transport);
7804 | 
7805 |     // Keep the process alive
7806 |     process.on('SIGINT', async () => {
7807 |       await this.server.close();
7808 |       process.exit(0);
7809 |     });
7810 |   }
7811 | 
7812 |   /**
7813 |    * File system tool implementations
7814 |    */
7815 | 
7816 |   /**
7817 |    * List accessible roots (MCP best practice)
7818 |    */
7819 |   private async listRoots(): Promise<CallToolResult> {
7820 |     const roots = this.rootManager.listRoots();
7821 | 
7822 |     const rootsList = roots
7823 |       .map(r => `### ${r.name}\n\n**Path**: \`${r.path}\`\n\n**Description**: ${r.description}\n`)
7824 |       .join('\n');
7825 | 
7826 |     return {
7827 |       content: [
7828 |         {
7829 |           type: 'text',
7830 |           text: `# Available File System Roots\n\nThese are the directories that can be accessed by this MCP server.\n\n${rootsList}\nUse these paths with \`read_directory\` and \`read_file\` tools to explore and access files.`,
7831 |         },
7832 |       ],
7833 |     };
7834 |   }
7835 | 
7836 |   /**
7837 |    * Read directory contents (MCP best practice for autonomous file discovery)
7838 |    */
7839 |   private async readDirectory(args: { path?: string }): Promise<CallToolResult> {
7840 |     const targetPath = args.path || this.config.projectPath;
7841 | 
7842 |     try {
7843 |       const path = await import('path');
7844 |       const resolvedPath = path.resolve(targetPath);
7845 | 
7846 |       // Security check: ensure path is within accessible roots
7847 |       if (!this.rootManager.isPathAllowed(resolvedPath)) {
7848 |         const roots = this.rootManager.listRoots();
7849 |         const rootList = roots.map(r => `  - ${r.name}: ${r.path}`).join('\n');
7850 | 
7851 |         throw new McpAdrError(
7852 |           `Access denied: Path '${targetPath}' is outside accessible roots.\n\nAccessible roots:\n${rootList}\n\nUse list_roots tool for more details.`,
7853 |           'ACCESS_DENIED'
7854 |         );
7855 |       }
7856 | 
7857 |       const { readdir } = await import('fs/promises');
7858 |       const entries = await readdir(resolvedPath, { withFileTypes: true });
7859 | 
7860 |       const files = entries.filter(e => e.isFile()).map(e => `📄 ${e.name}`);
7861 | 
7862 |       const dirs = entries.filter(e => e.isDirectory()).map(e => `📁 ${e.name}/`);
7863 | 
7864 |       const root = this.rootManager.getRootForPath(resolvedPath);
7865 |       const relPath = this.rootManager.getRelativePathFromRoot(resolvedPath);
7866 | 
7867 |       const filesList = files.length > 0 ? files.join('\n') : '(no files)';
7868 |       const dirsList = dirs.length > 0 ? dirs.join('\n') : '(no directories)';
7869 | 
7870 |       return {
7871 |         content: [
7872 |           {
7873 |             type: 'text',
7874 |             text: `# Directory: ${targetPath}\n\n**Root**: ${root?.name}\n**Relative Path**: ${relPath || '/'}\n**Full Path**: \`${resolvedPath}\`\n\n## Directories (${dirs.length})\n\n${dirsList}\n\n## Files (${files.length})\n\n${filesList}`,
7875 |           },
7876 |         ],
7877 |       };
7878 |     } catch (error) {
7879 |       throw new McpAdrError(
7880 |         `Failed to read directory: ${error instanceof Error ? error.message : String(error)}`,
7881 |         'DIRECTORY_READ_ERROR'
7882 |       );
7883 |     }
7884 |   }
7885 | 
7886 |   private async readFile(args: ReadFileArgs): Promise<CallToolResult> {
7887 |     const { filePath } = args;
7888 | 
7889 |     try {
7890 |       const fs = await import('fs/promises');
7891 |       const path = await import('path');
7892 | 
7893 |       // Resolve path (handle both relative and absolute paths)
7894 |       const safePath = path.resolve(filePath);
7895 | 
7896 |       // Security check: ensure path is within accessible roots
7897 |       if (!this.rootManager.isPathAllowed(safePath)) {
7898 |         const roots = this.rootManager.listRoots();
7899 |         const rootList = roots.map(r => `  - ${r.name}: ${r.path}`).join('\n');
7900 | 
7901 |         throw new McpAdrError(
7902 |           `Access denied: Path '${filePath}' is outside accessible roots.\n\nAccessible roots:\n${rootList}\n\nUse list_roots tool for more details.`,
7903 |           'ACCESS_DENIED'
7904 |         );
7905 |       }
7906 | 
7907 |       const content = await fs.readFile(safePath, 'utf-8');
7908 | 
7909 |       return {
7910 |         content: [
7911 |           {
7912 |             type: 'text',
7913 |             text: content,
7914 |           },
7915 |         ],
7916 |       };
7917 |     } catch (error) {
7918 |       throw new McpAdrError(
7919 |         `Failed to read file: ${error instanceof Error ? error.message : String(error)}`,
7920 |         'FILE_READ_ERROR'
7921 |       );
7922 |     }
7923 |   }
7924 | 
7925 |   private async writeFile(args: WriteFileArgs): Promise<CallToolResult> {
7926 |     const { filePath, content } = args;
7927 | 
7928 |     try {
7929 |       const fs = await import('fs/promises');
7930 |       const path = await import('path');
7931 | 
7932 |       // Resolve path relative to project path for security
7933 |       const safePath = path.resolve(this.config.projectPath, filePath);
7934 | 
7935 |       // Security check: ensure path is within project directory
7936 |       if (!safePath.startsWith(this.config.projectPath)) {
7937 |         throw new McpAdrError('Access denied: Path is outside project directory', 'ACCESS_DENIED');
7938 |       }
7939 | 
7940 |       // Ensure directory exists
7941 |       await fs.mkdir(path.dirname(safePath), { recursive: true });
7942 | 
7943 |       // Write file
7944 |       await fs.writeFile(safePath, content, 'utf-8');
7945 | 
7946 |       return {
7947 |         content: [
7948 |           {
7949 |             type: 'text',
7950 |             text: `Successfully wrote to ${filePath}`,
7951 |           },
7952 |         ],
7953 |       };
7954 |     } catch (error) {
7955 |       throw new McpAdrError(
7956 |         `Failed to write file: ${error instanceof Error ? error.message : String(error)}`,
7957 |         'FILE_WRITE_ERROR'
7958 |       );
7959 |     }
7960 |   }
7961 | 
7962 |   private async listDirectory(args: Record<string, unknown>): Promise<CallToolResult> {
7963 |     const { path: dirPath } = args;
7964 | 
7965 |     try {
7966 |       const fs = await import('fs/promises');
7967 |       const path = await import('path');
7968 | 
7969 |       // Resolve path relative to project path for security
7970 |       const safePath = path.resolve(this.config.projectPath, dirPath as string);
7971 | 
7972 |       // Security check: ensure path is within project directory
7973 |       if (!safePath.startsWith(this.config.projectPath)) {
7974 |         throw new McpAdrError('Access denied: Path is outside project directory', 'ACCESS_DENIED');
7975 |       }
7976 | 
7977 |       const entries = await fs.readdir(safePath, { withFileTypes: true });
7978 |       const fileList = entries.map(entry => ({
7979 |         name: entry.name,
7980 |         type: entry.isDirectory() ? 'directory' : 'file',
7981 |         path: path.join(dirPath as string, entry.name),
7982 |       }));
7983 | 
7984 |       return {
7985 |         content: [
7986 |           {
7987 |             type: 'text',
7988 |             text: JSON.stringify(fileList, null, 2),
7989 |           },
7990 |         ],
7991 |       };
7992 |     } catch (error) {
7993 |       throw new McpAdrError(
7994 |         `Failed to list directory: ${error instanceof Error ? error.message : String(error)}`,
7995 |         'DIRECTORY_LIST_ERROR'
7996 |       );
7997 |     }
7998 |   }
7999 | 
8000 |   private async generateDeploymentGuidance(args: Record<string, unknown>): Promise<CallToolResult> {
8001 |     try {
8002 |       const { generateDeploymentGuidance } = await import('./tools/deployment-guidance-tool.js');
8003 |       return await generateDeploymentGuidance(args);
8004 |     } catch (error) {
8005 |       throw new McpAdrError(
8006 |         `Deployment guidance generation failed: ${error instanceof Error ? error.message : String(error)}`,
8007 |         'DEPLOYMENT_GUIDANCE_ERROR'
8008 |       );
8009 |     }
8010 |   }
8011 | 
8012 |   private async smartGitPush(args: Record<string, unknown>): Promise<CallToolResult> {
8013 |     try {
8014 |       const { smartGitPush } = await import('./tools/smart-git-push-tool-v2.js');
8015 |       return await smartGitPush(args);
8016 |     } catch (error) {
8017 |       throw new McpAdrError(
8018 |         `Smart git push failed: ${error instanceof Error ? error.message : String(error)}`,
8019 |         'SMART_GIT_PUSH_ERROR'
8020 |       );
8021 |     }
8022 |   }
8023 | 
8024 |   private async deploymentReadiness(args: Record<string, unknown>): Promise<CallToolResult> {
8025 |     try {
8026 |       const { deploymentReadiness } = await import('./tools/deployment-readiness-tool.js');
8027 |       return await deploymentReadiness(args);
8028 |     } catch (error) {
8029 |       throw new McpAdrError(
8030 |         `Deployment readiness check failed: ${error instanceof Error ? error.message : String(error)}`,
8031 |         'DEPLOYMENT_READINESS_ERROR'
8032 |       );
8033 |     }
8034 |   }
8035 | 
8036 |   private async troubleshootGuidedWorkflow(args: Record<string, unknown>): Promise<CallToolResult> {
8037 |     try {
8038 |       const { troubleshootGuidedWorkflow } = await import(
8039 |         './tools/troubleshoot-guided-workflow-tool.js'
8040 |       );
8041 |       return await troubleshootGuidedWorkflow(args as unknown as TodoManagementV2Args);
8042 |     } catch (error) {
8043 |       throw new McpAdrError(
8044 |         `Troubleshoot guided workflow failed: ${error instanceof Error ? error.message : String(error)}`,
8045 |         'TROUBLESHOOT_GUIDED_WORKFLOW_ERROR'
8046 |       );
8047 |     }
8048 |   }
8049 | 
8050 |   private async smartScore(_args: Record<string, unknown>): Promise<CallToolResult> {
8051 |     // Smart score tool was removed - return deprecation message
8052 |     return {
8053 |       content: [
8054 |         {
8055 |           type: 'text',
8056 |           text: `⚠️ **Smart Score Tool Deprecated**
8057 | 
8058 | This tool has been deprecated and replaced with memory-centric health scoring.
8059 | 
8060 | **Replacement:** The new MemoryHealthScoring system tracks:
8061 | - Memory quality and relevance
8062 | - Retrieval performance
8063 | - Entity relationship coherence
8064 | - Context utilization
8065 | - Decision alignment
8066 | 
8067 | **Migration:** Health scoring is now integrated into the knowledge graph and automatically calculated based on memory usage patterns.`,
8068 |         },
8069 |       ],
8070 |       isError: false,
8071 |     };
8072 |   }
8073 | 
8074 |   private async mcpPlanning(args: Record<string, unknown>): Promise<CallToolResult> {
8075 |     try {
8076 |       const { mcpPlanning } = await import('./tools/mcp-planning-tool.js');
8077 |       return await mcpPlanning(args);
8078 |     } catch (error) {
8079 |       throw new McpAdrError(
8080 |         `MCP planning failed: ${error instanceof Error ? error.message : String(error)}`,
8081 |         'MCP_PLANNING_ERROR'
8082 |       );
8083 |     }
8084 |   }
8085 | 
8086 |   private async memoryLoading(args: Record<string, unknown>): Promise<CallToolResult> {
8087 |     try {
8088 |       const { MemoryLoadingTool } = await import('./tools/memory-loading-tool.js');
8089 |       const memoryTool = new MemoryLoadingTool();
8090 |       return await memoryTool.execute(args);
8091 |     } catch (error) {
8092 |       throw new McpAdrError(
8093 |         `Memory loading failed: ${error instanceof Error ? error.message : String(error)}`,
8094 |         'MEMORY_LOADING_ERROR'
8095 |       );
8096 |     }
8097 |   }
8098 | 
8099 |   private async expandAnalysisSection(args: Record<string, unknown>): Promise<CallToolResult> {
8100 |     try {
8101 |       const { expandAnalysisSection } = await import('./tools/expand-analysis-tool.js');
8102 |       return await expandAnalysisSection(args as any);
8103 |     } catch (error) {
8104 |       throw new McpAdrError(
8105 |         `Failed to expand analysis: ${error instanceof Error ? error.message : String(error)}`,
8106 |         'EXPAND_ANALYSIS_ERROR'
8107 |       );
8108 |     }
8109 |   }
8110 | 
8111 |   private async interactiveAdrPlanning(args: Record<string, unknown>): Promise<CallToolResult> {
8112 |     try {
8113 |       const { interactiveAdrPlanning } = await import('./tools/interactive-adr-planning-tool.js');
8114 |       return await interactiveAdrPlanning(args);
8115 |     } catch (error) {
8116 |       throw new McpAdrError(
8117 |         `Interactive ADR planning failed: ${error instanceof Error ? error.message : String(error)}`,
8118 |         'INTERACTIVE_ADR_PLANNING_ERROR'
8119 |       );
8120 |     }
8121 |   }
8122 | 
8123 |   /**
8124 |    * Tool chain orchestrator implementation
8125 |    */
8126 |   private async toolChainOrchestrator(args: ToolChainOrchestratorArgs): Promise<CallToolResult> {
8127 |     try {
8128 |       const { toolChainOrchestrator } = await import('./tools/tool-chain-orchestrator.js');
8129 |       return await toolChainOrchestrator(args as any);
8130 |     } catch (error) {
8131 |       throw new McpAdrError(
8132 |         `Tool chain orchestration failed: ${error instanceof Error ? error.message : String(error)}`,
8133 |         'TOOL_CHAIN_ORCHESTRATOR_ERROR'
8134 |       );
8135 |     }
8136 |   }
8137 | 
8138 |   /**
8139 |    * Phase 3: Expand Memory Tool
8140 |    * Retrieves and expands stored content from tiered responses
8141 |    */
8142 |   private async expandMemory(args: any): Promise<CallToolResult> {
8143 |     try {
8144 |       const { expandMemory } = await import('./tools/conversation-memory-tool.js');
8145 |       return await expandMemory(args, this.conversationMemoryManager);
8146 |     } catch (error) {
8147 |       throw new McpAdrError(
8148 |         `Memory expansion failed: ${error instanceof Error ? error.message : String(error)}`,
8149 |         'MEMORY_EXPANSION_ERROR'
8150 |       );
8151 |     }
8152 |   }
8153 | 
8154 |   /**
8155 |    * Phase 3: Query Conversation History Tool
8156 |    * Searches and retrieves conversation sessions
8157 |    */
8158 |   private async queryConversationHistory(args: any): Promise<CallToolResult> {
8159 |     try {
8160 |       const { queryConversationHistory } = await import('./tools/conversation-memory-tool.js');
8161 |       return await queryConversationHistory(args, this.conversationMemoryManager);
8162 |     } catch (error) {
8163 |       throw new McpAdrError(
8164 |         `Conversation history query failed: ${error instanceof Error ? error.message : String(error)}`,
8165 |         'CONVERSATION_QUERY_ERROR'
8166 |       );
8167 |     }
8168 |   }
8169 | 
8170 |   /**
8171 |    * Phase 3: Get Conversation Snapshot Tool
8172 |    * Retrieves current conversation context
8173 |    */
8174 |   private async getConversationSnapshot(args: any): Promise<CallToolResult> {
8175 |     try {
8176 |       const { getConversationSnapshot } = await import('./tools/conversation-memory-tool.js');
8177 |       return await getConversationSnapshot(args, this.conversationMemoryManager);
8178 |     } catch (error) {
8179 |       throw new McpAdrError(
8180 |         `Conversation snapshot retrieval failed: ${error instanceof Error ? error.message : String(error)}`,
8181 |         'SNAPSHOT_ERROR'
8182 |       );
8183 |     }
8184 |   }
8185 | 
8186 |   /**
8187 |    * Phase 3: Get Memory Statistics Tool
8188 |    * Retrieves conversation memory statistics
8189 |    */
8190 |   private async getMemoryStats(): Promise<CallToolResult> {
8191 |     try {
8192 |       const { getMemoryStats } = await import('./tools/conversation-memory-tool.js');
8193 |       return await getMemoryStats(this.conversationMemoryManager);
8194 |     } catch (error) {
8195 |       throw new McpAdrError(
8196 |         `Memory stats retrieval failed: ${error instanceof Error ? error.message : String(error)}`,
8197 |         'MEMORY_STATS_ERROR'
8198 |       );
8199 |     }
8200 |   }
8201 | 
8202 |   /**
8203 |    * Get Server Context Tool
8204 |    * Generates comprehensive server context file for LLM @ referencing
8205 |    */
8206 |   private async getServerContext(args: any): Promise<CallToolResult> {
8207 |     try {
8208 |       const { getServerContext } = await import('./tools/get-server-context-tool.js');
8209 |       return await getServerContext(
8210 |         args,
8211 |         this.kgManager,
8212 |         this.memoryEntityManager,
8213 |         this.conversationMemoryManager
8214 |       );
8215 |     } catch (error) {
8216 |       throw new McpAdrError(
8217 |         `Server context generation failed: ${error instanceof Error ? error.message : String(error)}`,
8218 |         'SERVER_CONTEXT_ERROR'
8219 |       );
8220 |     }
8221 |   }
8222 | }
8223 | 
8224 | /**
8225 |  * Main execution function for the MCP ADR Analysis Server
8226 |  *
8227 |  * @description Initializes and starts the MCP server with proper configuration,
8228 |  * error handling, and graceful shutdown. Handles command line arguments for
8229 |  * help, version, and test modes.
8230 |  *
8231 |  * @returns {Promise<void>} Resolves when server shuts down gracefully
8232 |  *
8233 |  * @throws {Error} When server initialization fails or configuration is invalid
8234 |  *
8235 |  * @example
8236 |  * ```typescript
8237 |  * // Start the server (typically called from CLI)
8238 |  * await main();
8239 |  * ```
8240 |  *
8241 |  * @since 1.0.0
8242 |  * @category Main
8243 |  */
8244 | async function main(): Promise<void> {
8245 |   const args = process.argv.slice(2);
8246 | 
8247 |   // Handle command line arguments
8248 |   if (args.includes('--help') || args.includes('-h')) {
8249 |     console.log(`
8250 | MCP ADR Analysis Server v${SERVER_INFO.version}
8251 | 
8252 | Usage: mcp-adr-analysis-server [options]
8253 | 
8254 | Options:
8255 |   --help, -h        Show this help message
8256 |   --version, -v     Show version information
8257 |   --test            Run health check and exit
8258 |   --config          Show configuration and exit
8259 | 
8260 | Environment Variables:
8261 |   PROJECT_PATH      Path to project directory (default: current directory)
8262 |   ADR_DIRECTORY     ADR directory relative to project (default: docs/adrs)
8263 |   LOG_LEVEL         Logging level: DEBUG, INFO, WARN, ERROR (default: INFO)
8264 |   CACHE_ENABLED     Enable caching: true, false (default: true)
8265 | 
8266 | Examples:
8267 |   mcp-adr-analysis-server                    # Start MCP server
8268 |   PROJECT_PATH=/path/to/project mcp-adr-analysis-server
8269 |   mcp-adr-analysis-server --test             # Health check
8270 | `);
8271 |     process.exit(0);
8272 |   }
8273 | 
8274 |   if (args.includes('--version') || args.includes('-v')) {
8275 |     console.log(`MCP ADR Analysis Server v${SERVER_INFO.version}`);
8276 |     process.exit(0);
8277 |   }
8278 | 
8279 |   try {
8280 |     const server = new McpAdrAnalysisServer();
8281 | 
8282 |     if (args.includes('--test')) {
8283 |       console.log('🔍 Running health check...');
8284 |       await server.healthCheck();
8285 |       console.log('✅ Health check passed - server can start successfully');
8286 |       process.exit(0);
8287 |     }
8288 | 
8289 |     if (args.includes('--config')) {
8290 |       console.log('📋 Server configuration validated');
8291 |       process.exit(0);
8292 |     }
8293 | 
8294 |     // Normal server startup
8295 |     await server.start();
8296 |   } catch (error) {
8297 |     console.error('❌ MCP server failed to start');
8298 |     console.error('Error:', error instanceof Error ? error.message : String(error));
8299 |     process.exit(1);
8300 |   }
8301 | }
8302 | 
8303 | // Start the server if this file is run directly
8304 | // Jest-compatible check: avoid import.meta.url which Jest cannot handle
8305 | // Handle both direct execution and npm global package symlinks
8306 | if (
8307 |   process.argv[1] &&
8308 |   (process.argv[1].endsWith('index.js') ||
8309 |     process.argv[1].endsWith('index.ts') ||
8310 |     process.argv[1].endsWith('mcp-adr-analysis-server'))
8311 | ) {
8312 |   main().catch(error => {
8313 |     console.error('Unhandled error:', error);
8314 |     process.exit(1);
8315 |   });
8316 | }
8317 | // Test comment for pre-commit hook
8318 | 
```
Page 435/436FirstPrevNextLast