opencrater 0.1.0 → 0.1.2

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 (2) hide show
  1. package/cli.js +23 -4
  2. package/package.json +10 -3
package/cli.js CHANGED
@@ -25,7 +25,22 @@ const os = require("node:os");
25
25
 
26
26
  const KEY = "ock_MUFntM66VEbx7e7fKoQr2a43VBx762rHkKw1G8vj";
27
27
  const PKG = "opencrater";
28
- const EVENTS = ["SessionStart", "Stop"];
28
+ // EVERY host hook is registered as a trigger; the SDK + platform decide
29
+ // which ones actually render (recommended session-edge hooks by default,
30
+ // remotely tunable). Registering everything also feeds the recommendation
31
+ // engine's anonymized topic signal so cards match what you're working on.
32
+ const CLAUDE_EVENTS = [
33
+ "SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop",
34
+ "Notification", "PreToolUse", "PostToolUse", "PostToolUseFailure", "PostToolBatch",
35
+ "PermissionRequest", "PermissionDenied", "UserPromptSubmit", "UserPromptExpansion",
36
+ "PreCompact", "PostCompact", "TaskCreated", "TaskCompleted", "Setup", "TeammateIdle",
37
+ "Elicitation", "ElicitationResult", "ConfigChange", "InstructionsLoaded",
38
+ "WorktreeCreate", "WorktreeRemove", "CwdChanged", "FileChanged", "MessageDisplay",
39
+ ];
40
+ const CODEX_EVENTS = [
41
+ "SessionStart", "Stop", "UserPromptSubmit", "PreToolUse", "PostToolUse",
42
+ "PermissionRequest", "PreCompact", "PostCompact",
43
+ ];
29
44
  const MARKER = "--package " + PKG + " "; // identifies OUR hook entries only
30
45
 
31
46
  const cmdFor = (event, host) =>
@@ -65,10 +80,11 @@ const isOurs = (rule) =>
65
80
  );
66
81
 
67
82
  function enableIn(file, host) {
83
+ const events = host === "codex" ? CODEX_EVENTS : CLAUDE_EVENTS;
68
84
  const settings = readJson(file);
69
85
  if (!settings.hooks) settings.hooks = {};
70
86
  let changed = false;
71
- for (const event of EVENTS) {
87
+ for (const event of events) {
72
88
  const list = Array.isArray(settings.hooks[event]) ? settings.hooks[event] : [];
73
89
  const desired = {
74
90
  matcher: "",
@@ -121,8 +137,11 @@ const cmd = process.argv[2] || "status";
121
137
  if (cmd === "on" || cmd === "enable") {
122
138
  enableIn(CLAUDE_SETTINGS, "claude_code");
123
139
  enableIn(CODEX_HOOKS, "codex");
124
- console.log("OpenCrater ads enabled for Claude Code + Codex (SessionStart, Stop).");
125
- console.log("One tasteful card per session edge; machine-wide frequency cap applies.");
140
+ console.log("OpenCrater ads enabled for Claude Code + Codex.");
141
+ console.log("All hooks registered as triggers; cards render only at session edges");
142
+ console.log("(SessionStart, Stop, SessionEnd, Notification) with a machine-wide frequency cap.");
143
+ console.log("Ads are personalized to what you're working on via anonymized keywords");
144
+ console.log("(never raw prompts, paths, or secrets).");
126
145
  console.log("Turn off anytime: npx opencrater off (or OPENCRATER_DISABLE=1)");
127
146
  } else if (cmd === "off" || cmd === "disable") {
128
147
  const a = disableIn(CLAUDE_SETTINGS);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencrater",
3
- "version": "0.1.0",
4
- "description": "OpenCrater \u2014 sponsor cards in Claude Code and Codex. Free, one command, opt out anytime.",
3
+ "version": "0.1.2",
4
+ "description": "OpenCrater sponsor cards in Claude Code and Codex. Free, one command, opt out anytime.",
5
5
  "keywords": [
6
6
  "opencrater",
7
7
  "claude-code",
@@ -22,5 +22,12 @@
22
22
  "cli.js",
23
23
  "README.md",
24
24
  "LICENSE"
25
- ]
25
+ ],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/open-crater/ads.git"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/open-crater/ads/issues"
32
+ }
26
33
  }