leerness 1.9.374 → 1.9.376

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/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.376 — 2026-06-06 — UR-0073 Phase D: team deploy 2중 게이트 (에이전트 팀 umbrella 완결) 🎉
4
+
5
+ **🧩 정의된 팀의 사용자 설정 배포 명령을 안전 게이트로 실행 — `leerness team deploy`. UR-0073 A~D 완결.**
6
+
7
+ ### 배경
8
+ UR-0073 로드맵의 마지막·최고위험 단계(실제 외부 배포). 방향 설계 안전 원칙(opt-in/dry-run 기본/명시 승인) 엄격 적용. **Firebase/블로그를 하드코딩하지 않고**(offline-first/0-deps 유지) 사용자가 `deployCommand` 를 설정하면 leerness 가 게이트와 함께 오케스트레이션.
9
+
10
+ ### 구현
11
+ 1. **`team add --deploy "<명령>"`**: 팀에 사용자 설정 배포 명령(예: `firebase deploy --only hosting`, `npm run deploy`) 저장.
12
+ 2. **`team deploy <id> [--yes]`** + **`_teamDeployGate`**(순수, 4-mode):
13
+ - **dry-run**(기본, --yes 없음): 명령 표시만, 실행 X.
14
+ - **gated**(--yes 만, env 없음): **거부** — `LEERNESS_TEAM_DEPLOY=1` 필요.
15
+ - **execute**(--yes + `LEERNESS_TEAM_DEPLOY=1`): shell-guard advisory 점검 후 팀 root 에서 spawn.
16
+ - no-command: deployCommand 미설정 안내.
17
+ 3. **2중 게이트 안전**: 실행은 명시 플래그(`--yes`) AND 명시 env opt-in(`LEERNESS_TEAM_DEPLOY=1`) 동시 충족 시에만. (전역 지침 "deploy 신중" 준수.)
18
+ 4. _renderTeamsMd/show + commands/help 에 deploy 반영.
19
+
20
+ ### 검증 (회귀 0)
21
+ - **selftest 121→122 PASS** (행위: `_teamDeployGate` 4-mode no-command/dry-run/gated/execute).
22
+ - **E2E 320→321 PASS** (행위: dry-run 실행 X marker 없음 · --yes만 거부 marker 없음 · --yes+env 실행 marker 생성).
23
+ - 실측: 3개 게이트 경로 정확 + 배포 명령 spawn 검증.
24
+
25
+ ### 🎉 UR-0073 에이전트 팀 umbrella 완결
26
+ A(정의 레지스트리)·B(preview dry-run)·C(스케줄 알림)·**D(배포 2중 게이트)** 전 단계 완료. 모두 opt-in/dry-run/게이트 안전 위에 구축.
27
+
28
+ ## 1.9.375 — 2026-06-06 — UR-0084: 동시성 락 하드닝 (e2e flake 제거 + lost-update 창 축소)
29
+
30
+ **🛠 고부하 시 간헐 flake 한 락 테스트 + `_withLock` fail-open 창 하드닝.**
31
+
32
+ ### 배경
33
+ 1.9.374 e2e(561s 고부하)에서 "lost-update 락" 테스트가 1회 flake(UR-0084). 근원: `_withLock` 이 `maxWaitMs`(5s) 초과 시 **락 없이 진행**(fail-open) → 극단 경합 시 lost-update 창. + e2e 폴 60s 가 CPU 포화 시 6 병렬 spawn 완료에 빠듯.
34
+
35
+ ### 구현
36
+ 1. **`_withLock` maxWaitMs 5s→10s**: fail-open(락 없이 쓰기) 전 인내 2배 — 고부하 경합에서 lost-update 창 축소(fail-open 정책은 유지, 무한 차단 방지).
37
+ 2. **e2e lost-update 폴 60s→120s**: CPU 포화 헤드룸 2배(격리 실측 0.4s 라 대폭 여유).
38
+ 3. **`_withLock` 행위 selftest 추가**: 실제 락 획득(lock 파일 존재)→재진입(중첩 호출 42)→해제(cleanup) + maxWaitMs 하드닝 확인.
39
+
40
+ ### 검증 (회귀 0)
41
+ - **selftest 120→121 PASS** (신규: _withLock 실호출 행위). **E2E 320/320 PASS**(락 테스트 강건화).
42
+ - 실측: _withLock 획득/재진입/해제 정상, 락 파일 정리.
43
+
3
44
  ## 1.9.374 — 2026-06-06 — UR-0074: release cadence 진단 (외부리뷰 케이던스 가시화)
