leerness 1.9.383 → 1.9.384

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,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.384 — 2026-06-06 — 5번째 외부평가: status/verify --json 구조화 출력 일관성 (UR-0085)
4
+
5
+ **🔌 `status --json` / `verify --json` 이 사람용 텍스트 → 구조화 JSON — AI 에이전트 자동화용 출력 일관성 확보.**
6
+
7
+ ### 배경 (5번째 외부평가, GPT-5.5 web, 1.9.382 · "참고하되 맹신 X")
8
+ 외부 평가가 #1 AI-에이전트 리스크로 지목: audit/health/task list 는 `--json` 시 JSON 인데 `status --json` 은 "Leerness: 1.9.x / Files: 56/56", `verify --json` 은 "✓ verify passed" 처럼 **사람용 텍스트**를 그대로 냄. 자체 재현으로 확인 후 수정.
9
+
10
+ ### 구현
11
+ 1. **status --json**: `{ version, language, minimal, total, present, missing[], healthy }` 구조화 출력(없으면 기존 사람용 유지).
12
+ 2. **verify --json**: 실패를 `failures[]` 로 먼저 수집 → `{ ok, failures[], healthy }` 출력. **exit code 1 보존**(JSON·사람용 양쪽 모두 실패 시 exit 1).
13
+ 3. 사람용 출력/동작 무변경(--json 없을 때 기존 `✗ ...` 메시지 + exit code 그대로).
14
+
15
+ ### 검증 (회귀 0)
16
+ - **selftest 129→130 PASS** (status --json behavioral 파싱(total/present/healthy/missing) + verify --json 와이어 확인).
17
+ - **E2E 328→329 PASS** (status --json 구조 + verify --json pass(exit0)/fail(exit1) + 사람용 verify fail(exit1, JSON 아님) 보존).
18
+ - 실측: pass `{ok:true,failures:0}` exit0 / AGENTS.md 삭제 `{ok:false,failures:3}` exit1 / 사람용 `✗ ...` exit1.
19
+
20
+ ### 5번째 외부평가 후속 (UR-0086 contract spec markdown-bullet 파서, UR-0087 secret .env.bad 정책)은 검증 후 별도 라운드.
21
+
3
22
  ## 1.9.383 — 2026-06-06 — UR-0025 큰 핸들러 모듈화 토대②: lib/io.js fs 프리미티브 분리
4
23
 
5
24
  **🧩 lib/io.js 에 파일 I/O 프리미티브 추가 — 핸들러를 별도 lib 모듈로 분리할 토대 완비(io 14종).**
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.383-green)]() [![tests](https://img.shields.io/badge/e2e-328%2F328-success)]() [![selftest](https://img.shields.io/badge/selftest-129-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.384-green)]() [![tests](https://img.shields.io/badge/e2e-329%2F329-success)]() [![selftest](https://img.shields.io/badge/selftest-130-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.383 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.384 하네스를 사용합니다. 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.383는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
528
+ Leerness v1.9.384는 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.383는 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.383)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.384)** · 매 라운드 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.383: 2026-06-06
587
+ Last synced by Leerness v1.9.384: 2026-06-06
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -29,7 +29,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
29
29
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
30
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 포함)
31
31
 
32
- const VERSION = '1.9.383';
32
+ const VERSION = '1.9.384';
33
33
 
34
34
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
35
35
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -2986,6 +2986,7 @@ function _selfTestCases() {
2986
2986
  { 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; } },
2987
2987
  { 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; } },
