leerness 1.9.320 → 1.9.321

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,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.321 — 2026-06-05 — UR-0053(2단계): decision/lesson 빈 필드 오파싱 수정
4
+
5
+ **🔧 빈 필드(Alternatives 등)가 다음 줄(Impact)을 캡처하던 `Alternatives→Impact 오파싱` 버그 수정 (UR-0053 의 두 번째 구체 결함).**
6
+
7
+ ### 배경 (UR-0053)
8
+ `decision add --reason r --impact x` (alternatives 비움) 후 `decision list --json` → `alternatives: "- Impact: x"` (다음 줄을 캡처). 원인 — 필드 파서 `block.match(/- Alternatives:\s*(.+)/)` 의 **`\s*` 가 개행을 포함**(`\s`) → 빈 필드일 때 개행을 건너뛰고 `(.+)` 가 다음 줄(`- Impact: …`)을 잡음.
9
+
10
+ ### 구현 (UR-0053 2단계)
11
+ 1. **필드 파서 `\s*` → `[ \t]*` (같은 줄 공백만)**: 빈 필드는 같은 줄에 내용이 없으면 매치 안 함 → 다음 줄 누출 차단. 적용 9곳: decision(Decision/Reason/Alternatives/Impact) + lesson(Lesson/Tag) 파서 전반.
12
+ 2. **락 테스트 안정화(테스트 품질)**: B(1.9.303) 동시 task add 락 테스트 폴 타임아웃 25s→60s — 전체 e2e CPU 포화 시 6 병렬 spawn 지연 간헐 플래키 방지(격리 실측 0.4s, 락 로직 불변).
13
+ 3. selftest 68→69 · e2e 265→266.
14
+
15
+ ### 검증
16
+ - **selftest 69/69 PASS** · **E2E 266/266 PASS** (회귀 0).
17
+ - 실측: 빈 alternatives → `alternatives` 가 `- Impact:…` 안 잡음(이전 누출) · 모든 필드 채움 → 정확 분리 · 락 테스트 6/6 안정.
18
+
3
19
  ## 1.9.320 — 2026-06-04 — UR-0053(1단계): decisions/lessons count drift 버그 수정
4
20
 
5
21
  **🔢 MD 파싱이 코드펜스 템플릿 예시까지 세어 `decisions=2 실제1` 로 오집계하던 count drift 버그 수정 (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.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)]()
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)]()
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.320 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.321 하네스를 사용합니다. 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.320는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.321는 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.320는 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.320)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.321)** · 매 라운드 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.320: 2026-06-04
587
+ Last synced by Leerness v1.9.321: 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.320';
18
+ const VERSION = '1.9.321';
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') 시 호스트 프로세스 오염.
@@ -3120,6 +3120,7 @@ function _selfTestCases() {
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
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
+ { 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; } },
3123
3124
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3124
3125
  ];
3125
3126
  }
