@cliphijack/santaclaude 0.2.0 → 0.3.0

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 +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cliphijack/santaclaude",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "publishConfig": { "access": "public" },
5
5
  "description": "SantaClaude 커넥터 — 클라우드 예약을 내 로컬 Claude(tmux)에 발사",
6
6
  "bin": { "santaclaude": "./santaclaude.js" },
package/santaclaude.js CHANGED
@@ -75,10 +75,18 @@ async function run(conf) {
75
75
  post(api, '/api/heartbeat', { token, pane }).catch(() => {});
76
76
  const d = await post(api, '/api/jobs/claim', { token });
77
77
  for (const j of (d.jobs || [])) {
78
- if (!paneExists(pane)) { if (!warned) { console.warn(` ⚠️ pane "${pane}" 없음 주입 보류`); warned = true; } continue; }
78
+ // 잡의 대상 세션 우선, 없으면 기본 pane. 대상 세션이 없으면 기본 pane으로 폴백
79
+ let tpane = (j.target && String(j.target).trim()) || pane;
80
+ if (!paneExists(tpane)) {
81
+ if (conf.spawn !== false && tpane !== pane) {
82
+ try { spawnClaude(String(tpane).split(':')[0], claudeCmd); console.log(` 🦌 대상 "${tpane}" 세션이 없어서 새로 띄웠어 (tmux attach 로 로그인 1회).`); }
83
+ catch (e) { tpane = pane; }
84
+ } else if (!paneExists(tpane)) { tpane = pane; }
85
+ }
86
+ if (!paneExists(tpane)) { if (!warned) { console.warn(` ⚠️ 주입할 세션 "${tpane}" 없음 — 보류`); warned = true; } continue; }
79
87
  warned = false;
80
- console.log(`[발사] ${new Date().toISOString()} → ${pane}: ${String(j.message).slice(0, 60)}`);
81
- inject(pane, '[SantaClaude] ' + j.message);
88
+ console.log(`[발사] ${new Date().toISOString()} → ${tpane}: ${String(j.message).slice(0, 60)}`);
89
+ inject(tpane, '[SantaClaude] ' + j.message);
82
90
  }
83
91
  } catch (e) { console.error('[폴링 오류]', e.message); }
84
92
  }