leerness 1.9.345 → 1.9.347

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,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.347 — 2026-06-05 — UR-0025(심층): _parseSkillMd 순수 파서 분리
4
+
5
+ **🧩 SKILL.md frontmatter 파서(`_parseSkillMd`, BOM-aware)를 lib/pure-utils.js 로 분리 — 순수함수 추출 3번째. 스킬 설치/임포트의 사용자 입력 파싱(Windows Notepad BOM 호환).** (UR-0025 심층)
6
+
7
+ ### 구현 (UR-0025 심층 — 순수함수)
8
+ 1. **`_parseSkillMd(text)`**(SKILL.md → `{meta, body}`, frontmatter `---...---` 파싱 + BOM strip + 따옴표 제거, 모듈 의존 0) → `lib/pure-utils.js`. harness 2개 사용처(skill discover/install)는 import 바인딩 사용.
9
+ 2. selftest 94→95 · e2e 291→292.
10
+
11
+ ### 검증
12
+ - **selftest 95/95 PASS** · **E2E 292/292 PASS** (회귀 0).
13
+ - 실측: frontmatter name/description(따옴표 제거) · body 분리 · **BOM-aware**(선행 U+FEFF strip) · no-frontmatter→`{meta:{}, body:원문}` · null-safe · **skill install end-to-end**: BOM 포함 SKILL.md → `e2e-skill/SKILL.md` 정상 설치.
14
+
15
+ ## 1.9.346 — 2026-06-05 — UR-0025(심층): _roadmapTokenStyles 순수함수 분리
16
+
17
+ **🧩 roadmap.html `:root` CSS 변수 빌더(`_roadmapTokenStyles`)를 lib/pure-utils.js 로 분리 — 순수함수 추출 2번째. + null-safe 가드 보강.** (UR-0025 심층)
18
+
19
+ ### 구현 (UR-0025 심층 — 순수함수)
20
+ 1. **`_roadmapTokenStyles(designTokens, cssVariables)`**(design token + CSS var → `:root { --lr-* }` CSS 문자열, 모듈 의존 0) → `lib/pure-utils.js`. `_roadmapLayout` 은 ROADMAP_NODE_* 상수를 `_roadmapHTML` 과 공유(entangled)라 harness 유지.
21
+ 2. 추출 시 **null-safe 가드 보강**(`designTokens||{}`, `cssVariables||{}`) — 기존 동작 동일, 견고성 향상.
22
+ 3. selftest 93→94 · e2e 290→291.
23
+
24
+ ### 검증
25
+ - **selftest 94/94 PASS** · **E2E 291/291 PASS** (회귀 0).
26
+ - 실측: `:root` prefix · token→`--lr-primary` · cssVar→`--lr-surface` · custom passthrough(`--lr-custom`) · 기본값(card-bg/edge/page-bg) · null-safe · **roadmap.html end-to-end** `:root`/`--lr-` CSS 주입 정상.
27
+
3
28
  ## 1.9.345 — 2026-06-05 — UR-0025(심층): _esc(HTML escape) 순수함수 분리
4
29
 
