@elyun/bylane 1.34.0 → 1.35.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.
- package/package.json +1 -1
- package/src/cli.js +3 -3
- package/src/loop-utils.js +18 -5
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -286,14 +286,14 @@ if (command === 'install') {
|
|
|
286
286
|
const mode = resolveLoopMode()
|
|
287
287
|
|
|
288
288
|
if (mode === 'tmux') {
|
|
289
|
-
startTmuxLoops(sessionName)
|
|
289
|
+
startTmuxLoops(sessionName, { packageRoot: ROOT, projectDir: process.cwd() })
|
|
290
290
|
console.log(`\n tmux 세션에 접속하려면: tmux attach -t ${sessionName}\n`)
|
|
291
291
|
} else {
|
|
292
292
|
// process 모드: 현재 프로세스에서 직접 실행
|
|
293
293
|
console.log('\n process 모드: review-loop + respond-loop 실행\n')
|
|
294
294
|
const { spawn } = await import('child_process')
|
|
295
|
-
const review = spawn(process.execPath, ['src
|
|
296
|
-
const respond = spawn(process.execPath, ['src
|
|
295
|
+
const review = spawn(process.execPath, [join(ROOT, 'src', 'review-loop.js')], { stdio: 'inherit', detached: false, cwd: process.cwd() })
|
|
296
|
+
const respond = spawn(process.execPath, [join(ROOT, 'src', 'respond-loop.js')], { stdio: 'inherit', detached: false, cwd: process.cwd() })
|
|
297
297
|
|
|
298
298
|
function shutdownAll() {
|
|
299
299
|
review.kill('SIGTERM')
|
package/src/loop-utils.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* 루프 프로세스 공통 유틸
|
|
4
4
|
*/
|
|
5
5
|
import { execSync } from 'child_process'
|
|
6
|
+
import { join } from 'path'
|
|
6
7
|
import { readState, writeState } from './state.js'
|
|
7
8
|
import { loadConfig } from './config.js'
|
|
8
9
|
|
|
@@ -152,22 +153,34 @@ export function verifyTmuxLoops(sessionName = 'bylane-loops', stateDir = '.bylan
|
|
|
152
153
|
/**
|
|
153
154
|
* tmux 세션에서 review-loop + respond-loop을 실행
|
|
154
155
|
* @param {string} sessionName
|
|
155
|
-
* @param {
|
|
156
|
+
* @param {object} opts
|
|
157
|
+
* @param {string} [opts.stateDir] 상태 디렉토리 (상대경로)
|
|
158
|
+
* @param {string} [opts.packageRoot] 패키지 루트 경로 (스크립트 절대경로 해석용)
|
|
159
|
+
* @param {string} [opts.projectDir] 프로젝트 디렉토리 (tmux CWD, .bylane/ 기준)
|
|
156
160
|
*/
|
|
157
|
-
export function startTmuxLoops(sessionName = 'bylane-loops',
|
|
161
|
+
export function startTmuxLoops(sessionName = 'bylane-loops', opts = {}) {
|
|
162
|
+
const {
|
|
163
|
+
stateDir = '.bylane/state',
|
|
164
|
+
packageRoot = process.cwd(),
|
|
165
|
+
projectDir = process.cwd()
|
|
166
|
+
} = typeof opts === 'string' ? { stateDir: opts } : opts
|
|
167
|
+
|
|
158
168
|
if (isTmuxSessionAlive(sessionName)) {
|
|
159
169
|
console.log(`[tmux] 세션 '${sessionName}'이 이미 실행 중입니다.`)
|
|
160
170
|
return { started: false, reason: 'already_running' }
|
|
161
171
|
}
|
|
162
172
|
|
|
163
|
-
|
|
173
|
+
const reviewScript = join(packageRoot, 'src', 'review-loop.js')
|
|
174
|
+
const respondScript = join(packageRoot, 'src', 'respond-loop.js')
|
|
175
|
+
|
|
176
|
+
// 첫 번째 윈도우: review-loop (-c 로 프로젝트 디렉토리에서 실행)
|
|
164
177
|
execSync(
|
|
165
|
-
`tmux new-session -d -s ${sessionName} -n review 'node
|
|
178
|
+
`tmux new-session -d -s ${sessionName} -n review -c '${projectDir}' 'node ${reviewScript}'`,
|
|
166
179
|
{ stdio: 'inherit' }
|
|
167
180
|
)
|
|
168
181
|
// 두 번째 윈도우: respond-loop
|
|
169
182
|
execSync(
|
|
170
|
-
`tmux new-window -t ${sessionName} -n respond 'node
|
|
183
|
+
`tmux new-window -t ${sessionName} -n respond -c '${projectDir}' 'node ${respondScript}'`,
|
|
171
184
|
{ stdio: 'inherit' }
|
|
172
185
|
)
|
|
173
186
|
|