procsi 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/LICENSE +665 -0
  2. package/README.md +587 -0
  3. package/dist/cli/commands/clear.d.ts +3 -0
  4. package/dist/cli/commands/clear.d.ts.map +1 -0
  5. package/dist/cli/commands/clear.js +30 -0
  6. package/dist/cli/commands/clear.js.map +1 -0
  7. package/dist/cli/commands/daemon.d.ts +3 -0
  8. package/dist/cli/commands/daemon.d.ts.map +1 -0
  9. package/dist/cli/commands/daemon.js +59 -0
  10. package/dist/cli/commands/daemon.js.map +1 -0
  11. package/dist/cli/commands/debug-dump.d.ts +27 -0
  12. package/dist/cli/commands/debug-dump.d.ts.map +1 -0
  13. package/dist/cli/commands/debug-dump.js +102 -0
  14. package/dist/cli/commands/debug-dump.js.map +1 -0
  15. package/dist/cli/commands/helpers.d.ts +18 -0
  16. package/dist/cli/commands/helpers.d.ts.map +1 -0
  17. package/dist/cli/commands/helpers.js +34 -0
  18. package/dist/cli/commands/helpers.js.map +1 -0
  19. package/dist/cli/commands/init.d.ts +9 -0
  20. package/dist/cli/commands/init.d.ts.map +1 -0
  21. package/dist/cli/commands/init.js +28 -0
  22. package/dist/cli/commands/init.js.map +1 -0
  23. package/dist/cli/commands/intercept.d.ts +9 -0
  24. package/dist/cli/commands/intercept.d.ts.map +1 -0
  25. package/dist/cli/commands/intercept.js +121 -0
  26. package/dist/cli/commands/intercept.js.map +1 -0
  27. package/dist/cli/commands/interceptors.d.ts +3 -0
  28. package/dist/cli/commands/interceptors.d.ts.map +1 -0
  29. package/dist/cli/commands/interceptors.js +163 -0
  30. package/dist/cli/commands/interceptors.js.map +1 -0
  31. package/dist/cli/commands/mcp.d.ts +3 -0
  32. package/dist/cli/commands/mcp.d.ts.map +1 -0
  33. package/dist/cli/commands/mcp.js +24 -0
  34. package/dist/cli/commands/mcp.js.map +1 -0
  35. package/dist/cli/commands/off.d.ts +8 -0
  36. package/dist/cli/commands/off.d.ts.map +1 -0
  37. package/dist/cli/commands/off.js +34 -0
  38. package/dist/cli/commands/off.js.map +1 -0
  39. package/dist/cli/commands/on.d.ts +9 -0
  40. package/dist/cli/commands/on.d.ts.map +1 -0
  41. package/dist/cli/commands/on.js +121 -0
  42. package/dist/cli/commands/on.js.map +1 -0
  43. package/dist/cli/commands/project.d.ts +3 -0
  44. package/dist/cli/commands/project.d.ts.map +1 -0
  45. package/dist/cli/commands/project.js +15 -0
  46. package/dist/cli/commands/project.js.map +1 -0
  47. package/dist/cli/commands/restart.d.ts +3 -0
  48. package/dist/cli/commands/restart.d.ts.map +1 -0
  49. package/dist/cli/commands/restart.js +35 -0
  50. package/dist/cli/commands/restart.js.map +1 -0
  51. package/dist/cli/commands/status.d.ts +3 -0
  52. package/dist/cli/commands/status.d.ts.map +1 -0
  53. package/dist/cli/commands/status.js +66 -0
  54. package/dist/cli/commands/status.js.map +1 -0
  55. package/dist/cli/commands/stop.d.ts +3 -0
  56. package/dist/cli/commands/stop.d.ts.map +1 -0
  57. package/dist/cli/commands/stop.js +24 -0
  58. package/dist/cli/commands/stop.js.map +1 -0
  59. package/dist/cli/commands/tui.d.ts +3 -0
  60. package/dist/cli/commands/tui.d.ts.map +1 -0
  61. package/dist/cli/commands/tui.js +36 -0
  62. package/dist/cli/commands/tui.js.map +1 -0
  63. package/dist/cli/commands/vars.d.ts +36 -0
  64. package/dist/cli/commands/vars.d.ts.map +1 -0
  65. package/dist/cli/commands/vars.js +207 -0
  66. package/dist/cli/commands/vars.js.map +1 -0
  67. package/dist/cli/index.d.ts +3 -0
  68. package/dist/cli/index.d.ts.map +1 -0
  69. package/dist/cli/index.js +37 -0
  70. package/dist/cli/index.js.map +1 -0
  71. package/dist/cli/tui/App.d.ts +15 -0
  72. package/dist/cli/tui/App.d.ts.map +1 -0
  73. package/dist/cli/tui/App.js +544 -0
  74. package/dist/cli/tui/App.js.map +1 -0
  75. package/dist/cli/tui/components/AccordionContent.d.ts +28 -0
  76. package/dist/cli/tui/components/AccordionContent.d.ts.map +1 -0
  77. package/dist/cli/tui/components/AccordionContent.js +87 -0
  78. package/dist/cli/tui/components/AccordionContent.js.map +1 -0
  79. package/dist/cli/tui/components/AccordionPanel.d.ts +38 -0
  80. package/dist/cli/tui/components/AccordionPanel.d.ts.map +1 -0
  81. package/dist/cli/tui/components/AccordionPanel.js +110 -0
  82. package/dist/cli/tui/components/AccordionPanel.js.map +1 -0
  83. package/dist/cli/tui/components/AccordionSection.d.ts +32 -0
  84. package/dist/cli/tui/components/AccordionSection.d.ts.map +1 -0
  85. package/dist/cli/tui/components/AccordionSection.js +41 -0
  86. package/dist/cli/tui/components/AccordionSection.js.map +1 -0
  87. package/dist/cli/tui/components/BodyView.d.ts +14 -0
  88. package/dist/cli/tui/components/BodyView.d.ts.map +1 -0
  89. package/dist/cli/tui/components/BodyView.js +39 -0
  90. package/dist/cli/tui/components/BodyView.js.map +1 -0
  91. package/dist/cli/tui/components/ExportModal.d.ts +34 -0
  92. package/dist/cli/tui/components/ExportModal.d.ts.map +1 -0
  93. package/dist/cli/tui/components/ExportModal.js +109 -0
  94. package/dist/cli/tui/components/ExportModal.js.map +1 -0
  95. package/dist/cli/tui/components/FilterBar.d.ts +21 -0
  96. package/dist/cli/tui/components/FilterBar.d.ts.map +1 -0
  97. package/dist/cli/tui/components/FilterBar.js +155 -0
  98. package/dist/cli/tui/components/FilterBar.js.map +1 -0
  99. package/dist/cli/tui/components/HeadersView.d.ts +13 -0
  100. package/dist/cli/tui/components/HeadersView.d.ts.map +1 -0
  101. package/dist/cli/tui/components/HeadersView.js +8 -0
  102. package/dist/cli/tui/components/HeadersView.js.map +1 -0
  103. package/dist/cli/tui/components/HelpModal.d.ts +13 -0
  104. package/dist/cli/tui/components/HelpModal.d.ts.map +1 -0
  105. package/dist/cli/tui/components/HelpModal.js +78 -0
  106. package/dist/cli/tui/components/HelpModal.js.map +1 -0
  107. package/dist/cli/tui/components/HintContent.d.ts +25 -0
  108. package/dist/cli/tui/components/HintContent.d.ts.map +1 -0
  109. package/dist/cli/tui/components/HintContent.js +44 -0
  110. package/dist/cli/tui/components/HintContent.js.map +1 -0
  111. package/dist/cli/tui/components/InfoModal.d.ts +15 -0
  112. package/dist/cli/tui/components/InfoModal.d.ts.map +1 -0
  113. package/dist/cli/tui/components/InfoModal.js +17 -0
  114. package/dist/cli/tui/components/InfoModal.js.map +1 -0
  115. package/dist/cli/tui/components/JsonExplorerModal.d.ts +24 -0
  116. package/dist/cli/tui/components/JsonExplorerModal.d.ts.map +1 -0
  117. package/dist/cli/tui/components/JsonExplorerModal.js +311 -0
  118. package/dist/cli/tui/components/JsonExplorerModal.js.map +1 -0
  119. package/dist/cli/tui/components/Modal.d.ts +26 -0
  120. package/dist/cli/tui/components/Modal.d.ts.map +1 -0
  121. package/dist/cli/tui/components/Modal.js +15 -0
  122. package/dist/cli/tui/components/Modal.js.map +1 -0
  123. package/dist/cli/tui/components/Panel.d.ts +19 -0
  124. package/dist/cli/tui/components/Panel.d.ts.map +1 -0
  125. package/dist/cli/tui/components/Panel.js +37 -0
  126. package/dist/cli/tui/components/Panel.js.map +1 -0
  127. package/dist/cli/tui/components/RequestDetails.d.ts +16 -0
  128. package/dist/cli/tui/components/RequestDetails.d.ts.map +1 -0
  129. package/dist/cli/tui/components/RequestDetails.js +23 -0
  130. package/dist/cli/tui/components/RequestDetails.js.map +1 -0
  131. package/dist/cli/tui/components/RequestList.d.ts +21 -0
  132. package/dist/cli/tui/components/RequestList.d.ts.map +1 -0
  133. package/dist/cli/tui/components/RequestList.js +30 -0
  134. package/dist/cli/tui/components/RequestList.js.map +1 -0
  135. package/dist/cli/tui/components/RequestListItem.d.ts +36 -0
  136. package/dist/cli/tui/components/RequestListItem.d.ts.map +1 -0
  137. package/dist/cli/tui/components/RequestListItem.js +130 -0
  138. package/dist/cli/tui/components/RequestListItem.js.map +1 -0
  139. package/dist/cli/tui/components/SaveModal.d.ts +30 -0
  140. package/dist/cli/tui/components/SaveModal.d.ts.map +1 -0
  141. package/dist/cli/tui/components/SaveModal.js +95 -0
  142. package/dist/cli/tui/components/SaveModal.js.map +1 -0
  143. package/dist/cli/tui/components/StatusBar.d.ts +39 -0
  144. package/dist/cli/tui/components/StatusBar.d.ts.map +1 -0
  145. package/dist/cli/tui/components/StatusBar.js +53 -0
  146. package/dist/cli/tui/components/StatusBar.js.map +1 -0
  147. package/dist/cli/tui/components/TextViewerModal.d.ts +19 -0
  148. package/dist/cli/tui/components/TextViewerModal.d.ts.map +1 -0
  149. package/dist/cli/tui/components/TextViewerModal.js +227 -0
  150. package/dist/cli/tui/components/TextViewerModal.js.map +1 -0
  151. package/dist/cli/tui/hooks/useBodyExport.d.ts +26 -0
  152. package/dist/cli/tui/hooks/useBodyExport.d.ts.map +1 -0
  153. package/dist/cli/tui/hooks/useBodyExport.js +173 -0
  154. package/dist/cli/tui/hooks/useBodyExport.js.map +1 -0
  155. package/dist/cli/tui/hooks/useExport.d.ts +29 -0
  156. package/dist/cli/tui/hooks/useExport.d.ts.map +1 -0
  157. package/dist/cli/tui/hooks/useExport.js +64 -0
  158. package/dist/cli/tui/hooks/useExport.js.map +1 -0
  159. package/dist/cli/tui/hooks/useRequests.d.ts +26 -0
  160. package/dist/cli/tui/hooks/useRequests.d.ts.map +1 -0
  161. package/dist/cli/tui/hooks/useRequests.js +131 -0
  162. package/dist/cli/tui/hooks/useRequests.js.map +1 -0
  163. package/dist/cli/tui/hooks/useSaveBinary.d.ts +26 -0
  164. package/dist/cli/tui/hooks/useSaveBinary.d.ts.map +1 -0
  165. package/dist/cli/tui/hooks/useSaveBinary.js +165 -0
  166. package/dist/cli/tui/hooks/useSaveBinary.js.map +1 -0
  167. package/dist/cli/tui/hooks/useSpinner.d.ts +5 -0
  168. package/dist/cli/tui/hooks/useSpinner.d.ts.map +1 -0
  169. package/dist/cli/tui/hooks/useSpinner.js +25 -0
  170. package/dist/cli/tui/hooks/useSpinner.js.map +1 -0
  171. package/dist/cli/tui/hooks/useStdoutDimensions.d.ts +11 -0
  172. package/dist/cli/tui/hooks/useStdoutDimensions.d.ts.map +1 -0
  173. package/dist/cli/tui/hooks/useStdoutDimensions.js +29 -0
  174. package/dist/cli/tui/hooks/useStdoutDimensions.js.map +1 -0
  175. package/dist/cli/tui/utils/binary.d.ts +24 -0
  176. package/dist/cli/tui/utils/binary.d.ts.map +1 -0
  177. package/dist/cli/tui/utils/binary.js +152 -0
  178. package/dist/cli/tui/utils/binary.js.map +1 -0
  179. package/dist/cli/tui/utils/clipboard.d.ts +9 -0
  180. package/dist/cli/tui/utils/clipboard.d.ts.map +1 -0
  181. package/dist/cli/tui/utils/clipboard.js +58 -0
  182. package/dist/cli/tui/utils/clipboard.js.map +1 -0
  183. package/dist/cli/tui/utils/content-type.d.ts +8 -0
  184. package/dist/cli/tui/utils/content-type.d.ts.map +1 -0
  185. package/dist/cli/tui/utils/content-type.js +10 -0
  186. package/dist/cli/tui/utils/content-type.js.map +1 -0
  187. package/dist/cli/tui/utils/curl.d.ts +9 -0
  188. package/dist/cli/tui/utils/curl.d.ts.map +1 -0
  189. package/dist/cli/tui/utils/curl.js +54 -0
  190. package/dist/cli/tui/utils/curl.js.map +1 -0
  191. package/dist/cli/tui/utils/filters.d.ts +6 -0
  192. package/dist/cli/tui/utils/filters.d.ts.map +1 -0
  193. package/dist/cli/tui/utils/filters.js +13 -0
  194. package/dist/cli/tui/utils/filters.js.map +1 -0
  195. package/dist/cli/tui/utils/formatters.d.ts +49 -0
  196. package/dist/cli/tui/utils/formatters.d.ts.map +1 -0
  197. package/dist/cli/tui/utils/formatters.js +200 -0
  198. package/dist/cli/tui/utils/formatters.js.map +1 -0
  199. package/dist/cli/tui/utils/har.d.ts +75 -0
  200. package/dist/cli/tui/utils/har.d.ts.map +1 -0
  201. package/dist/cli/tui/utils/har.js +117 -0
  202. package/dist/cli/tui/utils/har.js.map +1 -0
  203. package/dist/cli/tui/utils/json-tree.d.ts +69 -0
  204. package/dist/cli/tui/utils/json-tree.d.ts.map +1 -0
  205. package/dist/cli/tui/utils/json-tree.js +339 -0
  206. package/dist/cli/tui/utils/json-tree.js.map +1 -0
  207. package/dist/cli/tui/utils/open-external.d.ts +17 -0
  208. package/dist/cli/tui/utils/open-external.d.ts.map +1 -0
  209. package/dist/cli/tui/utils/open-external.js +57 -0
  210. package/dist/cli/tui/utils/open-external.js.map +1 -0
  211. package/dist/cli/tui/utils/syntax-highlight.d.ts +16 -0
  212. package/dist/cli/tui/utils/syntax-highlight.d.ts.map +1 -0
  213. package/dist/cli/tui/utils/syntax-highlight.js +64 -0
  214. package/dist/cli/tui/utils/syntax-highlight.js.map +1 -0
  215. package/dist/daemon/control.d.ts +21 -0
  216. package/dist/daemon/control.d.ts.map +1 -0
  217. package/dist/daemon/control.js +311 -0
  218. package/dist/daemon/control.js.map +1 -0
  219. package/dist/daemon/htpx-client.d.ts +8 -0
  220. package/dist/daemon/htpx-client.d.ts.map +1 -0
  221. package/dist/daemon/htpx-client.js +25 -0
  222. package/dist/daemon/htpx-client.js.map +1 -0
  223. package/dist/daemon/index.d.ts +3 -0
  224. package/dist/daemon/index.d.ts.map +1 -0
  225. package/dist/daemon/index.js +178 -0
  226. package/dist/daemon/index.js.map +1 -0
  227. package/dist/daemon/interceptor-loader.d.ts +30 -0
  228. package/dist/daemon/interceptor-loader.d.ts.map +1 -0
  229. package/dist/daemon/interceptor-loader.js +249 -0
  230. package/dist/daemon/interceptor-loader.js.map +1 -0
  231. package/dist/daemon/interceptor-runner.d.ts +39 -0
  232. package/dist/daemon/interceptor-runner.d.ts.map +1 -0
  233. package/dist/daemon/interceptor-runner.js +312 -0
  234. package/dist/daemon/interceptor-runner.js.map +1 -0
  235. package/dist/daemon/procsi-client.d.ts +8 -0
  236. package/dist/daemon/procsi-client.d.ts.map +1 -0
  237. package/dist/daemon/procsi-client.js +25 -0
  238. package/dist/daemon/procsi-client.js.map +1 -0
  239. package/dist/daemon/proxy.d.ts +34 -0
  240. package/dist/daemon/proxy.d.ts.map +1 -0
  241. package/dist/daemon/proxy.js +213 -0
  242. package/dist/daemon/proxy.js.map +1 -0
  243. package/dist/daemon/storage.d.ts +130 -0
  244. package/dist/daemon/storage.d.ts.map +1 -0
  245. package/dist/daemon/storage.js +761 -0
  246. package/dist/daemon/storage.js.map +1 -0
  247. package/dist/interceptors.d.ts +2 -0
  248. package/dist/interceptors.d.ts.map +1 -0
  249. package/dist/interceptors.js +2 -0
  250. package/dist/interceptors.js.map +1 -0
  251. package/dist/mcp/server.d.ts +110 -0
  252. package/dist/mcp/server.d.ts.map +1 -0
  253. package/dist/mcp/server.js +806 -0
  254. package/dist/mcp/server.js.map +1 -0
  255. package/dist/overrides/node.d.ts +30 -0
  256. package/dist/overrides/node.d.ts.map +1 -0
  257. package/dist/overrides/node.js +66 -0
  258. package/dist/overrides/node.js.map +1 -0
  259. package/dist/shared/config.d.ts +21 -0
  260. package/dist/shared/config.d.ts.map +1 -0
  261. package/dist/shared/config.js +83 -0
  262. package/dist/shared/config.js.map +1 -0
  263. package/dist/shared/content-type.d.ts +64 -0
  264. package/dist/shared/content-type.d.ts.map +1 -0
  265. package/dist/shared/content-type.js +145 -0
  266. package/dist/shared/content-type.js.map +1 -0
  267. package/dist/shared/control-client.d.ts +144 -0
  268. package/dist/shared/control-client.d.ts.map +1 -0
  269. package/dist/shared/control-client.js +272 -0
  270. package/dist/shared/control-client.js.map +1 -0
  271. package/dist/shared/daemon.d.ts +33 -0
  272. package/dist/shared/daemon.d.ts.map +1 -0
  273. package/dist/shared/daemon.js +231 -0
  274. package/dist/shared/daemon.js.map +1 -0
  275. package/dist/shared/logger.d.ts +47 -0
  276. package/dist/shared/logger.d.ts.map +1 -0
  277. package/dist/shared/logger.js +200 -0
  278. package/dist/shared/logger.js.map +1 -0
  279. package/dist/shared/project.d.ts +76 -0
  280. package/dist/shared/project.d.ts.map +1 -0
  281. package/dist/shared/project.js +185 -0
  282. package/dist/shared/project.js.map +1 -0
  283. package/dist/shared/proxy-info.d.ts +10 -0
  284. package/dist/shared/proxy-info.d.ts.map +1 -0
  285. package/dist/shared/proxy-info.js +15 -0
  286. package/dist/shared/proxy-info.js.map +1 -0
  287. package/dist/shared/types.d.ts +128 -0
  288. package/dist/shared/types.d.ts.map +1 -0
  289. package/dist/shared/types.js +5 -0
  290. package/dist/shared/types.js.map +1 -0
  291. package/dist/shared/version.d.ts +5 -0
  292. package/dist/shared/version.d.ts.map +1 -0
  293. package/dist/shared/version.js +21 -0
  294. package/dist/shared/version.js.map +1 -0
  295. package/package.json +113 -0
  296. package/skills/procsi/SKILL.md +228 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/shared/version.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAUzC"}
