leerness 1.9.317 → 1.9.318

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.318 — 2026-06-04 — UR-0025: HTML 파싱 유틸 모듈 분리 + 락 테스트 격리
4
+
5
+ **🧩 점진적 비파괴 모듈화(UR-0025) 한 단계 + pre-wake-audit critical 조사 결과 정리.**
6
+
7
+ ### pre-wake-audit critical 조사 (요청)
8
+ 매 라운드 관찰된 `pre-wake-audit critical 1` 을 조사 → **버그 아님**. `missing-user-requests` 가 미답 백로그 **3건**(UR-0025 모듈화 / UR-0044 ToolRegistry / UR-0053 JSON store)을 **정확히 보고**하는 정상 동작 (drift 마커와 달리 오발화 아님). 클리어하려면 백로그를 진행해야 함 → 가장 안전·확립된 UR-0025 를 진행.
9
+
10
+ ### 구현 (UR-0025)
11
+ 1. **순수 HTML 파싱 유틸 3종 → `lib/pure-utils.js` 분리**: `_htmlToText` / `_extractTitle` / `_extractLinks` (api-skill 문서 수집용, fs/네트워크 의존 0, URL·regex 만). harness.js 인라인 정의 제거 → require 로 동일 사용.
12
+ 2. **락 테스트 격리(테스트 품질)**: B(1.9.303) 동시 task add 락 테스트가 전체 e2e 부하 + review-request 내부 spawn(~550ms×6) 오버헤드로 **타임아웃 플래키** → `--no-review` 로 동시성만 격리(락 로직은 격리 실행 0.4s/6 보존 검증). 제품 락 로직 변경 없음.
13
+ 3. selftest 65→66 · e2e 262→263.
14
+
15
+ ### 검증
16
+ - **selftest 66/66 PASS** · **E2E 263/263 PASS** (회귀 0).
17
+ - 실측: 모듈 `_htmlToText('<p>Hello <b>World</b></p>')` → `Hello World` · `_extractTitle`(엔티티 디코드) · `_extractLinks`(same-domain only) · harness 인라인 제거 확인 · api-skill 명령 정상 로드.
18
+
3
19
  ## 1.9.317 — 2026-06-04 — UR-0051: 텔레메트리 분리 (설치리뷰)
4
20
 
5
21
  **📊 내부 auto-call 이 usage 통계를 오염시켜 거짓 skill 추천을 유발하던 결함 수정.**
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.317-green)]() [![tests](https://img.shields.io/badge/e2e-262%2F262-success)]() [![selftest](https://img.shields.io/badge/selftest-65-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.318-green)]() [![tests](https://img.shields.io/badge/e2e-263%2F263-success)]() [![selftest](https://img.shields.io/badge/selftest-66-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.317 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.318 하네스를 사용합니다. 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.317는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.318는 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.317는 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.317)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.318)** · 매 라운드 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.317: 2026-06-04
587
+ Last synced by Leerness v1.9.318: 2026-06-04
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -8,13 +8,14 @@ const os = require('os'); // 1.9.178: _publishToNpm 에서 os.tmpdir() 사용 (
8
8
  const readline = require('readline');
9
9
  // 1.9.274 (UR-0025 1단계): 순수 유틸 함수 모듈 분리 (require-based, 비파괴). selftest 7종이 동작 검증.
10
10
  const { _isSecretKey, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
11
- PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord } = require('../lib/pure-utils');
11
+ PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
12
+ _htmlToText, _extractTitle, _extractLinks } = require('../lib/pure-utils'); // 1.9.318 (UR-0025): 순수 HTML 파싱 유틸 분리
12
13
  // 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
13
14
  const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
14
15
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
15
16
  const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
16
17
 
17
- const VERSION = '1.9.317';
18
+ const VERSION = '1.9.318';
18
19
 
19
20
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
20
21
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -3116,6 +3117,7 @@ function _selfTestCases() {
3116
3117
  { name: 'doc/surface 정합: doctor 명령 + stale MCP 카운트 동적화(commands/banner) (UR-0054 설치리뷰 1.9.315)', run: () => { const src = read(__filename); const doctorOk = typeof doctorCmd === 'function' && /cmd === 'doctor'/.test(src) && /# leerness doctor/.test(src); const dynCount = /MCP 도구: \$\{_mcpToolCount\(\)\}/.test(src) && /외부 AI 통합 \(MCP \$\{_mcpToolCount\(\)\} 도구\)/.test(src); return doctorOk && dynCount; } },
3117
3118
  { name: 'drift 마커 버그: session-handoff 프론트매터는 ^--- 일 때만 + drift 최신 Last generated (1.9.316)', run: () => { const src = read(__filename); const writeFix = src.includes('if (/^---\\r?\\n/.test(cur))') && src.includes('writeUtf8(handoffPath(root), frontmatter + block)'); const readFix = src.includes('matchAll(/Last generated') && src.includes('allGen[allGen.length - 1]'); return writeFix && readFix; } },
3118
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
+ { 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; } },
3119
3121
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3120
3122
  ];
3121
3123
  }
@@ -3325,45 +3327,7 @@ function _fetchUrl(url, opts = {}) {
3325
3327
  go(url, 0);
3326
3328
  });