5
30
  **🔒 HTML escape 헬퍼(`_esc`)를 lib/pure-utils.js 로 분리 — roadmap.html 출력 인젝션 방지 보안 함수의 단위 테스트화. catalog vein 이후 순수함수 추출 전환 1번째.** (UR-0025 심층)
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.345-green)]() [![tests](https://img.shields.io/badge/e2e-290%2F290-success)]() [![selftest](https://img.shields.io/badge/selftest-93-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.347-green)]() [![tests](https://img.shields.io/badge/e2e-292%2F292-success)]() [![selftest](https://img.shields.io/badge/selftest-95-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.345 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.347 하네스를 사용합니다. 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.345는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.347는 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.345는 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.345)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.347)** · 매 라운드 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.345: 2026-06-05
587
+ Last synced by Leerness v1.9.347: 2026-06-05
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -21,13 +21,13 @@ const { _isSecretKey, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel,
21
21
  _detectOptimism: _puDetectOptimism, _computeConfidence: _puComputeConfidence,
22
22
  _personaSummaries, _translate,
23
23
  _decisionsFromMd, _renderDecisionsMd, _renderLessonsMd,
24
- _withBuiltinSource, _esc } = require('../lib/pure-utils'); // 1.9.318~345 (UR-0025/0053): 순수 유틸 모듈 분리
24
+ _withBuiltinSource, _esc, _roadmapTokenStyles, _parseSkillMd } = require('../lib/pure-utils'); // 1.9.318~347 (UR-0025/0053): 순수 유틸 모듈 분리
25
25
  // 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
26
26
  const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
27
27
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
28
28
  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 분리
29
29
 
30
- const VERSION = '1.9.345';
30
+ const VERSION = '1.9.347';
31
31
 
32
32
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
33
33
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -1468,17 +1468,7 @@ function skillConsolidate(root) {
1468
1468
 
1469
1469
  // SKILL.md frontmatter 파싱 (---name: ... description: ... --- 본문)
1470
1470
  // 1.9.44 BUG-fix: UTF-8 BOM () 제거 후 파싱 (stress-v2 G2에서 발견)
1471
- function _parseSkillMd(text) {
1472
- const cleaned = String(text || '').replace(/^/, '');
1473
- const m = cleaned.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);
1474
- if (!m) return { meta: {}, body: cleaned };
1475
- const meta = {};
1476
- for (const line of m[1].split('\n')) {
1477
- const km = line.match(/^([a-zA-Z_-]+):\s*(.+)$/);
1478
- if (km) meta[km[1].trim()] = km[2].trim().replace(/^["']|["']$/g, '');
1479
- }
1480
- return { meta, body: m[2] };
1481
- }
1471
+ // 1.9.347 (UR-0025 심층): _parseSkillMd 는 lib/pure-utils.js 로 이전 (SKILL.md frontmatter 파서, import).
1482
1472
 
1483
1473
  // HTTPS fetch — Node 18+ globalThis.fetch 사용. 미지원 시 https module.
1484
1474
  async function _httpFetch(urlStr, opts = {}) {
@@ -3054,6 +3044,8 @@ function _selfTestCases() {
3054
3044
  { name: 'UR-0025 심층: SECRET_PATTERNS→lib/catalogs 보안 응집 분리 (1.9.343)', run: () => { const c = require('../lib/catalogs'); const catOk = Array.isArray(c.SECRET_PATTERNS) && c.SECRET_PATTERNS.length === 13 && c.SECRET_PATTERNS.every(p => p.name && p.re instanceof RegExp); const A = 'A'.repeat(40); const hit = (s) => c.SECRET_PATTERNS.some(p => { p.re.lastIndex = 0; return p.re.test(s); }); const det = hit('AKIA' + 'ABCD1234EFGH5678') && hit('sk-' + 'ant-api03-' + A + '_' + A) && !hit('const u = "john' + '_doe_2024";'); const moved = SECRET_PATTERNS === c.SECRET_PATTERNS; return catOk && det && moved; } },
3055
3045
  { name: 'UR-0025 심층: SKILL_CATALOG_PRESETS→lib/catalogs 분리 (1.9.344)', run: () => { const c = require('../lib/catalogs'); const catOk = c.SKILL_CATALOG_PRESETS && Object.keys(c.SKILL_CATALOG_PRESETS).length === 2 && c.SKILL_CATALOG_PRESETS.vercel && c.SKILL_CATALOG_PRESETS.vercel.owner === 'vercel-labs' && c.SKILL_CATALOG_PRESETS.anthropic && c.SKILL_CATALOG_PRESETS.anthropic.repo === 'skills'; const moved = SKILL_CATALOG_PRESETS === c.SKILL_CATALOG_PRESETS; return catOk && moved; } },
3056
3046
  { name: 'UR-0025 심층: _esc(HTML escape)→pure-utils 분리 + XSS 가드 (1.9.345)', run: () => { const m = require('../lib/pure-utils'); const work = m._esc('&<>"\'') === '&amp;&lt;&gt;&quot;&#39;' && m._esc('<script>x</script>') === '&lt;script&gt;x&lt;/script&gt;' && m._esc(null) === '' && m._esc(undefined) === '' && m._esc(42) === '42'; const moved = _esc === m._esc; return work && moved; } },
3047
+ { name: 'UR-0025 심층: _roadmapTokenStyles→pure-utils 분리 (1.9.346)', run: () => { const m = require('../lib/pure-utils'); const out = m._roadmapTokenStyles({ 'color.primary': '#2563eb' }, { 'color-surface': '#fff', 'custom': '#abc' }); const work = out.startsWith(':root {') && out.includes('--lr-primary: #2563eb') && out.includes('--lr-surface: #fff') && out.includes('--lr-custom: #abc') && out.includes('--lr-card-bg') && m._roadmapTokenStyles(null, null).startsWith(':root {'); const moved = _roadmapTokenStyles === m._roadmapTokenStyles; return work && moved; } },
3048
+ { name: 'UR-0025 심층: _parseSkillMd(SKILL.md frontmatter, BOM-aware)→pure-utils 분리 (1.9.347)', run: () => { const m = require('../lib/pure-utils'); const r = m._parseSkillMd('---\nname: s1\ndescription: "d1"\n---\nbody'); const work = r.meta.name === 's1' && r.meta.description === 'd1' && r.body === 'body' && m._parseSkillMd('---\nname: b\n---\nx').meta.name === 'b' && Object.keys(m._parseSkillMd('plain text').meta).length === 0 && m._parseSkillMd('plain text').body === 'plain text' && m._parseSkillMd(null).body === ''; const moved = _parseSkillMd === m._parseSkillMd; return work && moved; } },
3057
3049
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3058
3050
  ];
3059
3051
  }
@@ -13316,22 +13308,7 @@ function _roadmapLayout(data) {
13316
13308
  return { nodes, edges, width: (maxCol + 1) * (ROADMAP_NODE_W + ROADMAP_COL_GAP) + padding * 2, height: canvasHeight };
13317
13309
  }
13318
13310
 
13319
- function _roadmapTokenStyles(designTokens, cssVariables) {
13320
- const vars = {};
13321
- const map = [
13322
- ['color.primary', 'color-primary', 'lr-primary'], ['color.surface', 'color-surface', 'lr-surface'],
13323
- ['color.text', 'color-text', 'lr-text'], ['color.muted', 'color-muted', 'lr-muted'],
13324
- ['space.1', 'space-1', 'lr-space-1'], ['space.2', 'space-2', 'lr-space-2'],
13325
- ['space.3', 'space-3', 'lr-space-3'], ['space.4', 'space-4', 'lr-space-4'],
13326
- ['radius', 'radius', 'lr-radius']
13327
- ];
13328
- for (const [ds, css, vn] of map) { const v = cssVariables[css] || designTokens[ds]; if (v) vars[vn] = v; }
13329
- for (const [k, v] of Object.entries(cssVariables)) if (!vars[`lr-${k}`]) vars[`lr-${k}`] = v;
13330
- if (!vars['lr-card-bg']) vars['lr-card-bg'] = vars['lr-surface'] || '#ffffff';
13331
- if (!vars['lr-edge']) vars['lr-edge'] = vars['lr-muted'] || '#cbd5e1';
13332
- if (!vars['lr-page-bg']) vars['lr-page-bg'] = '#f8fafc';
13333
- return ':root {\n' + Object.entries(vars).map(([k, v]) => ` --${k}: ${v};`).join('\n') + '\n }';
13334
- }
13311
+ // 1.9.346 (UR-0025 심층): _roadmapTokenStyles 는 lib/pure-utils.js 로 이전 (순수 CSS 변수 빌더, import).
13335
13312
 
13336
13313
  function _roadmapHTML(data) {
13337
13314
  const g = _roadmapLayout(data);
package/lib/pure-utils.js CHANGED
@@ -396,6 +396,38 @@ function _esc(s) {
396
396
  return String(s == null ? '' : s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
397
397
  }
398
398
 
399
+ // 1.9.346 (UR-0025 심층): roadmap.html :root CSS 변수 빌더 — designTokens/cssVariables 주입, 순수(모듈 의존 0).
400
+ function _roadmapTokenStyles(designTokens, cssVariables) {
401
+ const dt = designTokens || {}, cv = cssVariables || {};
402
+ const vars = {};
403
+ const map = [
404
+ ['color.primary', 'color-primary', 'lr-primary'], ['color.surface', 'color-surface', 'lr-surface'],
405
+ ['color.text', 'color-text', 'lr-text'], ['color.muted', 'color-muted', 'lr-muted'],
406
+ ['space.1', 'space-1', 'lr-space-1'], ['space.2', 'space-2', 'lr-space-2'],
407
+ ['space.3', 'space-3', 'lr-space-3'], ['space.4', 'space-4', 'lr-space-4'],
408
+ ['radius', 'radius', 'lr-radius']
409
+ ];
410
+ for (const [ds, css, vn] of map) { const v = cv[css] || dt[ds]; if (v) vars[vn] = v; }
411
+ for (const [k, v] of Object.entries(cv)) if (!vars[`lr-${k}`]) vars[`lr-${k}`] = v;
412
+ if (!vars['lr-card-bg']) vars['lr-card-bg'] = vars['lr-surface'] || '#ffffff';
413
+ if (!vars['lr-edge']) vars['lr-edge'] = vars['lr-muted'] || '#cbd5e1';
414
+ if (!vars['lr-page-bg']) vars['lr-page-bg'] = '#f8fafc';
415
+ return ':root {\n' + Object.entries(vars).map(([k, v]) => ` --${k}: ${v};`).join('\n') + '\n }';
416
+ }
417
+
418
+ // 1.9.347 (UR-0025 심층): SKILL.md frontmatter 파서 — { meta, body }, BOM-aware (Windows Notepad 호환). 순수.
419
+ function _parseSkillMd(text) {
420
+ const cleaned = String(text || '').replace(/^/, ''); // BOM strip (U+FEFF)
421
+ const m = cleaned.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);
422
+ if (!m) return { meta: {}, body: cleaned };
423
+ const meta = {};
424
+ for (const line of m[1].split('\n')) {
425
+ const km = line.match(/^([a-zA-Z_-]+):\s*(.+)$/);
426
+ if (km) meta[km[1].trim()] = km[2].trim().replace(/^["']|["']$/g, '');
427
+ }
428
+ return { meta, body: m[2] };
429
+ }
430
+
399
431
  // 1.9.333 (UR-0025 심층): 순수 플랫폼 제약 매칭 — catalog + 텍스트 → 매칭 플랫폼/제약/제안 (fs 의존 0, catalog 주입).
400
432
  function _matchConstraints(catalog, text) {
401
433
  if (!text || typeof text !== 'string' || !catalog || !catalog.platforms) return { matched: [], suggestions: [] };
@@ -598,6 +630,10 @@ module.exports = {
598
630
  _withBuiltinSource,
599
631
  // 1.9.345 (UR-0025 심층): HTML escape (출력 인젝션 방지)
600
632
  _esc,
633
+ // 1.9.346 (UR-0025 심층): roadmap CSS 변수 빌더
634
+ _roadmapTokenStyles,
635
+ // 1.9.347 (UR-0025 심층): SKILL.md frontmatter 파서 (BOM-aware)
636
+ _parseSkillMd,
601
637
  // 1.9.333 (UR-0025 심층): 순수 플랫폼 제약 매칭
602
638
  _matchConstraints,
603
639
  // 1.9.333 패턴 적용: 순수 도메인 매칭
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.345",
3
+ "version": "1.9.347",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -4514,5 +4514,59 @@ total++;
4514
4514
  if (!ok) failed++;
4515
4515
  }
4516
4516
 
4517
+ // 1.9.346 회귀 (UR-0025 심층): _roadmapTokenStyles→pure-utils + roadmap.html CSS 변수 회귀
4518
+ total++;
4519
+ {
4520
+ let ok = false;
4521
+ try {
4522
+ const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
4523
+ const out = m._roadmapTokenStyles({ 'color.primary': '#2563eb' }, { 'color-surface': '#fff', 'custom': '#abc' });
4524
+ const pureOk = typeof m._roadmapTokenStyles === 'function' && out.startsWith(':root {')
4525
+ && out.includes('--lr-primary: #2563eb') && out.includes('--lr-surface: #fff') && out.includes('--lr-custom: #abc')
4526
+ && out.includes('--lr-card-bg') && out.includes('--lr-page-bg') && m._roadmapTokenStyles(null, null).startsWith(':root {');
4527
+ const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
4528
+ const _puImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/pure-utils'\)/) || [''])[0];
4529
+ const movedOut = !/function _roadmapTokenStyles\(/.test(harnessSrc) && _puImp.includes('_roadmapTokenStyles');
4530
+ // 소비 회귀: roadmap.html 이 :root CSS 변수 주입
4531
+ const rd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-tok-'));
4532
+ cp.spawnSync(process.execPath, [CLI, 'init', rd, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
4533
+ cp.spawnSync(process.execPath, [CLI, 'roadmap', rd], { encoding: 'utf8', timeout: 20000 });
4534
+ const rf = path.join(rd, 'roadmap.html');
4535
+ const html = fs.existsSync(rf) ? fs.readFileSync(rf, 'utf8') : '';
4536
+ const renderOk = html.includes(':root {') && html.includes('--lr-');
4537
+ ok = pureOk && movedOut && renderOk;
4538
+ fs.rmSync(rd, { recursive: true, force: true });
4539
+ } catch {}
4540
+ console.log(ok ? '✓ B(1.9.346) UR-0025 심층: _roadmapTokenStyles 분리 + roadmap.html CSS 변수 회귀 (UR-0025)' : '✗ _roadmapTokenStyles 분리 실패');
4541
+ if (!ok) failed++;
4542
+ }
4543
+
4544
+ // 1.9.347 회귀 (UR-0025 심층): _parseSkillMd(SKILL.md frontmatter, BOM-aware)→pure-utils + skill install(BOM) 회귀
4545
+ total++;
4546
+ {
4547
+ let ok = false;
4548
+ try {
4549
+ const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
4550
+ const r = m._parseSkillMd('---\nname: s1\ndescription: "d1"\n---\nbody');
4551
+ const pureOk = typeof m._parseSkillMd === 'function' && r.meta.name === 's1' && r.meta.description === 'd1' && r.body === 'body'
4552
+ && m._parseSkillMd('---\nname: b\n---\nx').meta.name === 'b'
4553
+ && Object.keys(m._parseSkillMd('plain').meta).length === 0 && m._parseSkillMd(null).body === '';
4554
+ const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
4555
+ const _puImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/pure-utils'\)/) || [''])[0];
4556
+ const movedOut = !/function _parseSkillMd\(/.test(harnessSrc) && _puImp.includes('_parseSkillMd');
4557
+ // 소비 회귀: skill install 이 BOM 포함 SKILL.md 를 정상 설치 (frontmatter name 파싱)
4558
+ const sd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-smd-'));
4559
+ cp.spawnSync(process.execPath, [CLI, 'init', sd, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
4560
+ const smdPath = path.join(sd, 's.md');
4561
+ fs.writeFileSync(smdPath, Buffer.concat([Buffer.from([0xEF, 0xBB, 0xBF]), Buffer.from('---\nname: e2e-skill\ndescription: BOM 처리\n---\n# Body', 'utf8')]));
4562
+ cp.spawnSync(process.execPath, [CLI, 'skill', 'install', smdPath, '--path', sd], { encoding: 'utf8', timeout: 20000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1' } });
4563
+ const installOk = fs.existsSync(path.join(sd, '.harness', 'skills', 'e2e-skill', 'SKILL.md'));
4564
+ ok = pureOk && movedOut && installOk;
4565
+ fs.rmSync(sd, { recursive: true, force: true });
4566
+ } catch {}
4567
+ console.log(ok ? '✓ B(1.9.347) UR-0025 심층: _parseSkillMd 분리 + skill install(BOM) 회귀 (UR-0025)' : '✗ _parseSkillMd 분리 실패');
4568
+ if (!ok) failed++;
4569
+ }
4570
+
4517
4571
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
4518
4572
  if (failed > 0) process.exit(1);