diff --git a/AGENTS.md b/AGENTS.md index 1af4032..425d386 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,7 +42,7 @@ Mishchenko. | `cli/dist/code-alarm.mjs` | The bundled CLI, **committed** and built by `cli/build.mjs`; also the npm package's entry | | `plugins/claude-code/` | The Claude Code plugin: manifest, hooks, the skill (generated) and `bin/` (the bundle plus PATH shims) | | `.claude-plugin/marketplace.json` | Makes this repository a Claude Code plugin marketplace | -| `docs/` | Protocol and agent notes | +| `docs/` | Protocol and agent notes; `assets/` holds the README's logo and pictures, hand-written SVG that animates on GitHub. `cli/prepack.mjs` points the npm copy of the README at them on GitHub | ## Working conventions diff --git a/CHANGELOG.md b/CHANGELOG.md index e384994..f1d700e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ Notable changes to the `code-alarm` CLI and the Claude Code plugin. The format f ## [Unreleased] +## [0.2.2] — 2026-10-18 + +### Changed + +- A new README: the logo, a picture of an agent finishing and the phone ringing, a diagram of + what stays on your computer, both phone apps side by side, a commands table and + troubleshooting. On npm its images and links now point at GitHub, so they show there too. + ## [0.2.1] — 2026-10-18 ### Changed @@ -83,7 +91,8 @@ Notable changes to the `code-alarm` CLI and the Claude Code plugin. The format f quote safely; `uninstall codex` removes only its own files. The npm package includes the license and README. `status` never shows the topic. -[Unreleased]: https://github.com/Draganoider/code-alarm/compare/v0.2.1...test +[Unreleased]: https://github.com/Draganoider/code-alarm/compare/v0.2.2...test +[0.2.2]: https://github.com/Draganoider/code-alarm/compare/v0.2.1...v0.2.2 [0.2.1]: https://github.com/Draganoider/code-alarm/compare/v0.2.0...v0.2.1 [0.2.0]: https://github.com/Draganoider/code-alarm/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/Draganoider/code-alarm/releases/tag/v0.1.0 diff --git a/README.md b/README.md index 68dd3e1..492ff20 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,103 @@ +

+ Code Alarm logo: an alarm clock with a terminal prompt +

+

Code Alarm

- Start a long agent task, walk away, and get woken up when it's done.
- A real alarm on your phone when Claude Code or Codex finishes or needs you. + Your agent is done. Your phone rings.
+ A real alarm on your phone when Claude Code or Codex finishes, fails or needs you.

+ npm CI - License: MIT - Agents: Claude Code and Codex + Agents: Claude Code and Codex Node 22+ + License: MIT +

+ +

+ Quick start · + Use it · + How it works · + Commands · + Protocol

---- +

+ A terminal where Claude Code is armed with /code-alarm:alarm and finishes 47 minutes later; a phone shows Code Alarm's ring screen: Done, web-app, with a Stop button. +

