@cliphijack/santaclaude 1.0.3 → 1.0.4

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/santaclaude.js +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cliphijack/santaclaude",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "publishConfig": { "access": "public" },
5
5
  "description": "SantaClaude 커넥터 — 클라우드 예약을 내 로컬 Claude(tmux)에 발사",
6
6
  "bin": { "santaclaude": "./santaclaude.js" },
package/santaclaude.js CHANGED
@@ -31,9 +31,16 @@ function saveConf(c) { fs.writeFileSync(CONF, JSON.stringify(c, null, 2)); }
31
31
  function paneExists(pane) { try { execFileSync('tmux', ['has-session', '-t', pane.split(':')[0]], { stdio: 'ignore' }); return true; } catch { return false; } }
32
32
 
33
33
  function inject(pane, message) {
34
- const oneLine = String(message).replace(/[\r\n]+/g, ' ');
35
- execFileSync('tmux', ['send-keys', '-t', pane, '-l', oneLine]);
36
- setTimeout(() => { try { execFileSync('tmux', ['send-keys', '-t', pane, 'Enter']); } catch (e) {} }, 350);
34
+ const msg = String(message);
35
+ if (/[\r\n]/.test(msg)) {
36
+ // 멀티라인 tmux paste-buffer로 줄바꿈 보존 주입 (claude code가 bracketed paste로 입력 인식)
37
+ execFileSync('tmux', ['set-buffer', '-b', 'sc-inj', msg]);
38
+ execFileSync('tmux', ['paste-buffer', '-b', 'sc-inj', '-p', '-d', '-t', pane]); // -p bracketed, -d 버퍼삭제
39
+ setTimeout(() => { try { execFileSync('tmux', ['send-keys', '-t', pane, 'Enter']); } catch (e) {} }, 400);
40
+ } else {
41
+ execFileSync('tmux', ['send-keys', '-t', pane, '-l', msg]);
42
+ setTimeout(() => { try { execFileSync('tmux', ['send-keys', '-t', pane, 'Enter']); } catch (e) {} }, 350);
43
+ }
37
44
  }
38
45
  // tmux 세션 새로 만들고 그 안에 claude 자동 실행 (cwd 지정 시 그 폴더에서 = 프로젝트별 분리)
39
46
  function spawnClaude(session, cmd, cwd) {