barkclaude 1.0.0 → 1.0.1

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/main.js +34 -12
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -23,24 +23,46 @@ function getRandomMessage() {
23
23
  }
24
24
 
25
25
  function sendToClaude(message) {
26
- // Send Ctrl+C interrupt then a motivational message to Claude Code
27
- const escaped = message.replace(/"/g, '\\"').replace(/!/g, '\\!');
28
-
29
- // Try to find Claude Code terminal and send interrupt + message
30
- // Method 1: Use claude CLI directly
31
- exec(`claude --message "${escaped}" --no-input 2>/dev/null || true`);
32
-
33
- // Method 2: Send to most recent terminal via osascript (macOS)
26
+ const text = `🐕 ${message}`;
27
+
28
+ if (process.platform === 'win32') {
29
+ // Put text on clipboard, focus a likely terminal window, paste + Enter.
30
+ // Uses PowerShell -EncodedCommand so we don't have to escape anything.
31
+ const ps = `
32
+ Add-Type -AssemblyName System.Windows.Forms | Out-Null
33
+ [System.Windows.Forms.Clipboard]::SetText([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${Buffer.from(text, 'utf8').toString('base64')}')))
34
+ $wshell = New-Object -ComObject wscript.shell
35
+ $titles = @('Claude Code','Windows Terminal','PowerShell','Command Prompt','cmd','Terminal','WezTerm','Alacritty','Cursor','VSCode','Visual Studio Code')
36
+ $activated = $false
37
+ foreach ($t in $titles) { if ($wshell.AppActivate($t)) { $activated = $true; break } }
38
+ if (-not $activated) { exit 0 }
39
+ Start-Sleep -Milliseconds 200
40
+ [System.Windows.Forms.SendKeys]::SendWait('^v')
41
+ Start-Sleep -Milliseconds 80
42
+ [System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
43
+ `;
44
+ const encoded = Buffer.from(ps, 'utf16le').toString('base64');
45
+ exec(`powershell -NoProfile -EncodedCommand ${encoded}`);
46
+ return;
47
+ }
48
+
34
49
  if (process.platform === 'darwin') {
50
+ const escaped = text.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
35
51
  const osa = `
36
- tell application "Terminal"
37
- if (count of windows) > 0 then
38
- do script "echo '🐕 ${escaped}'" in front window
39
- end if
52
+ tell application "System Events"
53
+ set the clipboard to "${escaped}"
54
+ keystroke "v" using command down
55
+ delay 0.1
56
+ keystroke return
40
57
  end tell
41
58
  `;
42
59
  exec(`osascript -e '${osa}' 2>/dev/null || true`);
60
+ return;
43
61
  }
62
+
63
+ // Linux: try xdotool
64
+ const escaped = text.replace(/'/g, `'\\''`);
65
+ exec(`xdotool type --delay 0 -- '${escaped}' && xdotool key Return 2>/dev/null || true`);
44
66
  }
45
67
 
46
68
  function createOverlay() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "barkclaude",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "An animated Shiba Inu that barks at Claude Code to make it work faster 🐕",
5
5
  "main": "main.js",
6
6
  "bin": {