@selucas12/cheesy 2.0.0

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 (292) hide show
  1. package/.env.example +22 -0
  2. package/CHANGELOG.md +268 -0
  3. package/LICENSE +21 -0
  4. package/README.md +394 -0
  5. package/ccgram.service +24 -0
  6. package/config/channels.json +58 -0
  7. package/config/default.json +27 -0
  8. package/config/defaults/config.json +16 -0
  9. package/config/defaults/i18n.json +32 -0
  10. package/config/email-template.json +31 -0
  11. package/config/test-with-subagent.json +16 -0
  12. package/config/user.json +27 -0
  13. package/dist/claude-hook-notify.d.ts +7 -0
  14. package/dist/claude-hook-notify.d.ts.map +1 -0
  15. package/dist/claude-hook-notify.js +154 -0
  16. package/dist/claude-hook-notify.js.map +1 -0
  17. package/dist/claude-remote.d.ts +50 -0
  18. package/dist/claude-remote.d.ts.map +1 -0
  19. package/dist/claude-remote.js +927 -0
  20. package/dist/claude-remote.js.map +1 -0
  21. package/dist/elicitation-notify.d.ts +20 -0
  22. package/dist/elicitation-notify.d.ts.map +1 -0
  23. package/dist/elicitation-notify.js +241 -0
  24. package/dist/elicitation-notify.js.map +1 -0
  25. package/dist/enhanced-hook-notify.d.ts +23 -0
  26. package/dist/enhanced-hook-notify.d.ts.map +1 -0
  27. package/dist/enhanced-hook-notify.js +402 -0
  28. package/dist/enhanced-hook-notify.js.map +1 -0
  29. package/dist/permission-denied-notify.d.ts +11 -0
  30. package/dist/permission-denied-notify.d.ts.map +1 -0
  31. package/dist/permission-denied-notify.js +193 -0
  32. package/dist/permission-denied-notify.js.map +1 -0
  33. package/dist/permission-hook.d.ts +15 -0
  34. package/dist/permission-hook.d.ts.map +1 -0
  35. package/dist/permission-hook.js +386 -0
  36. package/dist/permission-hook.js.map +1 -0
  37. package/dist/pre-compact-notify.d.ts +13 -0
  38. package/dist/pre-compact-notify.d.ts.map +1 -0
  39. package/dist/pre-compact-notify.js +197 -0
  40. package/dist/pre-compact-notify.js.map +1 -0
  41. package/dist/prompt-bridge.d.ts +50 -0
  42. package/dist/prompt-bridge.d.ts.map +1 -0
  43. package/dist/prompt-bridge.js +173 -0
  44. package/dist/prompt-bridge.js.map +1 -0
  45. package/dist/question-notify.d.ts +17 -0
  46. package/dist/question-notify.d.ts.map +1 -0
  47. package/dist/question-notify.js +356 -0
  48. package/dist/question-notify.js.map +1 -0
  49. package/dist/setup.d.ts +10 -0
  50. package/dist/setup.d.ts.map +1 -0
  51. package/dist/setup.js +649 -0
  52. package/dist/setup.js.map +1 -0
  53. package/dist/smart-monitor.d.ts +7 -0
  54. package/dist/smart-monitor.d.ts.map +1 -0
  55. package/dist/smart-monitor.js +256 -0
  56. package/dist/smart-monitor.js.map +1 -0
  57. package/dist/src/automation/clipboard-automation.d.ts +35 -0
  58. package/dist/src/automation/clipboard-automation.d.ts.map +1 -0
  59. package/dist/src/automation/clipboard-automation.js +242 -0
  60. package/dist/src/automation/clipboard-automation.js.map +1 -0
  61. package/dist/src/channels/base/channel.d.ts +60 -0
  62. package/dist/src/channels/base/channel.d.ts.map +1 -0
  63. package/dist/src/channels/base/channel.js +96 -0
  64. package/dist/src/channels/base/channel.js.map +1 -0
  65. package/dist/src/channels/email/smtp.d.ts +74 -0
  66. package/dist/src/channels/email/smtp.d.ts.map +1 -0
  67. package/dist/src/channels/email/smtp.js +605 -0
  68. package/dist/src/channels/email/smtp.js.map +1 -0
  69. package/dist/src/channels/line/line.d.ts +36 -0
  70. package/dist/src/channels/line/line.d.ts.map +1 -0
  71. package/dist/src/channels/line/line.js +180 -0
  72. package/dist/src/channels/line/line.js.map +1 -0
  73. package/dist/src/channels/line/webhook.d.ts +55 -0
  74. package/dist/src/channels/line/webhook.d.ts.map +1 -0
  75. package/dist/src/channels/line/webhook.js +191 -0
  76. package/dist/src/channels/line/webhook.js.map +1 -0
  77. package/dist/src/channels/local/desktop.d.ts +30 -0
  78. package/dist/src/channels/local/desktop.d.ts.map +1 -0
  79. package/dist/src/channels/local/desktop.js +161 -0
  80. package/dist/src/channels/local/desktop.js.map +1 -0
  81. package/dist/src/channels/telegram/telegram.d.ts +43 -0
  82. package/dist/src/channels/telegram/telegram.d.ts.map +1 -0
  83. package/dist/src/channels/telegram/telegram.js +223 -0
  84. package/dist/src/channels/telegram/telegram.js.map +1 -0
  85. package/dist/src/channels/telegram/webhook.d.ts +75 -0
  86. package/dist/src/channels/telegram/webhook.d.ts.map +1 -0
  87. package/dist/src/channels/telegram/webhook.js +278 -0
  88. package/dist/src/channels/telegram/webhook.js.map +1 -0
  89. package/dist/src/cli.d.ts +9 -0
  90. package/dist/src/cli.d.ts.map +1 -0
  91. package/dist/src/cli.js +99 -0
  92. package/dist/src/cli.js.map +1 -0
  93. package/dist/src/commands/hooks.d.ts +10 -0
  94. package/dist/src/commands/hooks.d.ts.map +1 -0
  95. package/dist/src/commands/hooks.js +50 -0
  96. package/dist/src/commands/hooks.js.map +1 -0
  97. package/dist/src/commands/init.d.ts +20 -0
  98. package/dist/src/commands/init.d.ts.map +1 -0
  99. package/dist/src/commands/init.js +173 -0
  100. package/dist/src/commands/init.js.map +1 -0
  101. package/dist/src/commands/license.d.ts +15 -0
  102. package/dist/src/commands/license.d.ts.map +1 -0
  103. package/dist/src/commands/license.js +107 -0
  104. package/dist/src/commands/license.js.map +1 -0
  105. package/dist/src/commands/start.d.ts +17 -0
  106. package/dist/src/commands/start.d.ts.map +1 -0
  107. package/dist/src/commands/start.js +150 -0
  108. package/dist/src/commands/start.js.map +1 -0
  109. package/dist/src/commands/status.d.ts +8 -0
  110. package/dist/src/commands/status.d.ts.map +1 -0
  111. package/dist/src/commands/status.js +95 -0
  112. package/dist/src/commands/status.js.map +1 -0
  113. package/dist/src/commands/stop.d.ts +8 -0
  114. package/dist/src/commands/stop.d.ts.map +1 -0
  115. package/dist/src/commands/stop.js +64 -0
  116. package/dist/src/commands/stop.js.map +1 -0
  117. package/dist/src/config-manager.d.ts +16 -0
  118. package/dist/src/config-manager.d.ts.map +1 -0
  119. package/dist/src/config-manager.js +152 -0
  120. package/dist/src/config-manager.js.map +1 -0
  121. package/dist/src/core/config.d.ts +28 -0
  122. package/dist/src/core/config.d.ts.map +1 -0
  123. package/dist/src/core/config.js +248 -0
  124. package/dist/src/core/config.js.map +1 -0
  125. package/dist/src/core/logger.d.ts +19 -0
  126. package/dist/src/core/logger.d.ts.map +1 -0
  127. package/dist/src/core/logger.js +47 -0
  128. package/dist/src/core/logger.js.map +1 -0
  129. package/dist/src/core/notifier.d.ts +45 -0
  130. package/dist/src/core/notifier.d.ts.map +1 -0
  131. package/dist/src/core/notifier.js +189 -0
  132. package/dist/src/core/notifier.js.map +1 -0
  133. package/dist/src/lib/license-validator.d.ts +120 -0
  134. package/dist/src/lib/license-validator.d.ts.map +1 -0
  135. package/dist/src/lib/license-validator.js +294 -0
  136. package/dist/src/lib/license-validator.js.map +1 -0
  137. package/dist/src/lib/preflight.d.ts +28 -0
  138. package/dist/src/lib/preflight.d.ts.map +1 -0
  139. package/dist/src/lib/preflight.js +90 -0
  140. package/dist/src/lib/preflight.js.map +1 -0
  141. package/dist/src/relay/claude-command-bridge.d.ts +57 -0
  142. package/dist/src/relay/claude-command-bridge.d.ts.map +1 -0
  143. package/dist/src/relay/claude-command-bridge.js +188 -0
  144. package/dist/src/relay/claude-command-bridge.js.map +1 -0
  145. package/dist/src/relay/email-listener.d.ts +65 -0
  146. package/dist/src/relay/email-listener.d.ts.map +1 -0
  147. package/dist/src/relay/email-listener.js +460 -0
  148. package/dist/src/relay/email-listener.js.map +1 -0
  149. package/dist/src/relay/relay-pty.d.ts +21 -0
  150. package/dist/src/relay/relay-pty.d.ts.map +1 -0
  151. package/dist/src/relay/relay-pty.js +696 -0
  152. package/dist/src/relay/relay-pty.js.map +1 -0
  153. package/dist/src/relay/smart-injector.d.ts +30 -0
  154. package/dist/src/relay/smart-injector.d.ts.map +1 -0
  155. package/dist/src/relay/smart-injector.js +233 -0
  156. package/dist/src/relay/smart-injector.js.map +1 -0
  157. package/dist/src/relay/tmux-injector.d.ts +46 -0
  158. package/dist/src/relay/tmux-injector.d.ts.map +1 -0
  159. package/dist/src/relay/tmux-injector.js +413 -0
  160. package/dist/src/relay/tmux-injector.js.map +1 -0
  161. package/dist/src/tools/config-manager.d.ts +33 -0
  162. package/dist/src/tools/config-manager.d.ts.map +1 -0
  163. package/dist/src/tools/config-manager.js +448 -0
  164. package/dist/src/tools/config-manager.js.map +1 -0
  165. package/dist/src/tools/installer.d.ts +38 -0
  166. package/dist/src/tools/installer.d.ts.map +1 -0
  167. package/dist/src/tools/installer.js +222 -0
  168. package/dist/src/tools/installer.js.map +1 -0
  169. package/dist/src/types/callbacks.d.ts +53 -0
  170. package/dist/src/types/callbacks.d.ts.map +1 -0
  171. package/dist/src/types/callbacks.js +7 -0
  172. package/dist/src/types/callbacks.js.map +1 -0
  173. package/dist/src/types/config.d.ts +56 -0
  174. package/dist/src/types/config.d.ts.map +1 -0
  175. package/dist/src/types/config.js +6 -0
  176. package/dist/src/types/config.js.map +1 -0
  177. package/dist/src/types/hooks.d.ts +47 -0
  178. package/dist/src/types/hooks.d.ts.map +1 -0
  179. package/dist/src/types/hooks.js +6 -0
  180. package/dist/src/types/hooks.js.map +1 -0
  181. package/dist/src/types/index.d.ts +7 -0
  182. package/dist/src/types/index.d.ts.map +1 -0
  183. package/dist/src/types/index.js +23 -0
  184. package/dist/src/types/index.js.map +1 -0
  185. package/dist/src/types/ipc.d.ts +43 -0
  186. package/dist/src/types/ipc.d.ts.map +1 -0
  187. package/dist/src/types/ipc.js +7 -0
  188. package/dist/src/types/ipc.js.map +1 -0
  189. package/dist/src/types/session.d.ts +87 -0
  190. package/dist/src/types/session.d.ts.map +1 -0
  191. package/dist/src/types/session.js +9 -0
  192. package/dist/src/types/session.js.map +1 -0
  193. package/dist/src/types/telegram.d.ts +58 -0
  194. package/dist/src/types/telegram.d.ts.map +1 -0
  195. package/dist/src/types/telegram.js +6 -0
  196. package/dist/src/types/telegram.js.map +1 -0
  197. package/dist/src/utils/active-check.d.ts +20 -0
  198. package/dist/src/utils/active-check.d.ts.map +1 -0
  199. package/dist/src/utils/active-check.js +42 -0
  200. package/dist/src/utils/active-check.js.map +1 -0
  201. package/dist/src/utils/callback-parser.d.ts +23 -0
  202. package/dist/src/utils/callback-parser.d.ts.map +1 -0
  203. package/dist/src/utils/callback-parser.js +85 -0
  204. package/dist/src/utils/callback-parser.js.map +1 -0
  205. package/dist/src/utils/controller-injector.d.ts +21 -0
  206. package/dist/src/utils/controller-injector.d.ts.map +1 -0
  207. package/dist/src/utils/controller-injector.js +108 -0
  208. package/dist/src/utils/controller-injector.js.map +1 -0
  209. package/dist/src/utils/conversation-tracker.d.ts +32 -0
  210. package/dist/src/utils/conversation-tracker.d.ts.map +1 -0
  211. package/dist/src/utils/conversation-tracker.js +119 -0
  212. package/dist/src/utils/conversation-tracker.js.map +1 -0
  213. package/dist/src/utils/deep-link.d.ts +22 -0
  214. package/dist/src/utils/deep-link.d.ts.map +1 -0
  215. package/dist/src/utils/deep-link.js +43 -0
  216. package/dist/src/utils/deep-link.js.map +1 -0
  217. package/dist/src/utils/ghostty-session-manager.d.ts +81 -0
  218. package/dist/src/utils/ghostty-session-manager.d.ts.map +1 -0
  219. package/dist/src/utils/ghostty-session-manager.js +370 -0
  220. package/dist/src/utils/ghostty-session-manager.js.map +1 -0
  221. package/dist/src/utils/hook-definitions.d.ts +25 -0
  222. package/dist/src/utils/hook-definitions.d.ts.map +1 -0
  223. package/dist/src/utils/hook-definitions.js +36 -0
  224. package/dist/src/utils/hook-definitions.js.map +1 -0
  225. package/dist/src/utils/http-request.d.ts +25 -0
  226. package/dist/src/utils/http-request.d.ts.map +1 -0
  227. package/dist/src/utils/http-request.js +66 -0
  228. package/dist/src/utils/http-request.js.map +1 -0
  229. package/dist/src/utils/optional-require.d.ts +13 -0
  230. package/dist/src/utils/optional-require.d.ts.map +1 -0
  231. package/dist/src/utils/optional-require.js +37 -0
  232. package/dist/src/utils/optional-require.js.map +1 -0
  233. package/dist/src/utils/paths.d.ts +13 -0
  234. package/dist/src/utils/paths.d.ts.map +1 -0
  235. package/dist/src/utils/paths.js +30 -0
  236. package/dist/src/utils/paths.js.map +1 -0
  237. package/dist/src/utils/pty-session-manager.d.ts +43 -0
  238. package/dist/src/utils/pty-session-manager.d.ts.map +1 -0
  239. package/dist/src/utils/pty-session-manager.js +183 -0
  240. package/dist/src/utils/pty-session-manager.js.map +1 -0
  241. package/dist/src/utils/subagent-tracker.d.ts +64 -0
  242. package/dist/src/utils/subagent-tracker.d.ts.map +1 -0
  243. package/dist/src/utils/subagent-tracker.js +191 -0
  244. package/dist/src/utils/subagent-tracker.js.map +1 -0
  245. package/dist/src/utils/tmux-monitor.d.ts +102 -0
  246. package/dist/src/utils/tmux-monitor.d.ts.map +1 -0
  247. package/dist/src/utils/tmux-monitor.js +642 -0
  248. package/dist/src/utils/tmux-monitor.js.map +1 -0
  249. package/dist/src/utils/trace-capture.d.ts +42 -0
  250. package/dist/src/utils/trace-capture.d.ts.map +1 -0
  251. package/dist/src/utils/trace-capture.js +102 -0
  252. package/dist/src/utils/trace-capture.js.map +1 -0
  253. package/dist/src/utils/transcript-reader.d.ts +57 -0
  254. package/dist/src/utils/transcript-reader.d.ts.map +1 -0
  255. package/dist/src/utils/transcript-reader.js +229 -0
  256. package/dist/src/utils/transcript-reader.js.map +1 -0
  257. package/dist/start-all-webhooks.d.ts +7 -0
  258. package/dist/start-all-webhooks.d.ts.map +1 -0
  259. package/dist/start-all-webhooks.js +98 -0
  260. package/dist/start-all-webhooks.js.map +1 -0
  261. package/dist/start-line-webhook.d.ts +7 -0
  262. package/dist/start-line-webhook.d.ts.map +1 -0
  263. package/dist/start-line-webhook.js +59 -0
  264. package/dist/start-line-webhook.js.map +1 -0
  265. package/dist/start-relay-pty.d.ts +7 -0
  266. package/dist/start-relay-pty.d.ts.map +1 -0
  267. package/dist/start-relay-pty.js +173 -0
  268. package/dist/start-relay-pty.js.map +1 -0
  269. package/dist/start-telegram-webhook.d.ts +7 -0
  270. package/dist/start-telegram-webhook.d.ts.map +1 -0
  271. package/dist/start-telegram-webhook.js +80 -0
  272. package/dist/start-telegram-webhook.js.map +1 -0
  273. package/dist/user-prompt-hook.d.ts +13 -0
  274. package/dist/user-prompt-hook.d.ts.map +1 -0
  275. package/dist/user-prompt-hook.js +45 -0
  276. package/dist/user-prompt-hook.js.map +1 -0
  277. package/dist/workspace-router.d.ts +114 -0
  278. package/dist/workspace-router.d.ts.map +1 -0
  279. package/dist/workspace-router.js +572 -0
  280. package/dist/workspace-router.js.map +1 -0
  281. package/dist/workspace-telegram-bot.d.ts +3 -0
  282. package/dist/workspace-telegram-bot.d.ts.map +1 -0
  283. package/dist/workspace-telegram-bot.js +1847 -0
  284. package/dist/workspace-telegram-bot.js.map +1 -0
  285. package/package.json +85 -0
  286. package/src/types/callbacks.ts +73 -0
  287. package/src/types/config.ts +63 -0
  288. package/src/types/hooks.ts +50 -0
  289. package/src/types/index.ts +6 -0
  290. package/src/types/ipc.ts +55 -0
  291. package/src/types/session.ts +91 -0
  292. package/src/types/telegram.ts +66 -0
