leerness 1.9.380 → 1.9.382

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,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.382 — 2026-06-06 — UR-0025 큰 핸들러 모듈화 토대: lib/io.js 출력·시간 프리미티브 분리
4
+
5
+ **🧩 (사용자 명시 허용) 큰 핸들러 분리의 선결 토대 — 공유 출력/시간 프리미티브 모듈 신설.**
6
+
7
+ ### 배경
8
+ 큰 핸들러를 별도 lib 모듈로 분리하려면, harness 인라인이던 `log/ok/warn/fail`(출력) + `today/now`(시간) 프리미티브를 **공유 모듈**로 빼야 함(다른 모듈이 import 가능해야 함). 이 토대 없이는 핸들러 추출 시 매번 deps 주입 필요. 첫 단계로 자기완결적 프리미티브 6종을 `lib/io.js` 로 분리.
9
+
10
+ ### 구현
11
+ 1. **`lib/io.js`**(신설): `log/ok/warn/fail/today/now` 단일출처. fail 은 stdout + `process.exitCode=1`(UR-0045 정책 유지).
12
+ 2. harness 인라인 정의 제거 → `const { log, ok, warn, fail, today, now } = require('../lib/io')`. **호출부 무변경**(이름 동일, ~1000+ 호출 그대로).
13
+
14
+ ### 검증 (회귀 0)
15
+ - **selftest 127→128 PASS** (io exports 6종 함수 + reference equality + today/now 포맷 + fail→exitCode 1 행위 + 인라인 정의 제거 확인).
16
+ - **E2E 326→327 PASS** (io exports + init `ok()` 출력 유지 + verify 누락 `fail()`→exit 1 유지 — consumer 동작 보존).
17
+ - 실측: init ✓ 6줄, verify 누락 exit 1, handoff(now/today) exit 0.
18
+
19
+ ### 향후: lib/io.js 에 fs 프리미티브(read/write/exists 등) 추가 → 핸들러를 lib 모듈로 점진 분리 가능.
20
+
21
+ ## 1.9.381 — 2026-06-06 — UR-0025: KEYWORD_STOPWORDS 단일출처 (키워드 stopwords 2중 중복 제거)
22
+
23
+ **🧩 handoff 자동회수 / lessons 키워드추출이 각자 보유하던 동일 stopwords Set 을 catalogs 단일출처로 DRY.**
24
+
25
+ ### 배경
26
+ 키워드 추출 stopwords(한국어 24 + 영어 5)가 harness.js 두 곳(handoff 자동회수 8332, lessons 키워드추출 14647)에 **2중 복제**. 한 곳만 바뀌면 두 키워드 추출 동작이 갈라짐.
27
+
28
+ ### 구현
29
+ 1. **`KEYWORD_STOPWORDS`** → lib/catalogs.js (Set, 29개 단일출처).
30
+ 2. harness 2개 인라인 `new Set([...])` → `const stopwords = KEYWORD_STOPWORDS;` (node 스크립트 정규식 결정적 교체, 내용 동일).
31
+
32
+ ### 검증 (회귀 0)
33
+ - **selftest 126→127 PASS** (catalog Set 29개 + '작업'/'task' 포함 + reference equality + 2 사이트 const + 인라인 Set 0).
34
+ - **E2E 325→326 PASS** (catalog Set + 키워드 필터 동작(stopwords 제거 후 고유 키워드만) + handoff consumer 무크래시).
35
+ - 실측: KEYWORD_STOPWORDS 29개, 필터 정상, handoff exit 0.
36
+
3
37
  ## 1.9.380 — 2026-06-06 — UR-0025: REQUIRED_WORKSPACE_FILES 단일출처 (필수목록 3중 중복 제거)
4
38
 
