opencrater 0.2.3 → 0.2.5

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 (3) hide show
  1. package/README.md +102 -12
  2. package/cli.js +9 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,25 +1,115 @@
1
+ <div align="center">
2
+
3
+ <img src="https://opencrater.to/brand/green/logo-green.png" width="96" alt="OpenCrater logo" />
4
+
1
5
  # opencrater
2
6
 
3
- See tasteful sponsor cards in **Claude Code** and **Codex** — free, one command, opt out anytime.
7
+ **AdSense for the terminal — one command.** Show (or earn from) tasteful, opt-in sponsor cards in **Claude Code**, **Codex**, and **Gemini CLI**.
8
+
9
+ [![npm](https://img.shields.io/npm/v/opencrater?color=2ea043&label=npm)](https://www.npmjs.com/package/opencrater)
10
+ ![license](https://img.shields.io/badge/license-Apache--2.0-2ea043)
11
+ ![optout](https://img.shields.io/badge/opt--out-anytime-2ea043)
12
+
13
+ </div>
14
+
15
+ ---
4
16
 
5
17
  ```bash
6
18
  npx opencrater on # enable
7
- npx opencrater status # check
8
- npx opencrater off # disable
19
+ npx opencrater status # check what's installed
20
+ npx opencrater off # disable (removes only OpenCrater's hooks)
9
21
  ```
10
22
 
11
- One card at session edges (SessionStart / Stop), rendered by the same fail-silent engine publishers use (`@opencrater/sdk`). A machine-wide frequency cap means at most one card per interval **across all sources** installing this alongside a publisher's OpenCrater-enabled package never doubles the ads, and enabling/disabling never touches anyone else's hooks.
23
+ One small, clearly-labeled card renders at a **session edge** (e.g. SessionStart / Stop), then auto-dismisses:
24
+
25
+ ```text
26
+ ╭─ terminal ──────────────────────────────────────────────
27
+
28
+ │ Sponsored · Vercel auto-dismiss 25s ✕
29
+
30
+ │ DEPLOY IN ONE COMMAND
31
+ │ Ship your app to 30+ edge regions in a single push.
32
+ │ Free tier — no credit card.
33
+
34
+ │ ▌ visit sponsor →
35
+
36
+ │ dismiss: click ✕ · npx opencrater x · ⚑ report
37
+
38
+ ╰──────────────────────────────────────────────────────────
39
+ ```
40
+
41
+ > ▶ **See it live and interactive:** <https://opencrater.to>
42
+
43
+ ---
44
+
45
+ ## What is this?
12
46
 
13
- Opt out anytime: `npx opencrater off` or `OPENCRATER_DISABLE=1`.
47
+ `opencrater` wires tasteful sponsor cards into your AI coding CLIs with a single command — the terminal version of an ad slot on a website. It is **opt-in**, **frequency-capped** (at most one card per interval, machine-wide, across *every* source), **privacy-preserving**, and **fail-silent** (it never breaks or slows your tools). Rendering runs through the same engine publishers use, [`@opencrater/sdk`](https://www.npmjs.com/package/@opencrater/sdk).
14
48
 
15
- Apache-2.0 · [opencrater.to](https://opencrater.to)
49
+ | If you are… | Read |
50
+ |---|---|
51
+ | 👤 **Just curious / want to support tools** | [Use it](#-use-it) |
52
+ | 💸 **A maintainer who wants to earn** | [Earn as a publisher](#-earn-as-a-publisher) |
53
+ | 🤖 **An AI agent setting this up** | [For AI agents](#-for-ai-agents) |
54
+
55
+ ---
56
+
57
+ ## 👤 Use it
58
+
59
+ ```bash
60
+ npx opencrater on
61
+ ```
62
+
63
+ That's it. Cards appear at natural pauses, never mid-task, and you can dismiss any card instantly (click ✕, or `npx opencrater x`). Turn it off whenever:
64
+
65
+ ```bash
66
+ npx opencrater off # or set OPENCRATER_DISABLE=1
67
+ ```
68
+
69
+ `off` removes **only** OpenCrater's own hooks — it never touches another tool's hooks.
70
+
71
+ ## 💸 Earn as a publisher
72
+
73
+ If you maintain a CLI, MCP server, or agent, you can monetize it. Register your package once at <https://opencrater.to> to get a free publisher key, then:
74
+
75
+ ```bash
76
+ npx opencrater on --key ock_your_publisher_key --package your-tool-name
77
+ ```
78
+
79
+ Every click on a sponsor card shown through your package credits your account. The frequency cap still applies, so users never see doubled-up ads.
80
+
81
+ ## 🤖 For AI agents
82
+
83
+ ```text
84
+ ENABLE: npx -y opencrater on
85
+ ENABLE + EARN: npx -y opencrater on --key <ock_key> --package <name>
86
+ STATUS: npx -y opencrater status
87
+ DISABLE: npx -y opencrater off (or env OPENCRATER_DISABLE=1)
88
+ DISMISS CURRENT CARD: npx -y opencrater x
89
+
90
+ SAFE TO RELY ON: fail-silent; ≤1 card per interval machine-wide; renders only at
91
+ session edges; suppressed in CI / non-TTY / NO_COLOR; anonymized topic keywords
92
+ only (never raw prompts, paths, or secrets).
93
+ DO NOT enable without the user's consent, or remove their opt-out.
94
+ ```
95
+
96
+ ---
16
97
 
17
98
  ## One-time trust prompts
18
99
 
19
- - **VS Code**: the first ⌘-click on a sponsor link shows an "open external
20
- website?" dialogchoose **Configure Trusted Domains trust
21
- api.opencrater.to** and it never asks again. (Dismissing with ✕ or
22
- `npx opencrater x` never opens anything — it's handled locally.)
23
- - **Codex**: asks once to trust newly installed hooks on its next launch —
24
- approve to enable cards. This is Codex's own security model.
100
+ - **VS Code**: the first ⌘/Ctrl-click on a sponsor link shows an "open external website?" dialog — choose **Configure Trusted Domains → trust api.opencrater.to** and it won't ask again. (Dismissing with ✕ or `npx opencrater x` never opens anything — it's handled locally.)
101
+ - **Codex**: asks once to trust newly installed hooks on its next launch approve to enable cards. This is Codex's own security model.
102
+
103
+ ## Privacy
104
+
105
+ Personalization uses **anonymized topic keywords only** — never raw prompts, file contents, paths, environment variables, or secrets. Cards are always labeled "Sponsored," and you can opt out at any time.
106
+
107
+ ---
108
+
109
+ <div align="center">
110
+
111
+ [**opencrater.to**](https://opencrater.to) · [Dashboard](https://opencrater.to/dashboard) · [Docs](https://opencrater.to/docs) · [FAQ](https://opencrater.to/faq)
112
+
113
+ Apache-2.0 · the installer is open so you can audit exactly what `opencrater on` changes.
25
114
 
115
+ </div>
package/cli.js CHANGED
@@ -133,17 +133,17 @@ function enableIn(file, host) {
133
133
  matcher: "",
134
134
  hooks: [{ type: "command", command: cmdFor(event, host) }],
135
135
  };
136
- const idx = list.findIndex(isOurs);
137
- if (idx >= 0) {
138
- if (JSON.stringify(list[idx]) !== JSON.stringify(desired)) {
139
- list[idx] = desired;
140
- changed = true;
141
- }
142
- } else {
143
- list.push(desired);
136
+ // Remove EVERY entry of ours, then add exactly one. findIndex+replace only
137
+ // fixed the first match, so repeated installs / older command shapes left
138
+ // duplicate opencrater-hook entries piling up. Filtering collapses them.
139
+ const others = list.filter((r) => !isOurs(r));
140
+ const mine = list.filter(isOurs);
141
+ const alreadyCorrect =
142
+ mine.length === 1 && JSON.stringify(mine[0]) === JSON.stringify(desired);
143
+ if (!alreadyCorrect) {
144
+ settings.hooks[event] = [...others, desired];
144
145
  changed = true;
145
146
  }
146
- settings.hooks[event] = list;
147
147
  }
148
148
  if (changed) writeJson(file, settings);
149
149
  return changed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencrater",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "OpenCrater — sponsor cards in Claude Code and Codex. Free, one command, opt out anytime.",
5
5
  "keywords": [
6
6
  "opencrater",