leerness 1.9.356 → 1.9.358

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,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.358 — 2026-06-05 — UR-0075 Phase D: migrate plan — 임시폴더 설치 후 비교 마이그레이션 플랜 (umbrella 완결)
4
+
5
+ **🧩 `leerness migrate plan` — 임시폴더에 현재 버전을 설치한 뒤 프로젝트의 .harness 코어 파일과 비교해 정확한 마이그레이션 플랜을 산출. 읽기 전용. UR-0075 마이그레이션 umbrella 완결.** (UR-0075 Phase D)
6
+
7
+ ### 배경
8
+ 사용자 비전: "임시 폴더에 leerness 설치 후 기존 프로젝트의 내용을 정확하게 마이그레이션." Phase A(가이드)·B(audit 진단)·C(apply 적용)에 이어, Phase D는 그 비전의 핵심인 **임시폴더 설치 기반 정밀 비교**를 구현한다. 임시폴더에 현재 버전을 실제로 설치(서브프로세스 격리)해 "최신 버전이 생성하는 관리 파일 집합"을 확보하고, 프로젝트의 현재 파일과 비교해 누락 파일을 정확히 식별한다.
9
+
10
+ ### 구현
11
+ 1. **`migratePlanCmd(root, opts)`**(신규) + **`leerness migrate plan [--path <p>] [--json]`**:
12
+ - **임시폴더 설치**: `mkdtempSync` → `cp.spawnSync(node, [harness, init, <tmp>, --yes, --language <projlang>, --no-banner])` (서브프로세스 격리 — stdout 미오염, 부작용 격리). e2e 검증 패턴 재사용.
13
+ - **비교**: 임시폴더 `.harness` 코어 파일(depth-1) + `AGENTS.md`/`CLAUDE.md` 중 프로젝트에 **없는** 파일 → `missing-file`.
14
+ - **통합**: `version-drift`(compareVer) + `canonical-pending`(decisions/lessons MD-without-JSON) 합산.
15
+ 2. **완전 읽기 전용**: 프로젝트 미변경 — 임시폴더만 사용 후 `rmSync` 자동 정리.
16
+ 3. `--json`: `{ projectVersion, versionDrift, canonicalPending[], missingFiles[], tempInstallOk, willChange }`. 각 finding 에 적용 명령 안내(`update --yes` / `migrate apply --yes`).
17
+
18
+ ### 검증
19
+ - **selftest 104→105 PASS** · **E2E 302→303 PASS** (회귀 0).
20
+ - 실측: clean → `willChange:0` `tempInstallOk:true`. 코어 파일(reuse-map.md) 삭제 → `missingFiles` 에 정확 감지 · `willChange:1`. 플랜 실행 후 프로젝트 미변경(읽기 전용 확인).
21
+
22
+ ### UR-0075 umbrella 완결
23
+ Phase A(가이드) · B(audit 진단) · C(apply 적용) · **D(plan 임시폴더 비교)** 4단계 완료. 크로스버전 마이그레이션 워크플로: `migrate plan`(진단) → `migrate apply --yes`(canonical) / `update --yes`(버전) → `migrate audit`(재확인).
24
+
25
+ ## 1.9.357 — 2026-06-05 — UR-0075 Phase C: migrate apply — canonical 백필 비파괴 적용
26
+
27
+ **🧩 `leerness migrate apply` — `migrate audit` 가 찾은 '안전 항목'(canonical 백필)만 실제로 적용하는 실행 짝. 기본 dry-run, `--yes` 로 적용, 멱등.** (UR-0075 Phase C)
28
+
29
+ ### 배경
30
+ Phase B(`migrate audit`)는 무엇이 어긋났는지 **진단(읽기 전용)** 만 했다. Phase C는 그중 **안전하게 자동 적용 가능한 항목**(canonical-pending: MD-only → canonical JSON 백필)을 실제로 처리한다. version-drift(npm 재설치 필요)·missing-file(재초기화 필요)는 in-place 자동 처리가 안전하지 않으므로 apply 범위에서 제외하고 수동 안내만 한다.
31
+
32
+ ### 구현
33
+ 1. **`migrateApplyCmd(root, opts)`**(신규) + **`leerness migrate apply [--path <p>] [--json] [--yes]`**:
34
+ - **canonical-pending** → `_loadX(root)`(MD 백필) → `_saveX(root, arr)`(canonical JSON + MD 정규화). UR-0053/0058 라운드트립이라 **멱등**(재실행 시 변경 0).
35
+ - **version-drift / missing-file** → apply 범위 외 → "수동 필요"로 분류 + 조치 명령 안내(`update --yes` / `migrate`).
36
+ 2. **기본 dry-run(비파괴)** — `--yes` 없으면 변경 0, "적용 예정" 만 표시(전역 지침 "Dry-run 기본" 준수). `--yes` 시에만 실제 백필.
37
+ 3. `--json`: `{ dryRun, appliedCount, applied:[], skipped:[] }` 구조화 출력.
38
+
39
+ ### 검증
40
+ - **selftest 103→104 PASS** · **E2E 301→302 PASS** (회귀 0).
41
+ - 실측: dry-run → `decisions.json` 미생성(비파괴). `--yes` → 생성. 재실행 → `applied 0`(멱등). clean → "적용할 항목 없음".
42
+
3
43
  ## 1.9.356 — 2026-06-05 — UR-0075 Phase B: migrate audit — 비파괴 스키마 drift 리포트