4
45
 
5
46
  **🧩 외부 리뷰가 반복 지적한 "릴리스 케이던스 과다"를 측정·가시화 — `leerness release cadence`.**
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > **AI 코딩 에이전트의 거짓 완료·중복·망각·충돌을 막아주는 검수·기억·협업 CLI 하네스.**
4
4
  > **A CLI harness that stops AI coding agents from faking completion, duplicating work, forgetting context, and colliding.**
5
5
 
6
- [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.374-green)]() [![tests](https://img.shields.io/badge/e2e-320%2F320-success)]() [![selftest](https://img.shields.io/badge/selftest-120-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-83-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
6
+ [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.376-green)]() [![tests](https://img.shields.io/badge/e2e-321%2F321-success)]() [![selftest](https://img.shields.io/badge/selftest-122-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-83-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
7
7
 
8
8
  ```
9
9
  ╔══════════════════════════════════════════════════════════════╗
@@ -471,7 +471,7 @@ MIT — © leerness contributors
471
471
  <!-- leerness:project-readme:start -->
472
472
  ## Leerness Project Harness
473
473
 
474
- 이 프로젝트는 Leerness v1.9.374 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.376 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
475
475
 
476
476
  ### 정체성 — AI 에이전트 운영 레이어 (UR-0030)
477
477
 
@@ -525,7 +525,7 @@ leerness memory restore decision <date|title>
525
525
 
526
526
  ### MCP server (외부 AI 통합)
527
527
 
528
- Leerness v1.9.374는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.376는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
529
529
 
530
530
  ```jsonc
531
531
  // 카테고리별
@@ -546,7 +546,7 @@ Leerness v1.9.374는 stdio JSON-RPC MCP server를 내장합니다 — Claude Cod
546
546
  `<<autonomous-loop-dynamic>>` 신호만 보내면 AI가:
547
547
  1) 다음 라운드 후보 선정 → 2) 코드 변경 → 3) stress-v* 신규 작성 + 누적 회귀 → 4) e2e 219/219 → 5) npm pack + git tag + GitHub release → 6) main 자동 push (1.9.140+) → 7) session close → 8) 다음 라운드 예약.
548
548
 
549
- 현재 누적: **70 라운드 (1.9.40 → 1.9.374)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.376)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
550
550
 
551
551
  ### 성능 가이드 (1.9.140 측정)
552
552
 
@@ -584,6 +584,6 @@ leerness release pack --close --auto-main-push
584
584
  - `.harness/session-handoff.md`: 다음 세션 인수인계 (자동 작성)
585
585
  - `.harness/lessons.md` / `decisions.md` / `rules.md`: 영구 메모리 (5 surface)
586
586
 
587
- Last synced by Leerness v1.9.374: 2026-06-06
587
+ Last synced by Leerness v1.9.376: 2026-06-06
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -7,7 +7,7 @@ const cp = require('child_process');
7
7
  const os = require('os'); // 1.9.178: _publishToNpm 에서 os.tmpdir() 사용 (전역 import)
8
8
  const readline = require('readline');
9
9
  // 1.9.274 (UR-0025 1단계): 순수 유틸 함수 모듈 분리 (require-based, 비파괴). selftest 7종이 동작 검증.