3327
3329
  }
3328
- function _htmlToText(html) {
3329
- if (!html) return '';
3330
- return html
3331
- .replace(/<script[\s\S]*?<\/script>/gi, '')
3332
- .replace(/<style[\s\S]*?<\/style>/gi, '')
3333
- .replace(/<!--[\s\S]*?-->/g, '')
3334
- .replace(/<br\s*\/?>/gi, '\n')
3335
- .replace(/<\/?(p|div|li|h[1-6]|tr|td|pre)[^>]*>/gi, '\n')
3336
- .replace(/<[^>]+>/g, ' ')
3337
- .replace(/&nbsp;/g, ' ').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'")
3338
- .replace(/&#(\d+);/g, (_, n) => String.fromCharCode(parseInt(n, 10)))
3339
- .replace(/[ \t]+/g, ' ').replace(/\n\s*\n\s*\n+/g, '\n\n').trim();
3340
- }
3341
- function _extractTitle(html) {
3342
- const m = (html || '').match(/<title[^>]*>([\s\S]*?)<\/title>/i);
3343
- if (!m) return '';
3344
- return _htmlToText(m[1]).slice(0, 200);
3345
- }
3346
- function _extractLinks(html, baseUrl, maxLinks) {
3347
- if (!html) return [];
3348
- const base = new URL(baseUrl);
3349
- const found = new Map();
3350
- const re = /<a\s+[^>]*href=["']([^"']+)["'][^>]*>([\s\S]*?)<\/a>/gi;
3351
- let m;
3352
- while ((m = re.exec(html)) !== null) {
3353
- let href = m[1];
3354
- if (!href || href.startsWith('#') || href.startsWith('javascript:') || href.startsWith('mailto:')) continue;
3355
- let abs;
3356
- try { abs = new URL(href, baseUrl).toString(); } catch { continue; }
3357
- const u = new URL(abs);
3358
- if (u.hostname !== base.hostname) continue; // same-domain only
3359
- if (abs === baseUrl) continue;
3360
- if (found.has(abs)) continue;
3361
- const text = _htmlToText(m[2]).slice(0, 120);
3362
- found.set(abs, { url: abs, text });
3363
- if (found.size >= (maxLinks || 10)) break;
3364
- }
3365
- return Array.from(found.values());
3366
- }
3330
+ // 1.9.318 (UR-0025): _htmlToText / _extractTitle / _extractLinks → lib/pure-utils.js 로 이동 (순수 함수, require 로 사용).
3367
3331
  async function _collectAPIDoc(url, opts = {}) {
3368
3332
  const direction = opts.direction || '';
3369
3333
  const noCrawl = opts.noCrawl;
package/lib/pure-utils.js CHANGED
@@ -155,9 +155,52 @@ function _newRunRecord(opts = {}) {
155
155
  };
156
156
  }
157
157
 
158
+ // 1.9.318 (UR-0025): 순수 HTML 파싱 유틸 (api-skill 문서 수집용) — fs/네트워크 의존 0, URL/regex 만 사용.
159
+ function _htmlToText(html) {
160
+ if (!html) return '';
161
+ return html
162
+ .replace(/<script[\s\S]*?<\/script>/gi, '')
163
+ .replace(/<style[\s\S]*?<\/style>/gi, '')
164
+ .replace(/<!--[\s\S]*?-->/g, '')
165
+ .replace(/<br\s*\/?>/gi, '\n')
166
+ .replace(/<\/?(p|div|li|h[1-6]|tr|td|pre)[^>]*>/gi, '\n')
167
+ .replace(/<[^>]+>/g, ' ')
168
+ .replace(/&nbsp;/g, ' ').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'")
169
+ .replace(/&#(\d+);/g, (_, n) => String.fromCharCode(parseInt(n, 10)))
170
+ .replace(/[ \t]+/g, ' ').replace(/\n\s*\n\s*\n+/g, '\n\n').trim();
171
+ }
172
+ function _extractTitle(html) {
173
+ const m = (html || '').match(/<title[^>]*>([\s\S]*?)<\/title>/i);
174
+ if (!m) return '';
175
+ return _htmlToText(m[1]).slice(0, 200);
176
+ }
177
+ function _extractLinks(html, baseUrl, maxLinks) {
178
+ if (!html) return [];
179
+ const base = new URL(baseUrl);
180
+ const found = new Map();
181
+ const re = /<a\s+[^>]*href=["']([^"']+)["'][^>]*>([\s\S]*?)<\/a>/gi;
182
+ let m;
183
+ while ((m = re.exec(html)) !== null) {
184
+ let href = m[1];
185
+ if (!href || href.startsWith('#') || href.startsWith('javascript:') || href.startsWith('mailto:')) continue;
186
+ let abs;
187
+ try { abs = new URL(href, baseUrl).toString(); } catch { continue; }
188
+ const u = new URL(abs);
189
+ if (u.hostname !== base.hostname) continue; // same-domain only
190
+ if (abs === baseUrl) continue;
191
+ if (found.has(abs)) continue;
192
+ const text = _htmlToText(m[2]).slice(0, 120);
193
+ found.set(abs, { url: abs, text });
194
+ if (found.size >= (maxLinks || 10)) break;
195
+ }
196
+ return Array.from(found.values());
197
+ }
198
+
158
199
  module.exports = {
159
200
  _isSecretKey, compareVer, parseHarnessVersion,
160
201
  _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
161
202
  // 1.9.283 (UR-0025 2단계)
162
- PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord
203
+ PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
204
+ // 1.9.318 (UR-0025): 순수 HTML 파싱 유틸
205
+ _htmlToText, _extractTitle, _extractLinks
163
206
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.317",
3
+ "version": "1.9.318",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -3411,7 +3411,8 @@ total++;
3411
3411
  cp.spawnSync(process.execPath, [CLI, 'init', lDir, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
3412
3412
  const N = 6;
3413
3413
  const procs = [];
3414
- for (let i = 0; i < N; i++) procs.push(cp.spawn(process.execPath, [CLI, 'task', 'add', 'LOCKTEST-' + i, '--path', lDir], { stdio: 'ignore' }));
3414
+ // 1.9.318: --no-review review-request 내부 spawn(~550ms×N) 제외 (동시성) 자체만 격리 검증 (전체 e2e 부하 타임아웃 플래키 방지)
3415
+ for (let i = 0; i < N; i++) procs.push(cp.spawn(process.execPath, [CLI, 'task', 'add', 'LOCKTEST-' + i, '--path', lDir, '--no-review'], { stdio: 'ignore' }));
3415
3416
  const ptPath = path.join(lDir, '.harness', 'progress-tracker.md');
3416
3417
  // 자식들이 OS 프로세스로 독립 진행 → 부모는 파일을 sync 폴링(원자쓰기라 부분읽기 없음)
3417
3418
  const start = Date.now(); let found = 0;
@@ -3778,5 +3779,25 @@ total++;
3778
3779
  if (!ok) failed++;
3779
3780
  }
3780
3781
 
3782
+ // 1.9.318 회귀 (UR-0025 모듈화): HTML 파싱 유틸 3종 lib/pure-utils 분리 + harness 인라인 제거 + 동작 보존 + 소비명령 로드
3783
+ total++;
3784
+ {
3785
+ let ok = false;
3786
+ try {
3787
+ const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
3788
+ const fnOk = typeof m._htmlToText === 'function' && typeof m._extractTitle === 'function' && typeof m._extractLinks === 'function';
3789
+ const work = m._htmlToText('<p>a <b>b</b></p>') === 'a b'
3790
+ && m._extractTitle('<title>T &amp; U</title>') === 'T & U'
3791
+ && m._extractLinks('<a href="/x">x</a><a href="https://o.com/y">y</a>', 'https://h.com/').length === 1; // same-domain only
3792
+ const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
3793
+ const movedOut = !/function _htmlToText\(html\) \{/.test(harnessSrc) && /_htmlToText, _extractTitle, _extractLinks \} = require\('\.\.\/lib\/pure-utils'\)/.test(harnessSrc);
3794
+ const r = cp.spawnSync(process.execPath, [CLI, 'api-skill'], { encoding: 'utf8', timeout: 15000 }); // 소비 명령 로드
3795
+ const cmdOk = /api-skill/.test(r.stdout || '');
3796
+ ok = fnOk && work && movedOut && cmdOk;
3797
+ } catch {}
3798
+ console.log(ok ? '✓ B(1.9.318) lib/pure-utils HTML 유틸 분리: 모듈 단일출처 + 인라인 제거 + api-skill 로드 (UR-0025)' : '✗ HTML 유틸 분리 실패');
3799
+ if (!ok) failed++;
3800
+ }
3801
+
3781
3802
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
3782
3803
  if (failed > 0) process.exit(1);