@@ -0,0 +1,21 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = path.dirname(__filename);
6
+ /**
7
+ * Get procsi version from package.json.
8
+ */
9
+ export function getProcsiVersion() {
10
+ try {
11
+ // Find package.json relative to this file (dist/shared/version.js -> package.json)
12
+ const packageJsonPath = path.resolve(__dirname, "..", "..", "package.json");
13
+ const content = fs.readFileSync(packageJsonPath, "utf-8");
14
+ const pkg = JSON.parse(content);
15
+ return pkg.version ?? "unknown";
16
+ }
17
+ catch {
18
+ return "unknown";
19
+ }
20
+ }
21
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/shared/version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,CAAC;QACH,mFAAmF;QACnF,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC5E,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAyB,CAAC;QACxD,OAAO,GAAG,CAAC,OAAO,IAAI,SAAS,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,113 @@
1
+ {
2
+ "name": "procsi",
3
+ "version": "0.2.6",
4
+ "description": "Terminal HTTP interception toolkit",
5
+ "type": "module",
6
+ "main": "dist/cli/index.js",
7
+ "bin": {
8
+ "procsi": "dist/cli/index.js"
9
+ },
10
+ "exports": {
11
+ ".": "./dist/cli/index.js",
12
+ "./interceptors": {
13
+ "types": "./dist/interceptors.d.ts",
14
+ "default": "./dist/interceptors.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "skills"
20
+ ],
21
+ "agents": {
22
+ "skills": [
23
+ {
24
+ "name": "procsi",
25
+ "path": "./skills/procsi"
26
+ }
27
+ ]
28
+ },
29
+ "scripts": {
30
+ "build": "tsc",
31
+ "dev": "tsc --watch",
32
+ "start": "node dist/cli/index.js",
33
+ "test": "vitest run",
34
+ "test:watch": "vitest",
35
+ "test:unit": "vitest run --dir src",
36
+ "test:int": "vitest run --dir tests/integration",
37
+ "lint": "eslint src tests",
38
+ "lint:fix": "eslint src tests --fix",
39
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
40
+ "format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\"",
41
+ "typecheck": "tsc --noEmit",
42
+ "prepare": "husky"
43
+ },
44
+ "lint-staged": {
45
+ "*.ts": [
46
+ "eslint --fix",
47
+ "prettier --write"
48
+ ]
49
+ },
50
+ "keywords": [
51
+ "http",
52
+ "https",
53
+ "proxy",
54
+ "intercept",
55
+ "mitm",
56
+ "debugging",
57
+ "cli",
58
+ "tui",
59
+ "terminal"
60
+ ],
61
+ "author": "",
62
+ "license": "AGPL-3.0-or-later",
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "git+https://github.com/mtford90/procsi.git"
66
+ },
67
+ "bugs": {
68
+ "url": "https://github.com/mtford90/procsi/issues"
69
+ },
70
+ "homepage": "https://github.com/mtford90/procsi#readme",
71
+ "packageManager": "pnpm@10.13.1",
72
+ "engines": {
73
+ "node": ">=20"
74
+ },
75
+ "dependencies": {
76
+ "@ink-tools/ink-mouse": "^2.1.0",
77
+ "@modelcontextprotocol/sdk": "^1.26.0",
78
+ "better-sqlite3": "^12.6.2",
79
+ "cli-highlight": "^2.1.11",
80
+ "commander": "^14.0.3",
81
+ "global-agent": "^3.0.0",
82
+ "ink": "^6.6.0",
83
+ "ink-use-stdout-dimensions": "^1.0.5",
84
+ "jiti": "^2.6.1",
85
+ "mockttp": "^4.2.1",
86
+ "react": "^19.2.4",
87
+ "undici": "^7.21.0",
88
+ "uuid": "^13.0.0",
89
+ "zod": "^4.3.6"
90
+ },
91
+ "devDependencies": {
92
+ "@eslint/js": "^9.39.2",
93
+ "@types/better-sqlite3": "^7.6.13",
94
+ "@types/node": "^25.2.0",
95
+ "@types/react": "^19.2.10",
96
+ "@types/uuid": "^11.0.0",
97
+ "cli-testing-library": "^3.0.1",
98
+ "eslint": "^9.39.2",
99
+ "eslint-config-prettier": "^10.1.8",
100
+ "husky": "^9.1.7",
101
+ "ink-testing-library": "^4.0.0",
102
+ "lint-staged": "^16.2.7",
103
+ "prettier": "^3.8.1",
104
+ "typescript": "^5.9.3",
105
+ "typescript-eslint": "^8.54.0",
106
+ "vitest": "^4.0.18"
107
+ },
108
+ "pnpm": {
109
+ "onlyBuiltDependencies": [
110
+ "better-sqlite3"
111
+ ]
112
+ }
113
+ }
@@ -0,0 +1,228 @@
1
+ # /procsi
2
+
3
+ Use procsi to inspect, filter, and intercept HTTP traffic. Activate when procsi MCP tools are available or when the user mentions HTTP traffic, API debugging, request interception, or mocking.
4
+
5
+ ## Installation & Setup
6
+
7
+ If procsi is not installed or the daemon is not running, you can set it up:
8
+
9
+ 1. **Install**: `npm install -g procsi`
10
+ 2. **Shell setup** (one-time): Add `eval "$(procsi init)"` to the user's shell config (`~/.zshrc` or `~/.bashrc`), then source it or ask them to restart their shell
11
+ 3. **Start intercepting**: `eval "$(procsi vars)"` in the project directory (or `procsi on` if the shell wrapper is installed)
12
+ 4. **MCP config**: Add procsi to the MCP configuration:
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "procsi": {
17
+ "command": "procsi",
18
+ "args": ["mcp"]
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ After setup, call `procsi_get_status` to verify the daemon is running.
25
+
26
+ ## When to Use procsi
27
+
28
+ - **Debugging failing API calls** -- filter by status code, inspect headers and response bodies
29
+ - **Understanding traffic patterns** -- count requests, group by host/path/method
30
+ - **Writing mocks/interceptors** -- capture real traffic as a template, write TypeScript interceptors
31
+ - **Investigating auth issues** -- filter by `authorization` header, inspect tokens
32
+ - **Performance analysis** -- check response times (`durationMs`), body sizes
33
+
34
+ ## Preflight
35
+
36
+ Always call `procsi_get_status` first to confirm the daemon is running. If it is not running, try to start it by running `eval "$(procsi vars)"` in the project directory. If procsi is not installed, follow the Installation & Setup steps above.
37
+
38
+ ## MCP Tool Reference
39
+
40
+ | Tool | Purpose | Key Parameters |
41
+ |------|---------|----------------|
42
+ | `procsi_get_status` | Check daemon is running, get proxy port and request count | -- |
43
+ | `procsi_list_requests` | Browse/filter captured traffic (returns summaries) | `method`, `status_range`, `search`, `host`, `path`, `header_name`, `header_value`, `header_target`, `intercepted_by`, `since`, `before`, `limit`, `offset`, `format` |
44
+ | `procsi_get_request` | Full request details -- headers, bodies, timing | `id` (single or comma-separated IDs), `format` |
45
+ | `procsi_search_bodies` | Full-text search in request/response bodies | `query`, plus all filter params |
46
+ | `procsi_query_json` | Extract JSON values with JSONPath (SQLite `json_extract`) | `json_path`, `value`, `target` (`request`/`response`/`both`), plus filters |
47
+ | `procsi_count_requests` | Count matching requests | All filter params, `format` |
48
+ | `procsi_clear_requests` | Delete all captured traffic (irreversible) | -- |
49
+ | `procsi_list_sessions` | List active proxy sessions | -- |
50
+ | `procsi_list_interceptors` | List loaded interceptors with status/errors | `format` |
51
+ | `procsi_reload_interceptors` | Hot-reload interceptors from disk | `format` |
52
+
53
+ ### Output Formats
54
+
55
+ All query tools accept `format`:
56
+ - `"text"` (default) -- human-readable markdown summaries
57
+ - `"json"` -- structured JSON for programmatic processing
58
+
59
+ Use `"json"` when you need to process results (e.g. extract IDs, compare values). Use `"text"` when presenting to the user.
60
+
61
+ ## Common Filter Patterns
62
+
63
+ ```
64
+ status_range: "5xx" # Server errors
65
+ status_range: "4xx" # Client errors
66
+ status_range: "401" # Exact status code
67
+ status_range: "500-503" # Numeric range
68
+ method: "POST,PUT" # Mutation requests only
69
+ host: ".api.example.com" # Suffix match (note leading dot)
70
+ host: "api.example.com" # Exact match
71
+ path: "/api/v2" # Path prefix match
72
+ search: "api/users" # URL substring match
73
+ header_name: "authorization" # Requests with this header
74
+ header_name: "content-type", header_value: "application/json" # Exact header match
75
+ header_target: "request" # Only search request headers
76
+ intercepted_by: "my-mock" # Requests handled by a specific interceptor
77
+ since: "2024-01-15T10:30:00Z" # Time-bounded queries
78
+ ```
79
+
80
+ Filters can be combined freely. All are optional.
81
+
82
+ ## Workflow Patterns
83
+
84
+ ### Pattern 1: Investigate a Bug
85
+
86
+ 1. `procsi_list_requests` with relevant filters (status code, host, path) to find the request
87
+ 2. `procsi_get_request` with the ID to inspect full headers, bodies, timing
88
+ 3. If searching for specific content in bodies, use `procsi_search_bodies`
89
+
90
+ ### Pattern 2: Write a Mock Interceptor
91
+
92
+ 1. `procsi_list_requests` to understand the traffic pattern you want to mock
93
+ 2. `procsi_get_request` to capture a real response as a template
94
+ 3. Write a `.ts` file to `.procsi/interceptors/` (see interceptor patterns below)
95
+ 4. `procsi_reload_interceptors` to activate
96
+ 5. `procsi_list_interceptors` to verify it loaded without errors
97
+
98
+ ### Pattern 3: Analyse API Usage
99
+
100
+ 1. `procsi_count_requests` with various filters to understand volume
101
+ 2. `procsi_query_json` to extract specific values from JSON bodies
102
+ 3. `procsi_list_requests` with `format: "json"` for structured analysis
103
+
104
+ ### Pattern 4: Debug Auth Issues
105
+
106
+ 1. `procsi_list_requests` with `header_name: "authorization", header_target: "request"` to find authed requests
107
+ 2. `procsi_list_requests` with `status_range: "401"` to find failures
108
+ 3. `procsi_get_request` to compare auth headers between successful and failed requests
109
+
110
+ ## Writing Interceptors
111
+
112
+ Interceptor files are TypeScript files placed in `.procsi/interceptors/`. Each file exports a default `Interceptor` object.
113
+
114
+ ### Mock -- Return a Canned Response
115
+
116
+ ```typescript
117
+ import type { Interceptor } from "procsi/interceptors";
118
+
119
+ export default {
120
+ name: "mock-users",
121
+ match: (req) => req.path === "/api/users",
122
+ handler: async () => ({
123
+ status: 200,
124
+ headers: { "content-type": "application/json" },
125
+ body: JSON.stringify([{ id: 1, name: "Alice" }]),
126
+ }),
127
+ } satisfies Interceptor;
128
+ ```
129
+
130
+ Do not call `ctx.forward()` -- the request never reaches upstream. This is recorded as `interceptionType: "mocked"`.
131
+
132
+ ### Modify -- Forward, Then Alter the Response
133
+
134
+ ```typescript
135
+ import type { Interceptor } from "procsi/interceptors";
136
+
137
+ export default {
138
+ name: "inject-header",
139
+ match: (req) => req.host.includes("example.com"),
140
+ handler: async (ctx) => {
141
+ const response = await ctx.forward();
142
+ return { ...response, headers: { ...response.headers, "x-debug": "procsi" } };
143
+ },
144
+ } satisfies Interceptor;
145
+ ```
146
+
147
+ Calls `ctx.forward()` but returns a modified response. Recorded as `interceptionType: "modified"`.
148
+
149
+ ### Observe -- Log Without Altering
150
+
151
+ ```typescript
152
+ import type { Interceptor } from "procsi/interceptors";
153
+
154
+ export default {
155
+ name: "log-api",
156
+ match: (req) => req.path.startsWith("/api/"),
157
+ handler: async (ctx) => {
158
+ ctx.log(`${ctx.request.method} ${ctx.request.url}`);
159
+ const response = await ctx.forward();
160
+ ctx.log(` -> ${response.status}`);
161
+ return response;
162
+ },
163
+ } satisfies Interceptor;
164
+ ```
165
+
166
+ Calls `ctx.forward()` and returns the response unchanged. Useful for debugging.
167
+
168
+ ### InterceptorContext Properties
169
+
170
+ | Property | Type | Description |
171
+ |----------|------|-------------|
172
+ | `ctx.request` | `Readonly<InterceptorRequest>` | The incoming request (read-only) |
173
+ | `ctx.forward()` | `() => Promise<InterceptorResponse>` | Forward to upstream server, returns response |
174
+ | `ctx.log(msg)` | `(message: string) => void` | Write to `.procsi/procsi.log` (`console.log` is `/dev/null` in daemon) |
175
+ | `ctx.procsi` | `ProcsiClient` | Full query API (see below) |
176
+
177
+ ### InterceptorRequest Shape
178
+
179
+ | Property | Type |
180
+ |----------|------|
181
+ | `method` | `string` |
182
+ | `url` | `string` |
183
+ | `host` | `string` |
184
+ | `path` | `string` |
185
+ | `headers` | `Record<string, string>` |
186
+ | `body` | `Buffer \| undefined` |
187
+
188
+ ### InterceptorResponse Shape
189
+
190
+ | Property | Type |
191
+ |----------|------|
192
+ | `status` | `number` |
193
+ | `headers` | `Record<string, string> \| undefined` |
194
+ | `body` | `string \| Buffer \| undefined` |
195
+
196
+ ### ProcsiClient API (available as `ctx.procsi`)
197
+
198
+ ```typescript
199
+ ctx.procsi.countRequests(filter?) // Promise<number>
200
+ ctx.procsi.listRequests({ filter, limit, offset }) // Promise<CapturedRequestSummary[]>
201
+ ctx.procsi.getRequest(id) // Promise<CapturedRequest | null>
202
+ ctx.procsi.searchBodies({ query, filter, limit }) // Promise<CapturedRequestSummary[]>
203
+ ctx.procsi.queryJsonBodies({ jsonPath, filter }) // Promise<JsonQueryResult[]>
204
+ ```
205
+
206
+ This allows interceptors to make decisions based on previously captured traffic.
207
+
208
+ ### Interceptor Rules
209
+
210
+ - Any `.ts` file in `.procsi/interceptors/` is loaded as an interceptor
211
+ - Files are loaded alphabetically; **first matching interceptor wins**
212
+ - `match` is optional -- omit it to match all requests
213
+ - `name` is optional but strongly recommended (used in `intercepted_by` filter)
214
+ - Use `satisfies Interceptor` for full type checking and intellisense
215
+ - Handler timeout: 30 seconds. Match timeout: 5 seconds.
216
+ - Errors in handlers result in graceful pass-through -- never crashes the proxy
217
+ - `ctx.log()` writes to `.procsi/procsi.log` (since `console.log` goes nowhere in the daemon)
218
+ - Hot-reload on file changes, or run `procsi interceptors reload` / `procsi_reload_interceptors` / `procsi daemon restart`
219
+
220
+ ## Tips
221
+
222
+ - After writing an interceptor, always `procsi_reload_interceptors` then `procsi_list_interceptors` to verify it loaded without errors
223
+ - The `search` filter matches URL substrings -- useful for quick filtering when you do not know the exact host or path
224
+ - `procsi_query_json` uses SQLite `json_extract` syntax (e.g. `$.user.name`, `$.items[0].id`)
225
+ - Use `limit` and `offset` for pagination when there are many results (default limit: 50, max: 500)
226
+ - `procsi_get_request` accepts comma-separated IDs for batch fetching (e.g. `id: "id1,id2,id3"`)
227
+ - Host suffix matching requires a leading dot: `.example.com` matches `api.example.com` and `www.example.com`
228
+ - Time filters use ISO 8601 format: `since: "2024-01-15T10:30:00Z"`