leerness 1.9.398 → 1.9.399

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,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.399 — 2026-06-07 — 테이블셀 injection 차단: task/rule 파이프·개행 (7번째 버그헌트 P1-A, UR-0104)
4
+
5
+ **🛡 데이터 무결성 — task/rule 텍스트의 파이프(|)·개행(\\n)이 progress-tracker/rules.md 표를 손상·가짜행 주입·멱등성 무력화하던 것을 차단(셀 이스케이프).**
6
+
7
+ ### 배경 (7번째 — 내부 멀티에이전트 버그헌트, 외부리뷰 초월)
8
+ 38 에이전트 포괄 버그헌트(31후보→confirmed 30/refuted 1)가 외부 리뷰(codex/Opus)가 못 본 **테이블셀 injection 클래스**를 발견. 직접 재현 검증:
9
+ - `task add 'fix login | bypass'` → progress-tracker 행 컬럼 시프트, update 시 영구 절단(JSON 백업 없음).
10
+ - `task add '...\\n| T-9999 | done | ...'` → 가짜 done 행 주입 + 실제 task 무성 소실.
11
+ - `rule add 'a | b'` → rules.md 컬럼 밀림 + dedup(1.9.212) 무력화로 중복 룰 무한 생성.
12
+
13
+ ### 구현
14
+ - **`_cellSafe`/`_cellUnescape`** 순수 헬퍼(lib/pure-utils.js): 쓰기 시 개행→공백 + `|`→`\\|`, 읽기 시 비이스케이프 파이프(`/(?<!\\)\\|/`)에서만 분리 후 `\\|`→`|` 복원.
15
+ - 적용: `writeProgressRows`/`readProgressRows`(task) + `writeRules`/`readRules`(rule). 사용자 텍스트의 파이프는 **보존**(복원), 개행은 공백화(행 주입 차단).
16
+
17
+ ### 검증 (회귀 0)
18
+ - **selftest 144→145 PASS** (cellSafe/Unescape reference-equality + 파이프 round-trip + 개행 제거 + 와이어).
19
+ - **E2E 337→338 PASS** (task 파이프 보존/개행 가짜행 차단 + rule 파이프 보존/멱등 회복/status 비오염).
20
+ - 실측: `task add 'fix login | bypass'` 원본 보존, 개행 주입 T-9999 차단, rule 중복 add → skip(멱등).
21
+
22
+ ### 다음(같은 클러스터): decisions/lessons MD projection 셀 안전화(UR-0104 잔여, JSON canonical 은 이미 안전).
23
+
3
24
  ## 1.9.398 — 2026-06-07 — --json 에러 경로 구조화 (6번째 외부평가 P1-C, UR-0099)
4
25
 
5
26
  **🔌 `--json` 모드에서 에러도 구조화 JSON(`{ok:false,error,code}`) — AI 에이전트가 에러 경로에서 JSON.parse 실패하지 않도록.**
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.398-green)]() [![tests](https://img.shields.io/badge/e2e-337%2F337-success)]() [![selftest](https://img.shields.io/badge/selftest-144-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.399-green)]() [![tests](https://img.shields.io/badge/e2e-338%2F338-success)]() [![selftest](https://img.shields.io/badge/selftest-145-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.398 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.399 하네스를 사용합니다. 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.398는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
528
+ Leerness v1.9.399는 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.398는 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.398)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.399)** · 매 라운드 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.398: 2026-06-06
587
+ Last synced by Leerness v1.9.399: 2026-06-06
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -25,13 +25,13 @@ const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _merg
25
25
  _withBuiltinSource, _esc, _roadmapTokenStyles, _parseSkillMd,
26
26
  _migrationGuideText, _parseContractSpec, _gitignoreMatch,
27
27
  _featureGraphTemplate, _parseFeatureGraph, _nextFeatureId, _featureBlock, _featureImpactBfs,
28
- _parseChangelogBetween } = require('../lib/pure-utils'); // 1.9.318~393 (UR-0025/0053/0075/0086/0087): 순수 유틸 모듈 분리
28
+ _parseChangelogBetween, _cellSafe, _cellUnescape } = require('../lib/pure-utils'); // 1.9.318~399 (UR-0025/0053/0075/0086/0087/0104): 순수 유틸 모듈 분리
29
29
  // 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
30
30
  const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