@@ -6673,8 +6674,8 @@ function lessonListCmd(root, opts = {}) {
6673
6674
  for (const block of text.split(/\n(?=### )/)) {
6674
6675
  if (!block.startsWith('### ')) continue;
6675
6676
  const dateMatch = block.match(/^### (\d{4}-\d{2}-\d{2}[^\n]*)/);
6676
- const lessonMatch = block.match(/- Lesson:\s*(.+)/);
6677
- const tagMatch = block.match(/- Tag:\s*(.+)/);
6677
+ const lessonMatch = block.match(/- Lesson:[ \t]*(.+)/);
6678
+ const tagMatch = block.match(/- Tag:[ \t]*(.+)/);
6678
6679
  if (!lessonMatch) continue;
6679
6680
  const lesson = {
6680
6681
  date: dateMatch ? dateMatch[1].trim() : null,
@@ -6720,7 +6721,7 @@ function lessonDropCmd(root, target) {
6720
6721
  if (!b.startsWith('### ')) { kept.push(b); continue; }
6721
6722
  // date 매칭 (정확) 또는 text substring (lesson content)
6722
6723
  const dateMatch = b.match(/^### (\d{4}-\d{2}-\d{2})/);
6723
- const lessonMatch = b.match(/- Lesson:\s*(.+)/);
6724
+ const lessonMatch = b.match(/- Lesson:[ \t]*(.+)/);
6724
6725
  const isDateTarget = dateMatch && dateMatch[1] === target;
6725
6726
  const isTextTarget = lessonMatch && lessonMatch[1].includes(target);
6726
6727
  if (isDateTarget || isTextTarget) {
@@ -6785,10 +6786,10 @@ function decisionListCmd(root, opts = {}) {
6785
6786
  const dateTitleMatch = titleLine.match(/^(\d{4}-\d{2}-\d{2})\s*—\s*(.+)$/);
6786
6787
  const date = dateTitleMatch ? dateTitleMatch[1] : null;
6787
6788
  const title = dateTitleMatch ? dateTitleMatch[2].trim() : titleLine;
6788
- const decisionMatch = block.match(/- Decision:\s*(.+)/);
6789
- const reasonMatch = block.match(/- Reason:\s*(.+)/);
6790
- const alternativesMatch = block.match(/- Alternatives:\s*(.+)/);
6791
- const impactMatch = block.match(/- Impact:\s*(.+)/);
6789
+ const decisionMatch = block.match(/- Decision:[ \t]*(.+)/);
6790
+ const reasonMatch = block.match(/- Reason:[ \t]*(.+)/);
6791
+ const alternativesMatch = block.match(/- Alternatives:[ \t]*(.+)/);
6792
+ const impactMatch = block.match(/- Impact:[ \t]*(.+)/);
6792
6793
  const entry = {
6793
6794
  date,
6794
6795
  title,
@@ -13237,7 +13238,7 @@ function _brainstormFor(root, topic) {
13237
13238
  const lessonsText = read(lp_brainstorm);
13238
13239
  for (const block of lessonsText.split(/\n(?=### )/)) {
13239
13240
  if (!block.startsWith('### ')) continue;
13240
- const lessonMatch = block.match(/- Lesson:\s*(.+)/);
13241
+ const lessonMatch = block.match(/- Lesson:[ \t]*(.+)/);
13241
13242
  if (lessonMatch && matches(block)) {
13242
13243
  const idx = lessonsText.indexOf(block);
13243
13244
  const lineNo = idx >= 0 ? lessonsText.slice(0, idx).split('\n').length : 0;
@@ -13533,7 +13534,7 @@ function brainstormCmd(root, topic) {
13533
13534
  const lessonsText = read(lp_b2);
13534
13535
  for (const block of lessonsText.split(/\n(?=### )/)) {
13535
13536
  if (!block.startsWith('### ')) continue;
13536
- const lessonMatch = block.match(/- Lesson:\s*(.+)/);
13537
+ const lessonMatch = block.match(/- Lesson:[ \t]*(.+)/);
13537
13538
  if (lessonMatch && matches(block)) {
13538
13539
  const idx = lessonsText.indexOf(block);
13539
13540
  const lineNo = idx >= 0 ? lessonsText.slice(0, idx).split('\n').length : 0;
@@ -15958,7 +15959,7 @@ function _loadLessonsIndex(root) {
15958
15959
  const txt = read(lp);
15959
15960
  for (const block of txt.split(/\n(?=### )/)) {
15960
15961
  if (!block.startsWith('### ')) continue;
15961
- const lessonMatch = block.match(/- Lesson:\s*(.+)/);
15962
+ const lessonMatch = block.match(/- Lesson:[ \t]*(.+)/);
15962
15963
  if (lessonMatch) lessonsExplicit.push({ title: lessonMatch[1].trim(), block });
15963
15964
  }
15964
15965
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.320",
3
+ "version": "1.9.321",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -3416,7 +3416,8 @@ total++;
3416
3416
  const ptPath = path.join(lDir, '.harness', 'progress-tracker.md');
3417
3417
  // 자식들이 OS 프로세스로 독립 진행 → 부모는 파일을 sync 폴링(원자쓰기라 부분읽기 없음)
3418
3418
  const start = Date.now(); let found = 0;
3419
- while (Date.now() - start < 25000) {
3419
+ // 1.9.321: 폴 타임아웃 25s→60s — 전체 e2e CPU 포화 시 6 병렬 spawn 지연으로 인한 간헐 플래키 방지(격리 실측 0.4s, 대폭 여유)
3420
+ while (Date.now() - start < 60000) {
3420
3421
  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 {}
3421
3422
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 200);
3422
3423
  }
@@ -3834,5 +3835,24 @@ total++;
3834
3835
  if (!ok) failed++;
3835
3836
  }
3836
3837
 
3838
+ // 1.9.321 회귀 (UR-0053): decision 빈 필드(alternatives)가 [ \t]* 파싱으로 다음 줄(impact)을 캡처하지 않음
3839
+ total++;
3840
+ {
3841
+ let ok = false;
3842
+ try {
3843
+ const fd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-field-'));
3844
+ cp.spawnSync(process.execPath, [CLI, 'init', fd, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
3845
+ cp.spawnSync(process.execPath, [CLI, 'decision', 'add', '캐시 도입', '--path', fd, '--reason', '성능', '--impact', '응답50ms'], { encoding: 'utf8', timeout: 20000 }); // alternatives 비움
3846
+ const r = cp.spawnSync(process.execPath, [CLI, 'decision', 'list', '--path', fd, '--json'], { encoding: 'utf8', timeout: 20000 });
3847
+ let alt = 'X', imp = null; try { const parsed = JSON.parse(r.stdout); const arr = parsed.decisions || parsed; const d = arr[0]; alt = d.alternatives; imp = d.impact; } catch {}
3848
+ const noBleed = !alt || !String(alt).includes('Impact'); // 빈 alternatives 가 '- Impact:...' 캡처 안 함
3849
+ const impOk = imp === '응답50ms'; // impact 는 정확
3850
+ ok = noBleed && impOk;
3851
+ fs.rmSync(fd, { recursive: true, force: true });
3852
+ } catch {}
3853
+ console.log(ok ? '✓ B(1.9.321) decision 필드 파싱: 빈 alternatives 가 impact 로 안 샘 (UR-0053)' : '✗ decision 필드 파싱 실패');
3854
+ if (!ok) failed++;
3855
+ }
3856
+
3837
3857
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
3838
3858
  if (failed > 0) process.exit(1);