leerness 1.9.368 → 1.9.370

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,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.370 — 2026-06-06 — UR-0025 모듈화: archive/skill-catalog 순수 파서 분리
4
+
5
+ **🧩 순수 파서 2종을 lib/pure-utils 로 분리 — 인라인 ~65줄 제거.**
6
+
7
+ ### 구현
8
+ 1. **`_parseArchiveBlocks(text)`**(pure-utils): memory archive 블록 파서 — `## 제거 DATE (target: "...")` → `{date,target,originalHeader}[]`.
9
+ 2. **`_parseSkillCatalog(body, sourceUrl)`**(pure-utils): skill 카탈로그 파서 — JSON/RSS·Atom/markdown 링크/llms.txt 4형식 → `{name,url,description,format}[]`.
10
+ 3. harness 인라인 정의(~65줄) 제거 → import 대체. consumer(`memory archive list`/`skill discover`) 무변경.
11
+
12
+ ### 검증 (회귀 0)
13
+ - **selftest 115→116 PASS** (행위: archive 블록 파싱 + markdown/json skill 파싱 + 모듈 reference equality).
14
+ - **E2E 315→316 PASS** (행위: lib/pure-utils 직접 호출로 두 파서 출력 검증).
15
+ - 실측: `memory archive list` consumer 무크래시.
16
+
17
+ ## 1.9.369 — 2026-06-06 — UR-0025 모듈화: _parseSkillsValue + MINIMAL_SKIP_KEYS 분리
18
+
19
+ **🧩 install 설정 로직/데이터 모듈화 — --skills 파서 순수화(catalog 주입) + --minimal 제외목록 catalogs 응집.**
20
+
21
+ ### 구현
22
+ 1. **`_parseSkillsValue(v, catalog)`**(pure-utils): `--skills` 값 파싱(all/recommended/csv) + catalog 필터. skillCatalog 를 인자 주입해 harness 모듈 상태와 비결합. harness `parseSkillsValue(v)` = 얇은 래퍼.
23
+ 2. **`MINIMAL_SKIP_KEYS`**(catalogs): `init --minimal` 제외 키목록(에디터통합/가이드/템플릿 등 비핵심). harness import.
24
+
25
+ ### 검증 (회귀 0)
26
+ - **selftest 114→115 PASS** (행위: `_parseSkillsValue('all',cat)`/`'recommended'`/`'office,bar'`→catalog 필터 + 모듈 reference equality + `MINIMAL_SKIP_KEYS` 보유).
27
+ - **E2E 314→315 PASS** (행위: `init --minimal` → architecture.md 제외 + plan.md 유지 · `init --skills recommended` → office 스킬 설치).
28
+ - 실측: 위 시나리오 확인.
29
+
3
30
  ## 1.9.368 — 2026-06-06 — UR-0025 모듈화: README/managed 머지 + MERGE_OVERWRITE_FILES 분리
4
31
 
