@agentwhy/cli 0.0.0-dev

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 (400) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +181 -0
  4. package/THIRD_PARTY_NOTICES.md +31 -0
  5. package/dist/adapter/claude-code/contract/assumptions.js +208 -0
  6. package/dist/adapter/claude-code/contract/denials.js +15 -0
  7. package/dist/adapter/claude-code/contract/entry-points.js +15 -0
  8. package/dist/adapter/claude-code/contract/fields.js +73 -0
  9. package/dist/adapter/claude-code/contract/hooks.js +96 -0
  10. package/dist/adapter/claude-code/contract/identifiers.js +15 -0
  11. package/dist/adapter/claude-code/contract/layout.js +29 -0
  12. package/dist/adapter/claude-code/contract/line-types.js +26 -0
  13. package/dist/adapter/claude-code/contract/projects.js +23 -0
  14. package/dist/adapter/claude-code/contract/recognition.js +14 -0
  15. package/dist/adapter/claude-code/contract/session-title.js +20 -0
  16. package/dist/adapter/claude-code/contract/settings.js +27 -0
  17. package/dist/adapter/claude-code/contract/task-notifications.js +33 -0
  18. package/dist/adapter/claude-code/contract/tools.js +37 -0
  19. package/dist/adapter/claude-code/contract/version.js +51 -0
  20. package/dist/adapter/claude-code/discovery/claude-code-project-catalogue.js +129 -0
  21. package/dist/adapter/claude-code/discovery/claude-code-recognition.js +46 -0
  22. package/dist/adapter/claude-code/discovery/claude-code-session-catalogue.js +100 -0
  23. package/dist/adapter/claude-code/discovery/claude-code-session-discovery.js +61 -0
  24. package/dist/adapter/claude-code/discovery/claude-code-session-titles.js +28 -0
  25. package/dist/adapter/claude-code/discovery/discovered-session.js +1 -0
  26. package/dist/adapter/claude-code/discovery/session-entries.js +41 -0
  27. package/dist/adapter/claude-code/discovery/transcript-tail.js +81 -0
  28. package/dist/adapter/claude-code/events/claude-code-session-source.js +197 -0
  29. package/dist/adapter/claude-code/events/delegation-index.js +15 -0
  30. package/dist/adapter/claude-code/events/transcript-scan.js +179 -0
  31. package/dist/adapter/claude-code/hooks/hook-output.js +42 -0
  32. package/dist/adapter/claude-code/hooks/pre-tool-use-input.js +23 -0
  33. package/dist/adapter/claude-code/hooks/stop-input.js +25 -0
  34. package/dist/adapter/claude-code/hooks/subagent-stop-input.js +26 -0
  35. package/dist/adapter/claude-code/policy/deny-rules.js +46 -0
  36. package/dist/adapter/claude-code/probe/claude-code-probe.js +86 -0
  37. package/dist/adapter/claude-code/probe/collectors/agent-tool-input-key-collector.js +24 -0
  38. package/dist/adapter/claude-code/probe/collectors/denial-kind-collector.js +20 -0
  39. package/dist/adapter/claude-code/probe/collectors/denied-call-collector.js +11 -0
  40. package/dist/adapter/claude-code/probe/collectors/identifier-collector.js +19 -0
  41. package/dist/adapter/claude-code/probe/collectors/line-collector.js +1 -0
  42. package/dist/adapter/claude-code/probe/collectors/line-type-collector.js +29 -0
  43. package/dist/adapter/claude-code/probe/collectors/sidechain-collector.js +20 -0
  44. package/dist/adapter/claude-code/probe/collectors/task-notification-collector.js +51 -0
  45. package/dist/adapter/claude-code/probe/collectors/tool-result-reference-collector.js +31 -0
  46. package/dist/adapter/claude-code/probe/collectors/tool-use-collector.js +24 -0
  47. package/dist/adapter/claude-code/probe/collectors/tool-version-collector.js +14 -0
  48. package/dist/adapter/claude-code/probe/collectors/top-level-key-collector.js +14 -0
  49. package/dist/adapter/claude-code/probe/collectors/unknown-line-type-key-collector.js +24 -0
  50. package/dist/adapter/claude-code/probe/collectors/working-directory-collector.js +28 -0
  51. package/dist/adapter/claude-code/probe/doctor-report.js +1 -0
  52. package/dist/adapter/claude-code/probe/meta-tally.js +42 -0
  53. package/dist/adapter/claude-code/probe/session-probe.js +1 -0
  54. package/dist/adapter/claude-code/probe/session-tally.js +41 -0
  55. package/dist/adapter/claude-code/probe/transcript-line.js +30 -0
  56. package/dist/adapter/claude-code/probe/transcript-tally.js +74 -0
  57. package/dist/adapter/claude-code/settings/deny-entries.js +65 -0
  58. package/dist/adapter/claude-code/settings/hook-entries.js +303 -0
  59. package/dist/adapter/codex/contract/actions.js +69 -0
  60. package/dist/adapter/codex/contract/assumptions.js +55 -0
  61. package/dist/adapter/codex/contract/capabilities.js +24 -0
  62. package/dist/adapter/codex/contract/delegations.js +30 -0
  63. package/dist/adapter/codex/contract/deliveries.js +25 -0
  64. package/dist/adapter/codex/contract/envelope.js +33 -0
  65. package/dist/adapter/codex/contract/hook-refusals.js +14 -0
  66. package/dist/adapter/codex/contract/hooks.js +46 -0
  67. package/dist/adapter/codex/contract/messages.js +47 -0
  68. package/dist/adapter/codex/contract/permissions.js +27 -0
  69. package/dist/adapter/codex/contract/reviews.js +13 -0
  70. package/dist/adapter/codex/contract/session.js +31 -0
  71. package/dist/adapter/codex/contract/turns.js +23 -0
  72. package/dist/adapter/codex/contract/version.js +15 -0
  73. package/dist/adapter/codex/discovery/codex-conversations.js +44 -0
  74. package/dist/adapter/codex/discovery/codex-project-catalogue.js +49 -0
  75. package/dist/adapter/codex/discovery/codex-recognition.js +20 -0
  76. package/dist/adapter/codex/discovery/codex-session-catalogue.js +28 -0
  77. package/dist/adapter/codex/discovery/codex-session-discovery.js +115 -0
  78. package/dist/adapter/codex/discovery/codex-session-index.js +21 -0
  79. package/dist/adapter/codex/discovery/codex-session-titles.js +135 -0
  80. package/dist/adapter/codex/discovery/session-header.js +86 -0
  81. package/dist/adapter/codex/discovery/session-owners.js +11 -0
  82. package/dist/adapter/codex/discovery/session-roots.js +49 -0
  83. package/dist/adapter/codex/events/action-items.js +138 -0
  84. package/dist/adapter/codex/events/capability-records.js +26 -0
  85. package/dist/adapter/codex/events/codex-session-source.js +121 -0
  86. package/dist/adapter/codex/events/hook-refusals.js +27 -0
  87. package/dist/adapter/codex/events/rollout-scan.js +614 -0
  88. package/dist/adapter/codex/events/turn-permissions.js +60 -0
  89. package/dist/adapter/codex/hooks/pre-tool-use-input.js +24 -0
  90. package/dist/adapter/codex/hooks/stop-refusals.js +57 -0
  91. package/dist/adapter/codex/probe/codex-doctor-report.js +1 -0
  92. package/dist/adapter/codex/probe/codex-probe.js +268 -0
  93. package/dist/adapter/codex/settings/codex-hooks.js +83 -0
  94. package/dist/cli/cli-command.js +1 -0
  95. package/dist/cli/command-router.js +42 -0
  96. package/dist/cli/commands/check-cli-command.js +128 -0
  97. package/dist/cli/commands/codex-stop-cli-command.js +27 -0
  98. package/dist/cli/commands/doctor-arguments.js +32 -0
  99. package/dist/cli/commands/doctor-cli-command.js +31 -0
  100. package/dist/cli/commands/doctor-usage.js +14 -0
  101. package/dist/cli/commands/init-cli-command.js +123 -0
  102. package/dist/cli/commands/menu-cli-command.js +58 -0
  103. package/dist/cli/commands/notify-cli-command.js +158 -0
  104. package/dist/cli/commands/refuse-cli-command.js +79 -0
  105. package/dist/cli/commands/report-arguments.js +62 -0
  106. package/dist/cli/commands/report-cli-command.js +36 -0
  107. package/dist/cli/commands/report-usage.js +41 -0
  108. package/dist/cli/commands/sessions-cli-command.js +184 -0
  109. package/dist/cli/commands/start-cli-command.js +83 -0
  110. package/dist/cli/commands/watch-cli-command.js +142 -0
  111. package/dist/cli/exit-codes.js +13 -0
  112. package/dist/cli/project-switches.js +46 -0
  113. package/dist/cli.js +80 -0
  114. package/dist/composition-root.js +411 -0
  115. package/dist/core/access/command-line.js +454 -0
  116. package/dist/core/access/listing.js +58 -0
  117. package/dist/core/access/path-shape.js +59 -0
  118. package/dist/core/access/path-tokens.js +37 -0
  119. package/dist/core/access/protected-access.js +310 -0
  120. package/dist/core/access/protected-values.js +102 -0
  121. package/dist/core/access/recorded-effect.js +67 -0
  122. package/dist/core/access/returns.js +173 -0
  123. package/dist/core/access/search-output.js +34 -0
  124. package/dist/core/access/search-reach.js +268 -0
  125. package/dist/core/access/uses.js +143 -0
  126. package/dist/core/access/words-before.js +52 -0
  127. package/dist/core/agent.js +1 -0
  128. package/dist/core/capability.js +11 -0
  129. package/dist/core/combined-project-catalogue.js +36 -0
  130. package/dist/core/combined-session-catalogue.js +25 -0
  131. package/dist/core/completeness.js +10 -0
  132. package/dist/core/context.js +1 -0
  133. package/dist/core/correlation/correlate.js +329 -0
  134. package/dist/core/delegation.js +1 -0
  135. package/dist/core/detector/prompt-signals.js +78 -0
  136. package/dist/core/entry-point.js +1 -0
  137. package/dist/core/event.js +1 -0
  138. package/dist/core/evidence.js +9 -0
  139. package/dist/core/late-message.js +32 -0
  140. package/dist/core/message.js +1 -0
  141. package/dist/core/nearest-project.js +28 -0
  142. package/dist/core/policy/default-policy.js +32 -0
  143. package/dist/core/policy/glob.js +56 -0
  144. package/dist/core/policy/parse-policy.js +70 -0
  145. package/dist/core/policy/policy.js +20 -0
  146. package/dist/core/policy/resolve-policy.js +16 -0
  147. package/dist/core/project-catalogue.js +1 -0
  148. package/dist/core/project-root.js +133 -0
  149. package/dist/core/provider-titles.js +10 -0
  150. package/dist/core/redaction/entropy.js +46 -0
  151. package/dist/core/redaction/redacted.js +4 -0
  152. package/dist/core/redaction/redactor.js +339 -0
  153. package/dist/core/redaction/secret-patterns.js +22 -0
  154. package/dist/core/redaction/value-shapes.js +81 -0
  155. package/dist/core/redaction/value-trace.js +110 -0
  156. package/dist/core/review.js +1 -0
  157. package/dist/core/session-catalogue.js +19 -0
  158. package/dist/core/session-filter.js +42 -0
  159. package/dist/core/session-format.js +27 -0
  160. package/dist/core/session-model.js +1 -0
  161. package/dist/core/session-reader.js +22 -0
  162. package/dist/core/session-records.js +1 -0
  163. package/dist/core/session-source.js +1 -0
  164. package/dist/core/session-titles.js +21 -0
  165. package/dist/core/turn.js +1 -0
  166. package/dist/doctor/codex-doctor.js +14 -0
  167. package/dist/doctor/doctor-use-case.js +1 -0
  168. package/dist/doctor/format-selecting-doctor.js +28 -0
  169. package/dist/doctor/render/attention/attention-rule.js +1 -0
  170. package/dist/doctor/render/attention/doctor-attention-rules.js +28 -0
  171. package/dist/doctor/render/attention/rules/damaged-meta-files-rule.js +8 -0
  172. package/dist/doctor/render/attention/rules/damaged-transcripts-rule.js +9 -0
  173. package/dist/doctor/render/attention/rules/incomplete-subagent-pairs-rule.js +6 -0
  174. package/dist/doctor/render/attention/rules/missing-main-transcript-rule.js +5 -0
  175. package/dist/doctor/render/attention/rules/missing-spilled-results-rule.js +6 -0
  176. package/dist/doctor/render/attention/rules/multiple-working-directories-rule.js +15 -0
  177. package/dist/doctor/render/attention/rules/unknown-denial-kinds-rule.js +5 -0
  178. package/dist/doctor/render/attention/rules/unknown-line-types-rule.js +6 -0
  179. package/dist/doctor/render/attention/rules/unrecognised-entries-rule.js +6 -0
  180. package/dist/doctor/render/attention/rules/unusable-directories-rule.js +12 -0
  181. package/dist/doctor/render/attention/transcript-scopes.js +6 -0
  182. package/dist/doctor/render/codex-text-doctor-renderer.js +97 -0
  183. package/dist/doctor/render/doctor-renderers.js +1 -0
  184. package/dist/doctor/render/json-doctor-renderer.js +7 -0
  185. package/dist/doctor/render/output-format.js +1 -0
  186. package/dist/doctor/render/text-doctor-renderer.js +124 -0
  187. package/dist/doctor/session-doctor.js +16 -0
  188. package/dist/infrastructure/clack-asker.js +24 -0
  189. package/dist/infrastructure/clack-chooser.js +40 -0
  190. package/dist/infrastructure/clack-multi-chooser.js +31 -0
  191. package/dist/infrastructure/file-alert-store.js +120 -0
  192. package/dist/infrastructure/file-checked-store.js +55 -0
  193. package/dist/infrastructure/file-mark-store.js +67 -0
  194. package/dist/infrastructure/file-onboarding-store.js +93 -0
  195. package/dist/infrastructure/folder-window.js +26 -0
  196. package/dist/infrastructure/node-agentwhy-invocation.js +99 -0
  197. package/dist/infrastructure/node-browser.js +40 -0
  198. package/dist/infrastructure/node-file-system.js +111 -0
  199. package/dist/infrastructure/node-local-server.js +115 -0
  200. package/dist/infrastructure/node-text-input.js +26 -0
  201. package/dist/infrastructure/os-notifier.js +21 -0
  202. package/dist/infrastructure/osascript-folder-chooser.js +53 -0
  203. package/dist/infrastructure/powershell-folder-chooser.js +78 -0
  204. package/dist/infrastructure/real-directory.js +18 -0
  205. package/dist/infrastructure/stream-printer.js +11 -0
  206. package/dist/infrastructure/terminal-banner.js +19 -0
  207. package/dist/ports/agentwhy-invocation.js +1 -0
  208. package/dist/ports/alert-store.js +1 -0
  209. package/dist/ports/asker.js +1 -0
  210. package/dist/ports/browser.js +1 -0
  211. package/dist/ports/checked-store.js +1 -0
  212. package/dist/ports/chooser.js +1 -0
  213. package/dist/ports/directory-reader.js +1 -0
  214. package/dist/ports/file-access-error.js +11 -0
  215. package/dist/ports/file-reader.js +1 -0
  216. package/dist/ports/file-tail-reader.js +1 -0
  217. package/dist/ports/file-writer.js +1 -0
  218. package/dist/ports/folder-chooser.js +1 -0
  219. package/dist/ports/local-server.js +1 -0
  220. package/dist/ports/mark-store.js +10 -0
  221. package/dist/ports/multi-chooser.js +1 -0
  222. package/dist/ports/notifier.js +1 -0
  223. package/dist/ports/onboarding-store.js +1 -0
  224. package/dist/ports/printer.js +1 -0
  225. package/dist/ports/text-input.js +1 -0
  226. package/dist/refuse/command-reach.js +135 -0
  227. package/dist/refuse/command-refusal.js +88 -0
  228. package/dist/refuse/render/codex-stop-words.js +21 -0
  229. package/dist/refuse/render/refusal-words.js +34 -0
  230. package/dist/report/build-report.js +1037 -0
  231. package/dist/report/check/actions-digest.js +73 -0
  232. package/dist/report/check/check-lines.js +83 -0
  233. package/dist/report/check/mark-request.js +90 -0
  234. package/dist/report/check/marks.js +84 -0
  235. package/dist/report/check/render/text-digest-renderer.js +332 -0
  236. package/dist/report/check/session-actions.js +90 -0
  237. package/dist/report/check/session-check.js +91 -0
  238. package/dist/report/choose-policy.js +61 -0
  239. package/dist/report/flow-reads.js +18 -0
  240. package/dist/report/private-files/tell-lists.js +84 -0
  241. package/dist/report/project-rules.js +33 -0
  242. package/dist/report/render/home-relative.js +18 -0
  243. package/dist/report/render/html-head.js +26 -0
  244. package/dist/report/render/html-report-components.js +48 -0
  245. package/dist/report/render/html-report-styles.js +500 -0
  246. package/dist/report/render/html-sidebar.js +42 -0
  247. package/dist/report/render/path-tail.js +14 -0
  248. package/dist/report/render/report-copy.js +1177 -0
  249. package/dist/report/render/report-page/advanced-view.js +167 -0
  250. package/dist/report/render/report-page/file-story.js +114 -0
  251. package/dist/report/render/report-page/files-view.js +381 -0
  252. package/dist/report/render/report-page/files.js +77 -0
  253. package/dist/report/render/report-page/fix-wizard-script.js +269 -0
  254. package/dist/report/render/report-page/fix-wizard.js +310 -0
  255. package/dist/report/render/report-page/helpers-view.js +383 -0
  256. package/dist/report/render/report-page/helpers.js +51 -0
  257. package/dist/report/render/report-page/item-names.js +63 -0
  258. package/dist/report/render/report-page/protect-patterns.js +13 -0
  259. package/dist/report/render/report-page/providers.js +208 -0
  260. package/dist/report/render/report-page/record-view.js +367 -0
  261. package/dist/report/render/report-page/report-page-renderer.js +129 -0
  262. package/dist/report/render/report-page/report-views.js +31 -0
  263. package/dist/report/render/report-page/story-window.js +356 -0
  264. package/dist/report/render/report-page/times.js +25 -0
  265. package/dist/report/render/report-page/to-do-view.js +299 -0
  266. package/dist/report/render/report-page/to-do.js +152 -0
  267. package/dist/report/render/report-page.js +1 -0
  268. package/dist/report/render/session-view.js +250 -0
  269. package/dist/report/render/text-report-renderer.js +981 -0
  270. package/dist/report/render/ui/add-file-popup.js +122 -0
  271. package/dist/report/render/ui/app-sidebar.js +78 -0
  272. package/dist/report/render/ui/ask-panel.js +80 -0
  273. package/dist/report/render/ui/avatar.js +19 -0
  274. package/dist/report/render/ui/backdrop.js +29 -0
  275. package/dist/report/render/ui/brand-mark.js +4 -0
  276. package/dist/report/render/ui/button.js +67 -0
  277. package/dist/report/render/ui/callout.js +20 -0
  278. package/dist/report/render/ui/chat-example.js +17 -0
  279. package/dist/report/render/ui/checklist.js +50 -0
  280. package/dist/report/render/ui/confirm-dialog.js +34 -0
  281. package/dist/report/render/ui/data-table.js +49 -0
  282. package/dist/report/render/ui/drawer.js +25 -0
  283. package/dist/report/render/ui/file-chip.js +37 -0
  284. package/dist/report/render/ui/fold-line.js +22 -0
  285. package/dist/report/render/ui/guide-card.js +25 -0
  286. package/dist/report/render/ui/hero.js +37 -0
  287. package/dist/report/render/ui/labelled-select.js +10 -0
  288. package/dist/report/render/ui/live-script.js +222 -0
  289. package/dist/report/render/ui/local-date.js +58 -0
  290. package/dist/report/render/ui/mode-icon.js +6 -0
  291. package/dist/report/render/ui/page-shell.js +101 -0
  292. package/dist/report/render/ui/pill-tabs.js +47 -0
  293. package/dist/report/render/ui/popup.js +77 -0
  294. package/dist/report/render/ui/progress.js +35 -0
  295. package/dist/report/render/ui/project-list.js +284 -0
  296. package/dist/report/render/ui/scope-choice.js +19 -0
  297. package/dist/report/render/ui/stats.js +21 -0
  298. package/dist/report/render/ui/status-icon.js +30 -0
  299. package/dist/report/render/ui/status-look.js +21 -0
  300. package/dist/report/render/ui/switch.js +11 -0
  301. package/dist/report/render/ui/tag.js +19 -0
  302. package/dist/report/render/ui/task-list.js +56 -0
  303. package/dist/report/render/ui/tokens.js +46 -0
  304. package/dist/report/render/ui/update-notice.js +146 -0
  305. package/dist/report/render/ui/words/app-words.js +163 -0
  306. package/dist/report/render/ui/words/conversations-words.js +457 -0
  307. package/dist/report/render/ui/words/month-words.js +59 -0
  308. package/dist/report/render/ui/words/onboarding-words.js +446 -0
  309. package/dist/report/render/ui/words/projects-words.js +217 -0
  310. package/dist/report/render/ui/words/report-words.js +2099 -0
  311. package/dist/report/render/ui/words/settings-words.js +611 -0
  312. package/dist/report/render/ui/words/to-fix-words.js +287 -0
  313. package/dist/report/report-model.js +2 -0
  314. package/dist/report/report-use-case.js +1 -0
  315. package/dist/report/rule-names.js +20 -0
  316. package/dist/report/session-report.js +163 -0
  317. package/dist/report/start/app-nav.js +37 -0
  318. package/dist/report/start/conversations/calendar-view.js +104 -0
  319. package/dist/report/start/conversations/conversation-columns.js +187 -0
  320. package/dist/report/start/conversations/conversations-renderer.js +54 -0
  321. package/dist/report/start/conversations/empty-week.js +120 -0
  322. package/dist/report/start/conversations/files-window.js +166 -0
  323. package/dist/report/start/conversations/period-section.js +280 -0
  324. package/dist/report/start/conversations/periods-script.js +440 -0
  325. package/dist/report/start/conversations/periods.js +110 -0
  326. package/dist/report/start/conversations/week-view.js +30 -0
  327. package/dist/report/start/conversations/weeks.js +17 -0
  328. package/dist/report/start/month/month-renderer.js +50 -0
  329. package/dist/report/start/month/month-view.js +135 -0
  330. package/dist/report/start/month/months.js +17 -0
  331. package/dist/report/start/onboarding/done.js +171 -0
  332. package/dist/report/start/onboarding/finish-onboarding.js +93 -0
  333. package/dist/report/start/onboarding/intro.js +100 -0
  334. package/dist/report/start/onboarding/onboarding-changes.js +40 -0
  335. package/dist/report/start/onboarding/onboarding-renderer.js +195 -0
  336. package/dist/report/start/onboarding/onboarding-script.js +400 -0
  337. package/dist/report/start/onboarding/onboarding-view.js +98 -0
  338. package/dist/report/start/onboarding/project-step.js +210 -0
  339. package/dist/report/start/onboarding/steps.js +239 -0
  340. package/dist/report/start/onboarding/welcome.js +66 -0
  341. package/dist/report/start/page-notice.js +10 -0
  342. package/dist/report/start/projects/index-projects.js +43 -0
  343. package/dist/report/start/projects/moved-page.js +82 -0
  344. package/dist/report/start/projects/project-switch.js +138 -0
  345. package/dist/report/start/projects/projects-window.js +67 -0
  346. package/dist/report/start/projects/temporary-space.js +18 -0
  347. package/dist/report/start/render/air-datepicker-vendor.js +27 -0
  348. package/dist/report/start/render/session-status.js +41 -0
  349. package/dist/report/start/render/start-words.js +84 -0
  350. package/dist/report/start/repository.js +28 -0
  351. package/dist/report/start/serve/index-handler.js +372 -0
  352. package/dist/report/start/serve/onboarding-request.js +50 -0
  353. package/dist/report/start/serve/settings-request.js +1 -0
  354. package/dist/report/start/serve/settings-setup.js +193 -0
  355. package/dist/report/start/session-index.js +1 -0
  356. package/dist/report/start/session-start.js +974 -0
  357. package/dist/report/start/settings/alerts-tab.js +104 -0
  358. package/dist/report/start/settings/files-tab.js +169 -0
  359. package/dist/report/start/settings/general-tab.js +71 -0
  360. package/dist/report/start/settings/settings-renderer.js +254 -0
  361. package/dist/report/start/settings/settings-script.js +161 -0
  362. package/dist/report/start/settings/settings-view.js +240 -0
  363. package/dist/report/start/settings/settings-windows.js +334 -0
  364. package/dist/report/start/settings-files.js +43 -0
  365. package/dist/report/start/to-fix/done-list.js +45 -0
  366. package/dist/report/start/to-fix/file-window.js +110 -0
  367. package/dist/report/start/to-fix/to-fix-list.js +70 -0
  368. package/dist/report/start/to-fix/to-fix-renderer.js +237 -0
  369. package/dist/report/start/to-fix/to-fix-script.js +94 -0
  370. package/dist/report/start/to-fix/to-fix-view.js +124 -0
  371. package/dist/report/watch/agent-alert.js +72 -0
  372. package/dist/report/watch/notice-choices.js +35 -0
  373. package/dist/report/watch/notice-settings.js +65 -0
  374. package/dist/report/watch/preferences.js +100 -0
  375. package/dist/report/watch/render/instruction-words.js +54 -0
  376. package/dist/report/watch/render/notice-words.js +182 -0
  377. package/dist/report/watch/subagent-watch.js +345 -0
  378. package/dist/report/watch/watch-notice.js +1 -0
  379. package/dist/setup/behind.js +18 -0
  380. package/dist/setup/codex-mirror.js +171 -0
  381. package/dist/setup/not-a-project.js +19 -0
  382. package/dist/setup/project-setup.js +644 -0
  383. package/dist/setup/protected-patterns.js +30 -0
  384. package/dist/shared/colour.js +23 -0
  385. package/dist/shared/compare.js +4 -0
  386. package/dist/shared/content-version.js +13 -0
  387. package/dist/shared/counter.js +11 -0
  388. package/dist/shared/file-stamp.js +4 -0
  389. package/dist/shared/json.js +13 -0
  390. package/dist/shared/label.js +13 -0
  391. package/dist/shared/package-name.js +6 -0
  392. package/dist/shared/plain-invocation.js +44 -0
  393. package/dist/shared/plain-version.js +21 -0
  394. package/dist/shared/printable.js +25 -0
  395. package/dist/shared/renderer.js +1 -0
  396. package/dist/shared/sentence.js +20 -0
  397. package/dist/shared/terminal-logo.js +41 -0
  398. package/dist/shared/text-table.js +15 -0
  399. package/dist/shared/wrap.js +29 -0
  400. package/package.json +70 -0