31
31
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
32
32
  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 포함)
33
33
 
34
- const VERSION = '1.9.398';
34
+ const VERSION = '1.9.399';
35
35
 
36
36
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
37
37
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -3003,6 +3003,7 @@ function _selfTestCases() {
3003
3003
  { name: '6번째 외부평가/codex P1-B: task drop 존재확인 가드 — 없는 ID 가짜 row 방지 (1.9.396)', run: () => { const src = read(__filename); const i = src.indexOf('function taskDrop(root, id)'); if (i < 0) return false; const body = src.slice(i, i + 700); return body.includes('not found in progress-tracker.md') && body.includes('rows.find(r => r.id === id)') && body.includes('_requireInit'); } },
3004
3004
  { name: '6번째 외부평가/codex P1-A (UR-0098): install-safety 레시피 셸-무관 + hardeningNote (1.9.397)', run: () => { if (typeof installSafetyCmd !== 'function') return false; const save = process.argv; const _w = process.stdout.write; let out = ''; try { process.argv = ['node', 'h', 'install-safety', '--json']; process.stdout.write = s => { out += s; return true; }; installSafetyCmd({ json: true }); } catch {} finally { process.stdout.write = _w; process.argv = save; } let j; try { j = JSON.parse(out); } catch {} const noPosixPrefix = !!j && Array.isArray(j.safeInstall) && !j.safeInstall.some(x => /^npm_config_\w+=/.test(String(x).trim())); const crossShell = !!j && j.safeInstall.filter(x => String(x).includes('npx --yes')).length >= 2; const noteOk = !!j && typeof j.hardeningNote === 'string' && j.hardeningNote.includes('PowerShell'); return noPosixPrefix && crossShell && noteOk; } },
3005
3005
  { name: '6번째 외부평가/codex P1-C (UR-0099): --json 에러 경로 구조화 failJson + 와이어 (1.9.398)', run: () => { const io = require('../lib/io'); if (io.failJson !== failJson) return false; const _w = process.stdout.write; const saved = process.exitCode; let jOut = '', hOut = ''; let jExit = 0; try { process.stdout.write = s => { jOut += s; return true; }; process.exitCode = 0; failJson(true, 'tc', 'm'); jExit = process.exitCode; process.stdout.write = s => { hOut += s; return true; }; process.exitCode = 0; failJson(false, 'c', 'humanmsg'); } catch {} finally { process.stdout.write = _w; process.exitCode = saved; } let pj; try { pj = JSON.parse(jOut); } catch {} const jsonOk = !!pj && pj.ok === false && pj.code === 'tc' && pj.error === 'm' && jExit === 1; const humanOk = hOut.includes('✗') && hOut.includes('humanmsg') && !hOut.includes('{'); const src = read(__filename); const wired = src.includes("failJson(_j, 'missing_args'") && src.includes("failJson(_j, 'spec_not_found'"); return jsonOk && humanOk && wired; } },
3006
+ { name: '7번째 버그헌트 P1-A (UR-0104): 테이블셀 안전화 _cellSafe/_cellUnescape (파이프/개행 injection 차단) (1.9.399)', run: () => { const m = require('../lib/pure-utils'); if (m._cellSafe !== _cellSafe || m._cellUnescape !== _cellUnescape) return false; const safe = _cellSafe('fix | bug\nrow2'); const noRaw = !/(?<!\\)\|/.test(safe) && !/[\r\n]/.test(safe); const pipeRt = _cellUnescape(_cellSafe('a | b | c')) === 'a | b | c'; const nlGone = _cellSafe('a\nb') === 'a b'; const src = read(__filename); const wired = src.includes('_cellSafe(r.request)') && src.includes('_cellSafe(r.rule)'); return noRaw && pipeRt && nlGone && wired; } },
3006
3007
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3007
3008
  ];
3008
3009
  }
