leerness 1.9.319 → 1.9.320

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,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.320 — 2026-06-04 — UR-0053(1단계): decisions/lessons count drift 버그 수정
4
+
5
+ **🔢 MD 파싱이 코드펜스 템플릿 예시까지 세어 `decisions=2 실제1` 로 오집계하던 count drift 버그 수정 (UR-0053 의 구체적 결함).**
6
+
7
+ ### 배경 (UR-0053)
8
+ UR-0053 전략(상태 canonical=JSON, MD=projection) 중 **구체적으로 재현된 버그**: `context.memory.decisions=2 실제1`. 원인 — decisions.md/lessons.md 의 **Template 예시가 코드펜스(```md … ```) 안에 `### YYYY-MM-DD — Decision 제목` 형태**로 들어있는데, 카운터 6곳이 raw regex `match(/^### \d{4}-\d{2}-\d{2}/gm)` 로 **펜스 안 템플릿까지 카운트**.
9
+
10
+ ### 구현 (UR-0053 1단계 — 비파괴 count 정합)
11
+ 1. **`_countDatedBlocks(text)` 단일 진실소스** — 코드펜스 제거 후 `### YYYY-MM-DD` 헤더만 카운트 (기존 `_extractDecisionBlocks` 의 펜스 제거 로직과 동일 원리).
12
+ 2. **6개 카운트 사이트 교체** (context / auto-resume / handoff·audit builder): decisions 2곳 + lessons 4곳 → `_countDatedBlocks` 사용. raw regex 카운트 0.
13
+ 3. selftest 67→68 · e2e 264→265.
14
+ 4. 전체 JSON-canonical 아키텍처(쓰기 경로 전환)는 별도 후속 — 본 단계는 **읽기 카운트 정합**(비파괴, behavior change 0).
15
+
16
+ ### 검증
17
+ - **selftest 68/68 PASS** · **E2E 265/265 PASS** (회귀 0).
18
+ - 실측: decision 1건 + lesson 1건 추가 → `context` `memory.decisions=1, lessons=1` (이전 decisions=2) · `_countDatedBlocks`: 펜스 템플릿 제외(1), 펜스만(0), 펜스 없는 2건(2).
19
+
3
20
  ## 1.9.319 — 2026-06-04 — UR-0044(가드): MCP ToolRegistry 일치성 회귀 가드
4
21
 