10
- const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _mergeEnvLines, _mergeReadmeSection, _managedMerge, _parseSkillsValue, _parseArchiveBlocks, _parseSkillCatalog, _renderTeamsMd, _composeTeamPlan, _teamHandoffReminders, _cadenceAssessment, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
10
+ const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _mergeEnvLines, _mergeReadmeSection, _managedMerge, _parseSkillsValue, _parseArchiveBlocks, _parseSkillCatalog, _renderTeamsMd, _composeTeamPlan, _teamHandoffReminders, _cadenceAssessment, _teamDeployGate, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
11
11
  PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
12
12
  _htmlToText, _extractTitle, _extractLinks,
13
13
  _countDatedBlocks, _extractDecisionBlocks, _classifyIntent,
@@ -28,7 +28,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
28
28
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
29
29
  const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST, _DEFAULT_PLATFORM_CONSTRAINTS, _DEFAULT_DOMAIN_CATALOG, _LSP_LANG_PATTERNS, OPTIMISM_PATTERNS, BUILT_IN_PERSONAS, STRINGS, BUILTIN_CATALOG, ROADMAP_STATUS_LABEL, ROADMAP_STATUS_COLOR, SECRET_PATTERNS, MERGE_OVERWRITE_FILES, MINIMAL_SKIP_KEYS, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344/368/369 (UR-0025): catalog 분리 (MERGE_OVERWRITE_FILES/MINIMAL_SKIP_KEYS 포함)
30
30
 
31
- const VERSION = '1.9.374';
31
+ const VERSION = '1.9.376';
32
32
 