5
32
  **🧩 마이그레이션 머지 안전 핵심을 모듈화 — README/관리파일 머지 순수 코어 → pure-utils, overwrite 파일목록 → catalogs.**
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.368-green)]() [![tests](https://img.shields.io/badge/e2e-314%2F314-success)]() [![selftest](https://img.shields.io/badge/selftest-114-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.370-green)]() [![tests](https://img.shields.io/badge/e2e-316%2F316-success)]() [![selftest](https://img.shields.io/badge/selftest-116-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.368 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.370 하네스를 사용합니다. 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.368는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.370는 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.368는 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.368)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.370)** · 매 라운드 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.368: 2026-06-06
587
+ Last synced by Leerness v1.9.370: 2026-06-06
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -7,7 +7,7 @@ const cp = require('child_process');
7
7
  const os = require('os'); // 1.9.178: _publishToNpm 에서 os.tmpdir() 사용 (전역 import)
8
8
  const readline = require('readline');
9
9
  // 1.9.274 (UR-0025 1단계): 순수 유틸 함수 모듈 분리 (require-based, 비파괴). selftest 7종이 동작 검증.
10
- const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _mergeEnvLines, _mergeReadmeSection, _managedMerge, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
10
+ const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _mergeEnvLines, _mergeReadmeSection, _managedMerge, _parseSkillsValue, _parseArchiveBlocks, _parseSkillCatalog, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
11
11
  PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
12
12
  _htmlToText, _extractTitle, _extractLinks,
13
13
  _countDatedBlocks, _extractDecisionBlocks, _classifyIntent,
@@ -26,9 +26,9 @@ const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _merg
26
26
  // 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
27
27
  const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
28
28
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
29
- 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, MERGE_OVERWRITE_FILES, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344/368 (UR-0025): SKILL_CATALOG_PRESETS + MERGE_OVERWRITE_FILES 분리
29
+ 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, MERGE_OVERWRITE_FILES, MINIMAL_SKIP_KEYS, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344/368/369 (UR-0025): catalog 분리 (MERGE_OVERWRITE_FILES/MINIMAL_SKIP_KEYS 포함)
30
30
 
31
- const VERSION = '1.9.368';
31
+ const VERSION = '1.9.370';
32
32
 
33
33
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
34
34
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -438,19 +438,7 @@ function skillLock(skills) {
438
438
  return JSON.stringify(data, null, 2) + '\n';
439
439
  }
440
440
 
441
- // 1.9.276 (GPT-5.5 2차 리뷰): init --minimal 제외하는 — 에디터 통합/가이드/템플릿/스킬/특화 체크리스트 등
442
- // "코어 워크플로(handoff/verify/audit/session close)"가 요구하지 않는 파일만 제외 (verify 필수 파일은 유지).
443
- const MINIMAL_SKIP_KEYS = new Set([
444
- '.cursor/rules/leerness.mdc', '.github/copilot-instructions.md',
445
- '.harness/project-brief.md', '.harness/task-type-map.md', '.harness/architecture.md', '.harness/context-map.md',
446
- '.harness/guardrails.md', '.harness/feature-contracts.md', '.harness/feature-graph.md',
447
- '.harness/testing-strategy.md', '.harness/review-checklist.md', '.harness/release-checklist.md',
448
- '.harness/session-close-policy.md', '.harness/language-policy.md', '.harness/test-evidence-policy.md',
449
- '.harness/AX_PLAN_GUIDE.md', '.harness/AX_MIGRATION_GUIDE.md', '.harness/AX_NEW_PROJECT_GUIDE.md', '.harness/AX_SKILL_LIBRARY_GUIDE.md',
450
- '.harness/skill-index.md',
451
- '.harness/templates/end-of-session-report.md', '.harness/templates/decision.md', '.harness/templates/task-row.md',
452
- '.claude/skills/leerness.md'
453
- ]);
441
+ // 1.9.276/1.9.369 (UR-0025): MINIMAL_SKIP_KEYS → lib/catalogs (init --minimal 제외).
454
442
  function coreFiles(root, lang = 'ko', selectedSkills = [], opts = {}) {
455
443
  const project = detectProjectName(root);
456
444
  const skillRows = Object.entries(skillCatalog).map(([k, v]) => `| ${k} | ${v.displayNameKo} | ${v.capabilities.join(', ')} | ${v.lastUpdated} | ${v.verification} |`).join('\n');
@@ -852,13 +840,8 @@ function syncReadme(root) {
852
840
  ok('README.md Leerness section synced');
853
841
  }
854
842
 
855
- function parseSkillsValue(v) {
856
- if (!v || v === true) return [];
857
- if (v === 'all') return Object.keys(skillCatalog);
858
- // 1.9.11: recommended에 project-roadmap-generator 자동 포함
859
- if (v === 'recommended') return ['office','commerce-api','ai-verified-skill-publisher','feature-implementation','project-roadmap-generator'];
860
- return String(v).split(',').map(s => s.trim()).filter(Boolean).filter(s => skillCatalog[s]);
861
- }
843
+ // 1.9.369 (UR-0025): 순수 코어 _parseSkillsValue (lib/pure-utils) + skillCatalog 주입 래퍼.
844
+ function parseSkillsValue(v) { return _parseSkillsValue(v, skillCatalog); }
862
845
 
863
846
  async function resolveInstallOptions(root, opts = {}) {
864
847
  const explicitLang = arg('--language', null);
@@ -1554,54 +1537,7 @@ async function skillInstallCmd(root, source) {
1554
1537
 
1555
1538
  // 1.9.52: 카탈로그 형식 자동 감지 + 파싱 (JSON, llms.txt, RSS, manifest.json, 일반 마크다운)
1556
1539
  // 표준화된 entry 형식: { name, url, description, format }
1557
- function _parseSkillCatalog(body, sourceUrl) {
1558
- const entries = [];
1559
- const trimmed = body.trim();
1560
- // 1) JSON 카탈로그 — manifest.json 형식 (1.9.47에서 publish가 만드는 형식과 호환)
1561
- // { "skills": [{ "id"/"name", "url"/"path", "description" }, ...] }
1562
- if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
1563
- try {
1564
- const j = JSON.parse(trimmed);
1565
- const arr = Array.isArray(j) ? j : (j.skills || j.entries || j.items || []);
1566
- for (const e of arr) {
1567
- if (!e || (!e.name && !e.id)) continue;
1568
- entries.push({
1569
- name: e.name || e.id,
1570
- url: e.url || e.path || (sourceUrl ? sourceUrl.replace(/[^/]+$/, '') + (e.id || e.name) + '/SKILL.md' : ''),
1571
- description: e.description || '',
1572
- format: 'json'
1573
- });
1574
- }
1575
- if (entries.length) return entries;
1576
- } catch {}
1577
- }
1578
- // 2) RSS/Atom — <item><title>X</title><link>...</link><description>...</description></item>
1579
- if (/<rss|<feed|<channel|<item>/i.test(body)) {
1580
- for (const m of body.matchAll(/<(?:item|entry)\b[\s\S]*?<\/(?:item|entry)>/gi)) {
1581
- const item = m[0];
1582
- const title = (item.match(/<title>([^<]+)<\/title>/i) || [])[1];
1583
- const link = (item.match(/<link[^>]*>([^<]+)<\/link>/i) || item.match(/<link\s+href="([^"]+)"/i) || [])[1];
1584
- const desc = (item.match(/<description>([^<]+)<\/description>/i) || item.match(/<summary>([^<]+)<\/summary>/i) || [])[1];
1585
- if (title) entries.push({ name: title.trim(), url: (link || '').trim(), description: (desc || '').trim(), format: 'rss' });
1586
- }
1587
- if (entries.length) return entries;
1588
- }
1589
- // 3) 마크다운 링크 with description — "- [name](url) — description"
1590
- for (const m of body.matchAll(/^\s*[-*]\s*\[([^\]]+)\]\(([^)]+)\)\s*[-—:]\s*(.+)$/gm)) {
1591
- entries.push({ name: m[1], url: m[2], description: m[3].trim(), format: 'markdown' });
1592
- }
1593
- if (entries.length) return entries;
1594
- // 4) 마크다운 링크 without description — "- [name](url)"
1595
- for (const m of body.matchAll(/^\s*[-*]\s*\[([^\]]+)\]\(([^)]+\.md)\)/gm)) {
1596
- entries.push({ name: m[1], url: m[2], description: '', format: 'markdown' });
1597
- }
1598
- if (entries.length) return entries;
1599
- // 5) llms.txt — 단순 URL 라인
1600
- for (const m of body.matchAll(/(https?:\/\/[^\s)]+SKILL\.md)/g)) {
1601
- entries.push({ name: m[1].split('/').slice(-2)[0], url: m[1], description: '', format: 'urls' });
1602
- }
1603
- return entries;
1604
- }
1540
+ // 1.9.370 (UR-0025): _parseSkillCatalog → lib/pure-utils (순수 파서 — JSON/RSS/markdown/urls).
1605
1541
 