5
39
  **🧩 verify / migrate audit / migrate apply 가 각자 보유하던 동일 9-파일 필수목록을 catalogs 단일출처로 DRY.**
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.380-green)]() [![tests](https://img.shields.io/badge/e2e-325%2F325-success)]() [![selftest](https://img.shields.io/badge/selftest-126-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-85-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.382-green)]() [![tests](https://img.shields.io/badge/e2e-327%2F327-success)]() [![selftest](https://img.shields.io/badge/selftest-128-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-85-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.380 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.382 하네스를 사용합니다. 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.380는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
528
+ Leerness v1.9.382는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
529
529
 
530
530
  ```jsonc
531
531
  // 카테고리별
@@ -546,7 +546,7 @@ Leerness v1.9.380는 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.380)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.382)** · 매 라운드 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.380: 2026-06-06
587
+ Last synced by Leerness v1.9.382: 2026-06-06
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -4,6 +4,7 @@
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
6
  const cp = require('child_process');
7
+ const { log, ok, warn, fail, today, now } = require('../lib/io'); // 1.9.382 (UR-0025): 출력/시간 프리미티브 공유 모듈
7
8
  const os = require('os'); // 1.9.178: _publishToNpm 에서 os.tmpdir() 사용 (전역 import)
8
9
  const readline = require('readline');
9
10
  // 1.9.274 (UR-0025 1단계): 순수 유틸 함수 모듈 분리 (require-based, 비파괴). selftest 7종이 동작 검증.
@@ -26,9 +27,9 @@ const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _merg
26
27
  // 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
27
28
  const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
28
29
  // 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, MINIMAL_SKIP_KEYS, REQUIRED_WORKSPACE_FILES, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344/368/369 (UR-0025): catalog 분리 (MERGE_OVERWRITE_FILES/MINIMAL_SKIP_KEYS 포함)
30
+ 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, REQUIRED_WORKSPACE_FILES, KEYWORD_STOPWORDS, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344/368/369 (UR-0025): catalog 분리 (MERGE_OVERWRITE_FILES/MINIMAL_SKIP_KEYS 포함)
30
31
 
31
- const VERSION = '1.9.380';
32
+ const VERSION = '1.9.382';
32
33
 
33
34
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
34
35
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -149,12 +150,6 @@ const routes = {
149
150
 
150
151
  const STATUSES = ['requested','planned','in-progress','waiting','on-hold','blocked','incomplete','done','dropped'];
151
152
 
152
- function log(s = '') { console.log(s); }
153
- function ok(s) { log('✓ ' + s); }
154
- function warn(s) { log('⚠ ' + s); }
155
- // 1.9.306 (UR-0045, 설치리뷰 3중수렴): fail() 은 오류 신호 → exit code 1 설정 (CI/MCP/에이전트가 실패를 성공으로 오판 방지).
156
- // 비치명 경고는 warn() 사용. process.exit 즉시종료가 아니라 exitCode 설정(후속 출력/정리 보존, main 종료 wrapper 가 강제).
157
- function fail(s) { log('✗ ' + s); process.exitCode = 1; }
158
153
  // 1.9.326 (UR-0025): _sanitizeFences / _shellQuoteArg → lib/pure-utils.js 로 이동 (순수 문자열/셸 유틸, require 사용).
159
154
  // 1.9.297 (UR-0025 5단계): MCP 도구 수 = lib/mcp-tools.js 모듈 length (진짜 단일 출처).
160
155
  // 이전(1.9.288): __filename regex self-count — 도구 정의가 소스에 있어야만 동작(취약, Codex #5). 이제 tools/list 와 동일 배열을 직접 카운트.
@@ -217,8 +212,6 @@ function _withLock(targetPath, fn, opts = {}) {
217
212
  finally { if (held) { _heldLocks.delete(lockPath); try { fs.unlinkSync(lockPath); } catch {} } }
218
213
  }
219
214
  function rel(root, p) { return path.relative(root, p).replace(/\\/g, '/') || '.'; }
220
- function today() { return new Date().toISOString().slice(0, 10); }
221
- function now() { return new Date().toISOString(); }
222
215
  // 1.9.327 (UR-0025): _getLocalTz / _formatLocal → lib/pure-utils.js 로 이동 (순수 TZ/날짜 포맷, require 사용).
223
216
  // 자동 모드 활성 여부 (R-XXXX every-round 룰 존재 시 true)
224
217
  function _isAutoLoopActive(root) {
@@ -3017,6 +3010,8 @@ function _selfTestCases() {
3017
3010
  { name: 'UR-0073: team MCP 도구 2종(read-only) 정의 + dispatch 와이어 (1.9.378)', run: () => { const tools = require('../lib/mcp-tools'); const src = read(__filename); const tl = tools.find(t => t.name === 'leerness_team_list'); const tp = tools.find(t => t.name === 'leerness_team_preview'); const defsOk = tl && tl.requiredTier === 'read-only' && tp && tp.requiredTier === 'read-only' && tp.inputSchema.required && tp.inputSchema.required.includes('id'); const wired = src.includes("case " + "'leerness_team_list':") && src.includes("case " + "'leerness_team_preview':") && /cliArgs = \['team', 'list'/.test(src) && /cliArgs = \['team', 'preview'/.test(src); return !!defsOk && wired; } },
3018
3011
  { name: 'UR-0025 심화: pulse 렌더 코어 분리 — _memorySurface + _renderPulseLine 행위 (1.9.379)', run: () => { const m = require('../lib/pure-utils'); if (typeof _memorySurface !== 'function' || typeof _renderPulseLine !== 'function' || m._memorySurface !== _memorySurface || m._renderPulseLine !== _renderPulseLine) return false; const ms = _memorySurface({ tasks: 1, decisions: 2, rules: 3, milestones: 4, lessons: 5 }) === 'T1/D2/R3/P4/L5' && _memorySurface({}) === 'T0/D0/R0/P0/L0'; const base = _renderPulseLine({ version: '1.0.0', roundCount: 7, mcpTools: 85, memorySurface: 'T0/D1/R0/P2/L0' }); const ln = base.includes('v1.0.0') && base.includes('R7') && base.includes('MCP 85') && base.includes('T0/D1/R0/P2/L0') && !base.includes('🎯') && !base.includes('abnormal'); const full = _renderPulseLine({ version: '1.0.0', roundCount: 7, mcpTools: 85, memorySurface: 'x', nextMilestone: 400, etaDays: 6, abnormalShutdown: 'high' }); const ln2 = full.includes('🎯 R400 (6d)') && full.includes('abnormal:high'); const wired = read(__filename).includes('const line = _renderPulseLine(data)') && read(__filename).includes('data.memorySurface = _memorySurface('); return ms && ln && ln2 && wired; } },
3019
3012
  { name: 'UR-0025: REQUIRED_WORKSPACE_FILES 단일출처 — verify/migrate audit·apply 3중 중복 제거 (1.9.380)', run: () => { const c = require('../lib/catalogs'); if (REQUIRED_WORKSPACE_FILES !== c.REQUIRED_WORKSPACE_FILES) return false; const listOk = Array.isArray(c.REQUIRED_WORKSPACE_FILES) && c.REQUIRED_WORKSPACE_FILES.length === 9 && c.REQUIRED_WORKSPACE_FILES.includes('AGENTS.md') && c.REQUIRED_WORKSPACE_FILES.includes('.harness/plan.md'); const usesConst = (read(__filename).match(/const required = REQUIRED_WORKSPACE_FILES;/g) || []).length >= 3; return listOk && usesConst; } },
3013
+ { name: 'UR-0025: KEYWORD_STOPWORDS 단일출처 — handoff/lessons 키워드 stopwords 2중 중복 제거 (1.9.381)', run: () => { const c = require('../lib/catalogs'); if (KEYWORD_STOPWORDS !== c.KEYWORD_STOPWORDS) return false; const setOk = c.KEYWORD_STOPWORDS instanceof Set && c.KEYWORD_STOPWORDS.has('작업') && c.KEYWORD_STOPWORDS.has('task') && !c.KEYWORD_STOPWORDS.has('고유단어') && c.KEYWORD_STOPWORDS.size >= 25; const usesConst = (read(__filename).match(/const stopwords = KEYWORD_STOPWORDS;/g) || []).length >= 2 && !/const stopwords = new Set\(\[/.test(read(__filename)); return setOk && usesConst; } },
3014
+ { name: 'UR-0025 큰핸들러토대: lib/io.js 프리미티브(log/ok/warn/fail/today/now) 모듈 분리 + 동작 (1.9.382)', run: () => { const io = require('../lib/io'); const exportsOk = ['log', 'ok', 'warn', 'fail', 'today', 'now'].every(k => typeof io[k] === 'function') && io.log === log && io.fail === fail && io.now === now; const todayOk = /^\d{4}-\d{2}-\d{2}$/.test(io.today()) && /^\d{4}-\d{2}-\d{2}T/.test(io.now()); const src = read(__filename); const moved = src.includes("require('../lib/io')") && !/^function fail\(s\) \{ log/m.test(src) && !/^function now\(\) \{ return new Date/m.test(src); let exitOk = false; const saved = process.exitCode; const _w = process.stdout.write; try { process.stdout.write = () => true; process.exitCode = 0; io.fail('probe'); exitOk = process.exitCode === 1; } finally { process.stdout.write = _w; process.exitCode = saved; } return exportsOk && todayOk && moved && exitOk; } },
3020
3015
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3021
3016
  ];
3022
3017
  }
@@ -8329,12 +8324,7 @@ function handoff(root) {
8329
8324
  const lrows = readProgressRows(root);
8330
8325
  const latestRow = lrows.filter(r => r.status === 'in-progress' || r.status === 'planned').pop() || lrows[lrows.length - 1];
8331
8326
  if (latestRow && latestRow.request) {
8332
- const stopwords = new Set([
8333
- '이런','저런','하다','하고','있는','하지','에서',
8334
- '작업','구현','추가','진행','수정','변경','검토','확인',
8335
- '프로젝트','관리','기능','시스템','코드','파일','버전','정리','계획',
8336
- 'next','action','task','todo','work'
8337
- ]);
8327
+ const stopwords = KEYWORD_STOPWORDS; // 1.9.381 (UR-0025): lib/catalogs 단일출처
8338
8328
  const tokens = String(latestRow.request).toLowerCase().match(/[\w가-힣]{4,}/g) || [];
8339
8329
  const keyword = tokens.filter(t => !stopwords.has(t)).sort((a, b) => b.length - a.length)[0];
8340
8330
  if (keyword) {
@@ -14644,12 +14634,7 @@ function lessonsCmd(root) {
14644
14634
  // 4자+ 키워드 중 가장 긴 단어 1개 선택
14645
14635
  const tokens = String(latest.request).toLowerCase().match(/[\w가-힣]{4,}/g) || [];
14646
14636
  // 1.9.55: stopword 확장 — 너무 일반적인 단어 제외 (lessons 매칭에 도움 안 됨)
14647
- const stopwords = new Set([
14648
- '이런', '저런', '하다', '하고', '있는', '하지', '에서',
14649
- '작업', '구현', '추가', '진행', '수정', '변경', '검토', '확인',
14650
- '프로젝트', '관리', '기능', '시스템', '코드', '파일', '버전', '정리', '계획',
14651
- 'next', 'action', 'task', 'todo', 'work'
14652
- ]);
14637
+ const stopwords = KEYWORD_STOPWORDS; // 1.9.381 (UR-0025): lib/catalogs 단일출처
14653
14638
  const candidate = tokens.filter(t => !stopwords.has(t)).sort((a, b) => b.length - a.length)[0];
14654
14639
  if (candidate) query = candidate;
14655
14640
  }
package/lib/catalogs.js CHANGED
@@ -401,6 +401,14 @@ const MERGE_OVERWRITE_FILES = new Set([
401
401
  // 1.9.380 (UR-0025): 워크스페이스 필수 파일 — verify / migrate audit / migrate apply 단일출처 (harness 3중 중복 제거).
402
402
  const REQUIRED_WORKSPACE_FILES = ['.harness/plan.md', '.harness/progress-tracker.md', '.harness/guideline.md', '.harness/protected-files.md', '.harness/design-system.md', '.harness/anti-lazy-work-policy.md', '.harness/session-handoff.md', '.harness/current-state.md', 'AGENTS.md'];
403
403
 
404
+ // 1.9.381 (UR-0025): 키워드 추출 stopwords — handoff 자동회수 / lessons 키워드 추출 단일출처 (harness 2중 중복 제거).
405
+ const KEYWORD_STOPWORDS = new Set([
406
+ '이런', '저런', '하다', '하고', '있는', '하지', '에서',
407
+ '작업', '구현', '추가', '진행', '수정', '변경', '검토', '확인',
408
+ '프로젝트', '관리', '기능', '시스템', '코드', '파일', '버전', '정리', '계획',
409
+ 'next', 'action', 'task', 'todo', 'work'
410
+ ]);
411
+
404
412
  // 1.9.369 (UR-0025): init --minimal 시 제외하는 키 — 코어 워크플로(handoff/verify/audit/session close)가 요구하지 않는 파일만. harness 에서 분리.
405
413
  const MINIMAL_SKIP_KEYS = new Set([
406
414
  '.cursor/rules/leerness.mdc', '.github/copilot-instructions.md',
@@ -422,4 +430,4 @@ const SKILL_CATALOG_PRESETS = {
422
430
  homepage: 'https://github.com/anthropics/skills' }
423
431
  };
424
432
 
425
- 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, REQUIRED_WORKSPACE_FILES, SKILL_CATALOG_PRESETS };
433
+ 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, REQUIRED_WORKSPACE_FILES, KEYWORD_STOPWORDS, SKILL_CATALOG_PRESETS };
package/lib/io.js ADDED
@@ -0,0 +1,16 @@
1
+ // lib/io.js — 콘솔 출력 + 타임스탬프 기반 프리미티브 (단일출처).
2
+ // 1.9.382 (UR-0025, 큰 핸들러 모듈화 토대): bin/harness.js 인라인 log/ok/warn/fail/today/now 를 분리.
3
+ // 목적: 향후 핸들러를 별도 lib 모듈로 분리할 때 공유 가능한 출력 프리미티브 제공(harness 만 갖던 것 → 공용화).
4
+ // 부작용: log/ok/warn 은 stdout, fail 은 stdout + process.exitCode=1. today/now 는 순수(시간 의존).
5
+ 'use strict';
6
+
7
+ function log(s = '') { console.log(s); }
8
+ function ok(s) { log('✓ ' + s); }
9
+ function warn(s) { log('⚠ ' + s); }
10
+ // fail() 은 오류 신호 → exit code 1 설정 (CI/MCP/에이전트가 실패를 성공으로 오판 방지, UR-0045).
11
+ // process.exit 즉시종료가 아니라 exitCode 설정(후속 출력/정리 보존, main 종료 wrapper 가 강제).
12
+ function fail(s) { log('✗ ' + s); process.exitCode = 1; }
13
+ function today() { return new Date().toISOString().slice(0, 10); }
14
+ function now() { return new Date().toISOString(); }
15
+
16
+ module.exports = { log, ok, warn, fail, today, now };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.380",
3
+ "version": "1.9.382",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -5273,5 +5273,48 @@ total++;
5273
5273
  if (!ok) failed++;
5274
5274
  }
5275
5275
 
5276
+ // 1.9.381 회귀 (UR-0025): KEYWORD_STOPWORDS 단일출처 — catalog Set + 키워드 필터 동작 + handoff consumer 무크래시
5277
+ total++;
5278
+ {
5279
+ let ok = false;
5280
+ try {
5281
+ const c = require(path.resolve(__dirname, '..', 'lib', 'catalogs'));
5282
+ const setOk = c.KEYWORD_STOPWORDS instanceof Set && c.KEYWORD_STOPWORDS.has('작업') && c.KEYWORD_STOPWORDS.has('task') && !c.KEYWORD_STOPWORDS.has('고유키워드') && c.KEYWORD_STOPWORDS.size >= 25;
5283
+ // 필터 동작: stopwords 제거 후 고유 키워드만 남음
5284
+ const tokens = ['작업', 'task', '고유키워드', 'work'];
5285
+ const filtered = tokens.filter(t => !c.KEYWORD_STOPWORDS.has(t));
5286
+ const filterOk = filtered.length === 1 && filtered[0] === '고유키워드';
5287
+ // consumer 무크래시
5288
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-sw-'));
5289
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5290
+ const r = cp.spawnSync(process.execPath, [CLI, 'handoff', d], { encoding: 'utf8', timeout: 30000 });
5291
+ const handoffOk = r.status === 0;
5292
+ fs.rmSync(d, { recursive: true, force: true });
5293
+ ok = setOk && filterOk && handoffOk;
5294
+ } catch {}
5295
+ console.log(ok ? '✓ B(1.9.381) UR-0025: KEYWORD_STOPWORDS 단일출처 (catalog Set + 필터 + handoff 무크래시)' : '✗ stopwords 단일출처 실패');
5296
+ if (!ok) failed++;
5297
+ }
5298
+
5299
+ // 1.9.382 회귀 (UR-0025 큰핸들러토대): lib/io.js 프리미티브 분리 — exports + 동작 + init(ok)/verify(fail→exit1) consumer 유지
5300
+ total++;
5301
+ {
5302
+ let ok = false;
5303
+ try {
5304
+ const io = require(path.resolve(__dirname, '..', 'lib', 'io'));
5305
+ const expOk = ['log', 'ok', 'warn', 'fail', 'today', 'now'].every(k => typeof io[k] === 'function') && /^\d{4}-\d{2}-\d{2}$/.test(io.today());
5306
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-io-'));
5307
+ const ir = cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5308
+ const initOk = ir.status === 0 && /✓/.test(ir.stdout || ''); // ok() 출력 유지
5309
+ fs.rmSync(path.join(d, 'AGENTS.md'), { force: true });
5310
+ const vr = cp.spawnSync(process.execPath, [CLI, 'verify', d], { encoding: 'utf8', timeout: 15000 });
5311
+ const failOk = vr.status === 1 && /✗/.test((vr.stdout || '') + (vr.stderr || '')); // fail()→exit1 유지
5312
+ fs.rmSync(d, { recursive: true, force: true });
5313
+ ok = expOk && initOk && failOk;
5314
+ } catch {}
5315
+ console.log(ok ? '✓ B(1.9.382) UR-0025 큰핸들러토대: lib/io.js 프리미티브 분리 (exports + init ok/verify fail→exit1 유지)' : '✗ lib/io 프리미티브 실패');
5316
+ if (!ok) failed++;
5317
+ }
5318
+
5276
5319
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
5277
5320
  if (failed > 0) process.exit(1);