package/.env.example ADDED
@@ -0,0 +1,22 @@
1
+ # Cheesyboy Configuration
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # Required: Get your bot token from @BotFather (https://t.me/BotFather)
5
+ TELEGRAM_BOT_TOKEN=
6
+
7
+ # Required: Get your chat ID from @userinfobot (https://t.me/userinfobot)
8
+ TELEGRAM_CHAT_ID=
9
+
10
+ # Optional: Log level (debug, info, warn, error)
11
+ # LOG_LEVEL=info
12
+
13
+ # Project directories to scan for /new command (comma-separated)
14
+ # PROJECT_DIRS=~/projects,~/tools
15
+
16
+ # Suppress Telegram notifications when actively at terminal (seconds, default: 120)
17
+ # ACTIVE_THRESHOLD_SECONDS=120
18
+
19
+ # Injection backend: tmux (default), ghostty, or pty
20
+ # INJECTION_MODE=ghostty
21
+
22
+ # For advanced options (email relay, LINE, webhooks), see .env.full-example
package/CHANGELOG.md ADDED
@@ -0,0 +1,268 @@
1
+ # Changelog
2
+
3
+ All notable changes to Cheesyboy are documented here. Historical entries
4
+ below 2.0.0 are from the upstream ccgram project this is forked from.
5
+
6
+ ## [2.0.0] - 2026-05-23
7
+
8
+ The fork's first major release as `@selucas12/cheesy`. Marks the project's
9
+ transition from upstream ccgram to Cheesyboy.
10
+
11
+ ### Breaking
12
+
13
+ - **Package renamed** from `@jsayubi/ccgram` to `@selucas12/cheesy`. Upgraders
14
+ must re-install: `npm i -g @selucas12/cheesy`.
15
+ - **CLI binary renamed** from `ccgram` to `cheesy`. The legacy `ccgram` alias
16
+ has been removed. For muscle memory: `alias ccgram=cheesy`.
17
+ - **CLI restructured.** `bin` now points to `./dist/src/cli.js` (was
18
+ `./dist/cli.js`); the entry point and command modules live under `src/`.
19
+ - **License required.** `cheesy start` now refuses to start without a valid
20
+ LemonSqueezy license activation. Bypass with `cheesy init --dev`,
21
+ `--skip-license`, or `CHEESY_SKIP_LICENSE=1`.
22
+ - **Default idle threshold lowered** from 5 min to 2 min so Telegram takes
23
+ over more aggressively when the user steps away. Override via
24
+ `ACTIVE_THRESHOLD_SECONDS`.
25
+
26
+ ### Preserved (no breakage for existing ccgram users)
27
+
28
+ - Install directory remains `~/.ccgram/` — sessions, `.env`, and project
29
+ history survive the upgrade.
30
+ - `CCGRAM_HOME`, `CCGRAM_DATA_DIR`, launchd label `com.ccgram`, systemd unit
31
+ name `ccgram`, email subject markers `[CCGram #…]`, `X-CCGram-*` headers,
32
+ and other wire-format / installed-state identifiers are unchanged.
33
+
34
+ ### New: CLI
35
+
36
+ - `cheesy init` — interactive setup wizard with preflight (Node ≥18,
37
+ ~/.claude/ present, OS supported). `--dev` writes a dev marker that skips
38
+ license activation; `LICENSE_KEY` env var enables headless activation.
39
+ - `cheesy start [--foreground] [--skip-license]` — brings the bot online
40
+ via launchd (macOS) or systemd (Linux), with foreground fallback.
41
+ - `cheesy stop` — idempotent service + process teardown.
42
+ - `cheesy status` — bot + service + session + license overview.
43
+ - `cheesy hooks` — print the Claude Code settings.json hooks snippet for
44
+ manual install.
45
+ - `cheesy license activate <key> | status | deactivate` — manage
46
+ LemonSqueezy activations.
47
+ - Built on `commander` + `picocolors`. Picocolors over chalk because chalk
48
+ v5 is ESM-only and incompatible with our CommonJS build.
49
+
50
+ ### New: License validation
51
+
52
+ - LemonSqueezy License API client (`src/lib/license-validator.ts`):
53
+ activate / validate / deactivate with form-encoded POST (the License API
54
+ does not use bearer auth — the license key in the body IS the credential).
55
+ - License records stored at `~/.ccgram/.license.json` with mode 0600.
56
+ - 7-day offline grace window — `cheesy start` allows a recent cached
57
+ validation if the network is unreachable.
58
+ - Discriminated error results (invalid / limit / network / bad-request) so
59
+ the CLI shows focused error messages instead of HTTP noise.
60
+
61
+ ### New: 4-button permission UI
62
+
63
+ - Telegram permission prompts now show four buttons: Yes / Yes-stop-asking /
64
+ No / Explain. Hook + bot translate the new action vocabulary
65
+ (`yes` / `yes_stop` / `no` / `explain`) end-to-end; the legacy ccgram vocab
66
+ (`allow` / `always` / `defer` / `deny`) is still recognized for in-flight
67
+ prompts during upgrade.
68
+
69
+ ### New: CI / CD
70
+
71
+ - `.github/workflows/ci.yml` now runs on every PR in addition to pushes.
72
+ - `.github/workflows/publish.yml` creates a GitHub Release with auto-generated
73
+ notes (commits and PRs since the previous tag) after a successful
74
+ `npm publish`. Pre-release tags (e.g. `v2.0.0-beta.1`) are correctly
75
+ flagged so they don't displace `latest`.
76
+
77
+ ### Rebrand
78
+
79
+ - `CCGram` → `Cheesyboy` in all user-facing display strings (banners, README,
80
+ CLI help, log namespaces, email defaults, Discord webhook username, Windows
81
+ toast app name). Header comments mark each file as a fork.
82
+ - `workspace-router.PINNED_PROJECTS` updated from `['assistant', 'ccgram']` to
83
+ `['assistant', 'cheesy-source']` to match the new source-repo folder name.
84
+ - `LICENSE` retains the original `Copyright (c) 2026 JS Ayubi` (MIT) —
85
+ upstream attribution preserved.
86
+
87
+ ### Tooling
88
+
89
+ - `prepare: tsc` added to `package.json` scripts — fresh clones auto-build
90
+ on `npm install`.
91
+ - `CHANGELOG.md` added to the published `files` array.
92
+ - New runtime dependencies: `commander ^14`, `picocolors ^1.1`.
93
+
94
+ ---
95
+
96
+ ## [1.2.2] - 2026-04-14
97
+
98
+ ### Fixes
99
+
100
+ - **`ccgram hooks` command was missing 12 of 16 hooks.** `cli.ts` had its own out-of-date copy of `HOOK_DEFINITIONS` listing only PermissionRequest, PreToolUse, Stop, and Notification. Users who copy-pasted the output were silently missing PermissionDenied, PreCompact, PostCompact, Elicitation, StopFailure, TaskCreated, CwdChanged, InstructionsLoaded, UserPromptSubmit, SessionStart, SessionEnd, and SubagentStop.
101
+ - **`PreToolUse` timeout in `ccgram hooks` output was 5s instead of 120s** — the question hook can't complete a Telegram poll round-trip in 5 seconds, so the printed config would always time out before the user could answer.
102
+ - **`installToHome` only verified 2 of 7 hook scripts** (`permission-hook.js` and `workspace-telegram-bot.js`). A partial install missing newer scripts like `pre-compact-notify.js` or `elicitation-notify.js` would silently report success. Now derived from `HOOK_DEFINITIONS` so the check tightens automatically when hooks are added.
103
+
104
+ ### Refactor
105
+
106
+ - New shared module `src/utils/hook-definitions.ts` is the single source of truth for the 16 hooks ccgram installs. Both `setup.ts` (the interactive wizard) and `cli.ts` (the `ccgram hooks` command) now import from it, so they cannot drift apart again.
107
+
108
+ ### Other
109
+
110
+ - LICENSE updated to correct copyright holder (`Copyright (c) 2026 JS Ayubi`)
111
+ - `claude-remote.ts` help text updated with the correct repo URL (`github.com/jsayubi/ccgram`)
112
+
113
+ ---
114
+
115
+ ## [1.2.1] - 2026-04-14
116
+
117
+ ### Documentation
118
+
119
+ - README updated for v1.2.0 features: universal terminal support, Ghostty backend, rich `/status`, deep links, the eight new hooks, and the `transcript-reader` / `deep-link` / `ghostty-session-manager` modules
120
+ - Architecture diagram now lists `permission-denied-notify`, `pre-compact-notify`, `elicitation-notify` and the new `src/utils/` files
121
+ - FAQ "Do I need tmux?" entry rewritten to cover all three injection backends
122
+ - Test counts updated (84 → 120 tests across 6 suites)
123
+
124
+ No code changes from v1.2.0 — patch bump only so npm picks up the refreshed README on the package page.
125
+
126
+ ---
127
+
128
+ ## [1.2.0] - 2026-04-14
129
+
130
+ The biggest release yet. Universal terminal support, eight new hook integrations, a completely rewritten `/status`, and a sweep of critical hook-format fixes that were silently breaking question answering.
131
+
132
+ ### Headline features
133
+
134
+ - **Direct question answering — no more keystroke injection.** `AskUserQuestion` answers now flow back to Claude Code through the `updatedInput` hook output, so Telegram answers land in any terminal: tmux, Ghostty, bare zsh, screen, anything. The AppleScript / tmux-send-keys path for questions is gone.
135
+ - **Ghostty integration.** `src/utils/ghostty-session-manager.ts` adds full Ghostty support via AppleScript — auto-detected when `TERM_PROGRAM=ghostty`. Keystroke injection, tab focus, and command routing all work the same as tmux. macOS only.
136
+ - **Rich `/status` command.** Completely rewritten using Claude Code's transcript JSONL. Now shows model, Claude Code version, git branch, session ID + slug, context window usage with auto-detected 1M mode, rate limit + reset time, last activity timestamp, and the last assistant message snippet. Works for **every** terminal type — Ghostty, tmux, PTY, bare.
137
+ - **Deep links.** New `/link <prompt>` command generates `claude-cli://open?q=...` URLs that open Claude Code anywhere with your prompt pre-filled.
138
+
139
+ ### Eight new hook events
140
+
141
+ | Hook | What it gives you |
142
+ |----------------------|-------------------------------------------------------------------------|
143
+ | `PermissionDenied` | Telegram retry button when auto-mode blocks a tool |
144
+ | `PreCompact` | Block context compaction with one tap |
145
+ | `PostCompact` | Confirms compaction completed, with token savings |
146
+ | `Elicitation` | Forwards MCP server input requests to Telegram (schema-aware, per-field) |
147
+ | `StopFailure` | Instant alerts on API errors and rate limits |
148
+ | `TaskCreated` | Notify when Claude creates a task |
149
+ | `CwdChanged` | Track when Claude changes working directory |
150
+ | `InstructionsLoaded` | Debug aid for CLAUDE.md / rules loading |
151
+
152
+ ### New Telegram commands
153
+
154
+ - `/link <prompt>` — generate a Claude Code deep link
155
+ - `/effort [workspace] low|medium|high` — set thinking effort
156
+ - `/model [workspace] <model>` — switch model (sonnet, opus, haiku)
157
+
158
+ ### Permission improvements
159
+
160
+ - **Defer button** on permission prompts pauses the session for async approval (resume later with `claude --resume`)
161
+ - **Session title** support in permission and notification messages
162
+
163
+ ### Rate limit visibility
164
+
165
+ - Hook payloads' `rate_limits` field now extracted and stored per-session in `session-map.json`
166
+ - `/status` displays current usage, percent, and reset time when available
167
+
168
+ ### Conditional hooks
169
+
170
+ - Claude Code v2.1.85+ `if` field (jq expression) supported in `setup.ts` `HOOK_DEFINITIONS` for conditional hook execution — reduces unnecessary spawning
171
+
172
+ ### Critical fixes
173
+
174
+ Four hook scripts had silently-malformed stdout shapes that Claude Code was ignoring without any error log. All audited against the official docs and corrected:
175
+
176
+ - **`question-notify.ts`** — was outputting `{questions: [{question, answer}]}` (an invented format). Now correctly echoes the original `questions` array plus a separate `answers` map keyed by question text, with `hookEventName: "PreToolUse"`. Multi-select answers join labels with commas. Symptom was "I answered in Telegram, then the question also popped up in the terminal."
177
+ - **`pre-compact-notify.ts`** — had `decision: "block"` nested inside `hookSpecificOutput`. Per spec, `decision` belongs at the top level. Block button now actually blocks compaction.
178
+ - **`permission-denied-notify.ts`** — was missing required `hookEventName: "PermissionDenied"`. Retry button now actually retries.
179
+ - **`elicitation-notify.ts`** — had a completely invented shape. Now parses MCP `requested_schema.properties` from stdin, prompts the user once per field via Telegram, and emits the proper `{action: "accept", content: {<field>: <value>}}`. Timeout/send failure now emits `action: "cancel"` instead of hanging the MCP tool call. Also corrected payload field name (`mcp_server_name` → was reading `mcp_server`).
180
+
181
+ ### Other improvements
182
+
183
+ - Removed stale `!pending.tmuxSession` check from the `opt:` and `opt-submit:` callback handlers (leftover from the pre-`updatedInput` keystroke-injection era; was silently dropping responses in bare-terminal sessions)
184
+ - `enhanced-hook-notify.ts` extracts `last_assistant_message` directly from hook payloads (Claude Code v2.1.47+) with JSONL fallback for older versions
185
+ - Added `logger.info` on response writes for easier debugging
186
+ - Test suite grew from 84 → 120 tests across 6 suites (added `deep-link.test.js`, `ghostty-session-manager.test.js`, expanded `workspace-router.test.js` and `callback-parser.test.js`)
187
+
188
+ ### Upgrade
189
+
190
+ ```bash
191
+ npx @jsayubi/ccgram@latest init
192
+ ```
193
+
194
+ The wizard merges the new hook entries into `~/.claude/settings.json` and refreshes `~/.ccgram/dist/`. Existing config (`.env`, session map, project history) is preserved.
195
+
196
+ **Full changelog:** https://github.com/jsayubi/ccgram/compare/v1.1.1...v1.2.0
197
+
198
+ ---
199
+
200
+ ## [1.1.0] - 2026-02-24
201
+
202
+ ### Features
203
+ - **`/resume` command** — resume past Claude Code conversations from Telegram, reading directly from Claude Code's session storage (`~/.claude/projects/`)
204
+ - **Session picker with snippets** — shows the first user message from each session for easy identification; empty stub sessions (no user messages) are automatically filtered out
205
+ - **Smart active-session detection** — warns before resuming a session that appears to be running in a direct terminal (based on JSONL file mtime within 5 minutes), preventing dual-instance conflicts
206
+ - **PTY resume warning** — shows confirmation prompt before killing a headless PTY session (which cannot be reattached from terminal)
207
+ - **tmux inline session switching** — when switching to a different Claude session in tmux, injects `/exit` + `claude --resume` into the existing session instead of killing it, keeping the user's terminal attached
208
+ - **PTY `--resume` support** — `ptySessionManager.spawn()` now accepts CLI args (e.g. `['--resume', '<id>']`)
209
+ - **`rc:` callback type** — confirmation flow for destructive resume operations (PTY kill, active-session override)
210
+
211
+ ### Improvements
212
+ - Bot command menu now registers on both `all_private_chats` and `default` scopes (fixes menu not appearing when previously set via BotFather)
213
+ - `/help` output now includes `/resume` command
214
+ - `recordProjectUsage()` tracks session IDs in `project-history.json` (deduped, capped at 5 per project)
215
+ - 84 tests across 4 suites (up from 65)
216
+
217
+ ---
218
+
219
+ ## [1.0.2] - 2026-02-23
220
+
221
+ ### Security
222
+ - Removed legacy AppleScript GUI automation files (`claude-automation`, `simple-automation`, `command-relay`, `taskping-daemon`) — dead code never used in production that triggered a socket.dev "Obfuscated code" alert due to embedded osascript keystroke injection
223
+
224
+ ---
225
+
226
+ ## [1.0.1] - 2026-02-23
227
+
228
+ ### Security
229
+ - Removed `node-imap` from `optionalDependencies` — eliminates a high-severity ReDoS vulnerability chain (`node-imap` → `utf7` → `semver`). Users who need IMAP email relay can still install it manually: `npm install node-imap` inside `~/.ccgram/`
230
+
231
+ ### Fixes
232
+ - Renamed package to `@jsayubi/ccgram` (npm blocked `ccgram` due to similarity with existing package `cc-gram`)
233
+ - Fixed `vitest.config.js` → `vitest.config.mjs` for ESM compatibility on Node 18
234
+ - Fixed invalid JSON in `config/email-template.json` (trailing comments after closing brace)
235
+
236
+ ---
237
+
238
+ ## [1.0.0] - 2026-02-23
239
+
240
+ Initial public release.
241
+
242
+ ### Features
243
+
244
+ - **Telegram bot** with long-polling and inline keyboard support
245
+ - **PermissionRequest hook** — blocking approval via Telegram buttons (Allow / Deny / Always)
246
+ - **AskUserQuestion hook** — single-select and multi-select option buttons injected via tmux/PTY
247
+ - **Stop / Notification hooks** — completion and waiting notifications with Claude's last response (Telegram HTML formatted)
248
+ - **SessionStart / SessionEnd / SubagentStop hooks** — session lifecycle notifications
249
+ - **UserPromptSubmit hook** — terminal activity tracking for smart notification suppression
250
+ - **Smart suppression** — notifications silenced when user is actively at the terminal (configurable threshold, default 5 min); always fires when command is Telegram-injected
251
+ - **tmux integration** — keystroke injection for command routing and question answering
252
+ - **PTY fallback** — headless `node-pty` sessions when tmux is unavailable
253
+ - **Workspace routing** — prefix-matched workspace names, default workspace, reply-to routing
254
+ - **`/new` command** — start Claude in a project directory with recent-project history
255
+ - **`/compact` command** — compact Claude context in any session
256
+ - **`/status`, `/stop`, `/sessions`** commands
257
+ - **Typing indicator** — repeating `sendChatAction: typing` while a command runs
258
+ - **File-based IPC** — `/tmp/claude-prompts/` for permission polling (auto-cleaned after 5 min)
259
+ - **macOS launchd** and **Linux systemd** service support
260
+ - **`ccgram init`** — automated install: copies dist, writes hooks to `~/.claude/settings.json`, creates launchd/systemd service
261
+ - **TypeScript** codebase with 100% CommonJS output; zero required dependencies beyond `dotenv`
262
+ - **65 tests** across 4 suites (prompt-bridge, workspace-router, callback-parser, active-check)
263
+
264
+ ### Architecture
265
+
266
+ - Hook scripts communicate with Claude Code via stdout (blocking) or fire-and-forget (non-blocking)
267
+ - Bot and hooks share data via JSON files in `~/.ccgram/src/data/`
268
+ - All optional dependencies (express, node-pty, pino, nodemailer) degrade gracefully via `optionalRequire()`
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 JS Ayubi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.