2988
2988
  { name: 'UR-0025 큰핸들러토대: lib/io.js fs 프리미티브(read/writeUtf8/exists/mkdirp/append/rel/absRoot) 분리 + round-trip (1.9.383)', run: () => { const io = require('../lib/io'); const exp = ['absRoot', 'exists', 'read', 'readBuf', 'mkdirp', 'writeUtf8', 'append', 'rel'].every(k => typeof io[k] === 'function') && io.read === read && io.writeUtf8 === writeUtf8 && io.exists === exists; const src = read(__filename); const moved = !/^function writeUtf8\(p, s\) \{/m.test(src) && !/^function read\(p\) \{/m.test(src) && !/^function exists\(p\) \{/m.test(src); const tmp = fs.mkdtempSync(path.join(os.tmpdir(), '__leerness_io_')); let rt = false; try { const f = path.join(tmp, 'a', 'b.txt'); io.writeUtf8(f, '한글RT'); rt = io.exists(f) && io.read(f) === '한글RT' && io.rel(tmp, f) === 'a/b.txt'; } finally { try { fs.rmSync(tmp, { recursive: true, force: true }); } catch {} } return exp && moved && rt; } },
2989
+ { name: '5th외부평가/UR-0085: status --json 구조화 출력 + verify --json 와이어 (1.9.384)', run: () => { if (typeof status !== 'function' || typeof verify !== 'function') return false; const tmp = fs.mkdtempSync(path.join(os.tmpdir(), '__leerness_sj_')); const save = process.argv; const _w = process.stdout.write; let so = ''; try { fs.mkdirSync(path.join(tmp, '.harness'), { recursive: true }); process.argv = ['node', 'h', 'status', tmp, '--json']; process.stdout.write = s => { so += s; return true; }; status(tmp); } catch {} finally { process.stdout.write = _w; process.argv = save; try { fs.rmSync(tmp, { recursive: true, force: true }); } catch {} } let sj; try { sj = JSON.parse(so); } catch {} const statusOk = !!sj && typeof sj.total === 'number' && typeof sj.present === 'number' && 'healthy' in sj && Array.isArray(sj.missing); const src = read(__filename); const verifyWired = /function verify\(root\) \{[\s\S]*?has\('--json'\)[\s\S]*?JSON\.stringify\(\{ ok:/.test(src); return statusOk && verifyWired; } },
2989
2990
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
2990
2991
  ];
2991
2992
  }
@@ -6745,6 +6746,8 @@ function status(root) {
6745
6746
  try { const mf = path.join(root, '.harness/manifest.json'); if (exists(mf)) isMinimal = !!JSON.parse(read(mf)).minimal; } catch {}
6746
6747
  const files = Object.keys(coreFiles(root, lang, [], { minimal: isMinimal }));
6747
6748
  const missing = files.filter(f => !exists(path.join(root,f)));
6749
+ // 1.9.384 (5번째 외부평가/UR-0085): --json 일관성 — AI 에이전트용 구조화 출력.
6750
+ if (has('--json')) { log(JSON.stringify({ version: ver, language: lang, minimal: isMinimal, total: files.length, present: files.length - missing.length, missing, healthy: missing.length === 0 }, null, 2)); return; }
6748
6751
  log(`Leerness: ${ver}${isMinimal ? ' (minimal)' : ''}`);
6749
6752
  log(`Files: ${files.length - missing.length}/${files.length}`);
6750
6753
  if (missing.length) missing.forEach(x => warn('missing: ' + x));
@@ -6752,15 +6755,17 @@ function status(root) {
6752
6755
  }
6753
6756
  function verify(root) {
6754
6757
  root = absRoot(root);
6755
- let bad = 0;
6758
+ // 1.9.384 (5번째 외부평가/UR-0085): 실패를 먼저 수집 → --json 구조화 출력 + 사람용 분기 (exit code 일관 유지).
6759
+ const failures = [];
6756
6760
  const required = REQUIRED_WORKSPACE_FILES; // 1.9.380 (UR-0025): lib/catalogs 단일출처
6757
- for (const f of required) { if (!exists(path.join(root,f))) { bad++; fail(`missing: ${f}`); } }
6761
+ for (const f of required) { if (!exists(path.join(root,f))) failures.push(`missing: ${f}`); }
6758
6762
  const g = exists(path.join(root,'.harness/guideline.md')) ? read(path.join(root,'.harness/guideline.md')) : '';
6759
- if (!g.includes('plan.md') || !g.includes('progress-tracker.md')) { bad++; fail('guideline.md must reference plan.md and progress-tracker.md'); }
6763
+ if (!g.includes('plan.md') || !g.includes('progress-tracker.md')) failures.push('guideline.md must reference plan.md and progress-tracker.md');
6760
6764
  const a = exists(path.join(root,'AGENTS.md')) ? read(path.join(root,'AGENTS.md')) : '';
6761
- if (!a.includes('protected-files.md')) { bad++; fail('AGENTS.md must reference protected-files.md'); }
6762
- if (!a.includes('anti-lazy-work-policy.md')) { bad++; fail('AGENTS.md must reference anti-lazy-work-policy.md'); }
6763
- if (bad) process.exitCode = 1; else ok('verify passed');
6765
+ if (!a.includes('protected-files.md')) failures.push('AGENTS.md must reference protected-files.md');
6766
+ if (!a.includes('anti-lazy-work-policy.md')) failures.push('AGENTS.md must reference anti-lazy-work-policy.md');
6767
+ if (has('--json')) { log(JSON.stringify({ ok: failures.length === 0, failures, healthy: failures.length === 0 }, null, 2)); if (failures.length) process.exitCode = 1; return; }
6768
+ if (failures.length) { failures.forEach(f => fail(f)); process.exitCode = 1; } else ok('verify passed');
6764
6769
  }
6765
6770
  // 1.9.356 (UR-0075 Phase B): migrate audit — 비파괴 dry-run 스키마 drift 리포트(버전/ canonical JSON 백필/누락 파일). 실제 변경 X.
6766
6771
  function migrateAuditCmd(root, opts = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.383",
3
+ "version": "1.9.384",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -5340,5 +5340,31 @@ total++;
5340
5340
  if (!ok) failed++;
5341
5341
  }
5342
5342
 
5343
+ // 1.9.384 회귀 (5번째 외부평가/UR-0085): status/verify --json 구조화 출력 일관성 — pass JSON + fail JSON(exit1) + 사람용 exit1 유지
5344
+ total++;
5345
+ {
5346
+ let ok = false;
5347
+ try {
5348
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-svjson-'));
5349
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5350
+ const sr = cp.spawnSync(process.execPath, [CLI, 'status', d, '--json'], { encoding: 'utf8', timeout: 15000 });
5351
+ const sj = JSON.parse(sr.stdout);
5352
+ const statusOk = typeof sj.total === 'number' && sj.present === sj.total && sj.healthy === true && Array.isArray(sj.missing) && sj.missing.length === 0;
5353
+ const vr = cp.spawnSync(process.execPath, [CLI, 'verify', d, '--json'], { encoding: 'utf8', timeout: 15000 });
5354
+ const vj = JSON.parse(vr.stdout);
5355
+ const verifyPassOk = vj.ok === true && Array.isArray(vj.failures) && vj.failures.length === 0 && vr.status === 0;
5356
+ fs.rmSync(path.join(d, 'AGENTS.md'), { force: true });
5357
+ const vr2 = cp.spawnSync(process.execPath, [CLI, 'verify', d, '--json'], { encoding: 'utf8', timeout: 15000 });
5358
+ const vj2 = JSON.parse(vr2.stdout);
5359
+ const verifyFailOk = vj2.ok === false && vj2.failures.length >= 1 && vr2.status === 1; // --json 실패도 exit1
5360
+ const vr3 = cp.spawnSync(process.execPath, [CLI, 'verify', d], { encoding: 'utf8', timeout: 15000 }); // 사람용 분기 보존
5361
+ const humanFailOk = vr3.status === 1 && /✗/.test((vr3.stdout || '') + (vr3.stderr || '')) && !/^\s*\{/.test(vr3.stdout || '');
5362
+ fs.rmSync(d, { recursive: true, force: true });
5363
+ ok = statusOk && verifyPassOk && verifyFailOk && humanFailOk;
5364
+ } catch {}
5365
+ console.log(ok ? '✓ B(1.9.384) 5th외부평가: status/verify --json 구조화 일관성 (pass/fail JSON+exit1, 사람용 보존, UR-0085)' : '✗ status/verify --json 일관성 실패');
5366
+ if (!ok) failed++;
5367
+ }
5368
+
5343
5369
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
5344
5370
  if (failed > 0) process.exit(1);