@vicoa/cli 1.3.11-linux-x64 → 1.3.11-win32-x64

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 (304) hide show
  1. package/bin/_internal/81d243bd2c585b0f4821__mypyc.cp312-win_amd64.pyd +0 -0
  2. package/bin/_internal/VCRUNTIME140.dll +0 -0
  3. package/bin/_internal/VCRUNTIME140_1.dll +0 -0
  4. package/bin/_internal/_asyncio.pyd +0 -0
  5. package/bin/_internal/_bz2.pyd +0 -0
  6. package/bin/_internal/_cffi_backend.cp312-win_amd64.pyd +0 -0
  7. package/bin/_internal/_ctypes.pyd +0 -0
  8. package/bin/_internal/_decimal.pyd +0 -0
  9. package/bin/_internal/_hashlib.pyd +0 -0
  10. package/bin/_internal/_lzma.pyd +0 -0
  11. package/bin/_internal/_multiprocessing.pyd +0 -0
  12. package/bin/_internal/_overlapped.pyd +0 -0
  13. package/bin/_internal/_queue.pyd +0 -0
  14. package/bin/_internal/_socket.pyd +0 -0
  15. package/bin/_internal/_ssl.pyd +0 -0
  16. package/bin/_internal/_uuid.pyd +0 -0
  17. package/bin/_internal/_wmi.pyd +0 -0
  18. package/bin/_internal/_zoneinfo.pyd +0 -0
  19. package/bin/_internal/aiohttp/_http_parser.cp312-win_amd64.pyd +0 -0
  20. package/bin/_internal/aiohttp/_http_writer.cp312-win_amd64.pyd +0 -0
  21. package/bin/_internal/aiohttp/_websocket/mask.cp312-win_amd64.pyd +0 -0
  22. package/bin/_internal/aiohttp/_websocket/reader_c.cp312-win_amd64.pyd +0 -0
  23. package/bin/_internal/api-ms-win-core-console-l1-1-0.dll +0 -0
  24. package/bin/_internal/api-ms-win-core-datetime-l1-1-0.dll +0 -0
  25. package/bin/_internal/api-ms-win-core-debug-l1-1-0.dll +0 -0
  26. package/bin/_internal/api-ms-win-core-errorhandling-l1-1-0.dll +0 -0
  27. package/bin/_internal/api-ms-win-core-fibers-l1-1-0.dll +0 -0
  28. package/bin/_internal/api-ms-win-core-fibers-l1-1-1.dll +0 -0
  29. package/bin/_internal/api-ms-win-core-file-l1-1-0.dll +0 -0
  30. package/bin/_internal/api-ms-win-core-file-l1-2-0.dll +0 -0
  31. package/bin/_internal/api-ms-win-core-file-l2-1-0.dll +0 -0
  32. package/bin/_internal/api-ms-win-core-handle-l1-1-0.dll +0 -0
  33. package/bin/_internal/api-ms-win-core-heap-l1-1-0.dll +0 -0
  34. package/bin/_internal/api-ms-win-core-interlocked-l1-1-0.dll +0 -0
  35. package/bin/_internal/api-ms-win-core-kernel32-legacy-l1-1-1.dll +0 -0
  36. package/bin/_internal/api-ms-win-core-libraryloader-l1-1-0.dll +0 -0
  37. package/bin/_internal/api-ms-win-core-localization-l1-2-0.dll +0 -0
  38. package/bin/_internal/api-ms-win-core-memory-l1-1-0.dll +0 -0
  39. package/bin/_internal/api-ms-win-core-namedpipe-l1-1-0.dll +0 -0
  40. package/bin/_internal/api-ms-win-core-processenvironment-l1-1-0.dll +0 -0
  41. package/bin/_internal/api-ms-win-core-processthreads-l1-1-0.dll +0 -0
  42. package/bin/_internal/api-ms-win-core-processthreads-l1-1-1.dll +0 -0
  43. package/bin/_internal/api-ms-win-core-profile-l1-1-0.dll +0 -0
  44. package/bin/_internal/api-ms-win-core-rtlsupport-l1-1-0.dll +0 -0
  45. package/bin/_internal/api-ms-win-core-string-l1-1-0.dll +0 -0
  46. package/bin/_internal/api-ms-win-core-synch-l1-1-0.dll +0 -0
  47. package/bin/_internal/api-ms-win-core-synch-l1-2-0.dll +0 -0
  48. package/bin/_internal/api-ms-win-core-sysinfo-l1-1-0.dll +0 -0
  49. package/bin/_internal/api-ms-win-core-sysinfo-l1-2-0.dll +0 -0
  50. package/bin/_internal/api-ms-win-core-timezone-l1-1-0.dll +0 -0
  51. package/bin/_internal/api-ms-win-core-util-l1-1-0.dll +0 -0
  52. package/bin/_internal/api-ms-win-crt-conio-l1-1-0.dll +0 -0
  53. package/bin/_internal/api-ms-win-crt-convert-l1-1-0.dll +0 -0
  54. package/bin/_internal/api-ms-win-crt-environment-l1-1-0.dll +0 -0
  55. package/bin/_internal/api-ms-win-crt-filesystem-l1-1-0.dll +0 -0
  56. package/bin/_internal/api-ms-win-crt-heap-l1-1-0.dll +0 -0
  57. package/bin/_internal/api-ms-win-crt-locale-l1-1-0.dll +0 -0
  58. package/bin/_internal/api-ms-win-crt-math-l1-1-0.dll +0 -0
  59. package/bin/_internal/api-ms-win-crt-process-l1-1-0.dll +0 -0
  60. package/bin/_internal/api-ms-win-crt-runtime-l1-1-0.dll +0 -0
  61. package/bin/_internal/api-ms-win-crt-stdio-l1-1-0.dll +0 -0
  62. package/bin/_internal/api-ms-win-crt-string-l1-1-0.dll +0 -0
  63. package/bin/_internal/api-ms-win-crt-time-l1-1-0.dll +0 -0
  64. package/bin/_internal/api-ms-win-crt-utility-l1-1-0.dll +0 -0
  65. package/bin/_internal/base_library.zip +0 -0
  66. package/bin/_internal/charset_normalizer/cd.cp312-win_amd64.pyd +0 -0
  67. package/bin/_internal/charset_normalizer/md.cp312-win_amd64.pyd +0 -0
  68. package/bin/_internal/cryptography/hazmat/bindings/_rust.pyd +0 -0
  69. package/bin/_internal/cryptography-46.0.7.dist-info/RECORD +2 -2
  70. package/bin/_internal/cryptography-46.0.7.dist-info/WHEEL +1 -2
  71. package/bin/_internal/email_validator-2.3.0.dist-info/RECORD +1 -1
  72. package/bin/_internal/frozenlist/_frozenlist.cp312-win_amd64.pyd +0 -0
  73. package/bin/_internal/integrations/cli_wrappers/IMPORTANT_USE_CASES.md +32 -32
  74. package/bin/_internal/integrations/github/claude-code-action/CLAUDE.md +136 -136
  75. package/bin/_internal/integrations/github/claude-code-action/CODE_OF_CONDUCT.md +128 -128
  76. package/bin/_internal/integrations/github/claude-code-action/CONTRIBUTING.md +116 -116
  77. package/bin/_internal/integrations/github/claude-code-action/LICENSE +20 -20
  78. package/bin/_internal/integrations/github/claude-code-action/README.md +52 -52
  79. package/bin/_internal/integrations/github/claude-code-action/ROADMAP.md +20 -20
  80. package/bin/_internal/integrations/github/claude-code-action/SECURITY.md +15 -15
  81. package/bin/_internal/integrations/github/claude-code-action/action.yml +294 -294
  82. package/bin/_internal/integrations/github/claude-code-action/base-action/CLAUDE.md +60 -60
  83. package/bin/_internal/integrations/github/claude-code-action/base-action/CODE_OF_CONDUCT.md +128 -128
  84. package/bin/_internal/integrations/github/claude-code-action/base-action/CONTRIBUTING.md +136 -136
  85. package/bin/_internal/integrations/github/claude-code-action/base-action/LICENSE +21 -21
  86. package/bin/_internal/integrations/github/claude-code-action/base-action/MIRROR_DISCLAIMER.md +11 -11
  87. package/bin/_internal/integrations/github/claude-code-action/base-action/README.md +521 -521
  88. package/bin/_internal/integrations/github/claude-code-action/base-action/action.yml +149 -149
  89. package/bin/_internal/integrations/github/claude-code-action/base-action/bun.lock +54 -54
  90. package/bin/_internal/integrations/github/claude-code-action/base-action/examples/issue-triage.yml +108 -108
  91. package/bin/_internal/integrations/github/claude-code-action/base-action/package.json +23 -23
  92. package/bin/_internal/integrations/github/claude-code-action/base-action/scripts/install-hooks.sh +12 -12
  93. package/bin/_internal/integrations/github/claude-code-action/base-action/scripts/pre-push +45 -45
  94. package/bin/_internal/integrations/github/claude-code-action/base-action/src/index.ts +82 -82
  95. package/bin/_internal/integrations/github/claude-code-action/base-action/src/prepare-prompt.ts +82 -82
  96. package/bin/_internal/integrations/github/claude-code-action/base-action/src/run-claude.ts +257 -257
  97. package/bin/_internal/integrations/github/claude-code-action/base-action/src/run-vicoa.ts +300 -300
  98. package/bin/_internal/integrations/github/claude-code-action/base-action/src/setup-claude-code-settings.ts +68 -68
  99. package/bin/_internal/integrations/github/claude-code-action/base-action/src/validate-env.ts +54 -54
  100. package/bin/_internal/integrations/github/claude-code-action/base-action/test-local.sh +11 -11
  101. package/bin/_internal/integrations/github/claude-code-action/base-action/test-mcp-local.sh +17 -17
  102. package/bin/_internal/integrations/github/claude-code-action/base-action/tsconfig.json +30 -30
  103. package/bin/_internal/integrations/github/claude-code-action/bun.lock +384 -384
  104. package/bin/_internal/integrations/github/claude-code-action/docs/capabilities-and-limitations.md +33 -33
  105. package/bin/_internal/integrations/github/claude-code-action/docs/cloud-providers.md +99 -99
  106. package/bin/_internal/integrations/github/claude-code-action/docs/configuration.md +345 -345
  107. package/bin/_internal/integrations/github/claude-code-action/docs/custom-automations.md +113 -113
  108. package/bin/_internal/integrations/github/claude-code-action/docs/experimental.md +128 -128
  109. package/bin/_internal/integrations/github/claude-code-action/docs/faq.md +205 -205
  110. package/bin/_internal/integrations/github/claude-code-action/docs/migration-guide.md +261 -261
  111. package/bin/_internal/integrations/github/claude-code-action/docs/security.md +38 -38
  112. package/bin/_internal/integrations/github/claude-code-action/docs/setup.md +146 -146
  113. package/bin/_internal/integrations/github/claude-code-action/docs/usage.md +213 -213
  114. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci/auto-fix-ci.yml +97 -97
  115. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci/commands/fix-ci.md +127 -127
  116. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci-signed/auto-fix-ci-signed.yml +97 -97
  117. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci-signed/commands/fix-ci-signed.md +148 -148
  118. package/bin/_internal/integrations/github/claude-code-action/examples/issue-deduplication.yml +63 -63
  119. package/bin/_internal/integrations/github/claude-code-action/examples/issue-triage.yml +75 -75
  120. package/bin/_internal/integrations/github/claude-code-action/examples/vicoa.yml +74 -74
  121. package/bin/_internal/integrations/github/claude-code-action/package.json +31 -31
  122. package/bin/_internal/integrations/github/claude-code-action/scripts/install-hooks.sh +12 -12
  123. package/bin/_internal/integrations/github/claude-code-action/scripts/pre-commit +45 -45
  124. package/bin/_internal/integrations/github/claude-code-action/scripts/setup-network-restrictions.sh +122 -122
  125. package/bin/_internal/integrations/github/claude-code-action/src/create-prompt/index.ts +799 -799
  126. package/bin/_internal/integrations/github/claude-code-action/src/create-prompt/types.ts +102 -102
  127. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/collect-inputs.ts +58 -58
  128. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/format-turns.ts +465 -465
  129. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/prepare.ts +98 -98
  130. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/update-comment-link.ts +245 -245
  131. package/bin/_internal/integrations/github/claude-code-action/src/github/api/client.ts +23 -23
  132. package/bin/_internal/integrations/github/claude-code-action/src/github/api/config.ts +4 -4
  133. package/bin/_internal/integrations/github/claude-code-action/src/github/api/queries/github.ts +117 -117
  134. package/bin/_internal/integrations/github/claude-code-action/src/github/context.ts +277 -277
  135. package/bin/_internal/integrations/github/claude-code-action/src/github/data/fetcher.ts +233 -233
  136. package/bin/_internal/integrations/github/claude-code-action/src/github/data/formatter.ts +144 -144
  137. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/branch-cleanup.ts +132 -132
  138. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/branch.ts +163 -163
  139. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comment-logic.ts +203 -203
  140. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/common.ts +33 -33
  141. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/create-initial.ts +111 -111
  142. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/update-claude-comment.ts +70 -70
  143. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/update-with-branch.ts +57 -57
  144. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/git-config.ts +62 -62
  145. package/bin/_internal/integrations/github/claude-code-action/src/github/token.ts +108 -108
  146. package/bin/_internal/integrations/github/claude-code-action/src/github/types.ts +98 -98
  147. package/bin/_internal/integrations/github/claude-code-action/src/github/utils/image-downloader.ts +246 -246
  148. package/bin/_internal/integrations/github/claude-code-action/src/github/utils/sanitizer.ts +100 -100
  149. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/actor.ts +64 -64
  150. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/permissions.ts +47 -47
  151. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/trigger.ts +148 -148
  152. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-actions-server.ts +279 -279
  153. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-comment-server.ts +101 -101
  154. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-file-ops-server.ts +677 -677
  155. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-inline-comment-server.ts +184 -184
  156. package/bin/_internal/integrations/github/claude-code-action/src/mcp/install-mcp-server.ts +201 -201
  157. package/bin/_internal/integrations/github/claude-code-action/src/modes/agent/index.ts +152 -152
  158. package/bin/_internal/integrations/github/claude-code-action/src/modes/agent/parse-tools.ts +22 -22
  159. package/bin/_internal/integrations/github/claude-code-action/src/modes/detector.ts +66 -66
  160. package/bin/_internal/integrations/github/claude-code-action/src/modes/registry.ts +54 -54
  161. package/bin/_internal/integrations/github/claude-code-action/src/modes/tag/index.ts +187 -187
  162. package/bin/_internal/integrations/github/claude-code-action/src/modes/types.ts +100 -100
  163. package/bin/_internal/integrations/github/claude-code-action/src/prepare/index.ts +20 -20
  164. package/bin/_internal/integrations/github/claude-code-action/src/prepare/types.ts +20 -20
  165. package/bin/_internal/integrations/github/claude-code-action/src/utils/retry.ts +40 -40
  166. package/bin/_internal/integrations/github/claude-code-action/tsconfig.json +30 -30
  167. package/bin/_internal/integrations/n8n/LICENSE +20 -20
  168. package/bin/_internal/integrations/n8n/README.md +297 -297
  169. package/bin/_internal/integrations/n8n/package-lock.json +2989 -2989
  170. package/bin/_internal/integrations/n8n/package.json +68 -68
  171. package/bin/_internal/integrations/n8n/src/credentials/OmnaraApi.credentials.ts +52 -52
  172. package/bin/_internal/integrations/n8n/src/nodes/Omnara/Omnara.node.json +34 -34
  173. package/bin/_internal/integrations/n8n/src/nodes/Omnara/Omnara.node.ts +304 -304
  174. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/index.ts +37 -37
  175. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/send.operation.ts +151 -151
  176. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/sendAndWait.operation.ts +252 -252
  177. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/session/end.operation.ts +56 -56
  178. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/session/index.ts +29 -29
  179. package/bin/_internal/integrations/n8n/src/utils/GenericFunctions.ts +92 -92
  180. package/bin/_internal/integrations/n8n/src/utils/sendAndWait/configureWaitTillDate.ts +42 -42
  181. package/bin/_internal/integrations/n8n/src/utils/sendAndWait/descriptions.ts +20 -20
  182. package/bin/_internal/integrations/n8n/src/utils/sendAndWaitWebhook.ts +72 -72
  183. package/bin/_internal/integrations/n8n/tsconfig.json +19 -19
  184. package/bin/_internal/jiter/jiter.cp312-win_amd64.pyd +0 -0
  185. package/bin/_internal/jsonschema-4.26.0.dist-info/RECORD +1 -1
  186. package/bin/_internal/libcrypto-3.dll +0 -0
  187. package/bin/_internal/libffi-8.dll +0 -0
  188. package/bin/_internal/libssl-3.dll +0 -0
  189. package/bin/_internal/mcp-1.27.0.dist-info/RECORD +1 -1
  190. package/bin/_internal/multidict/_multidict.cp312-win_amd64.pyd +0 -0
  191. package/bin/_internal/propcache/_helpers_c.cp312-win_amd64.pyd +0 -0
  192. package/bin/_internal/pydantic_core/_pydantic_core.cp312-win_amd64.pyd +0 -0
  193. package/bin/_internal/pyexpat.pyd +0 -0
  194. package/bin/_internal/python3.dll +0 -0
  195. package/bin/_internal/python312.dll +0 -0
  196. package/bin/_internal/pywin32_system32/pythoncom312.dll +0 -0
  197. package/bin/_internal/pywin32_system32/pywintypes312.dll +0 -0
  198. package/bin/_internal/rpds/rpds.cp312-win_amd64.pyd +0 -0
  199. package/bin/_internal/select.pyd +0 -0
  200. package/bin/_internal/ucrtbase.dll +0 -0
  201. package/bin/_internal/{python3.12/lib-dynload/unicodedata.cpython-312-x86_64-linux-gnu.so → unicodedata.pyd} +0 -0
  202. package/bin/_internal/vicoa/_bin/README.md +28 -28
  203. package/bin/_internal/vicoa-1.3.10.dist-info/METADATA +311 -311
  204. package/bin/_internal/vicoa-1.3.10.dist-info/RECORD +6 -6
  205. package/bin/_internal/vicoa-1.3.10.dist-info/WHEEL +1 -1
  206. package/bin/_internal/vicoa-1.3.10.dist-info/direct_url.json +1 -1
  207. package/bin/_internal/vicoa-1.3.10.dist-info/licenses/LICENSE +201 -201
  208. package/bin/_internal/watchfiles/_rust_notify.cp312-win_amd64.pyd +0 -0
  209. package/bin/_internal/websockets/speedups.cp312-win_amd64.pyd +0 -0
  210. package/bin/_internal/websockets-16.0.dist-info/METADATA +179 -179
  211. package/bin/_internal/websockets-16.0.dist-info/RECORD +53 -53
  212. package/bin/_internal/websockets-16.0.dist-info/WHEEL +1 -3
  213. package/bin/_internal/websockets-16.0.dist-info/licenses/LICENSE +24 -24
  214. package/bin/_internal/win32/_win32sysloader.pyd +0 -0
  215. package/bin/_internal/win32/win32api.pyd +0 -0
  216. package/bin/_internal/win32/win32evtlog.pyd +0 -0
  217. package/bin/_internal/win32/win32job.pyd +0 -0
  218. package/bin/_internal/yaml/_yaml.cp312-win_amd64.pyd +0 -0
  219. package/bin/_internal/yarl/_quoting_c.cp312-win_amd64.pyd +0 -0
  220. package/bin/{vicoa → vicoa.exe} +0 -0
  221. package/package.json +3 -3
  222. package/bin/_internal/81d243bd2c585b0f4821__mypyc.cpython-312-x86_64-linux-gnu.so +0 -0
  223. package/bin/_internal/_cffi_backend.cpython-312-x86_64-linux-gnu.so +0 -0
  224. package/bin/_internal/aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so +0 -0
  225. package/bin/_internal/aiohttp/_http_writer.cpython-312-x86_64-linux-gnu.so +0 -0
  226. package/bin/_internal/aiohttp/_websocket/mask.cpython-312-x86_64-linux-gnu.so +0 -0
  227. package/bin/_internal/aiohttp/_websocket/reader_c.cpython-312-x86_64-linux-gnu.so +0 -0
  228. package/bin/_internal/caio/linux_aio.cpython-312-x86_64-linux-gnu.so +0 -0
  229. package/bin/_internal/caio/thread_aio.cpython-312-x86_64-linux-gnu.so +0 -0
  230. package/bin/_internal/charset_normalizer/cd.cpython-312-x86_64-linux-gnu.so +0 -0
  231. package/bin/_internal/charset_normalizer/md.cpython-312-x86_64-linux-gnu.so +0 -0
  232. package/bin/_internal/cryptography/hazmat/bindings/_rust.abi3.so +0 -0
  233. package/bin/_internal/frozenlist/_frozenlist.cpython-312-x86_64-linux-gnu.so +0 -0
  234. package/bin/_internal/jiter/jiter.cpython-312-x86_64-linux-gnu.so +0 -0
  235. package/bin/_internal/libbz2.so.1.0 +0 -0
  236. package/bin/_internal/libcrypto.so.3 +0 -0
  237. package/bin/_internal/libffi.so.8 +0 -0
  238. package/bin/_internal/libgcc_s.so.1 +0 -0
  239. package/bin/_internal/liblzma.so.5 +0 -0
  240. package/bin/_internal/libpython3.12.so.1.0 +0 -0
  241. package/bin/_internal/libreadline.so.8 +0 -0
  242. package/bin/_internal/libssl.so.3 +0 -0
  243. package/bin/_internal/libstdc++.so.6 +0 -0
  244. package/bin/_internal/libtinfo.so.6 +0 -0
  245. package/bin/_internal/libuuid.so.1 +0 -0
  246. package/bin/_internal/libz.so.1 +0 -0
  247. package/bin/_internal/multidict/_multidict.cpython-312-x86_64-linux-gnu.so +0 -0
  248. package/bin/_internal/propcache/_helpers_c.cpython-312-x86_64-linux-gnu.so +0 -0
  249. package/bin/_internal/pydantic_core/_pydantic_core.cpython-312-x86_64-linux-gnu.so +0 -0
  250. package/bin/_internal/python3.12/lib-dynload/_asyncio.cpython-312-x86_64-linux-gnu.so +0 -0
  251. package/bin/_internal/python3.12/lib-dynload/_bisect.cpython-312-x86_64-linux-gnu.so +0 -0
  252. package/bin/_internal/python3.12/lib-dynload/_blake2.cpython-312-x86_64-linux-gnu.so +0 -0
  253. package/bin/_internal/python3.12/lib-dynload/_bz2.cpython-312-x86_64-linux-gnu.so +0 -0
  254. package/bin/_internal/python3.12/lib-dynload/_codecs_cn.cpython-312-x86_64-linux-gnu.so +0 -0
  255. package/bin/_internal/python3.12/lib-dynload/_codecs_hk.cpython-312-x86_64-linux-gnu.so +0 -0
  256. package/bin/_internal/python3.12/lib-dynload/_codecs_iso2022.cpython-312-x86_64-linux-gnu.so +0 -0
  257. package/bin/_internal/python3.12/lib-dynload/_codecs_jp.cpython-312-x86_64-linux-gnu.so +0 -0
  258. package/bin/_internal/python3.12/lib-dynload/_codecs_kr.cpython-312-x86_64-linux-gnu.so +0 -0
  259. package/bin/_internal/python3.12/lib-dynload/_codecs_tw.cpython-312-x86_64-linux-gnu.so +0 -0
  260. package/bin/_internal/python3.12/lib-dynload/_contextvars.cpython-312-x86_64-linux-gnu.so +0 -0
  261. package/bin/_internal/python3.12/lib-dynload/_csv.cpython-312-x86_64-linux-gnu.so +0 -0
  262. package/bin/_internal/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-gnu.so +0 -0
  263. package/bin/_internal/python3.12/lib-dynload/_datetime.cpython-312-x86_64-linux-gnu.so +0 -0
  264. package/bin/_internal/python3.12/lib-dynload/_decimal.cpython-312-x86_64-linux-gnu.so +0 -0
  265. package/bin/_internal/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so +0 -0
  266. package/bin/_internal/python3.12/lib-dynload/_heapq.cpython-312-x86_64-linux-gnu.so +0 -0
  267. package/bin/_internal/python3.12/lib-dynload/_json.cpython-312-x86_64-linux-gnu.so +0 -0
  268. package/bin/_internal/python3.12/lib-dynload/_lzma.cpython-312-x86_64-linux-gnu.so +0 -0
  269. package/bin/_internal/python3.12/lib-dynload/_md5.cpython-312-x86_64-linux-gnu.so +0 -0
  270. package/bin/_internal/python3.12/lib-dynload/_multibytecodec.cpython-312-x86_64-linux-gnu.so +0 -0
  271. package/bin/_internal/python3.12/lib-dynload/_multiprocessing.cpython-312-x86_64-linux-gnu.so +0 -0
  272. package/bin/_internal/python3.12/lib-dynload/_opcode.cpython-312-x86_64-linux-gnu.so +0 -0
  273. package/bin/_internal/python3.12/lib-dynload/_pickle.cpython-312-x86_64-linux-gnu.so +0 -0
  274. package/bin/_internal/python3.12/lib-dynload/_posixshmem.cpython-312-x86_64-linux-gnu.so +0 -0
  275. package/bin/_internal/python3.12/lib-dynload/_posixsubprocess.cpython-312-x86_64-linux-gnu.so +0 -0
  276. package/bin/_internal/python3.12/lib-dynload/_queue.cpython-312-x86_64-linux-gnu.so +0 -0
  277. package/bin/_internal/python3.12/lib-dynload/_random.cpython-312-x86_64-linux-gnu.so +0 -0
  278. package/bin/_internal/python3.12/lib-dynload/_sha1.cpython-312-x86_64-linux-gnu.so +0 -0
  279. package/bin/_internal/python3.12/lib-dynload/_sha2.cpython-312-x86_64-linux-gnu.so +0 -0
  280. package/bin/_internal/python3.12/lib-dynload/_sha3.cpython-312-x86_64-linux-gnu.so +0 -0
  281. package/bin/_internal/python3.12/lib-dynload/_socket.cpython-312-x86_64-linux-gnu.so +0 -0
  282. package/bin/_internal/python3.12/lib-dynload/_ssl.cpython-312-x86_64-linux-gnu.so +0 -0
  283. package/bin/_internal/python3.12/lib-dynload/_statistics.cpython-312-x86_64-linux-gnu.so +0 -0
  284. package/bin/_internal/python3.12/lib-dynload/_struct.cpython-312-x86_64-linux-gnu.so +0 -0
  285. package/bin/_internal/python3.12/lib-dynload/_uuid.cpython-312-x86_64-linux-gnu.so +0 -0
  286. package/bin/_internal/python3.12/lib-dynload/_zoneinfo.cpython-312-x86_64-linux-gnu.so +0 -0
  287. package/bin/_internal/python3.12/lib-dynload/array.cpython-312-x86_64-linux-gnu.so +0 -0
  288. package/bin/_internal/python3.12/lib-dynload/binascii.cpython-312-x86_64-linux-gnu.so +0 -0
  289. package/bin/_internal/python3.12/lib-dynload/fcntl.cpython-312-x86_64-linux-gnu.so +0 -0
  290. package/bin/_internal/python3.12/lib-dynload/grp.cpython-312-x86_64-linux-gnu.so +0 -0
  291. package/bin/_internal/python3.12/lib-dynload/math.cpython-312-x86_64-linux-gnu.so +0 -0
  292. package/bin/_internal/python3.12/lib-dynload/mmap.cpython-312-x86_64-linux-gnu.so +0 -0
  293. package/bin/_internal/python3.12/lib-dynload/pyexpat.cpython-312-x86_64-linux-gnu.so +0 -0
  294. package/bin/_internal/python3.12/lib-dynload/readline.cpython-312-x86_64-linux-gnu.so +0 -0
  295. package/bin/_internal/python3.12/lib-dynload/resource.cpython-312-x86_64-linux-gnu.so +0 -0
  296. package/bin/_internal/python3.12/lib-dynload/select.cpython-312-x86_64-linux-gnu.so +0 -0
  297. package/bin/_internal/python3.12/lib-dynload/syslog.cpython-312-x86_64-linux-gnu.so +0 -0
  298. package/bin/_internal/python3.12/lib-dynload/termios.cpython-312-x86_64-linux-gnu.so +0 -0
  299. package/bin/_internal/python3.12/lib-dynload/zlib.cpython-312-x86_64-linux-gnu.so +0 -0
  300. package/bin/_internal/rpds/rpds.cpython-312-x86_64-linux-gnu.so +0 -0
  301. package/bin/_internal/watchfiles/_rust_notify.cpython-312-x86_64-linux-gnu.so +0 -0
  302. package/bin/_internal/websockets/speedups.cpython-312-x86_64-linux-gnu.so +0 -0
  303. package/bin/_internal/yaml/_yaml.cpython-312-x86_64-linux-gnu.so +0 -0
  304. package/bin/_internal/yarl/_quoting_c.cpython-312-x86_64-linux-gnu.so +0 -0