33
33
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
34
34
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -199,7 +199,7 @@ const _heldLocks = new Set(); // 프로세스 내 재진입 추적 (중첩 _wit
199
199
  function _withLock(targetPath, fn, opts = {}) {
200
200
  const lockPath = targetPath + '.lock';
201
201
  if (_heldLocks.has(lockPath)) return fn(); // 이미 이 프로세스가 보유 → 재진입(중첩 호출 안전)
202
- const maxWaitMs = opts.maxWaitMs || 5000;
202
+ const maxWaitMs = opts.maxWaitMs || 10000; // 1.9.375 (UR-0084): 5s→10s — 고부하 경합 시 fail-open(락 없이 진행) 전 인내 상향, lost-update 창 축소
203
203
  const staleMs = opts.staleMs || 30000;
204
204
  try { mkdirp(path.dirname(lockPath)); } catch {}
205
205
  const start = Date.now();
@@ -3011,6 +3011,8 @@ function _selfTestCases() {
3011
3011
  { name: 'UR-0073 Phase B: _composeTeamPlan dry-run 실행 계획 (멤버별 dispatch, 실행 없음) 행위 (1.9.372)', run: () => { const m = require('../lib/pure-utils'); if (typeof _composeTeamPlan !== 'function' || m._composeTeamPlan !== _composeTeamPlan) return false; const team = { id: 'rev', name: 'R', purpose: 'PR 리뷰', personas: ['security', 'perf'], members: ['claude', 'codex'], schedule: 'manual' }; const p1 = _composeTeamPlan(team, '점검'); const ok1 = p1.steps.length === 2 && p1.task === '점검' && p1.steps[0].member === 'claude' && p1.steps[0].suggestedCommand.includes('agents dispatch') && p1.steps[0].suggestedCommand.includes('--to claude') && p1.steps[0].dispatchPrompt.includes('security'); const p2 = _composeTeamPlan(team, null); const ok2 = p2.task === 'PR 리뷰'; const p3 = _composeTeamPlan({ id: 'e', personas: [], members: [] }, 'x'); const ok3 = p3.steps.length === 0 && p3.memberCount === 0; return ok1 && ok2 && ok3; } },
3012
3012
  { name: 'UR-0073 Phase C: _teamHandoffReminders 스케줄 알림 (비-manual·active 만, 실행 트리거 아님) 행위 (1.9.373)', run: () => { const m = require('../lib/pure-utils'); if (typeof _teamHandoffReminders !== 'function' || m._teamHandoffReminders !== _teamHandoffReminders) return false; const r = _teamHandoffReminders([{ id: 'rev', schedule: 'every-session', status: 'active', members: ['a', 'b'] }, { id: 'man', schedule: 'manual', status: 'active' }, { id: 'paused', schedule: 'daily', status: 'paused' }]); return r.length === 1 && r[0].includes('rev') && r[0].includes('every-session') && r[0].includes('team preview rev') && !r.join('|').includes('man') && !r.join('|').includes('paused'); } },
3013
3013
  { name: 'UR-0074: _cadenceAssessment 릴리스 빈도 평가 (임계값) 행위 (1.9.374)', run: () => { const m = require('../lib/pure-utils'); if (typeof _cadenceAssessment !== 'function' || m._cadenceAssessment !== _cadenceAssessment || typeof releaseCadenceCmd !== 'function') return false; return _cadenceAssessment(7, 1, 1).level === 'very-high' && _cadenceAssessment(3, 1, 1).level === 'high' && _cadenceAssessment(1, 1, 1).level === 'moderate' && _cadenceAssessment(0.2, 1, 1).level === 'healthy' && _cadenceAssessment(7, 1, 1).recommendation.length > 0; } },
3014
+ { name: 'UR-0084: _withLock 획득/재진입/해제 + maxWaitMs 하드닝(10s) 행위 (1.9.375)', run: () => { if (typeof _withLock !== 'function') return false; const src = read(__filename); const hardened = /maxWaitMs = opts\.maxWaitMs \|\| 10000/.test(src); const tmp = fs.mkdtempSync(path.join(os.tmpdir(), '__leerness_lock_')); try { const target = path.join(tmp, 'f.md'); let reentrant = false; const lockSeen = _withLock(target, () => { const exists = fs.existsSync(target + '.lock'); reentrant = (_withLock(target, () => 42) === 42); return exists; }); const cleaned = !fs.existsSync(target + '.lock'); return hardened && lockSeen === true && reentrant === true && cleaned; } finally { try { fs.rmSync(tmp, { recursive: true, force: true }); } catch {} } } },
3015
+ { name: 'UR-0073 Phase D: _teamDeployGate 이중 게이트 (dry-run 기본/env 게이트/실행) 행위 (1.9.376)', run: () => { const m = require('../lib/pure-utils'); if (typeof _teamDeployGate !== 'function' || m._teamDeployGate !== _teamDeployGate) return false; const team = { id: 'd', deployCommand: 'echo hi' }; const noCmd = _teamDeployGate({ id: 'x' }, { yes: true, envOn: true }).mode === 'no-command'; const dry = _teamDeployGate(team, { yes: false, envOn: true }).mode === 'dry-run'; const gated = _teamDeployGate(team, { yes: true, envOn: false }).mode === 'gated'; const exec = _teamDeployGate(team, { yes: true, envOn: true }).mode === 'execute'; return noCmd && dry && gated && exec; } },
3014
3016
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3015
3017
  ];
3016
3018
  }
@@ -3650,7 +3652,7 @@ function commandsCmd(root) {
3650
3652
  { cmd: 'deploy auto', desc: '배포 자동화' },
3651
3653
  { cmd: 'runs list|show', desc: '실행 이력' },
3652
3654
  { cmd: 'whats-new [path]', desc: '최근 버전 변경 요약' },
3653
- { cmd: 'team list|add|show|remove|preview <id> [--name --purpose --personas --members --schedule --task]', desc: '에이전트 팀 정의 + preview(dry-run 실행계획) — UR-0073 Phase A/B, opt-in · 정의/미리보기 전용' }
3655
+ { cmd: 'team list|add|show|remove|preview|deploy <id> [--name --purpose --personas --members --schedule --task --deploy --yes]', desc: '에이전트 팀 정의 + preview(dry-run) + deploy(2중 게이트) — UR-0073 A~D, opt-in · 배포는 --yes+LEERNESS_TEAM_DEPLOY=1' }
3654
3656
  ]
3655
3657
  };