@@ -5832,7 +5833,8 @@ function readProgressRows(root) {
5832
5833
  const rows = [];
5833
5834
  for (const line of text.split('\n')) {
5834
5835
  if (!/^\| (?:T|M|D)-\d{4} \|/.test(line)) continue;
5835
- const cells = line.split('|').slice(1, -1).map(s => s.trim());
5836
+ // 1.9.399 (7번째 버그헌트 P1-A, UR-0104): 비이스케이프 파이프에서만 분리 + 셀 복원 — 사용자 텍스트의 '|'(이스케이프됨)이 컬럼을 깨지 않음.
5837
+ const cells = line.split(/(?<!\\)\|/).slice(1, -1).map(s => _cellUnescape(s).trim());
5836
5838
  if (cells.length < 6) continue;
5837
5839
  const [id, status, request, evidence, nextAction, updated] = cells;
5838
5840
  rows.push({ id, status, request, evidence, nextAction, updated });
@@ -5853,8 +5855,9 @@ function progressHeader(root) {
5853
5855
  return text.slice(0, text.indexOf('\n', idx)).trimEnd();
5854
5856
  }
5855
5857
  function writeProgressRows(root, header, rows) {
5858
+ // 1.9.399 (7번째 버그헌트 P1-A, UR-0104): 셀 콘텐츠 안전화 — 개행→공백, '|'→'\|'. 사용자 텍스트의 파이프/개행이 표 행을 손상/주입 못 함.
5856
5859
  const composed = header + '\n' +
5857
- rows.map(r => `| ${r.id} | ${r.status} | ${r.request} | ${r.evidence} | ${r.nextAction} | ${r.updated} |`).join('\n') +
5860
+ rows.map(r => `| ${_cellSafe(r.id)} | ${_cellSafe(r.status)} | ${_cellSafe(r.request)} | ${_cellSafe(r.evidence)} | ${_cellSafe(r.nextAction)} | ${_cellSafe(r.updated)} |`).join('\n') +
5858
5861
  (rows.length ? '\n' : '');
5859
5862
  writeUtf8(progressPath(root), composed);
5860
5863
  }
@@ -13565,7 +13568,8 @@ function readRules(root) {
13565
13568
  const rules = [];
13566
13569
  for (const line of read(f).split('\n')) {
13567
13570
  if (!/^\| R-\d{4} \|/.test(line)) continue;
13568
- const cells = line.split('|').slice(1, -1).map(s => s.trim());
13571
+ // 1.9.399 (7번째 버그헌트 P1-A, UR-0104): 비이스케이프 파이프 분리 + 복원 — rule 텍스트의 '|'가 컬럼 밀림/멱등성 무력화를 못 일으킴.
13572
+ const cells = line.split(/(?<!\\)\|/).slice(1, -1).map(s => _cellUnescape(s).trim());
13569
13573
  if (cells.length < 6) continue;
13570
13574
  rules.push({ id: cells[0], trigger: cells[1], rule: cells[2], added: cells[3], status: cells[4], lastVerified: cells[5] });
13571
13575
  }
@@ -13573,7 +13577,8 @@ function readRules(root) {
13573
13577
  }
13574
13578
 
13575
13579
  function writeRules(root, rules) {
13576
- const body = rules.map(r => `| ${r.id} | ${r.trigger} | ${r.rule} | ${r.added} | ${r.status} | ${r.lastVerified || '-'} |`).join('\n');
13580
+ // 1.9.399 (7번째 버그헌트 P1-A, UR-0104): 안전화 rule 텍스트의 파이프/개행 차단(컬럼 밀림·중복 무한생성 방지).
13581
+ const body = rules.map(r => `| ${_cellSafe(r.id)} | ${_cellSafe(r.trigger)} | ${_cellSafe(r.rule)} | ${_cellSafe(r.added)} | ${_cellSafe(r.status)} | ${_cellSafe(r.lastVerified || '-')} |`).join('\n');
13577
13582
  writeUtf8(rulesPath(root), _rulesHeader() + '\n' + body + (body ? '\n' : ''));
13578
13583
  }
13579
13584
 
package/lib/pure-utils.js CHANGED
@@ -935,7 +935,9 @@ module.exports = {
935
935
  // 1.9.391 (UR-0025): feature 영향 BFS (순수, 공유)
936
936
  _featureImpactBfs,
937
937
  // 1.9.393 (UR-0025): CHANGELOG 버전 구간 차분 파서 (순수, 공유)
938
- _parseChangelogBetween
938
+ _parseChangelogBetween,
939
+ // 1.9.399 (7번째 버그헌트 P1-A, UR-0104): markdown 테이블 셀 안전화(파이프/개행 injection 차단)
940
+ _cellSafe, _cellUnescape
939
941
  };
940
942
 
941
943
  // 1.9.355 (UR-0075 Phase A): AI 에이전트용 크로스버전 마이그레이션 안전 워크플로 가이드 (순수 텍스트). 임시설치 + --path + 백업 + diff 검증.
@@ -1167,3 +1169,8 @@ function _parseChangelogBetween(changelogText, fromV, toV) {
1167
1169
  }
1168
1170
  return ranged;
1169
1171
  }
1172
+ // 1.9.399 (7번째 버그헌트 P1-A, UR-0104): markdown 테이블 셀 안전화 — 개행(행 주입)·파이프(컬럼 시프트) 차단.
1173
+ // _cellSafe: 쓰기 시 개행→공백, '|'→'\|'(이스케이프). _cellUnescape: 읽기 시 '\|'→'|' 복원.
1174
+ // table 파서는 split(/(?<!\\)\|/) 로 비이스케이프 파이프에서만 분리 → 사용자 텍스트의 파이프/개행이 데이터 손상·가짜행 주입을 못 일으킴.
1175
+ function _cellSafe(s) { return String(s == null ? '' : s).replace(/\r\n|\r|\n/g, ' ').replace(/\|/g, '\\|'); }
1176
+ function _cellUnescape(s) { return String(s == null ? '' : s).replace(/\\\|/g, '|'); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.398",
3
+ "version": "1.9.399",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -5558,5 +5558,31 @@ total++;
5558
5558
  if (!ok) failed++;
5559
5559
  }
5560
5560
 
5561
+ // 1.9.399 회귀 (7번째 버그헌트 P1-A, UR-0104): 테이블셀 injection 차단 — task/rule 텍스트의 파이프(|) 보존 + 개행 가짜행 주입 차단 + rule 멱등성
5562
+ total++;
5563
+ {
5564
+ let ok = false;
5565
+ try {
5566
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-cellinj-'));
5567
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5568
+ cp.spawnSync(process.execPath, [CLI, 'task', 'add', 'fix login | bypass', '--path', d, '--no-review'], { encoding: 'utf8', timeout: 15000 });
5569
+ cp.spawnSync(process.execPath, [CLI, 'task', 'add', 'real\n| T-9999 | done | x | y | z | w |', '--path', d, '--no-review'], { encoding: 'utf8', timeout: 15000 });
5570
+ const tl = JSON.parse(cp.spawnSync(process.execPath, [CLI, 'task', 'list', '--path', d, '--json'], { encoding: 'utf8', timeout: 15000 }).stdout);
5571
+ const ts = tl.tasks || tl;
5572
+ const pipeOk = ts.some(t => t.request === 'fix login | bypass'); // 파이프 원본 보존
5573
+ const noInject = !ts.some(t => t.id === 'T-9999' || t.status === 'done'); // 개행 가짜행 주입 차단
5574
+ // rule 파이프 + 멱등성(중복 add → skip)
5575
+ cp.spawnSync(process.execPath, [CLI, 'rule', 'add', 'lint | typecheck', '--trigger', 'every-commit', '--path', d], { encoding: 'utf8', timeout: 15000 });
5576
+ cp.spawnSync(process.execPath, [CLI, 'rule', 'add', 'lint | typecheck', '--trigger', 'every-commit', '--path', d], { encoding: 'utf8', timeout: 15000 });
5577
+ const rl = JSON.parse(cp.spawnSync(process.execPath, [CLI, 'rule', 'list', '--path', d, '--json'], { encoding: 'utf8', timeout: 15000 }).stdout);
5578
+ const rs = rl.rules || rl;
5579
+ const ruleOk = rs.length === 1 && rs[0].rule === 'lint | typecheck' && rs[0].status === 'active'; // 파이프 보존 + 멱등 + status 비오염
5580
+ fs.rmSync(d, { recursive: true, force: true });
5581
+ ok = pipeOk && noInject && ruleOk;
5582
+ } catch {}
5583
+ console.log(ok ? '✓ B(1.9.399) 7th버그헌트 P1-A: 테이블셀 injection 차단(task/rule 파이프 보존+개행 가짜행 차단+rule 멱등) (UR-0104)' : '✗ 테이블셀 injection 차단 실패');
5584
+ if (!ok) failed++;
5585
+ }
5586
+
5561
5587
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
5562
5588
  if (failed > 0) process.exit(1);