leerness 1.9.321 → 1.9.323

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,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.323 — 2026-06-05 — UR-0054 ⑥: fresh-init gate 통과 (lazy detect 부재신호 비차단)
4
+
5
+ **🚀 `leerness init` 직후 `leerness gate` 가 빈 트래커/미생성 handoff 때문에 즉시 실패하던 UX 결함 수정.**
6
+
7
+ ### 배경 (UR-0054 ⑥)
8
+ fresh init 후 `gate`(verify+audit+scan+encoding+lazy) 중 **lazy detect 만 exit 1** — `handoff_never_generated`/`handoff_empty`/`no_test_run` 같은 "아직 작업 안 함" 신호를 lazy work 위반처럼 차단. 갓 init 한 프로젝트가 즉시 gate 실패 → 나쁜 첫인상.
9
+
10
+ ### 구현 (UR-0054 ⑥)
11
+ 1. **작업 흔적 기반 차단 판정**: `done/completed/verified` row 가 하나도 없으면(fresh/무작업) "부재" 신호(`progress_empty`/`handoff_never_generated`/`handoff_empty`/`no_test_run`)는 **어드바이저리(비차단)**. `blockingIssues = issues − advisory(무작업 시)`.
12
+ 2. **active 프로젝트 보호 유지**: done-claim 이 있으면 모든 신호가 차단(기존 동작). 특히 `evidence_missing`(증거 없는 done)은 항상 차단.
13
+ 3. JSON 에 `blockingIssues` 필드 추가, `healthy`/exit 는 blocking 기준.
14
+ 4. selftest 70→71 · e2e 267→268.
15
+
16
+ ### 검증
17
+ - **selftest 71/71 PASS** · **E2E 268/268 PASS** (회귀 0).
18
+ - 실측: fresh init → `lazy detect` exit **0**(issues=3 advisory, blocking=0, healthy=true) · 거짓완료(done+증거0) 추가 → exit **1**(blocking=3, evidence_missing 차단 유지).
19
+
20
+ ## 1.9.322 — 2026-06-05 — UR-0044(완료): MCP handler 통합 (_mcpToCliArgs 추출)
21
+
22
+ **🧩 mcpServeCmd 의 인라인 83-case switch(name→cliArgs)를 단일 함수 `_mcpToCliArgs` 로 통합 — ToolRegistry handler 통합 완료.**
23
+
24
+ ### 배경 (UR-0044)
25
+ mcpServeCmd 의 tools/call 핸들러에 **230줄 인라인 switch**(83 도구 name→cliArgs 매핑)가 있어 mcpServeCmd 가 비대하고 매핑이 dispatch 로직과 뒤섞임. 1.9.319 에서 일치성 가드(모든 def↔case)를 먼저 깔아 안전망 확보 → 본 라운드에서 물리 이전.
26
+
27
+ ### 구현 (UR-0044 완료)
28
+ 1. **`_mcpToCliArgs(name, args, targetPath)` 모듈레벨 함수 추출** — 83-case switch 를 그대로 이전(미지 도구는 `null` 반환). mcpServeCmd 는 `cliArgs = _mcpToCliArgs(...)` 호출 + `null` 시 `-32601` 응답.
29
+ 2. **마이그레이션 스크립트(`scripts/_migrate-mcp-tocli.js`)로 프로그램적 splice** — 수기 전사 위험 0, 실행 후 삭제.
30
+ 3. 안전망: 일치성 가드(selftest: 83 def↔case) + e2e(MCP 16+ 테스트 + 신규 B(1.9.322) 인자매핑/미지도구) 가 검증.
31
+ 4. selftest 69→70 · e2e 266→267.
32
+
33
+ ### 검증
34
+ - **selftest 70/70 PASS** · **E2E 267/267 PASS** (회귀 0 — 전체 MCP 테스트 green).
35
+ - 실측: about/state_start(멀티인자)/feature_add/task_add(status push) dispatch 정상 · 미지 도구 → `-32601 Unknown tool` · `switch (name)` 소스 1곳(_mcpToCliArgs)만.
36
+
3
37
  ## 1.9.321 — 2026-06-05 — UR-0053(2단계): decision/lesson 빈 필드 오파싱 수정
