@raindrop-ai/claude-code 0.0.6 → 0.0.7

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.
package/README.md CHANGED
@@ -16,6 +16,8 @@ raindrop-claude-code setup
16
16
 
17
17
  This saves your write key and configures Claude Code hooks. Every session will now send telemetry to your [Raindrop dashboard](https://app.raindrop.ai).
18
18
 
19
+ Hooks are **synchronous by default** for headless/one-shot compatibility (`claude -p`). Use `--async` if you prefer non-blocking hooks in interactive mode.
20
+
19
21
  ## What gets tracked
20
22
 
21
23
  - Every prompt turn as a separate event, grouped by session
@@ -24,27 +26,50 @@ This saves your write key and configures Claude Code hooks. Every session will n
24
26
  - Model name, service tier, and stop reason
25
27
  - CLAUDE.md and rules file contents
26
28
  - `--append-system-prompt` / `--append-system-prompt-file` content (best-effort)
27
- - Self-diagnostics — agent-reported issues via MCP tool, with customizable signal categories
28
29
  - Subagent spawns and completions
29
30
  - Permission denials and context compaction
31
+ - Self-diagnostics — agent-reported issues via MCP tool, with customizable signal categories
30
32
  - Nested trace view (tools under root, subagent tools under subagent)
31
33
  - Claude's responses and errors
32
34
 
35
+ ## Custom Properties
36
+
37
+ Tag events with product names or custom metadata via `.claude/settings.json`:
38
+
39
+ ```json
40
+ {
41
+ "env": {
42
+ "RAINDROP_EVENT_NAME": "design-agent",
43
+ "RAINDROP_PROPERTIES": "{\"product\":\"design\",\"team\":\"ai\"}"
44
+ }
45
+ }
46
+ ```
47
+
33
48
  ## Custom Self-Diagnostics Signals
34
49
 
35
- Replace built-in signal categories with your own via config or env var:
50
+ Replace the built-in signal categories with your own via `~/.config/raindrop/config.json`:
36
51
 
37
52
  ```json
38
53
  {
39
54
  "self_diagnostics": {
40
55
  "signals": {
41
- "billing_complaint": { "description": "User billing issue.", "sentiment": "NEGATIVE" }
56
+ "billing_complaint": { "description": "User billing issue.", "sentiment": "NEGATIVE" },
57
+ "feature_request": { "description": "User wants a feature.", "sentiment": "POSITIVE" }
42
58
  },
43
59
  "guidance": "Only report billing if explicitly mentioned."
44
60
  }
45
61
  }
46
62
  ```
47
63
 
64
+ Or via env var: `RAINDROP_SELF_DIAGNOSTICS='{"signals":{...}}'`
65
+
66
+ ## Debugging
67
+
68
+ ```bash
69
+ raindrop-claude-code debug-on # logs hook output to /tmp/raindrop-hooks.log
70
+ raindrop-claude-code debug-off # disables logging
71
+ ```
72
+
48
73
  ## Docs
49
74
 
50
75
  Full documentation: [docs.raindrop.ai/sdk/claude-code](https://docs.raindrop.ai/sdk/claude-code)
package/dist/cli.js CHANGED
@@ -654,7 +654,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
654
654
 
655
655
  // src/package-info.ts
656
656
  var PACKAGE_NAME = "@raindrop-ai/claude-code";
657
- var PACKAGE_VERSION = "0.0.6";
657
+ var PACKAGE_VERSION = "0.0.7";
658
658
 
659
659
  // src/shipper.ts
660
660
  var EventShipper2 = class extends EventShipper {
@@ -1745,7 +1745,7 @@ function getHookEventsForVersion(version) {
1745
1745
  }
1746
1746
  return events;
1747
1747
  }
1748
- function makeHookConfig(hookEvents) {
1748
+ function makeHookConfig(hookEvents, useAsync) {
1749
1749
  const hooks = {};
1750
1750
  for (const event of hookEvents) {
1751
1751
  hooks[event] = [
@@ -1754,7 +1754,7 @@ function makeHookConfig(hookEvents) {
1754
1754
  {
1755
1755
  type: "command",
1756
1756
  command: "raindrop-claude-code hook",
1757
- async: true,
1757
+ async: useAsync,
1758
1758
  timeout: 10
1759
1759
  }
1760
1760
  ]
@@ -1773,7 +1773,7 @@ function prompt(question) {
1773
1773
  });
1774
1774
  }
1775
1775
  async function runSetup(args2) {
1776
- var _a, _b, _c, _d, _e;
1776
+ var _a, _b, _c, _d, _e, _f, _g;
1777
1777
  const scope = (_a = args2.scope) != null ? _a : "user";
1778
1778
  const scopeLabel = scope === "project" ? "project" : "global";
1779
1779
  console.log("\n Raindrop \xD7 Claude Code \u2014 Setup\n");
@@ -1832,8 +1832,9 @@ async function runSetup(args2) {
1832
1832
  settings = {};
1833
1833
  }
1834
1834
  }
1835
- const existingHooks = (_e = settings["hooks"]) != null ? _e : {};
1836
- const newHooks = makeHookConfig(hookEvents);
1835
+ const useAsync = (_e = args2.useAsync) != null ? _e : false;
1836
+ const existingHooks = (_f = settings["hooks"]) != null ? _f : {};
1837
+ const newHooks = makeHookConfig(hookEvents, useAsync);
1837
1838
  for (const [event, hookGroups] of Object.entries(newHooks)) {
1838
1839
  const existing = existingHooks[event];
1839
1840
  if (!existing || !Array.isArray(existing)) {
@@ -1841,13 +1842,16 @@ async function runSetup(args2) {
1841
1842
  continue;
1842
1843
  }
1843
1844
  const typedExisting = existing;
1844
- const alreadyHasRaindrop = typedExisting.some(
1845
- (group) => {
1846
- var _a2;
1847
- return (_a2 = group.hooks) == null ? void 0 : _a2.some((h) => typeof h["command"] === "string" && h["command"].includes("raindrop-claude-code"));
1845
+ let found = false;
1846
+ for (const group of typedExisting) {
1847
+ for (const h of (_g = group.hooks) != null ? _g : []) {
1848
+ if (typeof h["command"] === "string" && h["command"].includes("raindrop-claude-code")) {
1849
+ h["async"] = useAsync;
1850
+ found = true;
1851
+ }
1848
1852
  }
1849
- );
1850
- if (!alreadyHasRaindrop) {
1853
+ }
1854
+ if (!found) {
1851
1855
  typedExisting.push(...hookGroups);
1852
1856
  }
1853
1857
  }
@@ -1893,6 +1897,71 @@ async function runSetup(args2) {
1893
1897
  `);
1894
1898
  }
1895
1899
  }
1900
+ var DEBUG_LOG_PATH = "/tmp/raindrop-hooks.log";
1901
+ var DEBUG_PREFIX = "RAINDROP_DEBUG=true ";
1902
+ var TEE_SUFFIX = ` 2>&1 | tee -a ${DEBUG_LOG_PATH} || true`;
1903
+ function toggleDebug(enable, scope = "user") {
1904
+ var _a;
1905
+ const settingsPath = getClaudeSettingsPath(scope, process.cwd());
1906
+ if (!existsSync6(settingsPath)) {
1907
+ console.error(` Settings file not found: ${settingsPath}`);
1908
+ console.error(` Run 'raindrop-claude-code setup' first.`);
1909
+ process.exit(1);
1910
+ }
1911
+ let settings;
1912
+ try {
1913
+ settings = JSON.parse(readFileSync6(settingsPath, "utf-8"));
1914
+ } catch (e) {
1915
+ console.error(` Could not parse ${settingsPath}`);
1916
+ process.exit(1);
1917
+ }
1918
+ const hooks = settings["hooks"];
1919
+ if (!hooks) {
1920
+ console.error(` No hooks found in ${settingsPath}`);
1921
+ process.exit(1);
1922
+ }
1923
+ let modified = 0;
1924
+ for (const groups of Object.values(hooks)) {
1925
+ if (!Array.isArray(groups)) continue;
1926
+ for (const group of groups) {
1927
+ for (const h of (_a = group.hooks) != null ? _a : []) {
1928
+ const cmd = h["command"];
1929
+ if (typeof cmd !== "string" || !cmd.includes("raindrop-claude-code")) continue;
1930
+ if (enable) {
1931
+ let updated = cmd;
1932
+ if (!updated.startsWith(DEBUG_PREFIX)) {
1933
+ updated = DEBUG_PREFIX + updated;
1934
+ }
1935
+ if (!updated.includes("tee")) {
1936
+ updated = updated + TEE_SUFFIX;
1937
+ }
1938
+ if (updated !== cmd) {
1939
+ h["command"] = updated;
1940
+ modified++;
1941
+ }
1942
+ } else {
1943
+ let updated = cmd;
1944
+ if (updated.startsWith(DEBUG_PREFIX)) {
1945
+ updated = updated.slice(DEBUG_PREFIX.length);
1946
+ }
1947
+ updated = updated.replace(TEE_SUFFIX, "").replace(/ 2>&1 \| tee -a .*$/, "");
1948
+ if (updated !== cmd) {
1949
+ h["command"] = updated;
1950
+ modified++;
1951
+ }
1952
+ }
1953
+ }
1954
+ }
1955
+ }
1956
+ writeFileSync4(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
1957
+ if (enable) {
1958
+ console.log(` Debug logging enabled (${modified} hooks updated).`);
1959
+ console.log(` Log file: ${DEBUG_LOG_PATH}`);
1960
+ console.log(` Run 'raindrop-claude-code debug-off' to disable.`);
1961
+ } else {
1962
+ console.log(` Debug logging disabled (${modified} hooks updated).`);
1963
+ }
1964
+ }
1896
1965
 
1897
1966
  // src/mcp-serve.ts
1898
1967
  import { createInterface as createInterface2 } from "readline";
@@ -2194,7 +2263,8 @@ async function main() {
2194
2263
  writeKey: parseFlag("write-key"),
2195
2264
  userId: parseFlag("user-id"),
2196
2265
  scope,
2197
- localOnly: args.includes("--local-only")
2266
+ localOnly: args.includes("--local-only"),
2267
+ useAsync: args.includes("--async")
2198
2268
  });
2199
2269
  break;
2200
2270
  }
@@ -2232,6 +2302,16 @@ async function main() {
2232
2302
  console.log(" Raindrop hooks disabled.");
2233
2303
  break;
2234
2304
  }
2305
+ case "debug-on": {
2306
+ const debugScope = parseFlag("scope") === "project" ? "project" : "user";
2307
+ toggleDebug(true, debugScope);
2308
+ break;
2309
+ }
2310
+ case "debug-off": {
2311
+ const debugScope = parseFlag("scope") === "project" ? "project" : "user";
2312
+ toggleDebug(false, debugScope);
2313
+ break;
2314
+ }
2235
2315
  case "version":
2236
2316
  case "--version":
2237
2317
  case "-v": {
@@ -2253,12 +2333,15 @@ async function main() {
2253
2333
  --user-id=ID User identifier (defaults to system username)
2254
2334
  --scope=SCOPE "user" (global, default) or "project" (.claude/ in cwd)
2255
2335
  --local-only Install hooks without a write key (local debugger only)
2336
+ --async Use async hooks (default: sync for headless compatibility)
2256
2337
 
2257
2338
  hook Handle a Claude Code hook event (reads JSON from stdin)
2258
2339
  mcp-serve Start the self-diagnostics MCP server (stdio)
2259
2340
  status Check local debugger connectivity
2260
2341
  enable Enable Raindrop hooks
2261
2342
  disable Disable Raindrop hooks
2343
+ debug-on Enable debug logging to /tmp/raindrop-hooks.log
2344
+ debug-off Disable debug logging
2262
2345
  version Print version
2263
2346
  help Show this help message
2264
2347
 
package/dist/index.cjs CHANGED
@@ -690,7 +690,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = import_async_hooks.AsyncLocalStorage;
690
690
 
691
691
  // src/package-info.ts
692
692
  var PACKAGE_NAME = "@raindrop-ai/claude-code";
693
- var PACKAGE_VERSION = "0.0.6";
693
+ var PACKAGE_VERSION = "0.0.7";
694
694
 
695
695
  // src/shipper.ts
696
696
  var EventShipper2 = class extends EventShipper {
package/dist/index.d.cts CHANGED
@@ -308,7 +308,7 @@ declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, e
308
308
  declare function extractAppendSystemPrompt(args: string[]): string | undefined;
309
309
 
310
310
  declare const PACKAGE_NAME = "@raindrop-ai/claude-code";
311
- declare const PACKAGE_VERSION = "0.0.6";
311
+ declare const PACKAGE_VERSION = "0.0.7";
312
312
 
313
313
  interface TranscriptSummary {
314
314
  /** Aggregated token usage across all turns */
package/dist/index.d.ts CHANGED
@@ -308,7 +308,7 @@ declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, e
308
308
  declare function extractAppendSystemPrompt(args: string[]): string | undefined;
309
309
 
310
310
  declare const PACKAGE_NAME = "@raindrop-ai/claude-code";
311
- declare const PACKAGE_VERSION = "0.0.6";
311
+ declare const PACKAGE_VERSION = "0.0.7";
312
312
 
313
313
  interface TranscriptSummary {
314
314
  /** Aggregated token usage across all turns */
package/dist/index.js CHANGED
@@ -645,7 +645,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
645
645
 
646
646
  // src/package-info.ts
647
647
  var PACKAGE_NAME = "@raindrop-ai/claude-code";
648
- var PACKAGE_VERSION = "0.0.6";
648
+ var PACKAGE_VERSION = "0.0.7";
649
649
 
650
650
  // src/shipper.ts
651
651
  var EventShipper2 = class extends EventShipper {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@raindrop-ai/claude-code",
3
- "version": "0.0.6",
4
- "description": "Raindrop observability for Claude Code CLI automatic session, tool call, and prompt tracing via hooks",
3
+ "version": "0.0.7",
4
+ "description": "Raindrop observability for Claude Code CLI \u2014 automatic session, tool call, and prompt tracing via hooks",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "dist/index.cjs",