4
44
 
5
45
  **🧩 `leerness migrate audit` — 임시설치/변형 없이 프로젝트의 마이그레이션 필요 항목만 진단하는 비파괴 dry-run 리포트.** (UR-0075 Phase B — Phase A 가이드 다음 단계)
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.356-green)]() [![tests](https://img.shields.io/badge/e2e-301%2F301-success)]() [![selftest](https://img.shields.io/badge/selftest-103-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.358-green)]() [![tests](https://img.shields.io/badge/e2e-303%2F303-success)]() [![selftest](https://img.shields.io/badge/selftest-105-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.356 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.358 하네스를 사용합니다. 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.356는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.358는 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.356는 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.356)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.358)** · 매 라운드 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.356: 2026-06-05
587
+ Last synced by Leerness v1.9.358: 2026-06-05
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -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, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344 (UR-0025): SKILL_CATALOG_PRESETS 분리
30
30
 
31
- const VERSION = '1.9.356';
31
+ const VERSION = '1.9.358';
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') 시 호스트 프로세스 오염.
@@ -3061,6 +3061,8 @@ function _selfTestCases() {
3061
3061
  { name: 'UR-0072(외부리뷰 P3): compareVer pre-release + _classifyCJK 한자 kana 귀속', run: () => { const m = require('../lib/pure-utils'); const verOk = m.compareVer('1.9.0-beta', '1.9.0') === -1 && m.compareVer('1.9.0', '1.9.0-beta') === 1 && m.compareVer('1.9.5', '1.9.5') === 0 && m.compareVer('1.9.6', '1.9.5') === 1; const jp = Buffer.from([0xE3, 0x81, 0x82, 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC]); const cn = Buffer.from([0xE4, 0xB8, 0xAD, 0xE5, 0x9B, 0xBD]); const rj = m._classifyCJK(jp, jp.length); const rc = m._classifyCJK(cn, cn.length); const cjkOk = rj.japanese > rj.chinese && rc.chinese > 0 && rc.japanese === 0; return verOk && cjkOk; } },
3062
3062
  { name: 'UR-0075 Phase A: 마이그레이션 가이드(_migrationGuideText) + migrate --guide 와이어 + init/migrate/update --path', run: () => { const m = require('../lib/pure-utils'); const g = m._migrationGuideText('1.9.355'); const guideOk = typeof g === 'string' && g.includes('마이그레이션 가이드') && g.includes('update --check --path') && g.includes('selftest') && g.includes('canonical JSON') && g.includes('롤백') && g.includes('1.9.355'); const src = read(__filename); const wired = src.includes("has('--guide') || args[1] === " + "'guide'") && src.includes('install(arg(' + "'--path', args[1] || process.cwd())") && src.includes('updateCmd(arg(' + "'--path', args[1] || process.cwd())"); return guideOk && wired; } },
3063
3063
  { name: 'UR-0075 Phase B: migrate audit(dry-run 스키마 drift) 명령 + 와이어', run: () => { const src = read(__filename); return typeof migrateAuditCmd === 'function' && src.includes('migrateAuditCmd(arg(' + "'--path'") && src.includes("args[1] === " + "'audit'"); } },
3064
+ { name: 'UR-0075 Phase C: migrate apply(canonical 백필 비파괴 적용) 명령 + 와이어', run: () => { const src = read(__filename); return typeof migrateApplyCmd === 'function' && src.includes('migrateApplyCmd(arg(' + "'--path'") && src.includes("args[1] === " + "'apply'"); } },
3065
+ { name: 'UR-0075 Phase D: migrate plan(임시폴더 설치 후 비교) 명령 + 와이어', run: () => { const src = read(__filename); return typeof migratePlanCmd === 'function' && src.includes('migratePlanCmd(arg(' + "'--path'") && src.includes("args[1] === " + "'plan'"); } },
3064
3066
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3065
3067
  ];
3066
3068
  }
@@ -6784,6 +6786,88 @@ function migrateAuditCmd(root, opts = {}) {
6784
6786
  for (const f of findings) log(` • [${f.kind}] ${f.detail}${f.action ? ` → ${f.action}` : ''}`);
6785
6787
  log(`\n 적용: leerness update --yes --path ${root} · 안전 가이드: leerness migrate --guide`);
6786
6788
  }
6789
+ // UR-0075 Phase C (1.9.357): migrate apply — audit가 찾은 '안전 항목'(canonical 백필)만 비파괴 적용.
6790
+ // 기본 dry-run(변경 없음) · --yes 로 실제 적용. version-drift/missing-file 은 apply 범위 외(수동 안내).
6791
+ function migrateApplyCmd(root, opts = {}) {
6792
+ root = absRoot(root);
6793
+ const apply = !!opts.yes;
6794
+ const applied = []; // 안전하게 적용 가능(또는 dry-run 예정): canonical 백필
6795
+ const skipped = []; // apply 범위 외: 수동 조치 필요
6796
+ // canonical-pending: MD 항목 존재 + JSON 부재 → load(MD 백필)→save(canonical JSON + MD 정규화). idempotent(UR-0053).
6797
+ if (exists(decisionsPath(root)) && !exists(decisionsJsonPath(root)) && _loadDecisions(root).length > 0) {
6798
+ if (apply) _saveDecisions(root, _loadDecisions(root));
6799
+ applied.push({ kind: 'canonical-backfill', detail: 'decisions.md → decisions.json' });
6800
+ }
6801
+ if (exists(lessonsPath(root)) && !exists(lessonsJsonPath(root)) && _loadLessons(root).length > 0) {
6802
+ if (apply) _saveLessons(root, _loadLessons(root));
6803
+ applied.push({ kind: 'canonical-backfill', detail: 'lessons.md → lessons.json' });
6804
+ }
6805
+ // version-drift / 누락 파일 — apply 가 안전하게 in-place 처리 불가(npm 재설치/재초기화 필요) → 수동 안내.
6806
+ const hvPath = path.join(root, '.harness', 'HARNESS_VERSION');
6807
+ const projVer = exists(hvPath) ? read(hvPath).trim() : null;
6808
+ if (!projVer) skipped.push({ kind: 'no-version', detail: 'HARNESS_VERSION 없음', reason: `leerness migrate --path ${root}` });
6809
+ else if (compareVer(projVer, VERSION) < 0) skipped.push({ kind: 'version-drift', detail: `${projVer} → ${VERSION}`, reason: `leerness update --yes --path ${root}` });
6810
+ const required = ['.harness/plan.md', '.harness/progress-tracker.md', '.harness/guideline.md', '.harness/protected-files.md', '.harness/design-system.md', '.harness/anti-lazy-work-policy.md', '.harness/session-handoff.md', '.harness/current-state.md', 'AGENTS.md'];
6811
+ for (const f of required) if (!exists(path.join(root, f))) skipped.push({ kind: 'missing-file', detail: f, reason: 'leerness migrate / init' });
6812
+ if (opts.json) { log(JSON.stringify({ version: VERSION, root, dryRun: !apply, appliedCount: apply ? applied.length : 0, applied, skipped }, null, 2)); return; }
6813
+ log(`# leerness migrate apply (1.9.357, UR-0075 Phase C)${apply ? '' : ' — dry-run (변경 없음 · --yes 로 적용)'}`);
6814
+ log(` 대상: ${root}`);
6815
+ if (!applied.length && !skipped.length) { ok('적용할 항목 없음 — 최신 스키마 정합'); return; }
6816
+ if (applied.length) {
6817
+ log(apply ? ` ✓ 적용 ${applied.length}건 (canonical 백필 · MD→JSON, MD 정규화):` : ` 적용 예정 ${applied.length}건 (canonical 백필 · MD→JSON, MD 정규화):`);
6818
+ for (const a of applied) log(` • ${a.detail}`);
6819
+ }
6820
+ if (skipped.length) {
6821
+ log(` ⚠ 수동 필요 ${skipped.length}건 (apply 범위 외 — 안전상 자동 변경 안 함):`);
6822
+ for (const s of skipped) log(` • [${s.kind}] ${s.detail} → ${s.reason}`);
6823
+ }
6824
+ if (!apply && applied.length) log(`\n 적용: leerness migrate apply --path ${root} --yes`);
6825
+ }
6826
+ // UR-0075 Phase D (1.9.358): migrate plan — 임시폴더에 현재 버전을 설치(서브프로세스 격리)한 뒤
6827
+ // 프로젝트의 .harness 코어 관리 파일과 비교해 정확한 마이그레이션 플랜을 산출. 읽기 전용(프로젝트 미변경).
6828
+ // 사용자 비전("임시 폴더에 leerness 설치 후 기존 프로젝트 내용을 정확히 마이그레이션")의 진단 단계.
6829
+ function migratePlanCmd(root, opts = {}) {
6830
+ root = absRoot(root);
6831
+ const plan = { version: VERSION, root, projectVersion: null, versionDrift: null, canonicalPending: [], missingFiles: [], tempInstallOk: false, willChange: 0 };
6832
+ const hvPath = path.join(root, '.harness', 'HARNESS_VERSION');
6833
+ plan.projectVersion = exists(hvPath) ? read(hvPath).trim() : null;
6834
+ if (plan.projectVersion && compareVer(plan.projectVersion, VERSION) < 0) plan.versionDrift = `${plan.projectVersion} → ${VERSION}`;
6835
+ if (exists(decisionsPath(root)) && !exists(decisionsJsonPath(root)) && _loadDecisions(root).length > 0) plan.canonicalPending.push('decisions.md → decisions.json');
6836
+ if (exists(lessonsPath(root)) && !exists(lessonsJsonPath(root)) && _loadLessons(root).length > 0) plan.canonicalPending.push('lessons.md → lessons.json');
6837
+ // 임시폴더에 현재 버전 init → 생성되는 .harness 코어 파일(depth-1) 비교 (서브프로세스 격리, stdout 미오염)
6838
+ let tmp = null;
6839
+ try {
6840
+ tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-plan-'));
6841
+ const langPath = path.join(root, '.harness', 'LANGUAGE');
6842
+ const lang = exists(langPath) ? (read(langPath).trim() || 'ko') : 'ko';
6843
+ const r = cp.spawnSync(process.execPath, [__filename, 'init', tmp, '--yes', '--language', lang, '--no-banner'], { encoding: 'utf8', timeout: 60000 });
6844
+ plan.tempInstallOk = r.status === 0;
6845
+ if (plan.tempInstallOk) {
6846
+ const tmpHarness = path.join(tmp, '.harness');
6847
+ let tmpFiles = [];
6848
+ try { tmpFiles = fs.readdirSync(tmpHarness, { withFileTypes: true }).filter(e => e.isFile()).map(e => '.harness/' + e.name); } catch {}
6849
+ for (const top of ['AGENTS.md', 'CLAUDE.md']) if (exists(path.join(tmp, top))) tmpFiles.push(top);
6850
+ for (const f of tmpFiles) if (!exists(path.join(root, f))) plan.missingFiles.push(f);
6851
+ }
6852
+ } catch {}
6853
+ finally { if (tmp) { try { fs.rmSync(tmp, { recursive: true, force: true }); } catch {} } }
6854
+ plan.willChange = plan.missingFiles.length + plan.canonicalPending.length + (plan.versionDrift ? 1 : 0);
6855
+ if (opts.json) { log(JSON.stringify(plan, null, 2)); return; }
6856
+ log(`# leerness migrate plan (1.9.358, UR-0075 Phase D) — 임시폴더 설치 후 비교 · 읽기 전용(프로젝트 미변경)`);
6857
+ log(` 대상: ${root}`);
6858
+ log(` 프로젝트 버전: ${plan.projectVersion || '(없음)'} · 도구 버전: ${VERSION}`);
6859
+ if (!plan.tempInstallOk) warn('임시폴더 설치 실패 — 파일 비교 생략 (버전/canonical 만 보고)');
6860
+ if (!plan.willChange) { ok('마이그레이션 필요 없음 — 최신 스키마 정합'); return; }
6861
+ log(` 예상 변경 ${plan.willChange}건:`);
6862
+ if (plan.versionDrift) log(` • [version-drift] ${plan.versionDrift} → leerness update --yes --path ${root}`);
6863
+ for (const c of plan.canonicalPending) log(` • [canonical-pending] ${c} → leerness migrate apply --path ${root} --yes`);
6864
+ if (plan.missingFiles.length) {
6865
+ log(` • [missing-file] ${plan.missingFiles.length}건 (현재 버전이 생성하는 관리 파일 누락):`);
6866
+ for (const f of plan.missingFiles.slice(0, 20)) log(` - ${f}`);
6867
+ if (plan.missingFiles.length > 20) log(` … 외 ${plan.missingFiles.length - 20}건`);
6868
+ }
6869
+ log(`\n 전체 적용: leerness update --yes --path ${root} · canonical만: leerness migrate apply --path ${root} --yes`);
6870
+ }
6787
6871
  function debug(root) {
6788
6872
  root = absRoot(root); let warnings = 0, failures = 0;
6789
6873
  const checks = ['.harness/context-routing.md','.harness/writeback-policy.md','.harness/plan-progress-boundary.md','.harness/consistency-policy.md','.harness/reuse-map.md','.harness/leerness-maintenance.md','.harness/anti-lazy-work-policy.md','.harness/encoding-policy.md','.harness/secret-policy.md'];
@@ -21044,6 +21128,8 @@ async function main() {
21044
21128
  }
21045
21129
  if (cmd === 'migrate' && (has('--guide') || args[1] === 'guide')) { log(_migrationGuideText(VERSION)); return; } // 1.9.355 (UR-0075 Phase A): 크로스버전 마이그레이션 가이드
21046
21130
  if (cmd === 'migrate' && (args[1] === 'audit' || has('--audit'))) return migrateAuditCmd(arg('--path', args[2] && !args[2].startsWith('-') ? args[2] : process.cwd()), { json: has('--json') }); // 1.9.356 (UR-0075 Phase B): dry-run 스키마 drift 리포트
21131
+ if (cmd === 'migrate' && args[1] === 'apply') return migrateApplyCmd(arg('--path', args[2] && !args[2].startsWith('-') ? args[2] : process.cwd()), { json: has('--json'), yes: has('--yes') }); // 1.9.357 (UR-0075 Phase C): canonical 백필 비파괴 적용 (기본 dry-run)
21132
+ if (cmd === 'migrate' && args[1] === 'plan') return migratePlanCmd(arg('--path', args[2] && !args[2].startsWith('-') ? args[2] : process.cwd()), { json: has('--json') }); // 1.9.358 (UR-0075 Phase D): 임시폴더 설치 후 비교 마이그레이션 플랜 (읽기 전용)
21047
21133
  if (cmd === 'migrate') return await install(arg('--path', args[1] || process.cwd()), { force:has('--force'), dry:has('--dry-run'), migration:true }); // 1.9.355 (UR-0075): --path 지원
21048
21134
  if (cmd === 'update') return await updateCmd(arg('--path', args[1] || process.cwd()), { checkOnly: has('--check'), yes: has('--yes'), force: has('--force') }); // 1.9.355 (UR-0075): --path 지원
21049
21135
  if (cmd === 'auto-update' && args[1] === 'install') return autoUpdateInstall(arg('--path', args[2] || process.cwd()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.356",
3
+ "version": "1.9.358",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -4804,5 +4804,56 @@ total++;
4804
4804
  if (!ok) failed++;
4805
4805
  }
4806
4806
 
4807
+ // 1.9.357 회귀 (UR-0075 Phase C): migrate apply — dry-run 비파괴 · --yes canonical 백필 · 멱등
4808
+ total++;
4809
+ {
4810
+ let ok = false;
4811
+ try {
4812
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-app-'));
4813
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
4814
+ fs.writeFileSync(path.join(d, '.harness', 'decisions.md'), '# Decisions\n\n### 2026-06-01 — A\n- Decision: x\n');
4815
+ fs.rmSync(path.join(d, '.harness', 'decisions.json'), { force: true });
4816
+ // dry-run: json 미생성(비파괴)
4817
+ cp.spawnSync(process.execPath, [CLI, 'migrate', 'apply', '--path', d], { encoding: 'utf8', timeout: 20000 });
4818
+ const dryNoWrite = !fs.existsSync(path.join(d, '.harness', 'decisions.json'));
4819
+ // --yes: canonical json 생성
4820
+ cp.spawnSync(process.execPath, [CLI, 'migrate', 'apply', '--path', d, '--yes'], { encoding: 'utf8', timeout: 20000 });
4821
+ const appliedOk = fs.existsSync(path.join(d, '.harness', 'decisions.json'));
4822
+ // 멱등: 재실행 시 applied 0
4823
+ const c3 = cp.spawnSync(process.execPath, [CLI, 'migrate', 'apply', '--path', d, '--json'], { encoding: 'utf8', timeout: 20000 });
4824
+ let idem = false;
4825
+ try { idem = JSON.parse(c3.stdout).applied.length === 0; } catch {}
4826
+ fs.rmSync(d, { recursive: true, force: true });
4827
+ ok = dryNoWrite && appliedOk && idem;
4828
+ } catch {}
4829
+ console.log(ok ? '✓ B(1.9.357) UR-0075 Phase C: migrate apply (dry-run 비파괴 / --yes canonical 백필 / 멱등) (UR-0075)' : '✗ migrate apply 실패');
4830
+ if (!ok) failed++;
4831
+ }
4832
+
4833
+ // 1.9.358 회귀 (UR-0075 Phase D): migrate plan — 임시폴더 설치 후 비교 · clean=변경없음 · 코어파일 누락=missing 감지 · 읽기전용
4834
+ total++;
4835
+ {
4836
+ let ok = false;
4837
+ try {
4838
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-plan-'));
4839
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
4840
+ // clean: willChange 0 + tempInstallOk
4841
+ const c1 = cp.spawnSync(process.execPath, [CLI, 'migrate', 'plan', '--path', d, '--json'], { encoding: 'utf8', timeout: 90000 });
4842
+ let cleanOk = false, tmpOk = false;
4843
+ try { const j = JSON.parse(c1.stdout); cleanOk = j.willChange === 0 && j.missingFiles.length === 0; tmpOk = j.tempInstallOk === true; } catch {}
4844
+ // 코어 관리 파일 삭제 → missing 감지
4845
+ fs.rmSync(path.join(d, '.harness', 'reuse-map.md'), { force: true });
4846
+ const c2 = cp.spawnSync(process.execPath, [CLI, 'migrate', 'plan', '--path', d, '--json'], { encoding: 'utf8', timeout: 90000 });
4847
+ let missOk = false;
4848
+ try { const j = JSON.parse(c2.stdout); missOk = j.missingFiles.includes('.harness/reuse-map.md') && j.willChange >= 1; } catch {}
4849
+ // 읽기전용: 플랜은 프로젝트를 수정하지 않음 (reuse-map.md 재생성 안 됨)
4850
+ const readOnly = !fs.existsSync(path.join(d, '.harness', 'reuse-map.md'));
4851
+ fs.rmSync(d, { recursive: true, force: true });
4852
+ ok = cleanOk && tmpOk && missOk && readOnly;
4853
+ } catch {}
4854
+ console.log(ok ? '✓ B(1.9.358) UR-0075 Phase D: migrate plan (임시폴더 설치 후 비교, clean/missing 감지, 읽기전용) (UR-0075)' : '✗ migrate plan 실패');
4855
+ if (!ok) failed++;
4856
+ }
4857
+
4807
4858
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
4808
4859
  if (failed > 0) process.exit(1);