1606
1542
  // 1.9.182: 공식 조직 스킬 catalog presets — 사용자 명시 (vercel-labs, anthropics 같은 1st-party 자동 탐색).
1607
1543
  // 각 entry: GitHub repo의 skills/ 디렉토리에 SKILL.md 들이 있는 표준 구조.
@@ -3069,6 +3005,8 @@ function _selfTestCases() {
3069
3005
  { name: 'CV-6/UR-0081: 시크릿 스캐너 FP/FN — _isPlaceholderSecret + _looksSecretLike 행위', run: () => { if (typeof _isPlaceholderSecret !== 'function' || typeof _looksSecretLike !== 'function') return false; const fp = _isPlaceholderSecret('change-me') && _isPlaceholderSecret('your-api-key-here') && _isPlaceholderSecret('<token>') && _isPlaceholderSecret('') && !_isPlaceholderSecret('hunter2realpass'); const fn = _looksSecretLike('secret123') && _looksSecretLike('a'.repeat(24)) && !_looksSecretLike('processEnv') && !_looksSecretLike('reqBodyPassword'); return fp && fn; } },
3070
3006
  { name: 'UR-0025: _mergeLines/_mergeEnvLines 순수 코어 모듈 분리 + 행위 (1.9.367)', run: () => { if (typeof _mergeLines !== 'function' || typeof _mergeEnvLines !== 'function') return false; const m = require('../lib/pure-utils'); const moved = m._mergeLines === _mergeLines && m._mergeEnvLines === _mergeEnvLines; const ml = _mergeLines('a\n', ['a', 'b']) === 'a\nb\n'; const meKeep = _mergeEnvLines('FOO=keep\n', ['FOO=new']) === 'FOO=keep\n'; const meAdd = _mergeEnvLines('FOO=keep\n', ['BAR=add']).includes('BAR=add'); return moved && ml && meKeep && meAdd; } },
3071
3007
  { name: 'UR-0025: _mergeReadmeSection/_managedMerge + MERGE_OVERWRITE_FILES 모듈 분리 + 행위 (1.9.368)', run: () => { const m = require('../lib/pure-utils'); const c = require('../lib/catalogs'); if (typeof _mergeReadmeSection !== 'function' || typeof _managedMerge !== 'function') return false; const moved = m._mergeReadmeSection === _mergeReadmeSection && m._managedMerge === _managedMerge && MERGE_OVERWRITE_FILES === c.MERGE_OVERWRITE_FILES; const rd = _mergeReadmeSection('', 'BLOCK', '<s>', '<e>') === '# Project\n\nBLOCK'; const mm = _managedMerge('a.md', 'NEW', 'OLD', '.h', new Set()).includes('migration-preserved'); const ow = _managedMerge('.harness/manifest.json', 'NEW', 'OLD', '.h', c.MERGE_OVERWRITE_FILES) === 'NEW'; const same = _managedMerge('a.md', 'X', 'X', '.h', new Set()) === 'X'; return moved && rd && mm && ow && same; } },
3008
+ { name: 'UR-0025: _parseSkillsValue(catalog 주입) + MINIMAL_SKIP_KEYS 모듈 분리 + 행위 (1.9.369)', run: () => { const m = require('../lib/pure-utils'); const c = require('../lib/catalogs'); if (typeof _parseSkillsValue !== 'function') return false; const moved = m._parseSkillsValue === _parseSkillsValue && MINIMAL_SKIP_KEYS === c.MINIMAL_SKIP_KEYS; const cat = { office: {}, foo: {} }; const empty = _parseSkillsValue('', cat).length === 0; const all = _parseSkillsValue('all', cat).length === 2; const rec = _parseSkillsValue('recommended', cat).includes('office'); const csv = JSON.stringify(_parseSkillsValue('office,bar', cat)) === JSON.stringify(['office']); return moved && empty && all && rec && csv && MINIMAL_SKIP_KEYS.has('.claude/skills/leerness.md'); } },
3009
+ { name: 'UR-0025: _parseArchiveBlocks/_parseSkillCatalog 순수 파서 모듈 분리 + 행위 (1.9.370)', run: () => { const m = require('../lib/pure-utils'); if (typeof _parseArchiveBlocks !== 'function' || typeof _parseSkillCatalog !== 'function') return false; const moved = m._parseArchiveBlocks === _parseArchiveBlocks && m._parseSkillCatalog === _parseSkillCatalog; const ab = _parseArchiveBlocks('## 제거 2026-01-01 (target: ' + '"T-1")\n### 헤더\n'); const abOk = ab.length === 1 && ab[0].date === '2026-01-01' && ab[0].target === 'T-1' && ab[0].originalHeader === '헤더'; const md = _parseSkillCatalog('- [nm](https://x/SKILL.md) — d', ''); const mdOk = md.length === 1 && md[0].name === 'nm' && md[0].format === 'markdown'; const js = _parseSkillCatalog('{' + '"skills":[{"id":"a","url":"u"}]}', ''); const jsOk = js.length === 1 && js[0].name === 'a' && js[0].format === 'json'; return moved && abOk && mdOk && jsOk; } },
3072
3010
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3073
3011
  ];
