claude-remote-approver 0.6.1 → 0.6.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/package.json +1 -1
  2. package/src/ntfy.mjs +23 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-remote-approver",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Approve or deny Claude Code permission prompts remotely from your phone via ntfy.sh",
5
5
  "type": "module",
6
6
  "bin": {
package/src/ntfy.mjs CHANGED
@@ -127,6 +127,7 @@ export function stripMarkdown(text) {
127
127
  // ---------------------------------------------------------------------------
128
128
 
129
129
  const MAX_INPUT = 10000;
130
+ const MESSAGE_MAX_LENGTH = 1000;
130
131
 
131
132
  /**
132
133
  * Count consecutive runs of character ch starting at pos.
@@ -442,37 +443,32 @@ function stripInline(text) {
442
443
  * @returns {{ title: string, message: string }}
443
444
  */
444
445
  export function formatToolInfo({ hook_event_name, tool_name, tool_input }) {
445
- // Plan approval detection
446
+ let title;
447
+ let message;
448
+
446
449
  if (tool_name === 'ExitPlanMode' && typeof tool_input?.plan === 'string') {
447
- const PLAN_MESSAGE_MAX_LENGTH = 300;
448
- const title = 'Claude Code: Plan Review';
449
- if (!tool_input.plan.trim()) {
450
- return { title, message: '(empty plan)' };
450
+ title = 'Claude Code: Plan Review';
451
+ const plain = tool_input.plan.trim() ? stripMarkdown(tool_input.plan) : '';
452
+ message = plain || '(empty plan)';
453
+ } else {
454
+ title = `Claude Code: ${tool_name}`;
455
+ switch (tool_name) {
456
+ case 'Bash':
457
+ message = tool_input?.command ?? JSON.stringify(tool_input);
458
+ break;
459
+ case 'Read':
460
+ case 'Write':
461
+ case 'Edit':
462
+ message = tool_input?.file_path ?? JSON.stringify(tool_input);
463
+ break;
464
+ default:
465
+ message = JSON.stringify(tool_input);
466
+ break;
451
467
  }
452
- const raw = tool_input.plan;
453
- const plain = stripMarkdown(raw);
454
- const message = plain
455
- ? (plain.length > PLAN_MESSAGE_MAX_LENGTH ? plain.slice(0, PLAN_MESSAGE_MAX_LENGTH) + '...' : plain)
456
- : '(empty plan)';
457
- return { title, message };
458
468
  }
459
469
 
460
- const title = `Claude Code: ${tool_name}`;
461
- let message;
462
-
463
- switch (tool_name) {
464
- case 'Bash':
465
- message = tool_input?.command ?? JSON.stringify(tool_input);
466
- break;
467
- case 'Read':
468
- case 'Write':
469
- case 'Edit':
470
- message = tool_input?.file_path ?? JSON.stringify(tool_input);
471
- break;
472
- default:
473
- message = JSON.stringify(tool_input);
474
- break;
470
+ if (message.length > MESSAGE_MAX_LENGTH) {
471
+ message = message.slice(0, MESSAGE_MAX_LENGTH) + '...';
475
472
  }
476
-
477
473
  return { title, message };
478
474
  }