4
38
 
5
39
  **🔧 빈 필드(Alternatives 등)가 다음 줄(Impact)을 캡처하던 `Alternatives→Impact 오파싱` 버그 수정 (UR-0053 의 두 번째 구체 결함).**
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.321-green)]() [![tests](https://img.shields.io/badge/e2e-266%2F266-success)]() [![selftest](https://img.shields.io/badge/selftest-69-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.323-green)]() [![tests](https://img.shields.io/badge/e2e-268%2F268-success)]() [![selftest](https://img.shields.io/badge/selftest-71-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.321 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.323 하네스를 사용합니다. 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.321는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.323는 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.321는 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.321)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.323)** · 매 라운드 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.321: 2026-06-04
587
+ Last synced by Leerness v1.9.323: 2026-06-04
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -15,7 +15,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
15
15
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
16
16
  const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
17
17
 
18
- const VERSION = '1.9.321';
18
+ const VERSION = '1.9.323';
19
19
 
20
20
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
21
21
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -3121,6 +3121,8 @@ function _selfTestCases() {
3121
3121
  { name: 'MCP ToolRegistry 일치성: 모든 도구 def 가 dispatch case 보유 + 고아 case 0 + requiredTier 완비 (UR-0044 1.9.319)', run: () => { const tools = require('../lib/mcp-tools'); const src = read(__filename); const missing = tools.filter(t => !src.includes("case '" + t.name + "':")); const cases = [...src.matchAll(/case '(leerness_[a-z_]+)':/g)].map(m => m[1]); const defNames = new Set(tools.map(t => t.name)); const orphans = [...new Set(cases)].filter(c => !defNames.has(c)); const tierOk = tools.every(t => typeof t.requiredTier === 'string' && PERMISSION_TIERS.includes(t.requiredTier)); return tools.length >= 83 && missing.length === 0 && orphans.length === 0 && tierOk; } },
3122
3122
  { name: 'count drift 수정: _countDatedBlocks 코드펜스(템플릿) 제외 + 카운트 사이트 단일화 (UR-0053 1.9.320)', run: () => { const f = _countDatedBlocks; const withTpl = '# D\n\n```md\n### 2026-01-01 — Decision 제목\n- Decision:\n```\n\n### 2026-06-04 — 실제\n- Decision: 실제\n'; const c1 = f(withTpl) === 1; const c0 = f('```md\n### 2026-01-01 — x\n```\n') === 0; const c2 = f('### 2026-01-01 — A\n### 2026-02-02 — B\n') === 2; const src = read(__filename); const wired = src.includes('_countDatedBlocks(read(decisionsPath(root)))') && src.includes('_countDatedBlocks(read(lessonsPath(root)))') && src.includes('_countDatedBlocks(dtext)') && !src.includes('read(decisionsPath(root)).' + 'match(/^### '); return typeof f === 'function' && c1 && c0 && c2 && wired; } },
3123
3123
  { name: 'decision/lesson 필드 파싱: 빈 필드가 다음 줄로 안 샘 ([ \\t]* 사용) (UR-0053 1.9.321)', run: () => { const block = '### 2026-06-05 — X\n- Decision: X\n- Reason: r\n- Alternatives: \n- Impact: 보안\n'; const alt = block.match(/- Alternatives:[ \t]*(.+)/); const imp = block.match(/- Impact:[ \t]*(.+)/); const altNoBleed = !alt || !/Impact/.test(alt[1]); const impOk = !!imp && imp[1].trim() === '보안'; const src = read(__filename); const fixedOk = src.includes('- Alternatives:[ \\t]*(.+)') && src.includes('- Lesson:[ \\t]*(.+)') && src.includes('- Impact:[ \\t]*(.+)'); return altNoBleed && impOk && fixedOk; } },
3124
+ { name: 'MCP handler 통합: _mcpToCliArgs 단일 함수 + mcpServeCmd 호출 + 인라인 switch 단일화 (UR-0044 1.9.322)', run: () => { const src = read(__filename); const fnDef = /function _mcpToCliArgs\(name, args, targetPath\) \{/.test(src); const called = src.includes('cliArgs = _mcpToCliArgs(name, args, targetPath)'); const switchCount = (src.match(/switch \(name\) \{/g) || []).length; const nullPath = src.includes('if (cliArgs === null) return send('); return fnDef && called && switchCount === 1 && nullPath; } },
3125
+ { name: 'fresh-init gate 통과: lazy detect 부재신호(handoff/test/progress) done-work 없으면 비차단 (UR-0054 ⑥ 1.9.323)', run: () => { const src = read(__filename); const doneWork = src.includes("const _hasDoneWork = rows.some(r => /^(done|completed|verified)$/i.test(r.status))"); const advisory = src.includes('_ADVISORY_KINDS') && src.includes("'handoff_never_generated'") && src.includes("'no_test_run'"); const blocking = src.includes('const blockingIssues = Math.max(0, issues - advisoryCount)') && src.includes('if (blockingIssues > 0) process.exitCode = 1'); return doneWork && advisory && blocking; } },
3124
3126
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3125
3127
  ];
3126
3128
  }
@@ -7546,23 +7548,31 @@ function lazyDetect(root, opts = {}) {
7546
7548
  issues++; _warn(`blocker without nextAction: ${b.id}`,
7547
7549
  { kind: 'blocker_no_next_action', severity: 'warn', taskId: b.id });
7548
7550
  }
7551
+ // 1.9.323 (UR-0054 ⑥, 설치리뷰): fresh/무작업 프로젝트 gate 통과 — 작업 흔적(done/completed/verified) 없으면
7552
+ // "부재" 신호(progress empty / handoff 미생성·빈 / 테스트 미실행)는 비차단(어드바이저리). active 프로젝트는 기존대로 차단.
7553
+ // 배경: leerness init 직후 leerness gate 가 빈 트래커·미생성 handoff 때문에 즉시 실패하던 UX 결함.
7554
+ const _hasDoneWork = rows.some(r => /^(done|completed|verified)$/i.test(r.status));
7555
+ const _ADVISORY_KINDS = new Set(['progress_empty', 'handoff_never_generated', 'handoff_empty', 'no_test_run']);
7556
+ const advisoryCount = _hasDoneWork ? 0 : findings.filter(f => _ADVISORY_KINDS.has(f.kind)).length;
7557
+ const blockingIssues = Math.max(0, issues - advisoryCount);
7549
7558
  // 1.9.101: JSON 모드 → 구조화 출력만 (process.exitCode는 일관 유지)
7550
7559
  if (jsonMode) {
7551
7560
  const payload = {
7552
7561
  version: VERSION,
7553
7562
  root,
7554
7563
  issues,
7555
- healthy: issues === 0,
7564
+ blockingIssues,
7565
+ healthy: blockingIssues === 0,
7556
7566
  todoCount,
7557
7567
  newTodoCount: newTodos.length,
7558
7568
  findings,
7559
7569
  };
7560
7570
  process.stdout.write(JSON.stringify(payload, null, 2) + '\n');
7561
- if (issues > 0) process.exitCode = 1;
7571
+ if (blockingIssues > 0) process.exitCode = 1;
7562
7572
  return;
7563
7573
  }
7564
- if (issues === 0) ok('lazy detect passed (no obvious lazy work signals)');
7565
- else { fail(`lazy detect found ${issues} issues`); process.exitCode = 1; }
7574
+ if (blockingIssues === 0) ok(advisoryCount > 0 ? `lazy detect passed (${advisoryCount} advisory, 0 blocking — 작업 흔적 없는 fresh 프로젝트)` : 'lazy detect passed (no obvious lazy work signals)');
7575
+ else { fail(`lazy detect found ${blockingIssues} blocking issues`); process.exitCode = 1; }
7566
7576
  }
7567
7577
 
7568
7578
  function preCheck(root) {
@@ -16742,49 +16752,11 @@ function skillExportAllCmd(root) {
16742
16752
  }
16743
16753
 
16744
16754
  // 1.9.43: MCP server — stdio JSON-RPC로 leerness 도구 노출 (Claude Code/Hermes 등이 호출)
16745
- // 프로토콜: MCP 표준 (JSON-RPC 2.0). 메서드: initialize, tools/list, tools/call
16746
- function mcpServeCmd(root) {
16747
- root = absRoot(root || process.cwd());
16748
- // 노출할 leerness 도구 목록
16749
- // 1.9.297 (UR-0025 5단계): MCP 도구 정의를 lib/mcp-tools.js 단일출처로 분리 (Codex #5 regex self-count 영구 해소).
16750
- const TOOLS = require('../lib/mcp-tools');
16751
16755
 
16752
- function send(obj) {
16753
- process.stdout.write(JSON.stringify(obj) + '\n');
16754
- }
16755
- function callLeerness(cliArgs) {
16756
- const r = cp.spawnSync(process.execPath, [__filename, ...cliArgs], {
16757
- encoding: 'utf8',
16758
- timeout: 60000,
16759
- env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_STALE_CHECK: '1', LEERNESS_NO_DRIFT_CHECK: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_WORKFLOW_GUIDE: '1' }
16760
- });
16761
- return { ok: r.status === 0, exit: r.status, stdout: r.stdout || '', stderr: r.stderr || '' };
16762
- }
16763
- function handleRequest(req) {
16764
- const id = req.id;
16765
- // 1.9.313 (UR-0049, 설치리뷰 3중수렴): JSON-RPC 2.0 / MCP notification 준수.
16766
- // notification = id 없는 요청 (또는 notifications/* 메서드) → spec "MUST NOT reply" → 절대 응답 금지.
16767
- // 이전: notifications/initialized 에 -32601 + id 없는 응답 → 엄격한 MCP 클라이언트가 프로토콜 위반 로깅/중단.
16768
- const isNotification = !('id' in req) || (typeof req.method === 'string' && req.method.startsWith('notifications/'));
16769
- if (isNotification) return; // initialized/cancelled/progress 등 조용히 수용 (무응답)
16770
- if (req.method === 'initialize') {
16771
- send({ jsonrpc: '2.0', id, result: {
16772
- protocolVersion: '2024-11-05',
16773
- capabilities: { tools: {} },
16774
- serverInfo: { name: 'leerness', version: VERSION }
16775
- } });
16776
- } else if (req.method === 'ping') {
16777
- // 1.9.313 (UR-0049): MCP 표준 ping → 빈 결과 응답 (연결 확인 — 이전엔 -32601 오류)
16778
- send({ jsonrpc: '2.0', id, result: {} });
16779
- } else if (req.method === 'tools/list') {
16780
- send({ jsonrpc: '2.0', id, result: { tools: TOOLS } });
16781
- } else if (req.method === 'tools/call') {
16782
- const { name, arguments: args = {} } = req.params || {};
16783
- const targetPath = args.path || root;
16784
- // 1.9.70: MCP tools/call 자동 사용 통계 — 어떤 도구가 자주/드물게 호출되는지 가시화
16785
- try { _bumpMcpUsage(targetPath, name); } catch {}
16786
- let cliArgs;
16787
- try {
16756
+ // 1.9.322 (UR-0044, 설치리뷰): MCP tools/call name->cliArgs 매핑을 단일 함수로 통합 (이전: mcpServeCmd 인라인 83-case switch).
16757
+ // 일치성 가드(selftest: 모든 도구 def 가 case 보유) + e2e(대표 도구 dispatch) 가 안전망. 미지 도구는 null 반환.
16758
+ function _mcpToCliArgs(name, args, targetPath) {
16759
+ let cliArgs;
16788
16760
  switch (name) {
16789
16761
  case 'leerness_handoff': cliArgs = ['handoff', targetPath, '--compact', '--no-drift-check']; break;
16790
16762
  case 'leerness_drift_check': cliArgs = ['drift', 'check', targetPath, '--json']; break;
@@ -17017,8 +16989,56 @@ function mcpServeCmd(root) {
17017
16989
  cliArgs = ['brief', args.export === true ? 'export' : 'show', '--path', targetPath, ...(args.export === true ? [] : ['--json'])];
17018
16990
  break;
17019
16991
  default:
17020
- return send({ jsonrpc: '2.0', id, error: { code: -32601, message: `Unknown tool: ${name}` } });
16992
+ return null;
17021
16993
  }
16994
+ return cliArgs;
16995
+ }
16996
+
16997
+ // 프로토콜: MCP 표준 (JSON-RPC 2.0). 메서드: initialize, tools/list, tools/call
16998
+ function mcpServeCmd(root) {
16999
+ root = absRoot(root || process.cwd());
17000
+ // 노출할 leerness 도구 목록
17001
+ // 1.9.297 (UR-0025 5단계): MCP 도구 정의를 lib/mcp-tools.js 단일출처로 분리 (Codex #5 regex self-count 영구 해소).
17002
+ const TOOLS = require('../lib/mcp-tools');
17003
+
17004
+ function send(obj) {
17005
+ process.stdout.write(JSON.stringify(obj) + '\n');
17006
+ }
17007
+ function callLeerness(cliArgs) {
17008
+ const r = cp.spawnSync(process.execPath, [__filename, ...cliArgs], {
17009
+ encoding: 'utf8',
17010
+ timeout: 60000,
17011
+ env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_STALE_CHECK: '1', LEERNESS_NO_DRIFT_CHECK: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_WORKFLOW_GUIDE: '1' }
17012
+ });
17013
+ return { ok: r.status === 0, exit: r.status, stdout: r.stdout || '', stderr: r.stderr || '' };
17014
+ }
17015
+ function handleRequest(req) {
17016
+ const id = req.id;
17017
+ // 1.9.313 (UR-0049, 설치리뷰 3중수렴): JSON-RPC 2.0 / MCP notification 준수.
17018
+ // notification = id 없는 요청 (또는 notifications/* 메서드) → spec "MUST NOT reply" → 절대 응답 금지.
17019
+ // 이전: notifications/initialized 에 -32601 + id 없는 응답 → 엄격한 MCP 클라이언트가 프로토콜 위반 로깅/중단.
17020
+ const isNotification = !('id' in req) || (typeof req.method === 'string' && req.method.startsWith('notifications/'));
17021
+ if (isNotification) return; // initialized/cancelled/progress 등 조용히 수용 (무응답)
17022
+ if (req.method === 'initialize') {
17023
+ send({ jsonrpc: '2.0', id, result: {
17024
+ protocolVersion: '2024-11-05',
17025
+ capabilities: { tools: {} },
17026
+ serverInfo: { name: 'leerness', version: VERSION }
17027
+ } });
17028
+ } else if (req.method === 'ping') {
17029
+ // 1.9.313 (UR-0049): MCP 표준 ping → 빈 결과 응답 (연결 확인 — 이전엔 -32601 오류)
17030
+ send({ jsonrpc: '2.0', id, result: {} });
17031
+ } else if (req.method === 'tools/list') {
17032
+ send({ jsonrpc: '2.0', id, result: { tools: TOOLS } });
17033
+ } else if (req.method === 'tools/call') {
17034
+ const { name, arguments: args = {} } = req.params || {};
17035
+ const targetPath = args.path || root;
17036
+ // 1.9.70: MCP tools/call 자동 사용 통계 — 어떤 도구가 자주/드물게 호출되는지 가시화
17037
+ try { _bumpMcpUsage(targetPath, name); } catch {}
17038
+ let cliArgs;
17039
+ try {
17040
+ cliArgs = _mcpToCliArgs(name, args, targetPath);
17041
+ if (cliArgs === null) return send({ jsonrpc: '2.0', id, error: { code: -32601, message: `Unknown tool: ${name}` } });
17022
17042
  // 1.9.288 (Codex gpt-5.5 리뷰 #1 수렴): MCP 도구도 policy enforce 적용 — read-only enforce 시 write 도구 차단.
17023
17043
  // 이전: _policyEnforce 는 agents multi --execute 한 곳뿐 → MCP state_start 등이 정책 우회하고 .leerness 기록.
17024
17044
  // cliArgs(실제 실행 명령) 로 required tier 판정 → enforce ON 이고 초과 시 JSON-RPC error 반환(실행 안 함).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.321",
3
+ "version": "1.9.323",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -3854,5 +3854,45 @@ total++;
3854
3854
  if (!ok) failed++;
3855
3855
  }
3856
3856
 
3857
+ // 1.9.322 회귀 (UR-0044): _mcpToCliArgs 추출 후 인자 매핑(push) 보존 + 미지 도구 -32601
3858
+ total++;
3859
+ {
3860
+ let ok = false;
3861
+ try {
3862
+ const md = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-tocli-'));
3863
+ cp.spawnSync(process.execPath, [CLI, 'init', md, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
3864
+ const call = (req) => { const r = cp.spawnSync(process.execPath, [CLI, 'mcp', 'serve'], { encoding: 'utf8', timeout: 15000, input: JSON.stringify(req) + '\n' }); try { return JSON.parse(r.stdout.split('\n').filter(Boolean)[0]); } catch { return null; } };
3865
+ // task_add with status arg (멀티 인자 push 경로) → task list 반영 확인
3866
+ call({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'leerness_task_add', arguments: { path: md, text: 'TOCLI 테스트', status: 'in-progress' } } });
3867
+ const listed = call({ jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name: 'leerness_task_list', arguments: { path: md } } });
3868
+ const t = (listed && listed.result && listed.result.content && listed.result.content[0].text) || '';
3869
+ const argMapOk = /TOCLI 테스트/.test(t) && /in-progress/.test(t);
3870
+ const unk = call({ jsonrpc: '2.0', id: 3, method: 'tools/call', params: { name: 'leerness_nope', arguments: {} } });
3871
+ const unkOk = !!unk && !!unk.error && unk.error.code === -32601;
3872
+ ok = argMapOk && unkOk;
3873
+ fs.rmSync(md, { recursive: true, force: true });
3874
+ } catch {}
3875
+ console.log(ok ? '✓ B(1.9.322) _mcpToCliArgs 추출: 인자 매핑(task_add status) 보존 + 미지 도구 -32601 (UR-0044)' : '✗ _mcpToCliArgs 추출 실패');
3876
+ if (!ok) failed++;
3877
+ }
3878
+
3879
+ // 1.9.323 회귀 (UR-0054 ⑥): fresh init → gate(lazy detect) 통과(부재신호 비차단) + active 거짓완료는 차단 유지
3880
+ total++;
3881
+ {
3882
+ let ok = false;
3883
+ try {
3884
+ const fg = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-freshgate-'));
3885
+ cp.spawnSync(process.execPath, [CLI, 'init', fg, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
3886
+ const freshExit = cp.spawnSync(process.execPath, [CLI, 'lazy', 'detect', fg], { encoding: 'utf8', timeout: 20000 }).status; // fresh → 통과(0)
3887
+ // 거짓완료(done + 증거0) 추가 → 다시 lazy detect → 차단(1)
3888
+ cp.spawnSync(process.execPath, [CLI, 'task', 'add', '거짓완료', '--status', 'done', '--evidence', '', '--path', fg, '--no-review', '--force'], { encoding: 'utf8', timeout: 20000 });
3889
+ const activeExit = cp.spawnSync(process.execPath, [CLI, 'lazy', 'detect', fg], { encoding: 'utf8', timeout: 20000 }).status; // 거짓완료 → 차단(1)
3890
+ ok = freshExit === 0 && activeExit === 1;
3891
+ fs.rmSync(fg, { recursive: true, force: true });
3892
+ } catch {}
3893
+ console.log(ok ? '✓ B(1.9.323) fresh-init gate: lazy detect 부재신호 비차단(통과) + 거짓완료 차단 유지 (UR-0054 ⑥)' : '✗ fresh-init gate 실패');
3894
+ if (!ok) failed++;
3895
+ }
3896
+
3857
3897
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
3858
3898
  if (failed > 0) process.exit(1);