@@ -1,465 +1,465 @@
1
- #!/usr/bin/env bun
2
-
3
- import { readFileSync, existsSync } from "fs";
4
- import { exit } from "process";
5
-
6
- export type ToolUse = {
7
- type: string;
8
- name?: string;
9
- input?: Record<string, any>;
10
- id?: string;
11
- };
12
-
13
- export type ToolResult = {
14
- type: string;
15
- tool_use_id?: string;
16
- content?: any;
17
- is_error?: boolean;
18
- };
19
-
20
- export type ContentItem = {
21
- type: string;
22
- text?: string;
23
- tool_use_id?: string;
24
- content?: any;
25
- is_error?: boolean;
26
- name?: string;
27
- input?: Record<string, any>;
28
- id?: string;
29
- };
30
-
31
- export type Message = {
32
- content: ContentItem[];
33
- usage?: {
34
- input_tokens?: number;
35
- output_tokens?: number;
36
- };
37
- };
38
-
39
- export type Turn = {
40
- type: string;
41
- subtype?: string;
42
- message?: Message;
43
- tools?: any[];
44
- cost_usd?: number;
45
- duration_ms?: number;
46
- result?: string;
47
- };
48
-
49
- export type GroupedContent = {
50
- type: string;
51
- tools_count?: number;
52
- data?: Turn;
53
- text_parts?: string[];
54
- tool_calls?: { tool_use: ToolUse; tool_result?: ToolResult }[];
55
- usage?: Record<string, number>;
56
- };
57
-
58
- export function detectContentType(content: any): string {
59
- const contentStr = String(content).trim();
60
-
61
- // Check for JSON
62
- if (contentStr.startsWith("{") && contentStr.endsWith("}")) {
63
- try {
64
- JSON.parse(contentStr);
65
- return "json";
66
- } catch {
67
- // Fall through
68
- }
69
- }
70
-
71
- if (contentStr.startsWith("[") && contentStr.endsWith("]")) {
72
- try {
73
- JSON.parse(contentStr);
74
- return "json";
75
- } catch {
76
- // Fall through
77
- }
78
- }
79
-
80
- // Check for code-like content
81
- const codeKeywords = [
82
- "def ",
83
- "class ",
84
- "import ",
85
- "from ",
86
- "function ",
87
- "const ",
88
- "let ",
89
- "var ",
90
- ];
91
- if (codeKeywords.some((keyword) => contentStr.includes(keyword))) {
92
- if (
93
- contentStr.includes("def ") ||
94
- contentStr.includes("import ") ||
95
- contentStr.includes("from ")
96
- ) {
97
- return "python";
98
- } else if (
99
- ["function ", "const ", "let ", "var ", "=>"].some((js) =>
100
- contentStr.includes(js),
101
- )
102
- ) {
103
- return "javascript";
104
- } else {
105
- return "python"; // default for code
106
- }
107
- }
108
-
109
- // Check for shell/bash output
110
- const shellIndicators = ["ls -", "cd ", "mkdir ", "rm ", "$ ", "# "];
111
- if (
112
- contentStr.startsWith("/") ||
113
- contentStr.includes("Error:") ||
114
- contentStr.startsWith("total ") ||
115
- shellIndicators.some((indicator) => contentStr.includes(indicator))
116
- ) {
117
- return "bash";
118
- }
119
-
120
- // Check for diff format
121
- if (
122
- contentStr.startsWith("@@") ||
123
- contentStr.includes("+++ ") ||
124
- contentStr.includes("--- ")
125
- ) {
126
- return "diff";
127
- }
128
-
129
- // Check for HTML/XML
130
- if (contentStr.startsWith("<") && contentStr.endsWith(">")) {
131
- return "html";
132
- }
133
-
134
- // Check for markdown
135
- const mdIndicators = ["# ", "## ", "### ", "- ", "* ", "```"];
136
- if (mdIndicators.some((indicator) => contentStr.includes(indicator))) {
137
- return "markdown";
138
- }
139
-
140
- // Default to plain text
141
- return "text";
142
- }
143
-
144
- export function formatResultContent(content: any): string {
145
- if (!content) {
146
- return "*(No output)*\n\n";
147
- }
148
-
149
- let contentStr: string;
150
-
151
- // Check if content is a list with "type": "text" structure
152
- try {
153
- let parsedContent: any;
154
- if (typeof content === "string") {
155
- parsedContent = JSON.parse(content);
156
- } else {
157
- parsedContent = content;
158
- }
159
-
160
- if (
161
- Array.isArray(parsedContent) &&
162
- parsedContent.length > 0 &&
163
- typeof parsedContent[0] === "object" &&
164
- parsedContent[0]?.type === "text"
165
- ) {
166
- // Extract the text field from the first item
167
- contentStr = parsedContent[0]?.text || "";
168
- } else {
169
- contentStr = String(content).trim();
170
- }
171
- } catch {
172
- contentStr = String(content).trim();
173
- }
174
-
175
- // Truncate very long results
176
- if (contentStr.length > 3000) {
177
- contentStr = contentStr.substring(0, 2997) + "...";
178
- }
179
-
180
- // Detect content type
181
- const contentType = detectContentType(contentStr);
182
-
183
- // Handle JSON content specially - pretty print it
184
- if (contentType === "json") {
185
- try {
186
- // Try to parse and pretty print JSON
187
- const parsed = JSON.parse(contentStr);
188
- contentStr = JSON.stringify(parsed, null, 2);
189
- } catch {
190
- // Keep original if parsing fails
191
- }
192
- }
193
-
194
- // Format with appropriate syntax highlighting
195
- if (
196
- contentType === "text" &&
197
- contentStr.length < 100 &&
198
- !contentStr.includes("\n")
199
- ) {
200
- // Short text results don't need code blocks
201
- return `**→** ${contentStr}\n\n`;
202
- } else {
203
- return `**Result:**\n\`\`\`${contentType}\n${contentStr}\n\`\`\`\n\n`;
204
- }
205
- }
206
-
207
- export function formatToolWithResult(
208
- toolUse: ToolUse,
209
- toolResult?: ToolResult,
210
- ): string {
211
- const toolName = toolUse.name || "unknown_tool";
212
- const toolInput = toolUse.input || {};
213
-
214
- let result = `### 🔧 \`${toolName}\`\n\n`;
215
-
216
- // Add parameters if they exist and are not empty
217
- if (Object.keys(toolInput).length > 0) {
218
- result += "**Parameters:**\n```json\n";
219
- result += JSON.stringify(toolInput, null, 2);
220
- result += "\n```\n\n";
221
- }
222
-
223
- // Add result if available
224
- if (toolResult) {
225
- const content = toolResult.content || "";
226
- const isError = toolResult.is_error || false;
227
-
228
- if (isError) {
229
- result += `❌ **Error:** \`${content}\`\n\n`;
230
- } else {
231
- result += formatResultContent(content);
232
- }
233
- }
234
-
235
- return result;
236
- }
237
-
238
- export function groupTurnsNaturally(data: Turn[]): GroupedContent[] {
239
- const groupedContent: GroupedContent[] = [];
240
- const toolResultsMap = new Map<string, ToolResult>();
241
-
242
- // First pass: collect all tool results by tool_use_id
243
- for (const turn of data) {
244
- if (turn.type === "user") {
245
- const content = turn.message?.content || [];
246
- for (const item of content) {
247
- if (item.type === "tool_result" && item.tool_use_id) {
248
- toolResultsMap.set(item.tool_use_id, {
249
- type: item.type,
250
- tool_use_id: item.tool_use_id,
251
- content: item.content,
252
- is_error: item.is_error,
253
- });
254
- }
255
- }
256
- }
257
- }
258
-
259
- // Second pass: process turns and group naturally
260
- for (const turn of data) {
261
- const turnType = turn.type || "unknown";
262
-
263
- if (turnType === "system") {
264
- const subtype = turn.subtype || "";
265
- if (subtype === "init") {
266
- const tools = turn.tools || [];
267
- groupedContent.push({
268
- type: "system_init",
269
- tools_count: tools.length,
270
- });
271
- } else {
272
- groupedContent.push({
273
- type: "system_other",
274
- data: turn,
275
- });
276
- }
277
- } else if (turnType === "assistant") {
278
- const message = turn.message || { content: [] };
279
- const content = message.content || [];
280
- const usage = message.usage || {};
281
-
282
- // Process content items
283
- const textParts: string[] = [];
284
- const toolCalls: { tool_use: ToolUse; tool_result?: ToolResult }[] = [];
285
-
286
- for (const item of content) {
287
- const itemType = item.type || "";
288
-
289
- if (itemType === "text") {
290
- textParts.push(item.text || "");
291
- } else if (itemType === "tool_use") {
292
- const toolUseId = item.id;
293
- const toolResult = toolUseId
294
- ? toolResultsMap.get(toolUseId)
295
- : undefined;
296
- toolCalls.push({
297
- tool_use: {
298
- type: item.type,
299
- name: item.name,
300
- input: item.input,
301
- id: item.id,
302
- },
303
- tool_result: toolResult,
304
- });
305
- }
306
- }
307
-
308
- if (textParts.length > 0 || toolCalls.length > 0) {
309
- groupedContent.push({
310
- type: "assistant_action",
311
- text_parts: textParts,
312
- tool_calls: toolCalls,
313
- usage: usage,
314
- });
315
- }
316
- } else if (turnType === "user") {
317
- // Handle user messages that aren't tool results
318
- const message = turn.message || { content: [] };
319
- const content = message.content || [];
320
- const textParts: string[] = [];
321
-
322
- for (const item of content) {
323
- if (item.type === "text") {
324
- textParts.push(item.text || "");
325
- }
326
- }
327
-
328
- if (textParts.length > 0) {
329
- groupedContent.push({
330
- type: "user_message",
331
- text_parts: textParts,
332
- });
333
- }
334
- } else if (turnType === "result") {
335
- groupedContent.push({
336
- type: "final_result",
337
- data: turn,
338
- });
339
- }
340
- }
341
-
342
- return groupedContent;
343
- }
344
-
345
- export function formatGroupedContent(groupedContent: GroupedContent[]): string {
346
- let markdown = "## Claude Code Report\n\n";
347
-
348
- for (const item of groupedContent) {
349
- const itemType = item.type;
350
-
351
- if (itemType === "system_init") {
352
- markdown += `## 🚀 System Initialization\n\n**Available Tools:** ${item.tools_count} tools loaded\n\n---\n\n`;
353
- } else if (itemType === "system_other") {
354
- markdown += `## ⚙️ System Message\n\n${JSON.stringify(item.data, null, 2)}\n\n---\n\n`;
355
- } else if (itemType === "assistant_action") {
356
- // Add text content first (if any) - no header needed
357
- for (const text of item.text_parts || []) {
358
- if (text.trim()) {
359
- markdown += `${text}\n\n`;
360
- }
361
- }
362
-
363
- // Add tool calls with their results
364
- for (const toolCall of item.tool_calls || []) {
365
- markdown += formatToolWithResult(
366
- toolCall.tool_use,
367
- toolCall.tool_result,
368
- );
369
- }
370
-
371
- // Add usage info if available
372
- const usage = item.usage || {};
373
- if (Object.keys(usage).length > 0) {
374
- const inputTokens = usage.input_tokens || 0;
375
- const cacheCreationTokens = usage.cache_creation_input_tokens || 0;
376
- const cacheReadTokens = usage.cache_read_input_tokens || 0;
377
- const totalInputTokens =
378
- inputTokens + cacheCreationTokens + cacheReadTokens;
379
- const outputTokens = usage.output_tokens || 0;
380
- markdown += `*Token usage: ${totalInputTokens} input, ${outputTokens} output*\n\n`;
381
- }
382
-
383
- // Only add separator if this section had content
384
- if (
385
- (item.text_parts && item.text_parts.length > 0) ||
386
- (item.tool_calls && item.tool_calls.length > 0)
387
- ) {
388
- markdown += "---\n\n";
389
- }
390
- } else if (itemType === "user_message") {
391
- markdown += "## 👤 User\n\n";
392
- for (const text of item.text_parts || []) {
393
- if (text.trim()) {
394
- markdown += `${text}\n\n`;
395
- }
396
- }
397
- markdown += "---\n\n";
398
- } else if (itemType === "final_result") {
399
- const data = item.data || {};
400
- const cost = (data as any).total_cost_usd || (data as any).cost_usd || 0;
401
- const duration = (data as any).duration_ms || 0;
402
- const resultText = (data as any).result || "";
403
-
404
- markdown += "## ✅ Final Result\n\n";
405
- if (resultText) {
406
- markdown += `${resultText}\n\n`;
407
- }
408
- markdown += `**Cost:** $${cost.toFixed(4)} | **Duration:** ${(duration / 1000).toFixed(1)}s\n\n`;
409
- }
410
- }
411
-
412
- return markdown;
413
- }
414
-
415
- export function formatTurnsFromData(data: Turn[]): string {
416
- // Group turns naturally
417
- const groupedContent = groupTurnsNaturally(data);
418
-
419
- // Generate markdown
420
- const markdown = formatGroupedContent(groupedContent);
421
-
422
- return markdown;
423
- }
424
-
425
- function main(): void {
426
- // Get the JSON file path from command line arguments
427
- const args = process.argv.slice(2);
428
- if (args.length === 0) {
429
- console.error("Usage: format-turns.ts <json-file>");
430
- exit(1);
431
- }
432
-
433
- const jsonFile = args[0];
434
- if (!jsonFile) {
435
- console.error("Error: No JSON file provided");
436
- exit(1);
437
- }
438
-
439
- if (!existsSync(jsonFile)) {
440
- console.error(`Error: ${jsonFile} not found`);
441
- exit(1);
442
- }
443
-
444
- try {
445
- // Read the JSON file
446
- const fileContent = readFileSync(jsonFile, "utf-8");
447
- const data: Turn[] = JSON.parse(fileContent);
448
-
449
- // Group turns naturally
450
- const groupedContent = groupTurnsNaturally(data);
451
-
452
- // Generate markdown
453
- const markdown = formatGroupedContent(groupedContent);
454
-
455
- // Print to stdout (so it can be captured by shell)
456
- console.log(markdown);
457
- } catch (error) {
458
- console.error(`Error processing file: ${error}`);
459
- exit(1);
460
- }
461
- }
462
-
463
- if (import.meta.main) {
464
- main();
465
- }
1
+ #!/usr/bin/env bun
2
+
3
+ import { readFileSync, existsSync } from "fs";
4
+ import { exit } from "process";
5
+
6
+ export type ToolUse = {
7
+ type: string;
8
+ name?: string;
9
+ input?: Record<string, any>;
10
+ id?: string;
11
+ };
12
+
13
+ export type ToolResult = {
14
+ type: string;
15
+ tool_use_id?: string;
16
+ content?: any;
17
+ is_error?: boolean;
18
+ };
19
+
20
+ export type ContentItem = {
21
+ type: string;
22
+ text?: string;
23
+ tool_use_id?: string;
24
+ content?: any;
25
+ is_error?: boolean;
26
+ name?: string;
27
+ input?: Record<string, any>;
28
+ id?: string;
29
+ };
30
+
31
+ export type Message = {
32
+ content: ContentItem[];
33
+ usage?: {
34
+ input_tokens?: number;
35
+ output_tokens?: number;
36
+ };
37
+ };
38
+
39
+ export type Turn = {
40
+ type: string;
41
+ subtype?: string;
42
+ message?: Message;
43
+ tools?: any[];
44
+ cost_usd?: number;
45
+ duration_ms?: number;
46
+ result?: string;
47
+ };
48
+
49
+ export type GroupedContent = {
50
+ type: string;
51
+ tools_count?: number;
52
+ data?: Turn;
53
+ text_parts?: string[];
54
+ tool_calls?: { tool_use: ToolUse; tool_result?: ToolResult }[];
55
+ usage?: Record<string, number>;
56
+ };
57
+
58
+ export function detectContentType(content: any): string {
59
+ const contentStr = String(content).trim();
60
+
61
+ // Check for JSON
62
+ if (contentStr.startsWith("{") && contentStr.endsWith("}")) {
63
+ try {
64
+ JSON.parse(contentStr);
65
+ return "json";
66
+ } catch {
67
+ // Fall through
68
+ }
69
+ }
70
+
71
+ if (contentStr.startsWith("[") && contentStr.endsWith("]")) {
72
+ try {
73
+ JSON.parse(contentStr);
74
+ return "json";
75
+ } catch {
76
+ // Fall through
77
+ }
78
+ }
79
+
80
+ // Check for code-like content
81
+ const codeKeywords = [
82
+ "def ",
83
+ "class ",
84
+ "import ",
85
+ "from ",
86
+ "function ",
87
+ "const ",
88
+ "let ",
89
+ "var ",
90
+ ];
91
+ if (codeKeywords.some((keyword) => contentStr.includes(keyword))) {
92
+ if (
93
+ contentStr.includes("def ") ||
94
+ contentStr.includes("import ") ||
95
+ contentStr.includes("from ")
96
+ ) {
97
+ return "python";
98
+ } else if (
99
+ ["function ", "const ", "let ", "var ", "=>"].some((js) =>
100
+ contentStr.includes(js),
101
+ )
102
+ ) {
103
+ return "javascript";
104
+ } else {
105
+ return "python"; // default for code
106
+ }
107
+ }
108
+
109
+ // Check for shell/bash output
110
+ const shellIndicators = ["ls -", "cd ", "mkdir ", "rm ", "$ ", "# "];
111
+ if (
112
+ contentStr.startsWith("/") ||
113
+ contentStr.includes("Error:") ||
114
+ contentStr.startsWith("total ") ||
115
+ shellIndicators.some((indicator) => contentStr.includes(indicator))
116
+ ) {
117
+ return "bash";
118
+ }
119
+
120
+ // Check for diff format
121
+ if (
122
+ contentStr.startsWith("@@") ||
123
+ contentStr.includes("+++ ") ||
124
+ contentStr.includes("--- ")
125
+ ) {
126
+ return "diff";
127
+ }
128
+
129
+ // Check for HTML/XML
130
+ if (contentStr.startsWith("<") && contentStr.endsWith(">")) {
131
+ return "html";
132
+ }
133
+
134
+ // Check for markdown
135
+ const mdIndicators = ["# ", "## ", "### ", "- ", "* ", "```"];
136
+ if (mdIndicators.some((indicator) => contentStr.includes(indicator))) {
137
+ return "markdown";
138
+ }
139
+
140
+ // Default to plain text
141
+ return "text";
142
+ }
143
+
144
+ export function formatResultContent(content: any): string {
145
+ if (!content) {
146
+ return "*(No output)*\n\n";
147
+ }
148
+
149
+ let contentStr: string;
150
+
151
+ // Check if content is a list with "type": "text" structure
152
+ try {
153
+ let parsedContent: any;
154
+ if (typeof content === "string") {
155
+ parsedContent = JSON.parse(content);
156
+ } else {
157
+ parsedContent = content;
158
+ }
159
+
160
+ if (
161
+ Array.isArray(parsedContent) &&
162
+ parsedContent.length > 0 &&
163
+ typeof parsedContent[0] === "object" &&
164
+ parsedContent[0]?.type === "text"
165
+ ) {
166
+ // Extract the text field from the first item
167
+ contentStr = parsedContent[0]?.text || "";
168
+ } else {
169
+ contentStr = String(content).trim();
170
+ }
171
+ } catch {
172
+ contentStr = String(content).trim();
173
+ }
174
+
175
+ // Truncate very long results
176
+ if (contentStr.length > 3000) {
177
+ contentStr = contentStr.substring(0, 2997) + "...";
178
+ }
179
+
180
+ // Detect content type
181
+ const contentType = detectContentType(contentStr);
182
+
183
+ // Handle JSON content specially - pretty print it
184
+ if (contentType === "json") {
185
+ try {
186
+ // Try to parse and pretty print JSON
187
+ const parsed = JSON.parse(contentStr);
188
+ contentStr = JSON.stringify(parsed, null, 2);
189
+ } catch {
190
+ // Keep original if parsing fails
191
+ }
192
+ }
193
+
194
+ // Format with appropriate syntax highlighting
195
+ if (
196
+ contentType === "text" &&
197
+ contentStr.length < 100 &&
198
+ !contentStr.includes("\n")
199
+ ) {
200
+ // Short text results don't need code blocks
201
+ return `**→** ${contentStr}\n\n`;
202
+ } else {
203
+ return `**Result:**\n\`\`\`${contentType}\n${contentStr}\n\`\`\`\n\n`;
204
+ }
205
+ }
206
+
207
+ export function formatToolWithResult(
208
+ toolUse: ToolUse,
209
+ toolResult?: ToolResult,
210
+ ): string {
211
+ const toolName = toolUse.name || "unknown_tool";
212
+ const toolInput = toolUse.input || {};
213
+
214
+ let result = `### 🔧 \`${toolName}\`\n\n`;
215
+
216
+ // Add parameters if they exist and are not empty
217
+ if (Object.keys(toolInput).length > 0) {
218
+ result += "**Parameters:**\n```json\n";
219
+ result += JSON.stringify(toolInput, null, 2);
220
+ result += "\n```\n\n";
221
+ }
222
+
223
+ // Add result if available
224
+ if (toolResult) {
225
+ const content = toolResult.content || "";
226
+ const isError = toolResult.is_error || false;
227
+
228
+ if (isError) {
229
+ result += `❌ **Error:** \`${content}\`\n\n`;
230
+ } else {
231
+ result += formatResultContent(content);
232
+ }
233
+ }
234
+
235
+ return result;
236
+ }
237
+
238
+ export function groupTurnsNaturally(data: Turn[]): GroupedContent[] {
239
+ const groupedContent: GroupedContent[] = [];
240
+ const toolResultsMap = new Map<string, ToolResult>();
241
+
242
+ // First pass: collect all tool results by tool_use_id
243
+ for (const turn of data) {
244
+ if (turn.type === "user") {
245
+ const content = turn.message?.content || [];
246
+ for (const item of content) {
247
+ if (item.type === "tool_result" && item.tool_use_id) {
248
+ toolResultsMap.set(item.tool_use_id, {
249
+ type: item.type,
250
+ tool_use_id: item.tool_use_id,
251
+ content: item.content,
252
+ is_error: item.is_error,
253
+ });
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+ // Second pass: process turns and group naturally
260
+ for (const turn of data) {
261
+ const turnType = turn.type || "unknown";
262
+
263
+ if (turnType === "system") {
264
+ const subtype = turn.subtype || "";
265
+ if (subtype === "init") {
266
+ const tools = turn.tools || [];
267
+ groupedContent.push({
268
+ type: "system_init",
269
+ tools_count: tools.length,
270
+ });
271
+ } else {
272
+ groupedContent.push({
273
+ type: "system_other",
274
+ data: turn,
275
+ });
276
+ }
277
+ } else if (turnType === "assistant") {
278
+ const message = turn.message || { content: [] };
279
+ const content = message.content || [];
280
+ const usage = message.usage || {};
281
+
282
+ // Process content items
283
+ const textParts: string[] = [];
284
+ const toolCalls: { tool_use: ToolUse; tool_result?: ToolResult }[] = [];
285
+
286
+ for (const item of content) {
287
+ const itemType = item.type || "";
288
+
289
+ if (itemType === "text") {
290
+ textParts.push(item.text || "");
291
+ } else if (itemType === "tool_use") {
292
+ const toolUseId = item.id;
293
+ const toolResult = toolUseId
294
+ ? toolResultsMap.get(toolUseId)
295
+ : undefined;
296
+ toolCalls.push({
297
+ tool_use: {
298
+ type: item.type,
299
+ name: item.name,
300
+ input: item.input,
301
+ id: item.id,
302
+ },
303
+ tool_result: toolResult,
304
+ });
305
+ }
306
+ }
307
+
308
+ if (textParts.length > 0 || toolCalls.length > 0) {
309
+ groupedContent.push({
310
+ type: "assistant_action",
311
+ text_parts: textParts,
312
+ tool_calls: toolCalls,
313
+ usage: usage,
314
+ });
315
+ }
316
+ } else if (turnType === "user") {
317
+ // Handle user messages that aren't tool results
318
+ const message = turn.message || { content: [] };
319
+ const content = message.content || [];
320
+ const textParts: string[] = [];
321
+
322
+ for (const item of content) {
323
+ if (item.type === "text") {
324
+ textParts.push(item.text || "");
325
+ }
326
+ }
327
+
328
+ if (textParts.length > 0) {
329
+ groupedContent.push({
330
+ type: "user_message",
331
+ text_parts: textParts,
332
+ });
333
+ }
334
+ } else if (turnType === "result") {
335
+ groupedContent.push({
336
+ type: "final_result",
337
+ data: turn,
338
+ });
339
+ }
340
+ }
341
+
342
+ return groupedContent;
343
+ }
344
+
345
+ export function formatGroupedContent(groupedContent: GroupedContent[]): string {
346
+ let markdown = "## Claude Code Report\n\n";
347
+
348
+ for (const item of groupedContent) {
349
+ const itemType = item.type;
350
+
351
+ if (itemType === "system_init") {
352
+ markdown += `## 🚀 System Initialization\n\n**Available Tools:** ${item.tools_count} tools loaded\n\n---\n\n`;
353
+ } else if (itemType === "system_other") {
354
+ markdown += `## ⚙️ System Message\n\n${JSON.stringify(item.data, null, 2)}\n\n---\n\n`;
355
+ } else if (itemType === "assistant_action") {
356
+ // Add text content first (if any) - no header needed
357
+ for (const text of item.text_parts || []) {
358
+ if (text.trim()) {
359
+ markdown += `${text}\n\n`;
360
+ }
361
+ }
362
+
363
+ // Add tool calls with their results
364
+ for (const toolCall of item.tool_calls || []) {
365
+ markdown += formatToolWithResult(
366
+ toolCall.tool_use,
367
+ toolCall.tool_result,
368
+ );
369
+ }
370
+
371
+ // Add usage info if available
372
+ const usage = item.usage || {};
373
+ if (Object.keys(usage).length > 0) {
374
+ const inputTokens = usage.input_tokens || 0;
375
+ const cacheCreationTokens = usage.cache_creation_input_tokens || 0;
376
+ const cacheReadTokens = usage.cache_read_input_tokens || 0;
377
+ const totalInputTokens =
378
+ inputTokens + cacheCreationTokens + cacheReadTokens;
379
+ const outputTokens = usage.output_tokens || 0;
380
+ markdown += `*Token usage: ${totalInputTokens} input, ${outputTokens} output*\n\n`;
381
+ }
382
+
383
+ // Only add separator if this section had content
384
+ if (
385
+ (item.text_parts && item.text_parts.length > 0) ||
386
+ (item.tool_calls && item.tool_calls.length > 0)
387
+ ) {
388
+ markdown += "---\n\n";
389
+ }
390
+ } else if (itemType === "user_message") {
391
+ markdown += "## 👤 User\n\n";
392
+ for (const text of item.text_parts || []) {
393
+ if (text.trim()) {
394
+ markdown += `${text}\n\n`;
395
+ }
396
+ }
397
+ markdown += "---\n\n";
398
+ } else if (itemType === "final_result") {
399
+ const data = item.data || {};
400
+ const cost = (data as any).total_cost_usd || (data as any).cost_usd || 0;
401
+ const duration = (data as any).duration_ms || 0;
402
+ const resultText = (data as any).result || "";
403
+
404
+ markdown += "## ✅ Final Result\n\n";
405
+ if (resultText) {
406
+ markdown += `${resultText}\n\n`;
407
+ }
408
+ markdown += `**Cost:** $${cost.toFixed(4)} | **Duration:** ${(duration / 1000).toFixed(1)}s\n\n`;
409
+ }
410
+ }
411
+
412
+ return markdown;
413
+ }
414
+
415
+ export function formatTurnsFromData(data: Turn[]): string {
416
+ // Group turns naturally
417
+ const groupedContent = groupTurnsNaturally(data);
418
+
419
+ // Generate markdown
420
+ const markdown = formatGroupedContent(groupedContent);
421
+
422
+ return markdown;
423
+ }
424
+
425
+ function main(): void {
426
+ // Get the JSON file path from command line arguments
427
+ const args = process.argv.slice(2);
428
+ if (args.length === 0) {
429
+ console.error("Usage: format-turns.ts <json-file>");
430
+ exit(1);
431
+ }
432
+
433
+ const jsonFile = args[0];
434
+ if (!jsonFile) {
435
+ console.error("Error: No JSON file provided");
436
+ exit(1);
437
+ }
438
+
439
+ if (!existsSync(jsonFile)) {
440
+ console.error(`Error: ${jsonFile} not found`);
441
+ exit(1);
442
+ }
443
+
444
+ try {
445
+ // Read the JSON file
446
+ const fileContent = readFileSync(jsonFile, "utf-8");
447
+ const data: Turn[] = JSON.parse(fileContent);
448
+
449
+ // Group turns naturally
450
+ const groupedContent = groupTurnsNaturally(data);
451
+
452
+ // Generate markdown
453
+ const markdown = formatGroupedContent(groupedContent);
454
+
455
+ // Print to stdout (so it can be captured by shell)
456
+ console.log(markdown);
457
+ } catch (error) {
458
+ console.error(`Error processing file: ${error}`);
459
+ exit(1);
460
+ }
461
+ }
462
+
463
+ if (import.meta.main) {
464
+ main();
465
+ }