e2e-agent-runner 1.5.2 → 1.5.3
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/git.mjs +1 -6
- package/package.json +1 -1
- package/runner.mjs +31 -26
package/git.mjs
CHANGED
|
@@ -69,12 +69,7 @@ export async function probeFolder(cwd) {
|
|
|
69
69
|
const inside = await run(cwd, 'rev-parse', '--is-inside-work-tree');
|
|
70
70
|
if (inside !== 'true') return { ...base, ok: false, error: 'git 저장소가 아닙니다.', code: 'not_git' };
|
|
71
71
|
const branch = await run(cwd, 'rev-parse', '--abbrev-ref', 'HEAD');
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
remote = await run(cwd, 'remote', 'get-url', 'origin');
|
|
75
|
-
} catch {
|
|
76
|
-
/* origin 없음 — 로컬 전용 저장소 */
|
|
77
|
-
}
|
|
72
|
+
const remote = await originUrl(cwd); // origin 없으면 null(로컬 전용 저장소)
|
|
78
73
|
const dirty = await run(cwd, 'status', '--porcelain');
|
|
79
74
|
const dirtyCount = dirty ? dirty.split('\n').filter(Boolean).length : 0;
|
|
80
75
|
return { ...base, ok: true, branch, remote, clean: dirtyCount === 0, dirty_count: dirtyCount };
|
package/package.json
CHANGED
package/runner.mjs
CHANGED
|
@@ -249,6 +249,24 @@ function worktreeNote(project, base, branch) {
|
|
|
249
249
|
return `\n\n[러너 알림] 이 폴더는 이 작업 전용 git 워크트리입니다 — base \`${base}\` 에서 만든 \`${branch}\` 체크아웃. 커밋·빌드·테스트·배포는 모두 이 폴더에서 수행한다(의존성 설치가 필요하면 먼저 설치). 사용자의 원본 폴더(${project.folder_path})는 작업 중인 변경이 있을 수 있어 수정하지 않는다(읽기 참고는 가능).`;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
/** implement 종결 메타 수집 — 커밋 수 + (커밋 있을 때만)브랜치 팁 sha·origin URL.
|
|
253
|
+
* 두 실행 모드(워크트리·인플레이스)가 공유한다. 실패는 미보고(서버 폴백 동작). */
|
|
254
|
+
async function captureTaskMeta(repoPath, cwd, base) {
|
|
255
|
+
let commits;
|
|
256
|
+
let branchTip = null;
|
|
257
|
+
let remoteUrl = null;
|
|
258
|
+
try {
|
|
259
|
+
commits = await commitCount(cwd, base);
|
|
260
|
+
if (commits > 0) {
|
|
261
|
+
branchTip = await headSha(cwd);
|
|
262
|
+
remoteUrl = await originUrl(repoPath); // 무변경 과제는 링크 자체가 무의미 — 조회 생략
|
|
263
|
+
}
|
|
264
|
+
} catch {
|
|
265
|
+
/* 커밋 수 계산 실패 — 미보고 시 서버는 기존 전체 파이프라인으로 동작 */
|
|
266
|
+
}
|
|
267
|
+
return { commits, branchTip, remoteUrl };
|
|
268
|
+
}
|
|
269
|
+
|
|
252
270
|
/** implement — git 프리플라이트 → (이전 작업 브랜치 탈출) → 작업 브랜치 → claude(신규 세션).
|
|
253
271
|
* base_branch 를 서버에 보고(유실 방지: EventBuffer 가 재전송한다).
|
|
254
272
|
* 종결 시 작업 브랜치의 커밋 수(base..HEAD)를 함께 보고 — 0이면 서버가 무변경 단축한다.
|
|
@@ -269,17 +287,7 @@ async function runImplement({ step, task, project, buf, cancelled }) {
|
|
|
269
287
|
cwd: wt,
|
|
270
288
|
promptAddon: worktreeNote(project, base, branch),
|
|
271
289
|
});
|
|
272
|
-
|
|
273
|
-
let branchTip = null;
|
|
274
|
-
let remoteUrl = null;
|
|
275
|
-
try {
|
|
276
|
-
commits = await commitCount(wt, base);
|
|
277
|
-
if (commits > 0) branchTip = await headSha(wt);
|
|
278
|
-
} catch {
|
|
279
|
-
/* 커밋 수 계산 실패 — 미보고 시 서버는 기존 전체 파이프라인으로 동작 */
|
|
280
|
-
}
|
|
281
|
-
remoteUrl = await originUrl(project.folder_path);
|
|
282
|
-
return { ...result, commits, branchTip, remoteUrl };
|
|
290
|
+
return { ...result, ...(await captureTaskMeta(project.folder_path, wt, base)) };
|
|
283
291
|
}
|
|
284
292
|
await preflight(project.folder_path, { requireClean: true });
|
|
285
293
|
const base = await escapeTaskBranch(project.folder_path);
|
|
@@ -287,17 +295,7 @@ async function runImplement({ step, task, project, buf, cancelled }) {
|
|
|
287
295
|
buf.taskMeta = { base_branch: base, branch };
|
|
288
296
|
log(`브랜치 준비: ${branch} (base ${base})`);
|
|
289
297
|
const result = await runPhase({ step, task, project, buf, cancelled, extraMeta: buf.taskMeta });
|
|
290
|
-
|
|
291
|
-
let branchTip = null;
|
|
292
|
-
let remoteUrl = null;
|
|
293
|
-
try {
|
|
294
|
-
commits = await commitCount(project.folder_path, base);
|
|
295
|
-
if (commits > 0) branchTip = await headSha(project.folder_path);
|
|
296
|
-
} catch {
|
|
297
|
-
/* 커밋 수 계산 실패 — 미보고 시 서버는 기존 전체 파이프라인으로 동작 */
|
|
298
|
-
}
|
|
299
|
-
remoteUrl = await originUrl(project.folder_path);
|
|
300
|
-
return { ...result, commits, branchTip, remoteUrl };
|
|
298
|
+
return { ...result, ...(await captureTaskMeta(project.folder_path, project.folder_path, base)) };
|
|
301
299
|
}
|
|
302
300
|
|
|
303
301
|
/** discover — 기능 지도 추출·QA 페이즈(qa_run/qa_plan/qa_verify)·개선 사이클 페이즈(imp_analyze/imp_verify) — 읽기 전용. 브랜치·프리플라이트
|
|
@@ -423,8 +421,8 @@ async function runDeploy({ step, task, project, buf, cancelled }) {
|
|
|
423
421
|
|
|
424
422
|
if (WORKTREE) {
|
|
425
423
|
const { wt } = await ensureWorktree(project.folder_path, task.id, base, { reset: false });
|
|
426
|
-
await mergeToBaseWorktree(wt, base, branch);
|
|
427
|
-
log(`병합 완료(워크트리 detach): ${branch} → ${base}`);
|
|
424
|
+
const mergeSha = await mergeToBaseWorktree(wt, base, branch);
|
|
425
|
+
log(`병합 완료(워크트리 detach): ${branch} → ${base} (${mergeSha.slice(0, 8)})`);
|
|
428
426
|
buf.push(step.id, 'status', { event: 'merged', base, branch, worktree: wt });
|
|
429
427
|
|
|
430
428
|
const deployCwd = wt;
|
|
@@ -440,6 +438,9 @@ async function runDeploy({ step, task, project, buf, cancelled }) {
|
|
|
440
438
|
finalText: `# 배포 커맨드 결과\n\n종료 코드: ${output.code}\n\n\`\`\`\n${output.out.trim() || '(출력 없음)'}\n\`\`\`\n\nPHASE_RESULT: ${ok ? 'PASS' : 'FAIL'}`,
|
|
441
439
|
flag: ok ? 'pass' : 'fail',
|
|
442
440
|
sessionId: step.session_id ?? null,
|
|
441
|
+
// 배포 성공 시점의 병합 완성본(refined) — remediate·continue 가 늘린 커밋까지 포함된
|
|
442
|
+
// 정확한 sha 로 implement 시점 보고를 덮어쓴다(서버 update_task 는 null 무시).
|
|
443
|
+
branchTip: ok ? mergeSha : undefined,
|
|
443
444
|
};
|
|
444
445
|
}
|
|
445
446
|
// deploy_command 없음 — Claude 가 관례를 파악해 배포(검증 세션 resume, 워크트리 안에서).
|
|
@@ -452,7 +453,7 @@ async function runDeploy({ step, task, project, buf, cancelled }) {
|
|
|
452
453
|
// error·git 은 확정 완료(base 전진·브랜치 삭제)" 상태 분리를 막는다.
|
|
453
454
|
const deployOk = result.ok && !cancelled() && result.flag === 'pass';
|
|
454
455
|
if (deployOk) await finalizeWorktree();
|
|
455
|
-
return result;
|
|
456
|
+
return deployOk ? { ...result, branchTip: mergeSha } : result;
|
|
456
457
|
}
|
|
457
458
|
|
|
458
459
|
await mergeToBase(project.folder_path, base, branch);
|
|
@@ -470,11 +471,15 @@ async function runDeploy({ step, task, project, buf, cancelled }) {
|
|
|
470
471
|
finalText: `# 배포 커맨드 결과\n\n종료 코드: ${output.code}\n\n\`\`\`\n${output.out.trim() || '(출력 없음)'}\n\`\`\`\n\nPHASE_RESULT: ${ok ? 'PASS' : 'FAIL'}`,
|
|
471
472
|
flag: ok ? 'pass' : 'fail',
|
|
472
473
|
sessionId: step.session_id ?? null,
|
|
474
|
+
branchTip: ok ? await headSha(project.folder_path) : undefined, // 병합 완성본(base 위 HEAD)
|
|
473
475
|
};
|
|
474
476
|
}
|
|
475
477
|
|
|
476
478
|
// deploy_command 없음 — Claude 가 프로젝트 관례(CLAUDE.md/스크립트)를 파악해 배포.
|
|
477
|
-
|
|
479
|
+
// 성공 시 병합 완성본 sha 로 implement 시점 팁을 덮어쓴다(워크트리 경로와 동일 계약).
|
|
480
|
+
const result = await runPhase({ step, task, project, buf, cancelled });
|
|
481
|
+
const ok = result.ok && !cancelled() && result.flag === 'pass';
|
|
482
|
+
return ok ? { ...result, branchTip: await headSha(project.folder_path) } : result;
|
|
478
483
|
}
|
|
479
484
|
|
|
480
485
|
/** deploy_command 실행 — 타임아웃(DEPLOY_TIMEOUT_S)·취소(프로세스 그룹 종료) 내장. */
|