5
22
  **🛡 MCP 도구 def ↔ dispatch case 불일치(Unknown-tool 갭)를 영구 차단하는 회귀 가드 — UR-0044 의 실질 위험 해소.**
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.319-green)]() [![tests](https://img.shields.io/badge/e2e-264%2F264-success)]() [![selftest](https://img.shields.io/badge/selftest-67-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.320-green)]() [![tests](https://img.shields.io/badge/e2e-265%2F265-success)]() [![selftest](https://img.shields.io/badge/selftest-68-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.319 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.320 하네스를 사용합니다. 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.319는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.320는 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.319는 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.319)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.320)** · 매 라운드 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.319: 2026-06-04
587
+ Last synced by Leerness v1.9.320: 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.319';
18
+ const VERSION = '1.9.320';
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') 시 호스트 프로세스 오염.
@@ -3119,6 +3119,7 @@ function _selfTestCases() {
3119
3119
  { name: '텔레메트리 분리: 내부 auto-call(LEERNESS_INTERNAL) usage 집계 제외 + 주요 spawn 마킹 (UR-0051 설치리뷰 1.9.317)', run: () => { const src = read(__filename); const guard = src.includes("process.env.LEERNESS_INTERNAL !== '1'"); const marked = (src.match(/LEERNESS_INTERNAL: '1'/g) || []).length >= 10; const reviewMarked = /'review-request'[\s\S]{0,200}LEERNESS_INTERNAL: '1'/.test(src); return guard && marked && reviewMarked; } },
3120
3120
  { name: 'lib/pure-utils: HTML 파싱 유틸 3종 모듈 분리 + 동작 + 인라인 제거 (UR-0025 1.9.318)', run: () => { const m = require('../lib/pure-utils'); const fnOk = typeof m._htmlToText === 'function' && typeof m._extractTitle === 'function' && typeof m._extractLinks === 'function'; const work = m._htmlToText('<p>Hello <b>World</b></p>') === 'Hello World' && m._extractTitle('<html><title>My &amp; Page</title></html>') === 'My & Page' && m._extractLinks('<a href="/a">A</a><a href="https://other.com/b">B</a>', 'https://x.com/').length === 1; const moved = m._htmlToText === _htmlToText && !/^function _htmlToText\(html\) \{/m.test(read(__filename)); return fnOk && work && moved; } },
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
+ { 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; } },
3122
3123
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3123
3124
  ];
3124
3125
  }
@@ -4654,9 +4655,9 @@ function _buildAutoResumePlan(root, opts) {
4654
4655
  // memory surface counts
4655
4656
  const memorySurface = {
4656
4657
  tasksInProgress: rows.filter(r => r.status === 'in-progress').length,
4657
- decisions: exists(decisionsPath(root)) ? (read(decisionsPath(root)).match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length : 0,
4658
+ decisions: exists(decisionsPath(root)) ? _countDatedBlocks(read(decisionsPath(root))) : 0,
4658
4659
  rulesActive: readRules(root).filter(r => r.status === 'active').length,
4659
- lessons: exists(lessonsPath(root)) ? (read(lessonsPath(root)).match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length : 0
4660
+ lessons: exists(lessonsPath(root)) ? _countDatedBlocks(read(lessonsPath(root))) : 0
4660
4661
  };
4661
4662
  return {
4662
4663
  nextRoundVersion: opts.nextRoundVersion || `next after ${currentVersion}`,
@@ -7937,11 +7938,11 @@ function handoff(root) {
7937
7938
  try {
7938
7939
  const rows = readProgressRows(root);
7939
7940
  const inProgressTasks = rows.filter(r => r.status === 'in-progress').length;
7940
- const decisions = exists(decisionsPath(root)) ? (read(decisionsPath(root)).match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length : 0;
7941
+ const decisions = exists(decisionsPath(root)) ? _countDatedBlocks(read(decisionsPath(root))) : 0;
7941
7942
  const rulesActive = readRules(root).filter(r => r.status === 'active').length;
7942
7943
  const planText = exists(planPath(root)) ? read(planPath(root)) : '';
7943
7944
  const planMilestones = (planText.match(/^### M-\d{4}\./gm) || []).length;
7944
- const lessons = exists(lessonsPath(root)) ? (read(lessonsPath(root)).match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length : 0;
7945
+ const lessons = exists(lessonsPath(root)) ? _countDatedBlocks(read(lessonsPath(root))) : 0;
7945
7946
  parts.push(`🧠 mem T${inProgressTasks}/D${decisions}/R${rulesActive}/P${planMilestones}/L${lessons}`);
7946
7947
  } catch {}
7947
7948
  // 8) 1.9.152: 활성 외부 AI CLI 카운트 (1.9.151 복수 선택 결과 반영) — 메인 에이전트가 sub-agent 분배 가능성 즉시 인지
@@ -12817,6 +12818,12 @@ function readSessionCounter(root) {
12817
12818
  function writeSessionCounter(root, c) { writeUtf8(sessionCounterPath(root), JSON.stringify(c, null, 2) + '\n'); }
12818
12819
 
12819
12820
  // 1.9.14 A/D: 결정 블록 추출 — 코드 블록 안의 ### + Template 제외
12821
+ // 1.9.320 (UR-0053, 설치리뷰): 날짜 블록(### YYYY-MM-DD) 카운트 단일 진실소스 — 코드펜스(```md 템플릿 예시) 제거 후 카운트.
12822
+ // 배경: decisions/lessons 카운터 6곳이 raw regex 로 코드펜스 안 Template 예시까지 세어 count drift(decisions=2 실제1) 발생.
12823
+ function _countDatedBlocks(text) {
12824
+ const cleaned = String(text || '').replace(/^```[^\n]*\n[\s\S]*?\n```\s*$/gm, ''); // 코드펜스(템플릿) 제거
12825
+ return (cleaned.match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length;
12826
+ }
12820
12827
  function _extractDecisionBlocks(text) {
12821
12828
  // 줄 시작의 ```부터 줄 시작의 ```까지를 코드블록으로 인식 (인라인 백틱 무시)
12822
12829
  const cleaned = String(text || '').replace(/^```[^\n]*\n[\s\S]*?\n```\s*$/gm, '');
@@ -18442,7 +18449,7 @@ function contextCmd(root, opts = {}) {
18442
18449
  let decisionCount = 0;
18443
18450
  if (exists(decFile)) {
18444
18451
  const dtext = read(decFile);
18445
- decisionCount = (dtext.match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length;
18452
+ decisionCount = _countDatedBlocks(dtext);
18446
18453
  const blocks = _extractDecisionBlocks(dtext);
18447
18454
  recentDecisions = blocks.slice(-3).reverse().map(block => {
18448
18455
  const tm = (block.match(/^### (.+)$/m) || [])[1] || '';
@@ -18456,7 +18463,7 @@ function contextCmd(root, opts = {}) {
18456
18463
  tasksInProgress: rows.filter(r => r.status === 'in-progress').length,
18457
18464
  decisions: decisionCount,
18458
18465
  rulesActive: activeRules.length,
18459
- lessons: exists(lessonsPath(root)) ? (read(lessonsPath(root)).match(/^### \d{4}-\d{2}-\d{2}/gm) || []).length : 0
18466
+ lessons: exists(lessonsPath(root)) ? _countDatedBlocks(read(lessonsPath(root))) : 0
18460
18467
  };
18461
18468
  // 프로젝트 청사진 (1.9.308 UR-0055 2단계): brief 에서 의도/개요/방향이력 회수 (단일 출처)
18462
18469
  const brief = _loadBrief(root);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.319",
3
+ "version": "1.9.320",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -3816,5 +3816,23 @@ total++;
3816
3816
  if (!ok) failed++;
3817
3817
  }
3818
3818
 
3819
+ // 1.9.320 회귀 (UR-0053): count drift — decisions/lessons 카운터가 코드펜스(```md 템플릿 예시) 제외 (decisions=2 실제1 버그)
3820
+ total++;
3821
+ {
3822
+ let ok = false;
3823
+ try {
3824
+ const cd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-countdrift-'));
3825
+ cp.spawnSync(process.execPath, [CLI, 'init', cd, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
3826
+ cp.spawnSync(process.execPath, [CLI, 'decision', 'add', 'JWT 채택', '--path', cd, '--reason', 'stateless', '--alternatives', 'session', '--impact', '보안'], { encoding: 'utf8', timeout: 20000 });
3827
+ cp.spawnSync(process.execPath, [CLI, 'lesson', 'save', '락은 reentrant', '--path', cd], { encoding: 'utf8', timeout: 20000 });
3828
+ const r = cp.spawnSync(process.execPath, [CLI, 'context', '--path', cd, '--json'], { encoding: 'utf8', timeout: 20000 });
3829
+ let dec = null, les = null; try { const j = JSON.parse(r.stdout); dec = j.memory && j.memory.decisions; les = j.memory && j.memory.lessons; } catch {}
3830
+ ok = dec === 1 && les === 1; // 코드펜스 템플릿 제외 → 실제 1건씩 (이전: decisions=2)
3831
+ fs.rmSync(cd, { recursive: true, force: true });
3832
+ } catch {}
3833
+ console.log(ok ? '✓ B(1.9.320) count drift 수정: decisions/lessons 코드펜스 템플릿 제외 (실제 카운트) (UR-0053)' : '✗ count drift 실패');
3834
+ if (!ok) failed++;
3835
+ }
3836
+
3819
3837
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
3820
3838
  if (failed > 0) process.exit(1);