@@ -0,0 +1,30 @@
1
+ const CONTROL = /[\u0000-\u001f\u007f-\u009f]/;
2
+ const LONGEST = 200;
3
+ /** Splits what was typed on commas, and separates what can be written from what cannot. */
4
+ export function patternsIn(typed) {
5
+ return patternsOf(typed.split(',').map((pattern) => pattern.trim()));
6
+ }
7
+ /** The same rules for patterns given one at a time, as `--protect` gives them. */
8
+ export function patternsOf(given) {
9
+ const patterns = [];
10
+ const refused = [];
11
+ for (const pattern of given.map((one) => one.trim())) {
12
+ if (pattern === '')
13
+ continue;
14
+ const reason = reasonToRefuse(pattern);
15
+ if (reason !== undefined)
16
+ refused.push({ pattern, reason });
17
+ else if (!patterns.includes(pattern))
18
+ patterns.push(pattern);
19
+ }
20
+ return { patterns, refused };
21
+ }
22
+ function reasonToRefuse(pattern) {
23
+ if (pattern.includes('(') || pattern.includes(')'))
24
+ return 'a deny rule is written as Read(...), so a bracket cannot be part of the path';
25
+ if (CONTROL.test(pattern))
26
+ return 'it holds a character that cannot be in a file name';
27
+ if (pattern.length > LONGEST)
28
+ return `it is longer than ${LONGEST} characters`;
29
+ return undefined;
30
+ }
@@ -0,0 +1,23 @@
1
+ // `indigo` is the brand colour of the wordmark (`--indigo`, #7C8CF8), as the nearest of the 256 colours every modern
2
+ // terminal has. It marks the tool itself and never an outcome.
3
+ const CODES = {
4
+ bold: '1',
5
+ dim: '2',
6
+ red: '31',
7
+ green: '32',
8
+ yellow: '33',
9
+ indigo: '38;5;105',
10
+ };
11
+ /** Every escape `paint` writes, so that a test - or a reader piping a coloured report on - can remove them. */
12
+ export const ESCAPES = /\u001b\[[0-9;]*m/g;
13
+ /** `text` wrapped in the escape for `hue`. Removing the escapes gives `text` back exactly. */
14
+ export function paint(text, hue) {
15
+ return text === '' ? text : `\u001b[${CODES[hue]}m${text}\u001b[0m`;
16
+ }
17
+ /**
18
+ * Whether stdout may be coloured: only when it is a terminal, and never when `NO_COLOR` holds anything but the
19
+ * empty string, which is how no-color.org defines it. Flags narrow this further; nothing widens it.
20
+ */
21
+ export function colourWanted(stdoutIsTerminal, noColor) {
22
+ return stdoutIsTerminal && (noColor === undefined || noColor === '');
23
+ }
@@ -0,0 +1,4 @@
1
+ /** Orders strings by UTF-16 code units — the order `Array.prototype.sort` uses without a comparator. */
2
+ export function byString(a, b) {
3
+ return a < b ? -1 : a > b ? 1 : 0;
4
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A short name for a content, so that two contents can be told apart without keeping either (`live-pages` L1). FNV-1a,
3
+ * 32 bits, in base 36: it guards nothing - a page only asks "is my file still what I was sent?" - and a collision costs
4
+ * one update shown two seconds late, never a wrong answer about a session.
5
+ */
6
+ export function contentVersion(text) {
7
+ let hash = 0x811c9dc5;
8
+ for (let index = 0; index < text.length; index += 1) {
9
+ hash ^= text.charCodeAt(index);
10
+ hash = Math.imul(hash, 0x01000193);
11
+ }
12
+ return (hash >>> 0).toString(36);
13
+ }
@@ -0,0 +1,11 @@
1
+ import { byString } from './compare.js';
2
+ /** Counts occurrences per key and reports them sorted by key, so the same input always yields the same output. */
3
+ export class Counter {
4
+ #counts = new Map();
5
+ add(key) {
6
+ this.#counts.set(key, (this.#counts.get(key) ?? 0) + 1);
7
+ }
8
+ toCounts() {
9
+ return Object.fromEntries([...this.#counts.keys()].sort(byString).map((key) => [key, this.#counts.get(key) ?? 0]));
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ /** A moment as part of a file name: it sorts by time, and holds no character a file system refuses. */
2
+ export function fileStamp(now) {
3
+ return new Date(now).toISOString().replace(/[:.]/g, '-');
4
+ }
@@ -0,0 +1,13 @@
1
+ export function isJsonObject(value) {
2
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
3
+ }
4
+ /** Parses text that should hold a JSON object. Invalid JSON and any other JSON value yield undefined. */
5
+ export function parseJsonObject(text) {
6
+ try {
7
+ const value = JSON.parse(text);
8
+ return isJsonObject(value) ? value : undefined;
9
+ }
10
+ catch {
11
+ return undefined;
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ // Labels come only from structural positions: keys, line types, tool names, enumerations. A label must look
2
+ // like an identifier, and anything else is replaced, so free text cannot reach the output even from a
3
+ // malformed transcript. Known limit: an identifier-shaped secret placed in a structural position would pass;
4
+ // recognising secrets is the job of the secret scanner (spec §5.4), not of this guard.
5
+ const LABEL_PATTERN = /^[A-Za-z0-9_.:-]{1,64}$/;
6
+ export const ABSENT_LABEL = '(absent)';
7
+ export const INVALID_LABEL = '(invalid)';
8
+ export function toLabel(value) {
9
+ if (value === undefined)
10
+ return ABSENT_LABEL;
11
+ const text = typeof value === 'number' || typeof value === 'boolean' ? String(value) : value;
12
+ return typeof text === 'string' && LABEL_PATTERN.test(text) ? text : INVALID_LABEL;
13
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The name agentwhy is published under. npm refuses the unscoped `agentwhy` as too close to `agent-why`, so the package
3
+ * is scoped while the command it installs stays `agentwhy`. Written into a hook by the finder and read back from one by
4
+ * the settings adapter (`a-hook-runs-what-you-ran.md` J2, `nothing-updates-by-itself.md` U1).
5
+ */
6
+ export const PACKAGE = '@agentwhy/cli';
@@ -0,0 +1,44 @@
1
+ import { PACKAGE } from './package-name.js';
2
+ /**
3
+ * What separates two words: a space or a tab, the only characters a shell splits on. Found by a review: `\s` also takes
4
+ * a non-breaking space, a line break and the like, so `npx<NBSP>@agentwhy/cli` read as two words here and ran as one
5
+ * relative path in the shell, and a second line passed for the flags of the first.
6
+ */
7
+ export const WORD_BREAK = '[ \\t]+';
8
+ /** `npx`, with `--yes` or `-y`, up to the package's name: what the pinned form (`hook-entries.ts`) is read after too. */
9
+ export const NPX_BEFORE_NAME = `npx(?:${WORD_BREAK}(?:--yes|-y))?${WORD_BREAK}`;
10
+ /** A version after `@`, as plain words allow one: `0.3.0`, `0.3.0-beta.1`, `latest`. */
11
+ export const VERSION = '[\\w.+-]+';
12
+ /**
13
+ * One segment of an absolute path: no space, quote, variable, `~` or anything else a shell reads as more, and not `.`
14
+ * or `..`, which lead back up to where a path is not what it says.
15
+ */
16
+ const SEGMENT = '(?!\\.\\.?(?![\\w@%+=:,.-]))[\\w@%+=:,.-]+';
17
+ /**
18
+ * Where an absolute path may start: anywhere but `/proc` and `/dev`. Found by a review: `/proc/self/cwd/…` is absolute
19
+ * and is the working directory - on Linux, the project a hook runs in - and `/dev/fd/…` is a file already open.
20
+ */
21
+ const ROOTED = '(?!/(?:proc|dev)/)';
22
+ /**
23
+ * agentwhy named in plain words (`a-hook-runs-what-you-ran.md` J4, `the-agent-tells-you.md` R18), as a pattern's source
24
+ * with no anchors: `agentwhy` or an absolute path to its bin; `npx`, with `--yes` or `-y`, before the published name or
25
+ * the unscoped `agentwhy`, either with a version; or `node` before an absolute path to agentwhy's own entry - its bin,
26
+ * or `dist/cli.js` or `src/cli.ts` under a folder with agentwhy in its name.
27
+ *
28
+ * Found by a review: any word that merely held agentwhy was taken, so a cloned project's settings could have
29
+ * `npx @someone/agentwhy`, `npx agentwhy-helper` or `node --require=./x/agentwhy.js` repeated into the person's own
30
+ * hooks and handed to the agent. A name is now one agentwhy publishes, and a path is absolute - a relative one runs a
31
+ * file of the project the settings came from, and `~` a guessable one. A second review: after `node`, any absolute
32
+ * path with agentwhy in it passed, `/tmp/agentwhy-x.js` too, and an agent can write that file itself. A shape only
33
+ * narrows this - a folder laid out like the package passes - it does not prove the file is agentwhy's.
34
+ */
35
+ export const PLAIN_INVOCATION_SOURCE = [
36
+ `(?:${ROOTED}(?:/${SEGMENT})*/)?agentwhy`,
37
+ `${NPX_BEFORE_NAME}(?:${PACKAGE}|agentwhy)(?:@${VERSION})?`,
38
+ `node${WORD_BREAK}${ROOTED}(?:/${SEGMENT})*/(?:[\\w@%+=:,.-]*agentwhy[\\w@%+=:,.-]*(?:/${SEGMENT})*/(?:dist/cli\\.js|src/cli\\.ts)|agentwhy)`,
39
+ ].join('|');
40
+ const PLAIN_INVOCATION = new RegExp(`^(?:${PLAIN_INVOCATION_SOURCE})$`);
41
+ /** Whether a command's invocation, the words before its subcommand, runs agentwhy in plain words and nothing else. */
42
+ export function isPlainInvocation(invocation) {
43
+ return PLAIN_INVOCATION.test(invocation);
44
+ }
@@ -0,0 +1,21 @@
1
+ const PLAIN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
2
+ /**
3
+ * `x.y.z` and nothing else. A pre-release (`0.3.0-beta.1`), a build (`0.0.0-dev`) or a range is not plain: no rule here
4
+ * orders one against a release, so none is guessed (`nothing-updates-by-itself.md` U1, U2).
5
+ */
6
+ export function plainVersion(text) {
7
+ const match = PLAIN.exec(text);
8
+ return match === null ? undefined : [Number(match[1]), Number(match[2]), Number(match[3])];
9
+ }
10
+ /** Whether `version` is an older release than `than`. False where either is not plain: unknown is never older. */
11
+ export function isOlder(version, than) {
12
+ const a = plainVersion(version);
13
+ const b = plainVersion(than);
14
+ if (a === undefined || b === undefined)
15
+ return false;
16
+ for (let part = 0; part < 3; part += 1) {
17
+ if (a[part] !== b[part])
18
+ return (a[part] ?? 0) < (b[part] ?? 0);
19
+ }
20
+ return false;
21
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Text from a file as a terminal may be shown it: every character a terminal obeys rather than draws, as a space. A
3
+ * settings file, a transcript and a folder's name all arrive from outside this tool - a committed settings file and a
4
+ * folder's name with a clone - so an escape sequence in one would be run: `\u001b[2K\u001b[1G` rewrites the line a person
5
+ * reads to decide what to do next.
6
+ *
7
+ * The marks that turn the direction of text, and the separators that break a line, go too. Found by a review: they are
8
+ * no control characters, so `Stop\u{202e}…` in a committed key showed the rest of its line reversed in the plan a person
9
+ * reads before "Update it?". A second review found the title of a session and the name of a folder guarded by rules of
10
+ * their own, or none, so there is one set of rules for every place. Letters of any script are left as they are.
11
+ */
12
+ export function printable(text) {
13
+ return text.replace(/[\u0000-\u001f\u007f-\u009f\u{061c}\u{200e}\u{200f}\u{2028}\u{2029}\u{202a}-\u{202e}\u{2066}-\u{2069}]/gu, ' ');
14
+ }
15
+ /**
16
+ * One line of plain words, for a title drawn in a list: `printable`, with the spaces it leaves - a line break among them,
17
+ * which would split one row in two - run together. Found by a review: a title guarded against control characters alone
18
+ * reached the `sessions` chooser with a mark that turns the direction of text.
19
+ */
20
+ export function oneLine(text) {
21
+ return printable(text)
22
+ .split(' ')
23
+ .filter((word) => word !== '')
24
+ .join(' ');
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The first sentence of a piece of writing, capped (`specs/2026-09-15-why-this-call.md` §5.1, level B). Measured on one
3
+ * session: 311 of 315 first sentences run under 200 characters, so the cap is rarely reached - and when
4
+ * it is, the cut is reported rather than hidden, because a truncation read as a whole thought is a lie about the
5
+ * record.
6
+ */
7
+ export const SENTENCE_CAP = 200;
8
+ const ENDS = /[.!?](\s|$)/;
9
+ export function firstSentence(text, cap = SENTENCE_CAP) {
10
+ const written = text.trim().replace(/\s+/g, ' ');
11
+ const line = written.split('\n')[0] ?? written;
12
+ const end = ENDS.exec(line);
13
+ const sentence = end === null ? line : line.slice(0, end.index + 1);
14
+ if (sentence.length <= cap)
15
+ return { text: sentence, cut: sentence.length < written.length && end === null };
16
+ // Cut at a word, not inside one: a half word reads as a typo rather than as a cut.
17
+ const room = sentence.slice(0, cap);
18
+ const space = room.lastIndexOf(' ');
19
+ return { text: (space > cap / 2 ? room.slice(0, space) : room).trimEnd(), cut: true };
20
+ }
@@ -0,0 +1,41 @@
1
+ import { paint } from './colour.js';
2
+ /**
3
+ * The agentwhy wordmark for a terminal: the letters of `agentwhy-logo-transparent.svg` in two rows of block
4
+ * characters, "agent" in the text colour and "why" in the brand indigo, as the page draws them.
5
+ */
6
+ const ROWS = [
7
+ { agent: '▄▀█ █▀▀ █▀▀ █▄ █ ▀█▀', why: '█ █ █ █ █ █▄█' },
8
+ { agent: '█▀█ █▄█ ██▄ █ ▀█ █ ', why: '▀▄▀▄▀ █▀█ █ ' },
9
+ ];
10
+ /** The name in letters, for a terminal trusted with ASCII alone (§7.5 constraint 2). */
11
+ const NAME = 'agentwhy';
12
+ /** Between the mark and the words beside it. */
13
+ const BESIDE = ' ';
14
+ /** What the tool is for, in the words its package describes it with. Said beside the mark wherever it is drawn. */
15
+ export const TAGLINE = 'why an agent reached for protected data';
16
+ /** How many columns the mark takes, gap included, before the words beside it start. */
17
+ export function logoWidth(ascii) {
18
+ const mark = ascii ? NAME.length : Math.max(...ROWS.map(({ agent, why }) => agent.length + 1 + why.length));
19
+ return mark + BESIDE.length;
20
+ }
21
+ /**
22
+ * The mark, one string per row, with up to two lines of words beside it: the mark shares its rows rather than
23
+ * pushing everything below it further down. Colour only repeats what is drawn - removing the escapes gives exactly
24
+ * the rows drawn without it.
25
+ */
26
+ export function terminalLogo(beside, view) {
27
+ if (view.ascii) {
28
+ if (beside.length === 0)
29
+ return [NAME];
30
+ return beside.map((words, row) => `${row === 0 ? NAME : ' '.repeat(NAME.length)}${BESIDE}${words}`);
31
+ }
32
+ return ROWS.map(({ agent, why: letters }, row) => {
33
+ const words = beside[row] ?? '';
34
+ // A row with nothing beside it ends where the letters do, not in the padding that keeps two rows level.
35
+ const why = words === '' ? letters.trimEnd() : letters;
36
+ const mark = view.colour ? `${paint(agent, 'bold')} ${paint(why, 'indigo')}` : `${agent} ${why}`;
37
+ if (words === '')
38
+ return mark;
39
+ return `${mark}${BESIDE}${view.colour ? paint(words, 'dim') : words}`;
40
+ });
41
+ }
@@ -0,0 +1,15 @@
1
+ import { byString } from './compare.js';
2
+ const EMPTY_COUNTS = '(none)';
3
+ /** Rows with their labels aligned into one column. */
4
+ export function table(rows, indentWidth) {
5
+ const width = Math.max(...rows.map(([label]) => label.length));
6
+ return rows.map(([label, value]) => `${' '.repeat(indentWidth)}${label.padEnd(width)} ${value}`);
7
+ }
8
+ /** Counts as a table, largest first and ties by key, with the numbers right-aligned. */
9
+ export function countsTable(values, indentWidth) {
10
+ const entries = Object.entries(values).sort(([keyA, a], [keyB, b]) => b - a || byString(keyA, keyB));
11
+ if (entries.length === 0)
12
+ return [`${' '.repeat(indentWidth)}${EMPTY_COUNTS}`];
13
+ const width = Math.max(...entries.map(([, value]) => String(value).length));
14
+ return table(entries.map(([key, value]) => [key, String(value).padStart(width)]), indentWidth);
15
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Breaks text into lines that fit a width, at spaces where it can and inside a long run where it must - a URL
3
+ * or a path is never silently truncated, because a report that hides half a finding is worse than a wide line.
4
+ */
5
+ export function wrap(text, width) {
6
+ const usable = Math.max(width, 8);
7
+ return text.split('\n').flatMap((paragraph) => wrapParagraph(paragraph, usable));
8
+ }
9
+ function wrapParagraph(paragraph, width) {
10
+ const lines = [];
11
+ let current = '';
12
+ for (const word of paragraph.split(/\s+/).filter((part) => part !== '')) {
13
+ if (current === '')
14
+ current = word;
15
+ else if (`${current} ${word}`.length <= width)
16
+ current = `${current} ${word}`;
17
+ else {
18
+ lines.push(current);
19
+ current = word;
20
+ }
21
+ while (current.length > width) {
22
+ lines.push(current.slice(0, width));
23
+ current = current.slice(width);
24
+ }
25
+ }
26
+ if (current !== '')
27
+ lines.push(current);
28
+ return lines.length === 0 ? [''] : lines;
29
+ }
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@agentwhy/cli",
3
+ "version": "0.0.0-dev",
4
+ "description": "Reconstructs from transcripts why an AI agent reached for protected data",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/karolkozer/agentwhy.git"
10
+ },
11
+ "homepage": "https://github.com/karolkozer/agentwhy#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/karolkozer/agentwhy/issues"
14
+ },
15
+ "bin": {
16
+ "agentwhy": "./dist/cli.js"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "engines": {
22
+ "node": ">=22"
23
+ },
24
+ "devEngines": {
25
+ "runtime": {
26
+ "name": "node",
27
+ "version": ">=23.6",
28
+ "onFail": "warn"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "doctor": "node src/cli.ts doctor",
33
+ "typecheck": "tsc --noEmit",
34
+ "test": "node --test \"tests/**/*.test.ts\"",
35
+ "check:canary": "node scripts/check-canary.mjs",
36
+ "snapshot:doctor": "node src/cli.ts doctor --input tests/fixtures/redacted/951c4f76-9d2a-40d2-9c76-1e57cf47ae4e --json > tests/fixtures/doctor-report.snapshot.json",
37
+ "golden:report": "node scripts/regenerate-golden.mjs",
38
+ "demo:report": "node scripts/generate-dashboard-demo.mjs",
39
+ "demo:index": "node scripts/generate-index-demo.mjs",
40
+ "demo:settings": "node scripts/generate-settings-demo.mjs",
41
+ "demo:to-fix": "node scripts/generate-to-fix-demo.mjs",
42
+ "demo:onboarding": "node scripts/generate-onboarding-demo.mjs",
43
+ "demo:month": "node scripts/generate-month-demo.mjs",
44
+ "demo:report-page": "node scripts/generate-report-page-demo.mjs",
45
+ "build": "tsc -p tsconfig.build.json && node -e \"require('node:fs').chmodSync('dist/cli.js', 0o755)\"",
46
+ "prepack": "rm -rf dist && npm run build",
47
+ "check:package": "node scripts/check-package.mjs"
48
+ },
49
+ "files": [
50
+ "dist",
51
+ "README.md",
52
+ "LICENSE",
53
+ "NOTICE",
54
+ "THIRD_PARTY_NOTICES.md"
55
+ ],
56
+ "keywords": [
57
+ "claude-code",
58
+ "agents",
59
+ "secrets",
60
+ "audit",
61
+ "postmortem"
62
+ ],
63
+ "devDependencies": {
64
+ "@types/node": "^24.13.4",
65
+ "typescript": "^7.0.2"
66
+ },
67
+ "dependencies": {
68
+ "@clack/prompts": "1.8.1"
69
+ }
70
+ }