clawsec 0.0.1

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 (361) hide show
  1. package/README.md +560 -0
  2. package/dist/bin/clawsec.d.ts +7 -0
  3. package/dist/bin/clawsec.d.ts.map +1 -0
  4. package/dist/bin/clawsec.js +12 -0
  5. package/dist/bin/clawsec.js.map +1 -0
  6. package/dist/src/actions/block.d.ts +22 -0
  7. package/dist/src/actions/block.d.ts.map +1 -0
  8. package/dist/src/actions/block.js +83 -0
  9. package/dist/src/actions/block.js.map +1 -0
  10. package/dist/src/actions/confirm.d.ts +35 -0
  11. package/dist/src/actions/confirm.d.ts.map +1 -0
  12. package/dist/src/actions/confirm.js +156 -0
  13. package/dist/src/actions/confirm.js.map +1 -0
  14. package/dist/src/actions/executor.d.ts +64 -0
  15. package/dist/src/actions/executor.d.ts.map +1 -0
  16. package/dist/src/actions/executor.js +114 -0
  17. package/dist/src/actions/executor.js.map +1 -0
  18. package/dist/src/actions/index.d.ts +13 -0
  19. package/dist/src/actions/index.d.ts.map +1 -0
  20. package/dist/src/actions/index.js +15 -0
  21. package/dist/src/actions/index.js.map +1 -0
  22. package/dist/src/actions/log.d.ts +19 -0
  23. package/dist/src/actions/log.d.ts.map +1 -0
  24. package/dist/src/actions/log.js +63 -0
  25. package/dist/src/actions/log.js.map +1 -0
  26. package/dist/src/actions/types.d.ts +85 -0
  27. package/dist/src/actions/types.d.ts.map +1 -0
  28. package/dist/src/actions/types.js +78 -0
  29. package/dist/src/actions/types.js.map +1 -0
  30. package/dist/src/actions/warn.d.ts +22 -0
  31. package/dist/src/actions/warn.d.ts.map +1 -0
  32. package/dist/src/actions/warn.js +84 -0
  33. package/dist/src/actions/warn.js.map +1 -0
  34. package/dist/src/approval/agent-confirm.d.ts +104 -0
  35. package/dist/src/approval/agent-confirm.d.ts.map +1 -0
  36. package/dist/src/approval/agent-confirm.js +173 -0
  37. package/dist/src/approval/agent-confirm.js.map +1 -0
  38. package/dist/src/approval/index.d.ts +14 -0
  39. package/dist/src/approval/index.d.ts.map +1 -0
  40. package/dist/src/approval/index.js +9 -0
  41. package/dist/src/approval/index.js.map +1 -0
  42. package/dist/src/approval/native.d.ts +56 -0
  43. package/dist/src/approval/native.d.ts.map +1 -0
  44. package/dist/src/approval/native.js +196 -0
  45. package/dist/src/approval/native.js.map +1 -0
  46. package/dist/src/approval/store.d.ts +88 -0
  47. package/dist/src/approval/store.d.ts.map +1 -0
  48. package/dist/src/approval/store.js +192 -0
  49. package/dist/src/approval/store.js.map +1 -0
  50. package/dist/src/approval/types.d.ts +119 -0
  51. package/dist/src/approval/types.d.ts.map +1 -0
  52. package/dist/src/approval/types.js +6 -0
  53. package/dist/src/approval/types.js.map +1 -0
  54. package/dist/src/approval/webhook.d.ts +170 -0
  55. package/dist/src/approval/webhook.d.ts.map +1 -0
  56. package/dist/src/approval/webhook.js +362 -0
  57. package/dist/src/approval/webhook.js.map +1 -0
  58. package/dist/src/cli/commands/audit.d.ts +43 -0
  59. package/dist/src/cli/commands/audit.d.ts.map +1 -0
  60. package/dist/src/cli/commands/audit.js +115 -0
  61. package/dist/src/cli/commands/audit.js.map +1 -0
  62. package/dist/src/cli/commands/feedback.d.ts +27 -0
  63. package/dist/src/cli/commands/feedback.d.ts.map +1 -0
  64. package/dist/src/cli/commands/feedback.js +228 -0
  65. package/dist/src/cli/commands/feedback.js.map +1 -0
  66. package/dist/src/cli/commands/index.d.ts +11 -0
  67. package/dist/src/cli/commands/index.d.ts.map +1 -0
  68. package/dist/src/cli/commands/index.js +13 -0
  69. package/dist/src/cli/commands/index.js.map +1 -0
  70. package/dist/src/cli/commands/status.d.ts +20 -0
  71. package/dist/src/cli/commands/status.d.ts.map +1 -0
  72. package/dist/src/cli/commands/status.js +122 -0
  73. package/dist/src/cli/commands/status.js.map +1 -0
  74. package/dist/src/cli/commands/test.d.ts +23 -0
  75. package/dist/src/cli/commands/test.d.ts.map +1 -0
  76. package/dist/src/cli/commands/test.js +134 -0
  77. package/dist/src/cli/commands/test.js.map +1 -0
  78. package/dist/src/cli/commands/types.d.ts +81 -0
  79. package/dist/src/cli/commands/types.d.ts.map +1 -0
  80. package/dist/src/cli/commands/types.js +6 -0
  81. package/dist/src/cli/commands/types.js.map +1 -0
  82. package/dist/src/cli/index.d.ts +17 -0
  83. package/dist/src/cli/index.d.ts.map +1 -0
  84. package/dist/src/cli/index.js +267 -0
  85. package/dist/src/cli/index.js.map +1 -0
  86. package/dist/src/config/defaults.d.ts +20 -0
  87. package/dist/src/config/defaults.d.ts.map +1 -0
  88. package/dist/src/config/defaults.js +123 -0
  89. package/dist/src/config/defaults.js.map +1 -0
  90. package/dist/src/config/index.d.ts +8 -0
  91. package/dist/src/config/index.d.ts.map +1 -0
  92. package/dist/src/config/index.js +41 -0
  93. package/dist/src/config/index.js.map +1 -0
  94. package/dist/src/config/loader.d.ts +99 -0
  95. package/dist/src/config/loader.d.ts.map +1 -0
  96. package/dist/src/config/loader.js +242 -0
  97. package/dist/src/config/loader.js.map +1 -0
  98. package/dist/src/config/schema.d.ts +627 -0
  99. package/dist/src/config/schema.d.ts.map +1 -0
  100. package/dist/src/config/schema.js +585 -0
  101. package/dist/src/config/schema.js.map +1 -0
  102. package/dist/src/detectors/destructive/cloud-detector.d.ts +51 -0
  103. package/dist/src/detectors/destructive/cloud-detector.d.ts.map +1 -0
  104. package/dist/src/detectors/destructive/cloud-detector.js +556 -0
  105. package/dist/src/detectors/destructive/cloud-detector.js.map +1 -0
  106. package/dist/src/detectors/destructive/code-detector.d.ts +59 -0
  107. package/dist/src/detectors/destructive/code-detector.d.ts.map +1 -0
  108. package/dist/src/detectors/destructive/code-detector.js +558 -0
  109. package/dist/src/detectors/destructive/code-detector.js.map +1 -0
  110. package/dist/src/detectors/destructive/index.d.ts +54 -0
  111. package/dist/src/detectors/destructive/index.d.ts.map +1 -0
  112. package/dist/src/detectors/destructive/index.js +168 -0
  113. package/dist/src/detectors/destructive/index.js.map +1 -0
  114. package/dist/src/detectors/destructive/shell-detector.d.ts +43 -0
  115. package/dist/src/detectors/destructive/shell-detector.d.ts.map +1 -0
  116. package/dist/src/detectors/destructive/shell-detector.js +302 -0
  117. package/dist/src/detectors/destructive/shell-detector.js.map +1 -0
  118. package/dist/src/detectors/destructive/types.d.ts +143 -0
  119. package/dist/src/detectors/destructive/types.d.ts.map +1 -0
  120. package/dist/src/detectors/destructive/types.js +6 -0
  121. package/dist/src/detectors/destructive/types.js.map +1 -0
  122. package/dist/src/detectors/exfiltration/cloud-detector.d.ts +51 -0
  123. package/dist/src/detectors/exfiltration/cloud-detector.d.ts.map +1 -0
  124. package/dist/src/detectors/exfiltration/cloud-detector.js +427 -0
  125. package/dist/src/detectors/exfiltration/cloud-detector.js.map +1 -0
  126. package/dist/src/detectors/exfiltration/http-detector.d.ts +47 -0
  127. package/dist/src/detectors/exfiltration/http-detector.d.ts.map +1 -0
  128. package/dist/src/detectors/exfiltration/http-detector.js +429 -0
  129. package/dist/src/detectors/exfiltration/http-detector.js.map +1 -0
  130. package/dist/src/detectors/exfiltration/index.d.ts +44 -0
  131. package/dist/src/detectors/exfiltration/index.d.ts.map +1 -0
  132. package/dist/src/detectors/exfiltration/index.js +118 -0
  133. package/dist/src/detectors/exfiltration/index.js.map +1 -0
  134. package/dist/src/detectors/exfiltration/network-detector.d.ts +55 -0
  135. package/dist/src/detectors/exfiltration/network-detector.d.ts.map +1 -0
  136. package/dist/src/detectors/exfiltration/network-detector.js +504 -0
  137. package/dist/src/detectors/exfiltration/network-detector.js.map +1 -0
  138. package/dist/src/detectors/exfiltration/types.d.ts +139 -0
  139. package/dist/src/detectors/exfiltration/types.d.ts.map +1 -0
  140. package/dist/src/detectors/exfiltration/types.js +6 -0
  141. package/dist/src/detectors/exfiltration/types.js.map +1 -0
  142. package/dist/src/detectors/purchase/domain-detector.d.ts +44 -0
  143. package/dist/src/detectors/purchase/domain-detector.d.ts.map +1 -0
  144. package/dist/src/detectors/purchase/domain-detector.js +296 -0
  145. package/dist/src/detectors/purchase/domain-detector.js.map +1 -0
  146. package/dist/src/detectors/purchase/form-detector.d.ts +27 -0
  147. package/dist/src/detectors/purchase/form-detector.d.ts.map +1 -0
  148. package/dist/src/detectors/purchase/form-detector.js +344 -0
  149. package/dist/src/detectors/purchase/form-detector.js.map +1 -0
  150. package/dist/src/detectors/purchase/index.d.ts +65 -0
  151. package/dist/src/detectors/purchase/index.d.ts.map +1 -0
  152. package/dist/src/detectors/purchase/index.js +216 -0
  153. package/dist/src/detectors/purchase/index.js.map +1 -0
  154. package/dist/src/detectors/purchase/spend-tracker.d.ts +132 -0
  155. package/dist/src/detectors/purchase/spend-tracker.d.ts.map +1 -0
  156. package/dist/src/detectors/purchase/spend-tracker.js +313 -0
  157. package/dist/src/detectors/purchase/spend-tracker.js.map +1 -0
  158. package/dist/src/detectors/purchase/types.d.ts +139 -0
  159. package/dist/src/detectors/purchase/types.d.ts.map +1 -0
  160. package/dist/src/detectors/purchase/types.js +6 -0
  161. package/dist/src/detectors/purchase/types.js.map +1 -0
  162. package/dist/src/detectors/purchase/url-detector.d.ts +31 -0
  163. package/dist/src/detectors/purchase/url-detector.d.ts.map +1 -0
  164. package/dist/src/detectors/purchase/url-detector.js +292 -0
  165. package/dist/src/detectors/purchase/url-detector.js.map +1 -0
  166. package/dist/src/detectors/secrets/api-key-detector.d.ts +30 -0
  167. package/dist/src/detectors/secrets/api-key-detector.d.ts.map +1 -0
  168. package/dist/src/detectors/secrets/api-key-detector.js +297 -0
  169. package/dist/src/detectors/secrets/api-key-detector.js.map +1 -0
  170. package/dist/src/detectors/secrets/index.d.ts +43 -0
  171. package/dist/src/detectors/secrets/index.d.ts.map +1 -0
  172. package/dist/src/detectors/secrets/index.js +261 -0
  173. package/dist/src/detectors/secrets/index.js.map +1 -0
  174. package/dist/src/detectors/secrets/pii-detector.d.ts +54 -0
  175. package/dist/src/detectors/secrets/pii-detector.d.ts.map +1 -0
  176. package/dist/src/detectors/secrets/pii-detector.js +286 -0
  177. package/dist/src/detectors/secrets/pii-detector.js.map +1 -0
  178. package/dist/src/detectors/secrets/token-detector.d.ts +51 -0
  179. package/dist/src/detectors/secrets/token-detector.d.ts.map +1 -0
  180. package/dist/src/detectors/secrets/token-detector.js +233 -0
  181. package/dist/src/detectors/secrets/token-detector.js.map +1 -0
  182. package/dist/src/detectors/secrets/types.d.ts +157 -0
  183. package/dist/src/detectors/secrets/types.d.ts.map +1 -0
  184. package/dist/src/detectors/secrets/types.js +6 -0
  185. package/dist/src/detectors/secrets/types.js.map +1 -0
  186. package/dist/src/detectors/website/category-detector.d.ts +22 -0
  187. package/dist/src/detectors/website/category-detector.d.ts.map +1 -0
  188. package/dist/src/detectors/website/category-detector.js +162 -0
  189. package/dist/src/detectors/website/category-detector.js.map +1 -0
  190. package/dist/src/detectors/website/index.d.ts +53 -0
  191. package/dist/src/detectors/website/index.d.ts.map +1 -0
  192. package/dist/src/detectors/website/index.js +232 -0
  193. package/dist/src/detectors/website/index.js.map +1 -0
  194. package/dist/src/detectors/website/pattern-matcher.d.ts +33 -0
  195. package/dist/src/detectors/website/pattern-matcher.d.ts.map +1 -0
  196. package/dist/src/detectors/website/pattern-matcher.js +121 -0
  197. package/dist/src/detectors/website/pattern-matcher.js.map +1 -0
  198. package/dist/src/detectors/website/types.d.ts +105 -0
  199. package/dist/src/detectors/website/types.d.ts.map +1 -0
  200. package/dist/src/detectors/website/types.js +6 -0
  201. package/dist/src/detectors/website/types.js.map +1 -0
  202. package/dist/src/engine/analyzer.d.ts +87 -0
  203. package/dist/src/engine/analyzer.d.ts.map +1 -0
  204. package/dist/src/engine/analyzer.js +427 -0
  205. package/dist/src/engine/analyzer.js.map +1 -0
  206. package/dist/src/engine/cache.d.ts +80 -0
  207. package/dist/src/engine/cache.d.ts.map +1 -0
  208. package/dist/src/engine/cache.js +167 -0
  209. package/dist/src/engine/cache.js.map +1 -0
  210. package/dist/src/engine/index.d.ts +11 -0
  211. package/dist/src/engine/index.d.ts.map +1 -0
  212. package/dist/src/engine/index.js +11 -0
  213. package/dist/src/engine/index.js.map +1 -0
  214. package/dist/src/engine/llm-client.d.ts +210 -0
  215. package/dist/src/engine/llm-client.d.ts.map +1 -0
  216. package/dist/src/engine/llm-client.js +506 -0
  217. package/dist/src/engine/llm-client.js.map +1 -0
  218. package/dist/src/engine/types.d.ts +163 -0
  219. package/dist/src/engine/types.d.ts.map +1 -0
  220. package/dist/src/engine/types.js +21 -0
  221. package/dist/src/engine/types.js.map +1 -0
  222. package/dist/src/feedback/index.d.ts +9 -0
  223. package/dist/src/feedback/index.d.ts.map +1 -0
  224. package/dist/src/feedback/index.js +8 -0
  225. package/dist/src/feedback/index.js.map +1 -0
  226. package/dist/src/feedback/learner.d.ts +222 -0
  227. package/dist/src/feedback/learner.d.ts.map +1 -0
  228. package/dist/src/feedback/learner.js +401 -0
  229. package/dist/src/feedback/learner.js.map +1 -0
  230. package/dist/src/feedback/store.d.ts +113 -0
  231. package/dist/src/feedback/store.d.ts.map +1 -0
  232. package/dist/src/feedback/store.js +228 -0
  233. package/dist/src/feedback/store.js.map +1 -0
  234. package/dist/src/feedback/types.d.ts +126 -0
  235. package/dist/src/feedback/types.d.ts.map +1 -0
  236. package/dist/src/feedback/types.js +6 -0
  237. package/dist/src/feedback/types.js.map +1 -0
  238. package/dist/src/hooks/before-agent-start/handler.d.ts +37 -0
  239. package/dist/src/hooks/before-agent-start/handler.d.ts.map +1 -0
  240. package/dist/src/hooks/before-agent-start/handler.js +109 -0
  241. package/dist/src/hooks/before-agent-start/handler.js.map +1 -0
  242. package/dist/src/hooks/before-agent-start/index.d.ts +8 -0
  243. package/dist/src/hooks/before-agent-start/index.d.ts.map +1 -0
  244. package/dist/src/hooks/before-agent-start/index.js +7 -0
  245. package/dist/src/hooks/before-agent-start/index.js.map +1 -0
  246. package/dist/src/hooks/before-agent-start/prompts.d.ts +48 -0
  247. package/dist/src/hooks/before-agent-start/prompts.d.ts.map +1 -0
  248. package/dist/src/hooks/before-agent-start/prompts.js +103 -0
  249. package/dist/src/hooks/before-agent-start/prompts.js.map +1 -0
  250. package/dist/src/hooks/before-tool-call/handler.d.ts +42 -0
  251. package/dist/src/hooks/before-tool-call/handler.d.ts.map +1 -0
  252. package/dist/src/hooks/before-tool-call/handler.js +226 -0
  253. package/dist/src/hooks/before-tool-call/handler.js.map +1 -0
  254. package/dist/src/hooks/before-tool-call/index.d.ts +7 -0
  255. package/dist/src/hooks/before-tool-call/index.d.ts.map +1 -0
  256. package/dist/src/hooks/before-tool-call/index.js +6 -0
  257. package/dist/src/hooks/before-tool-call/index.js.map +1 -0
  258. package/dist/src/hooks/tool-result-persist/filter.d.ts +72 -0
  259. package/dist/src/hooks/tool-result-persist/filter.d.ts.map +1 -0
  260. package/dist/src/hooks/tool-result-persist/filter.js +305 -0
  261. package/dist/src/hooks/tool-result-persist/filter.js.map +1 -0
  262. package/dist/src/hooks/tool-result-persist/handler.d.ts +49 -0
  263. package/dist/src/hooks/tool-result-persist/handler.d.ts.map +1 -0
  264. package/dist/src/hooks/tool-result-persist/handler.js +217 -0
  265. package/dist/src/hooks/tool-result-persist/handler.js.map +1 -0
  266. package/dist/src/hooks/tool-result-persist/index.d.ts +11 -0
  267. package/dist/src/hooks/tool-result-persist/index.d.ts.map +1 -0
  268. package/dist/src/hooks/tool-result-persist/index.js +11 -0
  269. package/dist/src/hooks/tool-result-persist/index.js.map +1 -0
  270. package/dist/src/index.d.ts +256 -0
  271. package/dist/src/index.d.ts.map +1 -0
  272. package/dist/src/index.js +222 -0
  273. package/dist/src/index.js.map +1 -0
  274. package/dist/src/notifications/discord.d.ts +10 -0
  275. package/dist/src/notifications/discord.d.ts.map +1 -0
  276. package/dist/src/notifications/discord.js +218 -0
  277. package/dist/src/notifications/discord.js.map +1 -0
  278. package/dist/src/notifications/index.d.ts +37 -0
  279. package/dist/src/notifications/index.d.ts.map +1 -0
  280. package/dist/src/notifications/index.js +68 -0
  281. package/dist/src/notifications/index.js.map +1 -0
  282. package/dist/src/notifications/slack.d.ts +10 -0
  283. package/dist/src/notifications/slack.d.ts.map +1 -0
  284. package/dist/src/notifications/slack.js +218 -0
  285. package/dist/src/notifications/slack.js.map +1 -0
  286. package/dist/src/notifications/telegram.d.ts +10 -0
  287. package/dist/src/notifications/telegram.d.ts.map +1 -0
  288. package/dist/src/notifications/telegram.js +242 -0
  289. package/dist/src/notifications/telegram.js.map +1 -0
  290. package/dist/src/notifications/types.d.ts +119 -0
  291. package/dist/src/notifications/types.d.ts.map +1 -0
  292. package/dist/src/notifications/types.js +6 -0
  293. package/dist/src/notifications/types.js.map +1 -0
  294. package/dist/src/proxy/index.d.ts +8 -0
  295. package/dist/src/proxy/index.d.ts.map +1 -0
  296. package/dist/src/proxy/index.js +9 -0
  297. package/dist/src/proxy/index.js.map +1 -0
  298. package/dist/src/proxy/middleware.d.ts +55 -0
  299. package/dist/src/proxy/middleware.d.ts.map +1 -0
  300. package/dist/src/proxy/middleware.js +215 -0
  301. package/dist/src/proxy/middleware.js.map +1 -0
  302. package/dist/src/proxy/server.d.ts +57 -0
  303. package/dist/src/proxy/server.d.ts.map +1 -0
  304. package/dist/src/proxy/server.js +298 -0
  305. package/dist/src/proxy/server.js.map +1 -0
  306. package/dist/src/proxy/types.d.ts +136 -0
  307. package/dist/src/proxy/types.d.ts.map +1 -0
  308. package/dist/src/proxy/types.js +6 -0
  309. package/dist/src/proxy/types.js.map +1 -0
  310. package/dist/src/sanitization/index.d.ts +10 -0
  311. package/dist/src/sanitization/index.d.ts.map +1 -0
  312. package/dist/src/sanitization/index.js +9 -0
  313. package/dist/src/sanitization/index.js.map +1 -0
  314. package/dist/src/sanitization/patterns.d.ts +51 -0
  315. package/dist/src/sanitization/patterns.d.ts.map +1 -0
  316. package/dist/src/sanitization/patterns.js +266 -0
  317. package/dist/src/sanitization/patterns.js.map +1 -0
  318. package/dist/src/sanitization/scanner.d.ts +29 -0
  319. package/dist/src/sanitization/scanner.d.ts.map +1 -0
  320. package/dist/src/sanitization/scanner.js +328 -0
  321. package/dist/src/sanitization/scanner.js.map +1 -0
  322. package/dist/src/sanitization/types.d.ts +57 -0
  323. package/dist/src/sanitization/types.d.ts.map +1 -0
  324. package/dist/src/sanitization/types.js +5 -0
  325. package/dist/src/sanitization/types.js.map +1 -0
  326. package/openclaw.plugin.json +114 -0
  327. package/package.json +63 -0
  328. package/rules/builtin/README.md +139 -0
  329. package/rules/builtin/ai-services.yaml +70 -0
  330. package/rules/builtin/api-keys.yaml +64 -0
  331. package/rules/builtin/authentication.yaml +56 -0
  332. package/rules/builtin/aws-security.yaml +57 -0
  333. package/rules/builtin/azure-security.yaml +58 -0
  334. package/rules/builtin/cicd-security.yaml +64 -0
  335. package/rules/builtin/cloud-storage.yaml +64 -0
  336. package/rules/builtin/container-registry.yaml +55 -0
  337. package/rules/builtin/crypto-wallets.yaml +71 -0
  338. package/rules/builtin/database-nosql.yaml +58 -0
  339. package/rules/builtin/database-sql.yaml +62 -0
  340. package/rules/builtin/development-env.yaml +67 -0
  341. package/rules/builtin/docker.yaml +57 -0
  342. package/rules/builtin/filesystem.yaml +71 -0
  343. package/rules/builtin/financial-pci.yaml +61 -0
  344. package/rules/builtin/gcp-security.yaml +57 -0
  345. package/rules/builtin/git-operations.yaml +68 -0
  346. package/rules/builtin/healthcare-hipaa.yaml +64 -0
  347. package/rules/builtin/kubernetes.yaml +60 -0
  348. package/rules/builtin/messaging-services.yaml +53 -0
  349. package/rules/builtin/minimal.yaml +47 -0
  350. package/rules/builtin/mobile-development.yaml +61 -0
  351. package/rules/builtin/monitoring.yaml +63 -0
  352. package/rules/builtin/network-security.yaml +57 -0
  353. package/rules/builtin/package-managers.yaml +74 -0
  354. package/rules/builtin/payment-processing.yaml +66 -0
  355. package/rules/builtin/pii-protection.yaml +48 -0
  356. package/rules/builtin/production-strict.yaml +55 -0
  357. package/rules/builtin/secrets-management.yaml +63 -0
  358. package/rules/builtin/serverless.yaml +74 -0
  359. package/rules/builtin/ssh-security.yaml +66 -0
  360. package/rules/builtin/terraform.yaml +51 -0
  361. package/rules/builtin/web-security.yaml +62 -0
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Audit Command
3
+ * View and manage the audit log of detections
4
+ */
5
+ /**
6
+ * In-memory audit log storage
7
+ * In a production system, this would be persisted to disk or a database
8
+ */
9
+ const auditLog = [];
10
+ /**
11
+ * Add an entry to the audit log
12
+ *
13
+ * @param entry - The audit entry to add
14
+ */
15
+ export function addAuditEntry(entry) {
16
+ auditLog.push({
17
+ ...entry,
18
+ timestamp: new Date(),
19
+ });
20
+ }
21
+ /**
22
+ * Clear all audit log entries
23
+ * Primarily used for testing
24
+ */
25
+ export function clearAuditLog() {
26
+ auditLog.length = 0;
27
+ }
28
+ /**
29
+ * Get the raw audit log (for testing)
30
+ */
31
+ export function getAuditLog() {
32
+ return auditLog;
33
+ }
34
+ /**
35
+ * Execute the audit command
36
+ *
37
+ * @param options - Audit options for filtering and limiting results
38
+ * @returns Audit result with filtered entries
39
+ */
40
+ export async function auditCommand(options = {}) {
41
+ let entries = [...auditLog];
42
+ // Filter by category if specified
43
+ if (options.category) {
44
+ entries = entries.filter(entry => entry.category === options.category);
45
+ }
46
+ // Sort by timestamp (newest first)
47
+ entries.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime());
48
+ // Apply limit if specified
49
+ const limit = options.limit ?? 10;
50
+ const limitedEntries = entries.slice(0, limit);
51
+ return {
52
+ entries: limitedEntries,
53
+ totalEntries: auditLog.length,
54
+ };
55
+ }
56
+ /**
57
+ * Format a single audit entry for display
58
+ */
59
+ function formatEntry(entry, index) {
60
+ const timestamp = entry.timestamp.toISOString().replace('T', ' ').substring(0, 19);
61
+ const severityColors = {
62
+ critical: 'CRITICAL',
63
+ high: 'HIGH',
64
+ medium: 'MEDIUM',
65
+ low: 'LOW',
66
+ };
67
+ const lines = [];
68
+ lines.push(`[${index + 1}] ${timestamp}`);
69
+ lines.push(` Tool: ${entry.toolName}`);
70
+ lines.push(` Category: ${entry.category} | Severity: ${severityColors[entry.severity]} | Action: ${entry.action}`);
71
+ lines.push(` Reason: ${entry.reason}`);
72
+ return lines.join('\n');
73
+ }
74
+ /**
75
+ * Format audit result for console output
76
+ *
77
+ * @param result - Audit result to format
78
+ * @param options - The options used for the query
79
+ * @returns Formatted string for display
80
+ */
81
+ export function formatAuditResult(result, options = {}) {
82
+ const lines = [];
83
+ lines.push('=== Audit Log ===');
84
+ lines.push('');
85
+ if (options.category) {
86
+ lines.push(`Filter: category=${options.category}`);
87
+ }
88
+ lines.push(`Showing ${result.entries.length} of ${result.totalEntries} entries`);
89
+ lines.push('');
90
+ if (result.entries.length === 0) {
91
+ lines.push('No audit entries found.');
92
+ }
93
+ else {
94
+ for (let i = 0; i < result.entries.length; i++) {
95
+ lines.push(formatEntry(result.entries[i], i));
96
+ lines.push('');
97
+ }
98
+ }
99
+ return lines.join('\n');
100
+ }
101
+ /**
102
+ * Helper function to create an audit entry from detection data
103
+ * This is used by the action handlers to log detections
104
+ */
105
+ export function createAuditEntry(toolName, category, severity, action, reason, metadata) {
106
+ addAuditEntry({
107
+ toolName,
108
+ category,
109
+ severity,
110
+ action,
111
+ reason,
112
+ metadata,
113
+ });
114
+ }
115
+ //# sourceMappingURL=audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../../src/cli/commands/audit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,MAAM,QAAQ,GAAiB,EAAE,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAoC;IAChE,QAAQ,CAAC,IAAI,CAAC;QACZ,GAAG,KAAK;QACR,SAAS,EAAE,IAAI,IAAI,EAAE;KACtB,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,QAAQ,CAAC;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C,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAgB,EAChB,QAAwB,EACxB,QAAkB,EAClB,MAAc,EACd,MAAc,EACd,QAAkC;IAElC,aAAa,CAAC;QACZ,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,MAAM;QACN,MAAM;QACN,QAAQ;KACT,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Feedback Command
3
+ * CLI command for submitting and viewing user feedback on detection accuracy
4
+ */
5
+ import type { FeedbackEntry, FeedbackOptions, FeedbackResult } from '../../feedback/index.js';
6
+ import { FileFeedbackStore } from '../../feedback/index.js';
7
+ /**
8
+ * Execute the feedback command
9
+ *
10
+ * @param options - Feedback command options
11
+ * @param store - Optional feedback store (for testing)
12
+ * @returns Result of the feedback operation
13
+ */
14
+ export declare function feedbackCommand(options: FeedbackOptions, store?: FileFeedbackStore): Promise<FeedbackResult>;
15
+ /**
16
+ * Format feedback result for console output
17
+ *
18
+ * @param result - The feedback result to format
19
+ * @param detailed - Whether to include full details
20
+ * @returns Formatted string for display
21
+ */
22
+ export declare function formatFeedbackResult(result: FeedbackResult, detailed?: boolean): string;
23
+ /**
24
+ * Format a brief summary of a feedback entry for list display
25
+ */
26
+ export declare function formatFeedbackSummary(entry: FeedbackEntry): string;
27
+ //# sourceMappingURL=feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/feedback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAoB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAc9E;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,eAAe,EACxB,KAAK,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,cAAc,CAAC,CAiCzB;AA0ID;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,UAAQ,GAAG,MAAM,CAwCrF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAalE"}
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Feedback Command
3
+ * CLI command for submitting and viewing user feedback on detection accuracy
4
+ */
5
+ import { getFeedbackStore } from '../../feedback/index.js';
6
+ import { getAuditLog } from './audit.js';
7
+ /**
8
+ * Valid threat categories for validation
9
+ */
10
+ const VALID_CATEGORIES = [
11
+ 'purchase',
12
+ 'website',
13
+ 'destructive',
14
+ 'secrets',
15
+ 'exfiltration',
16
+ ];
17
+ /**
18
+ * Execute the feedback command
19
+ *
20
+ * @param options - Feedback command options
21
+ * @param store - Optional feedback store (for testing)
22
+ * @returns Result of the feedback operation
23
+ */
24
+ export async function feedbackCommand(options, store) {
25
+ const feedbackStore = store ?? getFeedbackStore();
26
+ // Ensure store is loaded
27
+ if (!feedbackStore.isLoaded()) {
28
+ await feedbackStore.load();
29
+ }
30
+ // Handle list operation
31
+ if (options.list) {
32
+ return handleList(feedbackStore, options.type);
33
+ }
34
+ // Handle show operation
35
+ if (options.show) {
36
+ return handleShow(feedbackStore, options.show);
37
+ }
38
+ // Handle false positive submission
39
+ if (options.falsePositive) {
40
+ return handleFalsePositive(feedbackStore, options.falsePositive);
41
+ }
42
+ // Handle false negative submission
43
+ if (options.falseNegative) {
44
+ return handleFalseNegative(feedbackStore, options.falseNegative, options.category);
45
+ }
46
+ // No valid operation specified
47
+ return {
48
+ success: false,
49
+ message: 'No operation specified. Use --list, --show, --false-positive, or --false-negative.',
50
+ };
51
+ }
52
+ /**
53
+ * Handle listing feedback entries
54
+ */
55
+ function handleList(store, type) {
56
+ const entries = type ? store.getByType(type) : store.getAll();
57
+ return {
58
+ success: true,
59
+ message: `Found ${entries.length} feedback ${entries.length === 1 ? 'entry' : 'entries'}`,
60
+ entries,
61
+ };
62
+ }
63
+ /**
64
+ * Handle showing a specific feedback entry
65
+ */
66
+ function handleShow(store, id) {
67
+ const entry = store.get(id);
68
+ if (!entry) {
69
+ return {
70
+ success: false,
71
+ message: `Feedback entry not found: ${id}`,
72
+ };
73
+ }
74
+ return {
75
+ success: true,
76
+ message: 'Feedback entry found',
77
+ entry,
78
+ };
79
+ }
80
+ /**
81
+ * Handle false positive submission
82
+ */
83
+ function handleFalsePositive(store, detectionId) {
84
+ // Try to find the detection in the audit log
85
+ const auditLog = getAuditLog();
86
+ const auditEntry = auditLog.find((entry, index) => {
87
+ // Match by index (1-based for user display) or partial timestamp match
88
+ const indexId = `${index + 1}`;
89
+ return indexId === detectionId ||
90
+ entry.timestamp.toISOString().includes(detectionId);
91
+ });
92
+ const entry = store.add({
93
+ type: 'false-positive',
94
+ detectionId,
95
+ detection: auditEntry ? {
96
+ category: auditEntry.category,
97
+ severity: auditEntry.severity,
98
+ reason: auditEntry.reason,
99
+ toolName: auditEntry.toolName,
100
+ toolInput: auditEntry.metadata ?? {},
101
+ } : undefined,
102
+ });
103
+ return {
104
+ success: true,
105
+ message: auditEntry
106
+ ? `False positive reported for detection: ${auditEntry.category} (${auditEntry.reason})`
107
+ : `False positive reported with ID: ${detectionId}`,
108
+ entry,
109
+ };
110
+ }
111
+ /**
112
+ * Handle false negative submission
113
+ */
114
+ function handleFalseNegative(store, description, category) {
115
+ // Validate category if provided
116
+ if (category && !VALID_CATEGORIES.includes(category)) {
117
+ return {
118
+ success: false,
119
+ message: `Invalid category: ${category}. Valid categories: ${VALID_CATEGORIES.join(', ')}`,
120
+ };
121
+ }
122
+ const entry = store.add({
123
+ type: 'false-negative',
124
+ description,
125
+ suggestedCategory: category,
126
+ });
127
+ return {
128
+ success: true,
129
+ message: category
130
+ ? `False negative reported in category "${category}": ${description}`
131
+ : `False negative reported: ${description}`,
132
+ entry,
133
+ };
134
+ }
135
+ /**
136
+ * Format a single feedback entry for display
137
+ */
138
+ function formatEntry(entry, detailed = false) {
139
+ const lines = [];
140
+ const date = new Date(entry.timestamp);
141
+ const dateStr = date.toISOString().replace('T', ' ').substring(0, 19);
142
+ lines.push(`ID: ${entry.id}`);
143
+ lines.push(`Type: ${entry.type}`);
144
+ lines.push(`Status: ${entry.status}`);
145
+ lines.push(`Date: ${dateStr}`);
146
+ if (entry.type === 'false-positive') {
147
+ lines.push(`Detection ID: ${entry.detectionId ?? '(not specified)'}`);
148
+ if (entry.detection) {
149
+ lines.push(`Category: ${entry.detection.category}`);
150
+ lines.push(`Severity: ${entry.detection.severity}`);
151
+ lines.push(`Reason: ${entry.detection.reason}`);
152
+ if (detailed) {
153
+ lines.push(`Tool: ${entry.detection.toolName}`);
154
+ lines.push(`Input: ${JSON.stringify(entry.detection.toolInput, null, 2)}`);
155
+ }
156
+ }
157
+ }
158
+ else {
159
+ lines.push(`Description: ${entry.description ?? '(none)'}`);
160
+ if (entry.suggestedCategory) {
161
+ lines.push(`Suggested Category: ${entry.suggestedCategory}`);
162
+ }
163
+ }
164
+ if (entry.notes) {
165
+ lines.push(`Notes: ${entry.notes}`);
166
+ }
167
+ return lines.join('\n');
168
+ }
169
+ /**
170
+ * Format feedback result for console output
171
+ *
172
+ * @param result - The feedback result to format
173
+ * @param detailed - Whether to include full details
174
+ * @returns Formatted string for display
175
+ */
176
+ export function formatFeedbackResult(result, detailed = false) {
177
+ const lines = [];
178
+ lines.push('=== Feedback ===');
179
+ lines.push('');
180
+ if (!result.success) {
181
+ lines.push(`Error: ${result.message}`);
182
+ return lines.join('\n');
183
+ }
184
+ // Single entry (add or show)
185
+ if (result.entry) {
186
+ lines.push(result.message);
187
+ lines.push('');
188
+ lines.push(formatEntry(result.entry, detailed));
189
+ return lines.join('\n');
190
+ }
191
+ // List of entries
192
+ if (result.entries !== undefined) {
193
+ lines.push(result.message);
194
+ lines.push('');
195
+ if (result.entries.length === 0) {
196
+ lines.push('No feedback entries found.');
197
+ }
198
+ else {
199
+ for (const entry of result.entries) {
200
+ lines.push('---');
201
+ lines.push(formatEntry(entry, detailed));
202
+ lines.push('');
203
+ }
204
+ }
205
+ return lines.join('\n');
206
+ }
207
+ // Generic success message
208
+ lines.push(result.message);
209
+ return lines.join('\n');
210
+ }
211
+ /**
212
+ * Format a brief summary of a feedback entry for list display
213
+ */
214
+ export function formatFeedbackSummary(entry) {
215
+ const date = new Date(entry.timestamp);
216
+ const dateStr = date.toISOString().substring(0, 10);
217
+ const shortId = entry.id.substring(0, 8);
218
+ if (entry.type === 'false-positive') {
219
+ const category = entry.detection?.category ?? 'unknown';
220
+ return `[${shortId}] ${dateStr} FP: ${category} - ${entry.detection?.reason ?? entry.detectionId}`;
221
+ }
222
+ else {
223
+ const desc = entry.description ?? '(no description)';
224
+ const truncated = desc.length > 50 ? desc.substring(0, 47) + '...' : desc;
225
+ return `[${shortId}] ${dateStr} FN: ${truncated}`;
226
+ }
227
+ }
228
+ //# sourceMappingURL=feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.js","sourceRoot":"","sources":["../../../../src/cli/commands/feedback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,gBAAgB,EAAqB,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,MAAM,gBAAgB,GAAqB;IACzC,UAAU;IACV,SAAS;IACT,aAAa;IACb,SAAS;IACT,cAAc;CACf,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAwB,EACxB,KAAyB;IAEzB,MAAM,aAAa,GAAG,KAAK,IAAI,gBAAgB,EAAE,CAAC;IAElD,yBAAyB;IACzB,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC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Options, AuditResult, } from './types.js';
6
+ export { statusCommand, formatStatusResult, } from './status.js';
7
+ export { testCommand, formatTestResult, } from './test.js';
8
+ export { auditCommand, formatAuditResult, addAuditEntry, clearAuditLog, getAuditLog, createAuditEntry, } from './audit.js';
9
+ export { feedbackCommand, formatFeedbackResult, formatFeedbackSummary, } from './feedback.js';
10
+ export type { FeedbackOptions, FeedbackResult, } from '../../feedback/index.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,WAAW,EACX,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,eAAe,EACf,cAAc,GACf,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * CLI Commands
3
+ * Re-exports for all CLI commands
4
+ */
5
+ // Status command
6
+ export { statusCommand, formatStatusResult, } from './status.js';
7
+ // Test command
8
+ export { testCommand, formatTestResult, } from './test.js';
9
+ // Audit command
10
+ export { auditCommand, formatAuditResult, addAuditEntry, clearAuditLog, getAuditLog, createAuditEntry, } from './audit.js';
11
+ // Feedback command
12
+ export { feedbackCommand, formatFeedbackResult, formatFeedbackSummary, } from './feedback.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,iBAAiB;AACjB,OAAO,EACL,aAAa,EACb,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,eAAe;AACf,OAAO,EACL,WAAW,EACX,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAEnB,gBAAgB;AAChB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,mBAAmB;AACnB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Status Command
3
+ * Shows configuration status, enabled rules, and any issues
4
+ */
5
+ import type { StatusResult, CLIOptions } from './types.js';
6
+ /**
7
+ * Execute the status command
8
+ *
9
+ * @param options - CLI options including optional config path
10
+ * @returns Status result with config info and rule status
11
+ */
12
+ export declare function statusCommand(options?: CLIOptions): Promise<StatusResult>;
13
+ /**
14
+ * Format status result for console output
15
+ *
16
+ * @param result - Status result to format
17
+ * @returns Formatted string for display
18
+ */
19
+ export declare function formatStatusResult(result: StatusResult): string;
20
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAK3D;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CA4EnF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAiC/D"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Status Command
3
+ * Shows configuration status, enabled rules, and any issues
4
+ */
5
+ import * as path from 'node:path';
6
+ import { loadConfig, findConfigFile, isValidConfig, ConfigLoadError, } from '../../config/index.js';
7
+ /** All available rule names */
8
+ const ALL_RULES = ['purchase', 'website', 'destructive', 'secrets', 'exfiltration'];
9
+ /**
10
+ * Execute the status command
11
+ *
12
+ * @param options - CLI options including optional config path
13
+ * @returns Status result with config info and rule status
14
+ */
15
+ export async function statusCommand(options = {}) {
16
+ const issues = [];
17
+ let configPath = options.config || '';
18
+ let configValid = false;
19
+ const enabledRules = [];
20
+ const disabledRules = [];
21
+ // Find config file if not specified
22
+ if (!configPath) {
23
+ const foundPath = findConfigFile();
24
+ if (foundPath) {
25
+ configPath = foundPath;
26
+ }
27
+ else {
28
+ configPath = '(none - using defaults)';
29
+ }
30
+ }
31
+ else {
32
+ configPath = path.resolve(configPath);
33
+ }
34
+ try {
35
+ // Load and validate config
36
+ const config = loadConfig(options.config);
37
+ // Check if config is valid
38
+ const validation = isValidConfig(config);
39
+ configValid = validation.valid;
40
+ if (!validation.valid) {
41
+ issues.push(...validation.errors.map(e => `${e.path}: ${e.message}`));
42
+ }
43
+ // Check global enabled status
44
+ if (!config.global.enabled) {
45
+ issues.push('Plugin is globally disabled');
46
+ }
47
+ // Check each rule's status
48
+ for (const ruleName of ALL_RULES) {
49
+ const rule = config.rules[ruleName];
50
+ if (rule && rule.enabled) {
51
+ enabledRules.push(ruleName);
52
+ }
53
+ else {
54
+ disabledRules.push(ruleName);
55
+ }
56
+ }
57
+ // Additional validation checks
58
+ if (config.rules.website.mode === 'allowlist' && config.rules.website.allowlist.length === 0) {
59
+ issues.push('Website rule is in allowlist mode but allowlist is empty (blocks all sites)');
60
+ }
61
+ if (config.approval.webhook?.enabled && !config.approval.webhook.url) {
62
+ issues.push('Webhook approval is enabled but no URL is configured');
63
+ }
64
+ }
65
+ catch (error) {
66
+ configValid = false;
67
+ if (error instanceof ConfigLoadError) {
68
+ issues.push(`Failed to load config: ${error.message}`);
69
+ }
70
+ else if (error instanceof Error) {
71
+ issues.push(`Configuration error: ${error.message}`);
72
+ }
73
+ else {
74
+ issues.push('Unknown configuration error');
75
+ }
76
+ // If config failed to load, mark all rules as unknown
77
+ disabledRules.push(...ALL_RULES);
78
+ }
79
+ return {
80
+ configPath,
81
+ configValid,
82
+ enabledRules,
83
+ disabledRules,
84
+ issues,
85
+ };
86
+ }
87
+ /**
88
+ * Format status result for console output
89
+ *
90
+ * @param result - Status result to format
91
+ * @returns Formatted string for display
92
+ */
93
+ export function formatStatusResult(result) {
94
+ const lines = [];
95
+ lines.push('=== Clawsec Status ===');
96
+ lines.push('');
97
+ lines.push(`Config File: ${result.configPath}`);
98
+ lines.push(`Config Valid: ${result.configValid ? 'Yes' : 'No'}`);
99
+ lines.push('');
100
+ if (result.enabledRules.length > 0) {
101
+ lines.push('Enabled Rules:');
102
+ for (const rule of result.enabledRules) {
103
+ lines.push(` - ${rule}`);
104
+ }
105
+ }
106
+ if (result.disabledRules.length > 0) {
107
+ lines.push('');
108
+ lines.push('Disabled Rules:');
109
+ for (const rule of result.disabledRules) {
110
+ lines.push(` - ${rule}`);
111
+ }
112
+ }
113
+ if (result.issues.length > 0) {
114
+ lines.push('');
115
+ lines.push('Issues:');
116
+ for (const issue of result.issues) {
117
+ lines.push(` ! ${issue}`);
118
+ }
119
+ }
120
+ return lines.join('\n');
121
+ }
122
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAG/B,+BAA+B;AAC/B,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,CAAU,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,CAA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AK,CAAC,IAAI,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Test Command
3
+ * Tests a specific rule against sample input
4
+ */
5
+ import type { TestResult, CLIOptions } from './types.js';
6
+ /**
7
+ * Execute the test command
8
+ *
9
+ * @param ruleName - Name of the rule to test
10
+ * @param input - JSON input object to test
11
+ * @param options - CLI options including optional config path
12
+ * @returns Test result showing detection status
13
+ */
14
+ export declare function testCommand(ruleName: string, input: Record<string, unknown>, options?: CLIOptions): Promise<TestResult>;
15
+ /**
16
+ * Format test result for console output
17
+ *
18
+ * @param result - Test result to format
19
+ * @param ruleName - Name of the rule that was tested
20
+ * @returns Formatted string for display
21
+ */
22
+ export declare function formatTestResult(result: TestResult, ruleName: string): string;
23
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAazD;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,UAAU,CAAC,CA8FrB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAkB7E"}