3074
3012
  }
@@ -6328,24 +6266,7 @@ function memoryStatusCmd(root, opts = {}) {
6328
6266
  // 1.9.127: memory archive list — DELETE 5종 archive 파일 통합 조회
6329
6267
  // .harness/decisions.archive.md / lessons.archive.md / plan.archive.md 의 "## 제거 YYYY-MM-DD" 블록 파싱
6330
6268
  // --surface decisions|lessons|plan 필터, --json 옵션
6331
- function _parseArchiveBlocks(text) {
6332
- // archive 형식: "## 제거 YYYY-MM-DD (target: \"...\")\n<원래 블록>"
6333
- // 첫 번째 "## 제거" 이전의 헤더(# Plan archive 등)는 skip
6334
- const entries = [];
6335
- if (!text) return entries;
6336
- const blocks = text.split(/\n(?=## 제거 )/);
6337
- for (const b of blocks) {
6338
- const m = b.match(/^## 제거 (\d{4}-\d{2}-\d{2})\s*\(target:\s*"([^"]*)"\)/);
6339
- if (!m) continue;
6340
- const date = m[1];
6341
- const target = m[2];
6342
- // 원래 헤더 추출 (### …)
6343
- const headerMatch = b.match(/^### (.+)$/m);
6344
- const originalHeader = headerMatch ? headerMatch[1].trim() : null;
6345
- entries.push({ date, target, originalHeader });
6346
- }
6347
- return entries;
6348
- }
6269
+ // 1.9.370 (UR-0025): _parseArchiveBlocks → lib/pure-utils (순수 파서).
6349
6270
  function memoryArchiveListCmd(root, opts = {}) {
6350
6271
  root = absRoot(root);
6351
6272
  const jsonMode = !!opts.json || has('--json');
package/lib/catalogs.js CHANGED
@@ -398,6 +398,19 @@ const MERGE_OVERWRITE_FILES = new Set([
398
398
  '.harness/context-routing.md'
399
399
  ]);
400
400
 
401
+ // 1.9.369 (UR-0025): init --minimal 시 제외하는 키 — 코어 워크플로(handoff/verify/audit/session close)가 요구하지 않는 파일만. harness 에서 분리.
402
+ const MINIMAL_SKIP_KEYS = new Set([
403
+ '.cursor/rules/leerness.mdc', '.github/copilot-instructions.md',
404
+ '.harness/project-brief.md', '.harness/task-type-map.md', '.harness/architecture.md', '.harness/context-map.md',
405
+ '.harness/guardrails.md', '.harness/feature-contracts.md', '.harness/feature-graph.md',
406
+ '.harness/testing-strategy.md', '.harness/review-checklist.md', '.harness/release-checklist.md',
407
+ '.harness/session-close-policy.md', '.harness/language-policy.md', '.harness/test-evidence-policy.md',
408
+ '.harness/AX_PLAN_GUIDE.md', '.harness/AX_MIGRATION_GUIDE.md', '.harness/AX_NEW_PROJECT_GUIDE.md', '.harness/AX_SKILL_LIBRARY_GUIDE.md',
409
+ '.harness/skill-index.md',
410
+ '.harness/templates/end-of-session-report.md', '.harness/templates/decision.md', '.harness/templates/task-row.md',
411
+ '.claude/skills/leerness.md'
412
+ ]);
413
+
401
414
  // 1.9.344 (UR-0025 심층): skill discover GitHub preset catalog (vercel/anthropic) — harness 에서 분리.
402
415
  const SKILL_CATALOG_PRESETS = {
403
416
  'vercel': { owner: 'vercel-labs', repo: 'agent-skills', branch: 'main', path: 'skills',
@@ -406,4 +419,4 @@ const SKILL_CATALOG_PRESETS = {
406
419
  homepage: 'https://github.com/anthropics/skills' }
407
420
  };
408
421
 
409
- module.exports = { 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, MERGE_OVERWRITE_FILES, SKILL_CATALOG_PRESETS };
422
+ module.exports = { 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, MERGE_OVERWRITE_FILES, MINIMAL_SKIP_KEYS, SKILL_CATALOG_PRESETS };
package/lib/pure-utils.js CHANGED
@@ -673,10 +673,71 @@ function _managedMerge(file, next, previous, archiveRel, overwriteSet) {
673
673
  return next.trimEnd() + `\n\n---\n${tag}\n## Preserved previous content\n\nPrevious content was backed up before migration. Archive reference:\n\n\`${ar}\`\n\n<details>\n<summary>Previous ${file}</summary>\n\n\`\`\`md\n${previous.replace(/```/g, '\\`\\`\\`')}\n\`\`\`\n\n</details>\n`;
674
674
  }
675
675
 
676
+ // 1.9.369 (UR-0025): --skills 값 파싱 순수 코어 — catalog 주입(harness skillCatalog 비결합). all/recommended/csv 처리 + catalog 필터.
677
+ function _parseSkillsValue(v, catalog) {
678
+ if (!v || v === true) return [];
679
+ if (v === 'all') return Object.keys(catalog || {});
680
+ if (v === 'recommended') return ['office', 'commerce-api', 'ai-verified-skill-publisher', 'feature-implementation', 'project-roadmap-generator'];
681
+ return String(v).split(',').map(s => s.trim()).filter(Boolean).filter(s => (catalog || {})[s]);
682
+ }
683
+
684
+ // 1.9.370 (UR-0025): memory archive 블록 파서 순수 코어 — "## 제거 DATE (target: \"...\")" 블록 → {date,target,originalHeader}[].
685
+ function _parseArchiveBlocks(text) {
686
+ const entries = [];
687
+ if (!text) return entries;
688
+ const blocks = text.split(/\n(?=## 제거 )/);
689
+ for (const b of blocks) {
690
+ const m = b.match(/^## 제거 (\d{4}-\d{2}-\d{2})\s*\(target:\s*"([^"]*)"\)/);
691
+ if (!m) continue;
692
+ const headerMatch = b.match(/^### (.+)$/m);
693
+ entries.push({ date: m[1], target: m[2], originalHeader: headerMatch ? headerMatch[1].trim() : null });
694
+ }
695
+ return entries;
696
+ }
697
+ // 1.9.370 (UR-0025): skill 카탈로그 파서 순수 코어 — JSON/RSS·Atom/markdown 링크/llms.txt 형식 → {name,url,description,format}[].
698
+ function _parseSkillCatalog(body, sourceUrl) {
699
+ const entries = [];
700
+ const trimmed = String(body || '').trim();
701
+ if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
702
+ try {
703
+ const j = JSON.parse(trimmed);
704
+ const arr = Array.isArray(j) ? j : (j.skills || j.entries || j.items || []);
705
+ for (const e of arr) {
706
+ if (!e || (!e.name && !e.id)) continue;
707
+ entries.push({ name: e.name || e.id, url: e.url || e.path || (sourceUrl ? sourceUrl.replace(/[^/]+$/, '') + (e.id || e.name) + '/SKILL.md' : ''), description: e.description || '', format: 'json' });
708
+ }
709
+ if (entries.length) return entries;
710
+ } catch {}
711
+ }
712
+ if (/<rss|<feed|<channel|<item>/i.test(body)) {
713
+ for (const m of String(body).matchAll(/<(?:item|entry)\b[\s\S]*?<\/(?:item|entry)>/gi)) {
714
+ const item = m[0];
715
+ const title = (item.match(/<title>([^<]+)<\/title>/i) || [])[1];
716
+ const link = (item.match(/<link[^>]*>([^<]+)<\/link>/i) || item.match(/<link\s+href="([^"]+)"/i) || [])[1];
717
+ const desc = (item.match(/<description>([^<]+)<\/description>/i) || item.match(/<summary>([^<]+)<\/summary>/i) || [])[1];
718
+ if (title) entries.push({ name: title.trim(), url: (link || '').trim(), description: (desc || '').trim(), format: 'rss' });
719
+ }
720
+ if (entries.length) return entries;
721
+ }
722
+ for (const m of String(body).matchAll(/^\s*[-*]\s*\[([^\]]+)\]\(([^)]+)\)\s*[-—:]\s*(.+)$/gm)) {
723
+ entries.push({ name: m[1], url: m[2], description: m[3].trim(), format: 'markdown' });
724
+ }
725
+ if (entries.length) return entries;
726
+ for (const m of String(body).matchAll(/^\s*[-*]\s*\[([^\]]+)\]\(([^)]+\.md)\)/gm)) {
727
+ entries.push({ name: m[1], url: m[2], description: '', format: 'markdown' });
728
+ }
729
+ if (entries.length) return entries;
730
+ for (const m of String(body).matchAll(/(https?:\/\/[^\s)]+SKILL\.md)/g)) {
731
+ entries.push({ name: m[1].split('/').slice(-2)[0], url: m[1], description: '', format: 'urls' });
732
+ }
733
+ return entries;
734
+ }
735
+
676
736
  module.exports = {
677
737
  _isSecretKey, compareVer, parseHarnessVersion,
678
738
  _isPlaceholderSecret, _looksSecretLike,
679
- _mergeLines, _mergeEnvLines, _mergeReadmeSection, _managedMerge,
739
+ _mergeLines, _mergeEnvLines, _mergeReadmeSection, _managedMerge, _parseSkillsValue,
740
+ _parseArchiveBlocks, _parseSkillCatalog,
680
741
  _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
681
742
  // 1.9.283 (UR-0025 2단계)
682
743
  PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.368",
3
+ "version": "1.9.370",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -1172,15 +1172,12 @@ total++;
1172
1172
 
1173
1173
  total++;
1174
1174
  {
1175
- // _parseSkillCatalog 4 형식 인식 — node -e로 동적 평가
1176
- const src = fs.readFileSync(CLI, 'utf8');
1177
- // 1.9.141 fix: Windows CRLF 대응 — \r?\n 으로 양쪽 line ending 모두 매칭
1178
- const m = src.match(/function _parseSkillCatalog\([\s\S]*?\r?\n\}\r?\n/);
1179
- if (!m) {
1180
- console.log('✗ _parseSkillCatalog 함수 위치 못 찾음');
1175
+ // _parseSkillCatalog 4 형식 인식 — 1.9.370 (UR-0025): lib/pure-utils 직접 require (이전: harness 소스 regex+eval, 모듈 이동으로 전환)
1176
+ const fn = require(path.resolve(__dirname, '..', 'lib', 'pure-utils'))._parseSkillCatalog;
1177
+ if (typeof fn !== 'function') {
1178
+ console.log('✗ _parseSkillCatalog 함수 위치 못 찾음 (lib/pure-utils)');
1181
1179
  failed++;
1182
1180
  } else {
1183
- const fn = eval('(' + m[0].replace('function _parseSkillCatalog', 'function') + ')');
1184
1181
  const jsonR = fn(JSON.stringify({ skills: [{ name: 'a', description: 'A' }] }), null);
1185
1182
  const rssR = fn('<rss><channel><item><title>X</title><link>http://x.com/s.md</link></item></channel></rss>', null);
1186
1183
  const mdR = fn('- [office](o.md) — Office\n- [crawling](c.md) — Web', null);
@@ -5053,5 +5050,41 @@ total++;
5053
5050
  if (!ok) failed++;
5054
5051
  }
5055
5052
 
5053
+ // 1.9.369 회귀 (UR-0025): MINIMAL_SKIP_KEYS/_parseSkillsValue 분리 — init --minimal 비핵심 스킵+코어 유지, --skills recommended 설치
5054
+ total++;
5055
+ {
5056
+ let ok = false;
5057
+ try {
5058
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-min-'));
5059
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko', '--minimal'], { encoding: 'utf8', timeout: 30000 });
5060
+ const skipAbsent = !fs.existsSync(path.join(d, '.harness', 'architecture.md')); // MINIMAL_SKIP_KEYS
5061
+ const corePresent = fs.existsSync(path.join(d, '.harness', 'plan.md')); // core 유지
5062
+ fs.rmSync(d, { recursive: true, force: true });
5063
+ const d2 = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-rec-'));
5064
+ cp.spawnSync(process.execPath, [CLI, 'init', d2, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
5065
+ const recInstalled = fs.existsSync(path.join(d2, '.harness', 'skills', 'office')); // recommended → office 포함
5066
+ fs.rmSync(d2, { recursive: true, force: true });
5067
+ ok = skipAbsent && corePresent && recInstalled;
5068
+ } catch {}
5069
+ console.log(ok ? '✓ B(1.9.369) UR-0025: MINIMAL_SKIP_KEYS/_parseSkillsValue 분리 (--minimal 스킵+코어유지, --skills recommended)' : '✗ minimal/skills 분리 실패');
5070
+ if (!ok) failed++;
5071
+ }
5072
+
5073
+ // 1.9.370 회귀 (UR-0025): _parseArchiveBlocks/_parseSkillCatalog 순수 파서 모듈 분리 — lib/pure-utils 직접 호출 행위
5074
+ total++;
5075
+ {
5076
+ let ok = false;
5077
+ try {
5078
+ const pu = require(path.resolve(__dirname, '..', 'lib', 'pure-utils'));
5079
+ const ab = pu._parseArchiveBlocks('## 제거 2026-01-01 (target: "T-9")\n### 옛제목\n');
5080
+ const md = pu._parseSkillCatalog('- [nm](https://x/SKILL.md) — d', '');
5081
+ const js = pu._parseSkillCatalog('{"skills":[{"id":"a","url":"u"}]}', '');
5082
+ ok = Array.isArray(ab) && ab.length === 1 && ab[0].target === 'T-9' && ab[0].originalHeader === '옛제목'
5083
+ && md.length === 1 && md[0].format === 'markdown' && js.length === 1 && js[0].format === 'json';
5084
+ } catch {}
5085
+ console.log(ok ? '✓ B(1.9.370) UR-0025: _parseArchiveBlocks/_parseSkillCatalog 순수 파서 모듈 분리 (행위)' : '✗ 파서 모듈 분리 실패');
5086
+ if (!ok) failed++;
5087
+ }
5088
+
5056
5089
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
5057
5090
  if (failed > 0) process.exit(1);