@hmduc16031996/claude-mb-bridge 1.1.3 → 1.1.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 (2) hide show
  1. package/dist/index.js +21 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -60,25 +60,43 @@ async function handleUserPrompt(content, sessionId, cwd) {
60
60
  // Using 'claude' CLI as per plan.
61
61
  // We'll use '-p' to pass the prompt if supported, or pipe it.
62
62
  // The plan says "runClaudeCode(payload.new.content, path)"
63
- const child = spawn('claude', [content], { cwd, shell: true });
63
+ // Remove shell: true to avoid security warnings and help with argument parsing
64
+ // Pass the prompt via stdin instead of arguments for more reliability with long text
65
+ const child = spawn('claude', [], {
66
+ cwd,
67
+ stdio: ['pipe', 'pipe', 'pipe']
68
+ });
64
69
  let output = '';
70
+ // Send the prompt through stdin
71
+ child.stdin.write(content + '\n');
72
+ child.stdin.end();
65
73
  child.stdout.on('data', (data) => {
66
74
  output += data.toString();
67
75
  process.stdout.write(data);
68
76
  });
69
77
  child.stderr.on('data', (data) => {
70
- output += data.toString();
78
+ const str = data.toString();
79
+ // Suppress common CLI noise from the captured output
80
+ if (!str.includes('Warning: no stdin data received') &&
81
+ !str.includes('DeprecationWarning')) {
82
+ output += str;
83
+ }
71
84
  process.stderr.write(data);
72
85
  });
73
86
  child.on('close', async (code) => {
74
87
  console.log(`\n✅ Claude Code finished with code ${code}`);
88
+ // Clean up output from common CLI noise
89
+ const cleanedOutput = output
90
+ .replace(/Warning: no stdin data received in 3s, proceeding without it\..*?\n/g, '')
91
+ .replace(/.*?DeprecationWarning:.*?\n/g, '')
92
+ .trim();
75
93
  // Insert assistant response back to Supabase
76
94
  const { error } = await supabase
77
95
  .from('messages')
78
96
  .insert({
79
97
  session_id: sessionId,
80
98
  role: 'assistant',
81
- content: output || '(No output)'
99
+ content: cleanedOutput || '(No output)'
82
100
  });
83
101
  if (error) {
84
102
  console.error(`❌ Failed to send response: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmduc16031996/claude-mb-bridge",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Bridge between Claude Code CLI and your mobile app via Supabase",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",