-Coding agents now work for an hour or more on their own. Their phone apps will *notify* you when -they're done, but Do Not Disturb swallows a notification and it rings once. **Code Alarm rings like -an alarm**, until you dismiss it, and only for work you armed. +Coding agents now work for an hour or more on their own. Their apps can *notify* you when they're +done, but Do Not Disturb swallows a notification and it only sounds once. **Code Alarm rings like an +alarm**, and only for the work you armed. Start a long task, go make dinner or go to sleep, and +come back when the agent actually needs you. + + + + + + + + + + + + +
Only armed work rings
Sessions you didn't arm stay silent. Old and duplicate alerts never ring.
Knows why it stopped
Done, needs you (a question or a permission prompt), failed or stopped.
Loud, or quiet
A repeating alarm by default, or one ordinary notification when you arm it with quiet.
Private by design
Only the event's kind, the folder's name and the agent leave your computer. No prompts, code or transcripts.
Never slows your agent
Hooks return at once and send in the background, so a bad network can't stall a session.
Free and open source
The CLI, the hooks and the Claude Code plugin are MIT, all in this repository.
+ +## Quick start + +You need **Node.js 22 or newer** on the computer that runs your agent, and an app on your phone to +ring: the **Code Alarm app** or **ntfy**. + +| | Code Alarm app | ntfy | +|---|---|---| +| **Phones** | Android | Android and iPhone | +| **Available** | In closed testing: [join the testers group](https://groups.google.com/g/code-alarm-testers) | Now, free | +| **How it rings** | A full-screen alarm over the lock screen, on the alarm volume, with Stop and Snooze | ntfy's highest-priority alert, which keeps alerting once you turn that on | +| **Set up with** | `npx code-alarm pair` and a QR scan | `npx code-alarm init` and a topic subscription | + +### 1. Connect your phone + +**With the Code Alarm app.** Once you're in the test, install it from Google Play, then run this +on your computer: -- **One command to arm:** `/code-alarm:alarm` in Claude Code, or ask Codex to use the code-alarm - skill. Sessions you didn't arm stay silent. -- **Knows why it stopped:** *done*, *needs you* (a question or a permission prompt), *failed*, or - *stopped*. -- **Nothing leaves your computer** except the event type and the project folder's name: no prompts, - code, paths or transcripts ([protocol](docs/protocol.md)). -- **Never slows your agent down:** hooks return at once and send in the background. A network - problem can't stall a session. -- **Free:** it rings your phone through the [ntfy](https://ntfy.sh) app today. A dedicated Code - Alarm Android app is coming. +```bash +npx code-alarm pair +``` -## Set up (5 minutes) +It shows a QR code. In the app, tap **Pair a computer**, then **Scan QR code**, and confirm. No +camera? Choose **Show a code instead** in the app and run `npx code-alarm pair `. -You need **Node.js 22 or newer** on the computer that runs your agent. +
+With ntfy (Android or iPhone) +
-**1. Create your private alarm channel:** +Create your private alarm channel: ```bash npx code-alarm init ``` It prints a long random ntfy topic. Treat it like a password: anyone who knows it can ring your -phone. - -**2. On your phone:** install **ntfy** ([Google Play](https://play.google.com/store/apps/details?id=io.heckel.ntfy), +phone. Install **ntfy** ([Google Play](https://play.google.com/store/apps/details?id=io.heckel.ntfy), [F-Droid](https://f-droid.org/packages/io.heckel.ntfy/), [App Store](https://apps.apple.com/app/ntfy/id1625396347)) and subscribe to that topic. In the subscription's settings, turn on **keep alerting for the -highest priority** and the **Do Not Disturb override**. Then check it: +highest priority** and the **Do Not Disturb override**. + +
+ +Then ring it once to check: ```bash npx code-alarm test ``` -**3. Connect your agent.** +### 2. Connect your agent -Claude Code: +**Claude Code:** add the plugin. ```bash claude plugin marketplace add Draganoider/code-alarm @@ -63,56 +107,78 @@ claude plugin marketplace add Draganoider/code-alarm claude plugin install code-alarm@code-alarm ``` -Codex (adds user-level hooks and a skill; open Codex afterwards and **trust the new hooks**): +**Codex:** add user-level hooks and a skill, then open Codex and **trust the new hooks**. ```bash npx code-alarm install codex ``` -## Use +## Use it Before a long task, arm it: -| Agent | How | +| Where | How | |---|---| -| Claude Code | `/code-alarm:alarm`, then give it the task (or say "wake me when it's done") | +| Claude Code | `/code-alarm:alarm`, then give it the task, or just say "wake me when it's done" | | Codex | "Use the code-alarm skill and …", or "wake me when it's done" | -| Any terminal | `code-alarm arm` in the project folder; `code-alarm nap 2h` arms every session for 2 hours | - -**Prefer a plain notification?** Say *quiet*: `/code-alarm:alarm quiet …`, "quietly notify me -when done", or `code-alarm arm --notify`. You get one normal notification, which pops up with sound -and vibration and follows your phone's sound settings, instead of the repeating alarm. +| Any terminal | `code-alarm arm` in the project folder, or `code-alarm nap 2h` to arm every session for two hours | The agent ends its work with `done`, `needs-you` or `failed`, and your phone rings with that reason. If it forgets, the alarm still rings when it stops, labelled *stopped*. -`code-alarm status` shows what's set up, what's armed and the last alerts. `code-alarm disarm` -cancels arming. +**Prefer a plain notification?** Say *quiet*: `/code-alarm:alarm quiet …`, "quietly notify me +when done", or `code-alarm arm --notify`. You get one normal notification with sound and +vibration, following your phone's sound settings, instead of the repeating alarm. -If you reinstall Code Alarm on your phone or clear its data, the phone registers afresh and this -computer's pairing stops reaching it. `code-alarm status` and `code-alarm test` say so: pair again -with `code-alarm pair`, and remove the old computer from the app's list. +## How it works -Codex's hooks run their own copy of code-alarm. After you update code-alarm, `status` says if -that copy is out of date, and `init`, `pair`, `unpair` and `use` update it for you. +

+ On your computer, your armed agent's hooks call code-alarm. One small event, its kind, the folder's name and the agent, goes through the Code Alarm relay or ntfy to your phone, which rings like an alarm. Prompts, code, file paths and transcripts never leave the computer. +

-## How it works +- **Arming decides.** Hooks fire for every session, but `code-alarm` only sends for work you + armed. Arming a folder lasts until its first end-of-task alert; nap mode lasts until its time is + up. +- **One small event.** An alert carries its kind, the folder's *name* (never a path), the agent, + an ID and two timestamps. That's the whole [protocol](docs/protocol.md), and + [a test](cli/test/privacy.test.ts) fails if anything else would leave. +- **Hooks stay out of the way.** They print nothing, always exit 0 and hand the send to a detached + process, so the agent never waits on the network. +- **The app has the last word.** It ignores an alert that's expired (alerts live 30 minutes), or + one it has already rung for. -```mermaid -sequenceDiagram - actor You - participant Agent as Claude Code / Codex - participant CLI as code-alarm (hooks) - participant Phone as ntfy on your phone - You->>Agent: /code-alarm:alarm + the task - Agent->>CLI: code-alarm arm - Note over Agent: works for minutes or hours - Agent->>CLI: code-alarm done (or the Stop hook) - CLI-->>Phone: {kind, folder name}, max priority - Phone->>You: rings until you dismiss it -``` +Push is best-effort, as on any phone: a phone that's off, offline for a long time, or has the app +force-stopped won't ring. With the app, `code-alarm status --last` shows what happened to the last +alert: whether it rang, how long after it was sent, and when you stopped it. -Details: [event protocol](docs/protocol.md) · [agent integration notes](docs/agents.md). +## Commands + +| Command | What it does | +|---|---| +| `code-alarm pair []` | Pair with the Code Alarm app, by QR or by the code the app shows | +| `code-alarm init` | Create a private ntfy topic instead, and show how to subscribe | +| `code-alarm test [--notify]` | Ring the phone now, or send a plain notification | +| `code-alarm arm [--for 12h] [--notify]` | Ring when the agent in this folder next finishes, stops or needs you | +| `code-alarm nap 2h [--notify]` | Ring for every session until the time is up | +| `code-alarm disarm [--all]` | Cancel arming for this folder, or everything | +| `code-alarm status [--last]` | What's set up, what's armed, and the last alerts | +| `code-alarm use ntfy\|app` | Switch between ntfy and the app when both are set up | +| `code-alarm unpair` | Remove this computer from the phone | +| `code-alarm install codex` | Add the hooks and skill to Codex (`uninstall codex` removes them) | + +`code-alarm --help` lists every option. + +## Troubleshooting + +- **Nothing rings after you reinstalled the app or cleared its data.** The phone registered + afresh, so this computer's pairing points at the old install. `code-alarm status` and + `code-alarm test` say so. Pair again with `code-alarm pair`, and remove the old computer from the + app's list. +- **Codex stopped alerting after an update.** Codex's hooks run their own copy of code-alarm. + `code-alarm status` says when it's out of date, and `init`, `pair`, `unpair` and `use` refresh + it for you. +- **Anything else:** `code-alarm status` shows the last alerts and what happened to them. Bugs and + ideas are welcome in [issues](https://github.com/Draganoider/code-alarm/issues). ## Develop @@ -124,7 +190,8 @@ npm run check `npm run check` type-checks, runs the tests, and builds the bundle into `cli/dist/` and the Claude Code plugin. The bundled files are committed, because plugins install straight from the repository. -To try your working copy in Claude Code: `claude --plugin-dir plugins/claude-code`. +To try your working copy in Claude Code: `claude --plugin-dir plugins/claude-code`. The rules for +contributors, human or AI, are in [AGENTS.md](AGENTS.md). ## License diff --git a/cli/dist/code-alarm.mjs b/cli/dist/code-alarm.mjs index 2b39d2a..a38e7f1 100755 --- a/cli/dist/code-alarm.mjs +++ b/cli/dist/code-alarm.mjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -// code-alarm 0.2.1, MIT License, https://github.com/Draganoider/code-alarm. Generated by cli/build.mjs: do not edit. +// code-alarm 0.2.2, MIT License, https://github.com/Draganoider/code-alarm. Generated by cli/build.mjs: do not edit. // src/main.ts import { homedir as homedir2 } from "node:os"; @@ -1904,7 +1904,7 @@ function qrForTerminal(text) { } // src/main.ts -var VERSION = true ? "0.2.1" : "dev"; +var VERSION = true ? "0.2.2" : "dev"; var DEFAULT_ARM_MS = 12 * HOUR; var HELP = `code-alarm ${VERSION}: a real alarm on your phone when Claude Code or Codex finishes or needs you. diff --git a/cli/package-lock.json b/cli/package-lock.json index 2914bfe..2b24811 100644 --- a/cli/package-lock.json +++ b/cli/package-lock.json @@ -1,12 +1,12 @@ { "name": "code-alarm", - "version": "0.2.1", + "version": "0.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "code-alarm", - "version": "0.2.1", + "version": "0.2.2", "license": "MIT", "bin": { "code-alarm": "dist/code-alarm.mjs" diff --git a/cli/package.json b/cli/package.json index 1451204..aca7cb8 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "code-alarm", - "version": "0.2.1", + "version": "0.2.2", "description": "Wake up when Claude Code or Codex finishes or needs you: a real alarm on your phone, from agent hooks.", "license": "MIT", "author": "Yevhen Mishchenko", @@ -35,7 +35,7 @@ "build": "node build.mjs", "test": "tsc -p tsconfig.test.json && node --test \"build/test/**/*.test.js\"", "check": "npm run typecheck && npm test && npm run build", - "prepack": "node -e \"for (const f of ['LICENSE', 'README.md']) require('node:fs').copyFileSync('../' + f, f)\"" + "prepack": "node prepack.mjs" }, "devDependencies": { "@types/node": "^26.6.5", diff --git a/cli/prepack.mjs b/cli/prepack.mjs new file mode 100644 index 0000000..a89db4c --- /dev/null +++ b/cli/prepack.mjs @@ -0,0 +1,25 @@ +// Copies the repository's LICENSE and README into the package before `npm pack` or `npm publish`. +// The README's links and images are relative to the repository root, which npm can't resolve, so +// they're pointed at GitHub: images at the raw files on main, links at the files' pages. +import { copyFileSync, readFileSync, writeFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const here = dirname(fileURLToPath(import.meta.url)); +const root = join(here, ".."); +const RAW = "https://raw.githubusercontent.com/Draganoider/code-alarm/main/"; +const PAGE = "https://github.com/Draganoider/code-alarm/blob/main/"; + +/** Rewrites src="…", href="…" and markdown (…) targets that are relative paths. */ +export function absoluteLinks(readme) { + const relative = (target) => !/^([a-z][a-z0-9+.-]*:|#|\/)/i.test(target); + return readme + .replace(/\bsrc="([^"]+)"/g, (all, target) => (relative(target) ? `src="${RAW}${target}"` : all)) + .replace(/\bhref="([^"]+)"/g, (all, target) => (relative(target) ? `href="${PAGE}${target}"` : all)) + .replace(/(!?)\]\(([^)\s]+)\)/g, (all, bang, target) => (relative(target) ? `${bang}](${bang ? RAW : PAGE}${target})` : all)); +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) { + copyFileSync(join(root, "LICENSE"), join(here, "LICENSE")); + writeFileSync(join(here, "README.md"), absoluteLinks(readFileSync(join(root, "README.md"), "utf8"))); +} diff --git a/docs/assets/hero.svg b/docs/assets/hero.svg new file mode 100644 index 0000000..6fbae47 --- /dev/null +++ b/docs/assets/hero.svg @@ -0,0 +1,127 @@ + + Code Alarm: your agent finishes, your phone rings + A terminal where Claude Code is armed with /code-alarm:alarm, works for 47 minutes and finishes. A dashed line runs to a phone showing Code Alarm's ring screen: Done, web-app, Claude Code finished the task, with a Stop button. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + web-app — claude + + + ~/web-app $ claude + > /code-alarm:alarm add rate limiting, then make the tests pass + ● Armed "web-app". I'll ring your phone when I'm done. + + + 47 MIN LATER + + + ● Edit src/middleware/rate-limit.ts + ● Bash npm test +   └ 128 passing (4.2s) + ● Done: rate limiting is in, and all 128 tests pass. +   └ code-alarm done → ringing your phone + + + + + + + + + + + + + + 13:05 + + + + + + + + + + + + + + + Done + web-app + Claude Code finished the task. + + + Stop + + Snooze 5 min + + + diff --git a/docs/assets/how-it-works.svg b/docs/assets/how-it-works.svg new file mode 100644 index 0000000..30b7269 --- /dev/null +++ b/docs/assets/how-it-works.svg @@ -0,0 +1,115 @@ + + How Code Alarm works + On your computer, an armed agent (Claude Code or Codex) runs code-alarm's hooks. When the work finishes, stops, fails or needs you, code-alarm sends one small event, its kind, the folder's name, the agent and two timestamps, through the Code Alarm relay or ntfy to your phone, which rings like an alarm. Prompts, code, file paths and transcripts stay on the computer. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ON YOUR COMPUTER + + + + Prompts, code, file paths and transcripts never leave this box. + + + + + 01 + + + + Your agent + Claude Code or Codex, + armed with + /code-alarm:alarm + + + + + 02 + + + code-alarm + Its hooks see the work finish, + stop, fail or wait for you. + + + + 03 + + + + + Relay or ntfy + Passes the event on as a + high-priority push. + + + + 04 + + + + + + Your phone + Rings like an alarm, not + a quiet notification. + + + + + + + + + + + THE WHOLE ALERT + {"kind":"done", "label":"web-app", "agent":"claude-code", …} + diff --git a/docs/assets/logo.svg b/docs/assets/logo.svg new file mode 100644 index 0000000..58cb39f --- /dev/null +++ b/docs/assets/logo.svg @@ -0,0 +1,23 @@ + + Code Alarm + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/claude-code/.claude-plugin/plugin.json b/plugins/claude-code/.claude-plugin/plugin.json index 574f05a..96ee445 100644 --- a/plugins/claude-code/.claude-plugin/plugin.json +++ b/plugins/claude-code/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "code-alarm", - "version": "0.2.1", + "version": "0.2.2", "description": "A real alarm on your phone when Claude Code finishes or needs you. Arm a task with /code-alarm:alarm; only armed work rings.", "author": { "name": "Yevhen Mishchenko", diff --git a/plugins/claude-code/bin/code-alarm.mjs b/plugins/claude-code/bin/code-alarm.mjs index 2b39d2a..a38e7f1 100755 --- a/plugins/claude-code/bin/code-alarm.mjs +++ b/plugins/claude-code/bin/code-alarm.mjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -// code-alarm 0.2.1, MIT License, https://github.com/Draganoider/code-alarm. Generated by cli/build.mjs: do not edit. +// code-alarm 0.2.2, MIT License, https://github.com/Draganoider/code-alarm. Generated by cli/build.mjs: do not edit. // src/main.ts import { homedir as homedir2 } from "node:os"; @@ -1904,7 +1904,7 @@ function qrForTerminal(text) { } // src/main.ts -var VERSION = true ? "0.2.1" : "dev"; +var VERSION = true ? "0.2.2" : "dev"; var DEFAULT_ARM_MS = 12 * HOUR; var HELP = `code-alarm ${VERSION}: a real alarm on your phone when Claude Code or Codex finishes or needs you.