3656
3658
  if (has('--json')) {
@@ -5896,6 +5898,7 @@ function teamCmd(root, sub, id, opts = {}) {
5896
5898
  personas: splitCsv(arg('--personas', null)),
5897
5899
  members: splitCsv(arg('--members', null)),
5898
5900
  schedule: validSched.has(sched) ? sched : 'manual',
5901
+ deployCommand: arg('--deploy', '') === true ? '' : arg('--deploy', ''), // 1.9.376 (Phase D): 사용자 설정 배포 명령 (실행은 게이트)
5899
5902
  status: 'active',
5900
5903
  createdAt: now()
5901
5904
  };
@@ -5915,6 +5918,7 @@ function teamCmd(root, sub, id, opts = {}) {
5915
5918
  log(` personas: ${(t.personas || []).join(', ') || '-'}`);
5916
5919
  log(` members: ${(t.members || []).join(', ') || '-'}`);
5917
5920
  log(` schedule: ${t.schedule || 'manual'} · status: ${t.status || 'active'}`);
5921
+ log(` deploy: ${t.deployCommand || '-'}`);
5918
5922
  return;
5919
5923
  }
5920
5924
  if (sub === 'remove') {
@@ -5943,7 +5947,37 @@ function teamCmd(root, sub, id, opts = {}) {
5943
5947
  log(`\n ⓘ dry-run — 실제 dispatch/배포 없음. 위 명령을 검토 후 직접 실행하거나, 향후 Phase C(스케줄)/D(배포)에서 게이트 적용.`);
5944
5948
  return;
5945
5949
  }
5946
- fail(`알 없는 team 하위명령: ${sub} (list|add|show|remove|preview)`);
5950
+ // 1.9.376 (UR-0073 Phase D): team deploy 사용자 설정 deployCommand 실행. 안전: dry-run 기본 + --yes + LEERNESS_TEAM_DEPLOY=1 이중 게이트 + shell-guard.
5951
+ if (sub === 'deploy') {
5952
+ const t = teams.find(x => x.id === id);
5953
+ if (!t) { fail(`team 없음: ${id}`); return; }
5954
+ const gate = _teamDeployGate(t, { yes: has('--yes'), envOn: process.env.LEERNESS_TEAM_DEPLOY === '1' });
5955
+ if (json) { log(JSON.stringify({ version: VERSION, teamId: t.id, ...gate }, null, 2)); if (gate.mode !== 'execute') return; }
5956
+ if (gate.mode === 'no-command') { fail(`team '${t.id}' deployCommand 미설정 — leerness team add ${t.id} --deploy "<배포 명령>"`); return; }
5957
+ if (gate.mode === 'dry-run') {
5958
+ log(`# team deploy ${t.id} (1.9.376, UR-0073 Phase D) — dry-run (실행 없음)`);
5959
+ log(` 배포 명령: ${gate.command}`);
5960
+ log(` ⓘ ${gate.message}`);
5961
+ log(` 실행: LEERNESS_TEAM_DEPLOY=1 leerness team deploy ${t.id} --yes (셸 호환성 점검 후 실행)`);
5962
+ return;
5963
+ }
5964
+ if (gate.mode === 'gated') { fail(`${gate.message} — dry-run 으로 먼저 검토: leerness team deploy ${t.id}`); return; }
5965
+ // execute: shell-guard 정적 점검(advisory) 후 spawn
5966
+ try {
5967
+ const ctx = _detectShellCtx();
5968
+ const guard = _shellGuardAnalyze ? _shellGuardAnalyze(gate.command, ctx) : null;
5969
+ if (guard && guard.findings && guard.findings.length) {
5970
+ warn(`shell-guard 경고 ${guard.findings.length}건 (배포 명령): ${guard.findings.map(f => f.rule || f.kind || f).join(', ')}`);
5971
+ }
5972
+ } catch {}
5973
+ log(`# team deploy ${t.id} — 실행 (LEERNESS_TEAM_DEPLOY=1 + --yes)`);
5974
+ log(` $ ${gate.command}`);
5975
+ const r = cp.spawnSync(gate.command, { cwd: root, shell: true, stdio: 'inherit', timeout: 600000 });
5976
+ if (r.status === 0) ok(`team deploy 완료: ${t.id} (exit 0)`);
5977
+ else { fail(`team deploy 실패: ${t.id} (exit ${r.status})`); }
5978
+ return;
5979
+ }
5980
+ fail(`알 수 없는 team 하위명령: ${sub} (list|add|show|remove|preview|deploy)`);
5947
5981
  }
5948
5982
 
5949
5983
  // 1.9.112: 전용 lessons.md (Memory Write Surface 5번째)
@@ -21223,7 +21257,7 @@ function help() {
21223
21257
  leerness skill install <SKILL.md|dir|url> · leerness skill discover --preset vercel|anthropic # 스킬 설치/탐색
21224
21258
  leerness release bump [--patch|--minor|--major] # package.json 자동 bump (1.9.8)
21225
21259
  leerness release note "<내용>" # CHANGELOG.md 자동 추가 (1.9.8)
21226
- leerness release publish [--dry-run] [--pack] [--git-push] [--gh-release] [--gh-pages] [--gh-pages-src file] [--npm-publish] [--auto] # 통합 배포 (1.9.8 + 1.9.10)\n leerness impact <target> [--all] # 변경 전 영향 분석 (기본 strong, --all로 weak 포함)\n leerness reuse find <query> # 기존 자원 검색 (재귀 안내)\n leerness reuse register <name> --where <p> --kind component|hook|util|api [--note ...]\n leerness ui consistency [path] [--strict] [--fail-on-violation]\n leerness graph [path] [--out <file>] # mermaid 의존성 그래프\n leerness guide [target] # impact + reuse + ui consistency 통합 가이드\n leerness migrate audit|apply|plan [path] [--json] [--yes] # 크로스버전 마이그레이션 진단/적용(canonical 백필)/플랜(임시폴더 비교) (UR-0075, 1.9.356~358)\n leerness migrate --guide # AI 에이전트용 크로스버전 마이그레이션 가이드 (1.9.355)\n leerness install-safety [--json] # 설치 안전 프로필 — 0 런타임 deps / 0 install-script (1.9.359)\n leerness capabilities [--json] # 권한·보안 표면 공개 (1.9.272)\n leerness feature add|link|impact|list|show # 기능 그래프(feature-graph) 추적\n leerness permissions list|set # agent 권한 모드 (1.9.174)\n leerness creds list|register|check|refresh # 크리덴셜 메타 추적 (값 미저장)\n leerness incident list|show|handle · webhook serve · deploy auto · runs list|show # 운영(ops)\n leerness whats-new [path] # 최근 버전 변경 요약\n leerness team list|add|show|remove|preview <id> [--name --purpose --personas a,b --members claude,codex --schedule every-session --task "..."] # 에이전트 팀 정의 + preview(dry-run 실행계획) — UR-0073 Phase A/B, opt-in · 정의/미리보기 전용(자동실행 X)\n leerness release channel|cadence [path] [--json] # 릴리스 채널 정책 + 빈도 진단 (UR-0074 케이던스 가시화, 1.9.275/374)\n leerness commands [--json] # 전체 명령 전수 목록 (누락 없이 이 명령으로 확인)\n`);
21260
+ leerness release publish [--dry-run] [--pack] [--git-push] [--gh-release] [--gh-pages] [--gh-pages-src file] [--npm-publish] [--auto] # 통합 배포 (1.9.8 + 1.9.10)\n leerness impact <target> [--all] # 변경 전 영향 분석 (기본 strong, --all로 weak 포함)\n leerness reuse find <query> # 기존 자원 검색 (재귀 안내)\n leerness reuse register <name> --where <p> --kind component|hook|util|api [--note ...]\n leerness ui consistency [path] [--strict] [--fail-on-violation]\n leerness graph [path] [--out <file>] # mermaid 의존성 그래프\n leerness guide [target] # impact + reuse + ui consistency 통합 가이드\n leerness migrate audit|apply|plan [path] [--json] [--yes] # 크로스버전 마이그레이션 진단/적용(canonical 백필)/플랜(임시폴더 비교) (UR-0075, 1.9.356~358)\n leerness migrate --guide # AI 에이전트용 크로스버전 마이그레이션 가이드 (1.9.355)\n leerness install-safety [--json] # 설치 안전 프로필 — 0 런타임 deps / 0 install-script (1.9.359)\n leerness capabilities [--json] # 권한·보안 표면 공개 (1.9.272)\n leerness feature add|link|impact|list|show # 기능 그래프(feature-graph) 추적\n leerness permissions list|set # agent 권한 모드 (1.9.174)\n leerness creds list|register|check|refresh # 크리덴셜 메타 추적 (값 미저장)\n leerness incident list|show|handle · webhook serve · deploy auto · runs list|show # 운영(ops)\n leerness whats-new [path] # 최근 버전 변경 요약\n leerness team list|add|show|remove|preview|deploy <id> [--personas a,b --members claude,codex --schedule every-session --task "..." --deploy "<배포명령>" --yes] # 에이전트 팀 정의/미리보기/배포 — UR-0073 A~D, opt-in · 배포는 2중게이트(--yes + LEERNESS_TEAM_DEPLOY=1)\n leerness release channel|cadence [path] [--json] # 릴리스 채널 정책 + 빈도 진단 (UR-0074 케이던스 가시화, 1.9.275/374)\n leerness commands [--json] # 전체 명령 전수 목록 (누락 없이 이 명령으로 확인)\n`);
21227
21261
  }
21228
21262
 
21229
21263
  async function main() {
package/lib/pure-utils.js CHANGED
@@ -743,6 +743,7 @@ function _renderTeamsMd(teams) {
743
743
  + `- Personas: ${(t.personas || []).join(', ')}\n`
744
744
  + `- Members: ${(t.members || []).join(', ')}\n`
745
745
  + `- Schedule: ${t.schedule || 'manual'}\n`
746
+ + `- Deploy: ${t.deployCommand || '-'}\n`
746
747
  + `- Status: ${t.status || 'active'}\n`;
747
748
  }).join('');
748
749
  return preamble + body;
@@ -780,11 +781,22 @@ function _cadenceAssessment(perDay, total, daysActive) {
780
781
  return { releasesPerDay: r, total: Number(total) || 0, daysActive: Number(daysActive) || 0, level, recommendation };
781
782
  }
782
783
 
784
+ // 1.9.376 (UR-0073 Phase D): team 배포 실행 게이트 결정 (순수). 안전: dry-run 기본, 실행은 --yes + env 이중 게이트.
785
+ // mode: no-command(설정 없음) / dry-run(실행 안 함) / gated(env 미충족 거부) / execute(실행 허용).
786
+ function _teamDeployGate(team, opts) {
787
+ const t = team || {}; opts = opts || {};
788
+ const command = (t.deployCommand && t.deployCommand !== true) ? String(t.deployCommand) : '';
789
+ if (!command) return { mode: 'no-command', command: '', message: 'deployCommand 미설정 — team add --deploy "<명령>" 으로 지정' };
790
+ if (!opts.yes) return { mode: 'dry-run', command, message: 'dry-run (실행 없음) — 실행하려면 --yes + LEERNESS_TEAM_DEPLOY=1' };
791
+ if (!opts.envOn) return { mode: 'gated', command, message: '실행 게이트 미충족 — LEERNESS_TEAM_DEPLOY=1 환경변수 필요 (의도적 opt-in)' };
792
+ return { mode: 'execute', command, message: '실행 허용 (--yes + env 게이트 충족)' };
793
+ }
794
+
783
795
  module.exports = {
784
796
  _isSecretKey, compareVer, parseHarnessVersion,
785
797
  _isPlaceholderSecret, _looksSecretLike,
786
798
  _mergeLines, _mergeEnvLines, _mergeReadmeSection, _managedMerge, _parseSkillsValue,
787
- _parseArchiveBlocks, _parseSkillCatalog, _renderTeamsMd, _composeTeamPlan, _teamHandoffReminders, _cadenceAssessment,
799
+ _parseArchiveBlocks, _parseSkillCatalog, _renderTeamsMd, _composeTeamPlan, _teamHandoffReminders, _cadenceAssessment, _teamDeployGate,
788
800
  _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
789
801
  // 1.9.283 (UR-0025 2단계)
790
802
  PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.374",
3
+ "version": "1.9.376",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -3413,8 +3413,8 @@ total++;
3413
3413
  const ptPath = path.join(lDir, '.harness', 'progress-tracker.md');
3414
3414
  // 자식들이 OS 프로세스로 독립 진행 → 부모는 파일을 sync 폴링(원자쓰기라 부분읽기 없음)
3415
3415
  const start = Date.now(); let found = 0;
3416
- // 1.9.321: 폴 타임아웃 25s60s — 전체 e2e CPU 포화 시 6 병렬 spawn 지연으로 인한 간헐 플래키 방지(격리 실측 0.4s, 대폭 여유)
3417
- while (Date.now() - start < 60000) {
3416
+ // 1.9.321/1.9.375 (UR-0084): 폴 타임아웃 60s120s — 전체 e2e CPU 포화(561s 실측 1회 flake) 대비 헤드룸 2배(격리 실측 0.4s, 대폭 여유)
3417
+ while (Date.now() - start < 120000) {
3418
3418
  try { const pt = fs.readFileSync(ptPath, 'utf8'); found = Array.from({ length: N }, (_, i) => i).filter(i => pt.includes('LOCKTEST-' + i)).length; if (found === N) break; } catch {}
3419
3419
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 200);
3420
3420
  }
@@ -5170,5 +5170,30 @@ total++;
5170
5170
  if (!ok) failed++;
5171
5171
  }
5172
5172
 
5173
+ // 1.9.376 회귀 (UR-0073 Phase D): team deploy 2중 게이트 — dry-run 실행안함 · --yes만이면 거부 · --yes+env 만 실행
5174
+ total++;
5175
+ {
5176
+ let ok = false;
5177
+ try {
5178
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-tdep-'));
5179
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5180
+ const marker = path.join(d, 'DEPLOYED.txt');
5181
+ cp.spawnSync(process.execPath, [CLI, 'team', 'add', 'dep', '--members', 'claude', '--deploy', 'node -e "require(\'fs\').writeFileSync(\'DEPLOYED.txt\',\'ok\')"', '--path', d], { encoding: 'utf8', timeout: 15000 });
5182
+ // 1) dry-run (no --yes) → 실행 안 함
5183
+ cp.spawnSync(process.execPath, [CLI, 'team', 'deploy', 'dep', '--path', d], { encoding: 'utf8', timeout: 15000 });
5184
+ const dryNoExec = !fs.existsSync(marker);
5185
+ // 2) --yes 인데 env 없음 → 거부 (실행 안 함)
5186
+ cp.spawnSync(process.execPath, [CLI, 'team', 'deploy', 'dep', '--yes', '--path', d], { encoding: 'utf8', timeout: 15000 });
5187
+ const gateRefuse = !fs.existsSync(marker);
5188
+ // 3) --yes + LEERNESS_TEAM_DEPLOY=1 → 실행 (marker 생성)
5189
+ cp.spawnSync(process.execPath, [CLI, 'team', 'deploy', 'dep', '--yes', '--path', d], { cwd: d, encoding: 'utf8', timeout: 20000, env: { ...process.env, LEERNESS_TEAM_DEPLOY: '1' } });
5190
+ const executed = fs.existsSync(marker);
5191
+ fs.rmSync(d, { recursive: true, force: true });
5192
+ ok = dryNoExec && gateRefuse && executed;
5193
+ } catch {}
5194
+ console.log(ok ? '✓ B(1.9.376) UR-0073 Phase D: team deploy 2중 게이트 (dry-run 실행X / env거부 / --yes+env 실행)' : '✗ team deploy 게이트 실패');
5195
+ if (!ok) failed++;
5196
+ }
5197
+
5173
5198
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
5174
5199
  if (failed > 0) process.exit(1);