leerness 1.9.352 → 1.9.353

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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.353 — 2026-06-05 — 외부리뷰 P2 마무리 3종 (UR-0067/0070/0071) · P2 전량 완료
4
+
5
+ **🧩 외부 리뷰 남은 P2 3건 — 인코딩 정책/CP949 · shell-guard 셸 명시 · init non-TTY ANSI. 외부리뷰 P0/P1/P2 전량 해소.**
6
+
7
+ ### 구현
8
+ 1. **UR-0067 — 인코딩 정합** (Opus P2-1/Codex#4): (a) `encoding check` 의 UTF-8 BOM 경고를 `.ps1`/`.bat` 예외 — PS5.1 호환 위해 BOM 이 의도적일 수 있어 `env encoding`(BOM 권장)과의 모순 해소. (b) 한글(`[가-힣]`) 게이트 제거 → **CP949/Latin-1 등 invalid UTF-8 을 round-trip 불일치로 감지**(이전: 한글 없으면 통과 = false negative). 유효 UTF-8 은 byte-exact round-trip 이라 오탐 0.
9
+ 2. **UR-0070 — shell-guard 셸 명시** (Opus P2-4): `--shell powershell|cmd|bash` (+ `--ps-version`) 옵션 — 자동 감지(git-bash 경유 등)가 실제 실행 셸과 달라 PS5.1 `&&` 가드가 무력화되던 문제. AI 에이전트가 대상 셸 지정 가능.
10
+ 3. **UR-0071 — init non-TTY ANSI** (Sonnet F-05): init 완료 안내 5개 raw ANSI(`\x1b[36m/33m/2m`)에 isTTY 가드 — 파이프 출력에 raw escape 누출 방지.
11
+
12
+ ### 검증
13
+ - **selftest 100/100 PASS** · **E2E 297→298 PASS** (회귀 0).
14
+ - 실측: cp949.txt(한글 utf8 미매치) invalid 감지 + script.ps1 BOM 예외 · `shell-guard "a && b" --shell powershell` → ps5-chain 감지 · init 파이프 출력 raw ANSI 0.
15
+
3
16
  ## 1.9.352 — 2026-06-05 — 외부리뷰 P2 정리 3종 (UR-0066/0068/0069)
4
17
 
5
18
  **🧩 외부 리뷰 P2 3건 — shell:true 주입 가드 + milestone 파서 누출 + usage subcommand 미집계.** (selftest 100 달성)
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.352-green)]() [![tests](https://img.shields.io/badge/e2e-297%2F297-success)]() [![selftest](https://img.shields.io/badge/selftest-100-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.353-green)]() [![tests](https://img.shields.io/badge/e2e-298%2F298-success)]() [![selftest](https://img.shields.io/badge/selftest-100-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.352 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.353 하네스를 사용합니다. 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.352는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.353는 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.352는 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.352)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.353)** · 매 라운드 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.352: 2026-06-05
587
+ Last synced by Leerness v1.9.353: 2026-06-05
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -27,7 +27,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
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.352';
30
+ const VERSION = '1.9.353';
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') 시 호스트 프로세스 오염.
@@ -235,7 +235,7 @@ function arg(name, def = null) { const i = process.argv.indexOf(name); return i
235
235
  function has(name) { return process.argv.includes(name); }
236
236
  function nonFlagArgs() {
237
237
  const out = [];
238
- const withValue = new Set(['--language','--skills','--path','--status','--progress','--goal','--reason','--next','--target','--token-env','--package','--out','--from','--repo','--id','--note','--evidence','--query','--limit','--action','--agent','--tool','--doc','--command','--capability','--before','--after','--display','--threshold','--trigger','--check','--set','--min-score','--include','--days','--gh-pages-src','--roadmap','--since','--agents','--model','--timeout','--retry-on-fail','--label','--score','--tokens','--alternatives','--impact','--tag','--surface','--depends-on','--affects','--co-changes-with','--files','--branch','--remote','--task-add','--next-action','--role','--provider','--env-var','--deploy','--token-lifetime-hours','--port','--secret','--keep']);
238
+ const withValue = new Set(['--language','--skills','--path','--status','--progress','--goal','--reason','--next','--target','--token-env','--package','--out','--from','--repo','--id','--note','--evidence','--query','--limit','--action','--agent','--tool','--doc','--command','--capability','--before','--after','--display','--threshold','--trigger','--check','--set','--min-score','--include','--days','--gh-pages-src','--roadmap','--since','--agents','--model','--timeout','--retry-on-fail','--label','--score','--tokens','--alternatives','--impact','--tag','--surface','--depends-on','--affects','--co-changes-with','--files','--branch','--remote','--task-add','--next-action','--role','--provider','--env-var','--deploy','--token-lifetime-hours','--port','--secret','--keep','--shell','--ps-version']);
239
239
  const a = process.argv.slice(2);
240
240
  for (let i = 0; i < a.length; i++) {
241
241
  const x = a[i];
@@ -1169,14 +1169,16 @@ async function install(root, opts = {}) {
1169
1169
  }
1170
1170
  // 1.9.251 (UR-0018 3단계): init 완료 시 터미널 인코딩 점검 안내 — 사용자 명시 ("leerness init 시 터미널 인코딩 점검 안내")
1171
1171
  // Windows CP949 / POSIX non-UTF-8 환경에서 leerness 한국어 출력 깨짐을 설치 직후 사용자에게 즉시 고지.
1172
+ // 1.9.353 (UR-0071 외부리뷰): non-TTY(파이프) 출력에 raw ANSI 누출 방지 — isTTY 일 때만 색상.
1173
+ const _c = (n, s) => (process.stdout && process.stdout.isTTY) ? `\x1b[${n}m${s}\x1b[0m` : s;
1172
1174
  if (!opts.migration) {
1173
1175
  try {
1174
1176
  const enc = _terminalEncodingNotice();
1175
1177
  if (enc.lines.length > 0) {
1176
1178
  log('');
1177
- log(`\x1b[36m🌐 터미널 인코딩 점검 (1.9.251, UR-0018)\x1b[0m`);
1179
+ log(_c(36, '🌐 터미널 인코딩 점검 (1.9.251, UR-0018)'));
1178
1180
  enc.lines.forEach(l => log(l));
1179
- if (!enc.ok) log(`\x1b[2m 상세: leerness env · 셸 스크립트 검사: leerness env encoding\x1b[0m`);
1181
+ if (!enc.ok) log(_c(2, ' 상세: leerness env · 셸 스크립트 검사: leerness env encoding'));
1180
1182
  }
1181
1183
  } catch {}
1182
1184
  }
@@ -1187,9 +1189,9 @@ async function install(root, opts = {}) {
1187
1189
  const diag = _pathDiagnose();
1188
1190
  if (!diag.resolvable && !diag.inPath && diag.globalBin) {
1189
1191
  log('');
1190
- log(`\x1b[33m🔗 leerness CLI PATH 미등록 (1.9.254, UR-0019)\x1b[0m`);
1191
- log(`\x1b[2m npm global bin (${diag.globalBin}) 이 PATH 에 없어 'leerness' 명령이 안 먹힐 수 있음\x1b[0m`);
1192
- log(`\x1b[36m → 자동 등록: leerness path-setup --apply\x1b[0m`);
1192
+ log(_c(33, '🔗 leerness CLI PATH 미등록 (1.9.254, UR-0019)'));
1193
+ log(_c(2, ` npm global bin (${diag.globalBin}) 이 PATH 에 없어 'leerness' 명령이 안 먹힐 수 있음`));
1194
+ log(_c(36, ' → 자동 등록: leerness path-setup --apply'));
1193
1195
  }
1194
1196
  } catch {}
1195
1197
  }
@@ -3150,7 +3152,8 @@ function shellGuardCmd(root, cmd, opts = {}) {
3150
3152
  const yl = s => isTty ? `\x1b[33m${s}\x1b[0m` : s;
3151
3153
  const rd = s => isTty ? `\x1b[31m${s}\x1b[0m` : s;
3152
3154
  const dm = s => isTty ? `\x1b[2m${s}\x1b[0m` : s;
3153
- const ctx = _detectShellCtx();
3155
+ // 1.9.353 (UR-0070 외부리뷰): --shell 로 대상 셸 명시 — 자동 감지(git-bash 경유 등)가 실제 실행 셸과 달라 PS5.1 && 가드가 무력화되는 것 방지
3156
+ const ctx = opts.shell ? { shell: opts.shell, psVersion: opts.shell === 'powershell' ? (opts.psVersion || '5') : null } : _detectShellCtx();
3154
3157
  // record 모드: 실패한 명령 기록
3155
3158
  if (opts.record) {
3156
3159
  if (!cmd) { fail('shell-guard --record 에는 --cmd "<명령>" 필요'); return; }
@@ -7139,7 +7142,7 @@ function encodingCheck(root) {
7139
7142
  if (buf.length === 0) continue;
7140
7143
  if (buf.length > 5 * 1024 * 1024) continue;
7141
7144
  const fileRel = rel(root, file);
7142
- if (buf[0] === 0xEF && buf[1] === 0xBB && buf[2] === 0xBF) { warnings++; findings.push({ file: fileRel, issue: 'UTF-8 BOM' }); }
7145
+ if (buf[0] === 0xEF && buf[1] === 0xBB && buf[2] === 0xBF) { if (ext !== '.ps1' && ext !== '.bat') { warnings++; findings.push({ file: fileRel, issue: 'UTF-8 BOM' }); } } // 1.9.353 (UR-0067 외부리뷰): .ps1/.bat 는 PS5.1 호환 위해 BOM 의도적일 수 있어 예외 (env encoding 정책과 모순 해소)
7143
7146
  else if ((buf[0] === 0xFF && buf[1] === 0xFE) || (buf[0] === 0xFE && buf[1] === 0xFF)) { warnings++; findings.push({ file: fileRel, issue: 'UTF-16 BOM' }); }
7144
7147
  let nul = false; for (let i = 0; i < Math.min(buf.length, 4096); i++) if (buf[i] === 0) { nul = true; break; }
7145
7148
  if (nul) { warnings++; findings.push({ file: fileRel, issue: 'NUL byte (binary in text path)' }); }
@@ -7147,13 +7150,13 @@ function encodingCheck(root) {
7147
7150
  const text = buf.toString('utf8').replace(/^/, '');
7148
7151
  if (!/^@?chcp\s+65001/i.test(text.split(/\r?\n/, 1)[0] || '')) { warnings++; findings.push({ file: fileRel, issue: '.bat missing chcp 65001' }); }
7149
7152
  }
7153
+ // 1.9.353 (UR-0067 외부리뷰): 가-힣 게이트 제거 — CP949/Latin-1 등 invalid UTF-8 은 한글 포함 여부와 무관하게 round-trip 불일치로 감지(이전: 한글 없으면 통과 = false negative). 유효 UTF-8 은 byte-exact round-trip 이라 오탐 없음.
7150
7154
  try {
7151
7155
  const text = buf.toString('utf8');
7152
- if (/[가-힣]/.test(text)) {
7153
- const reBuf = Buffer.from(text, 'utf8');
7154
- if (!reBuf.equals(buf) && !(buf[0] === 0xEF && buf[1] === 0xBB && buf[2] === 0xBF)) {
7155
- warnings++; findings.push({ file: fileRel, issue: 'Korean text but non-clean UTF-8 roundtrip' });
7156
- }
7156
+ const reBuf = Buffer.from(text, 'utf8');
7157
+ const hasBOM = buf[0] === 0xEF && buf[1] === 0xBB && buf[2] === 0xBF;
7158
+ if (!reBuf.equals(buf) && !hasBOM) {
7159
+ warnings++; findings.push({ file: fileRel, issue: 'invalid UTF-8 roundtrip (CP949/mojibake 의심)' });
7157
7160
  }
7158
7161
  } catch {}
7159
7162
  }
@@ -21158,7 +21161,7 @@ async function main() {
21158
21161
  if (cmd === 'shell-guard' || cmd === 'shellguard') {
21159
21162
  const cmdArg = arg('--cmd', args[1] && !args[1].startsWith('-') ? args[1] : '');
21160
21163
  const exitRaw = arg('--exit', null);
21161
- return shellGuardCmd(arg('--path', process.cwd()), cmdArg, { record: has('--record'), exit: exitRaw != null ? parseInt(exitRaw, 10) : null, json: has('--json') });
21164
+ return shellGuardCmd(arg('--path', process.cwd()), cmdArg, { record: has('--record'), exit: exitRaw != null ? parseInt(exitRaw, 10) : null, json: has('--json'), shell: arg('--shell', null), psVersion: arg('--ps-version', null) });
21162
21165
  }
21163
21166
  // 1.9.265: leerness slash-commands [agent] — CLI 에이전트별 슬래시 명령어 레지스트리 (사용자 명시 UR-0021)
21164
21167
  if (cmd === 'slash-commands' || cmd === 'slash' || cmd === 'agent-slash') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.352",
3
+ "version": "1.9.353",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -4693,5 +4693,35 @@ total++;
4693
4693
  if (!ok) failed++;
4694
4694
  }
4695
4695
 
4696
+ // 1.9.353 회귀 (외부리뷰 P2): UR-0067 encoding(CP949 감지/.ps1 BOM 예외) + UR-0070 shell-guard --shell + UR-0071 init non-TTY ANSI
4697
+ total++;
4698
+ {
4699
+ let ok = false;
4700
+ try {
4701
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-enc-'));
4702
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
4703
+ // UR-0067: CP949 bytes(한글 utf8 미매치) → invalid 감지 / .ps1 BOM → 예외
4704
+ fs.writeFileSync(path.join(d, 'cp949.txt'), Buffer.from([0xC7, 0xD1, 0xB1, 0xDB]));
4705
+ fs.writeFileSync(path.join(d, 'script.ps1'), Buffer.concat([Buffer.from([0xEF, 0xBB, 0xBF]), Buffer.from('Write-Host hi', 'utf8')]));
4706
+ const er = cp.spawnSync(process.execPath, [CLI, 'encoding', 'check', d], { encoding: 'utf8', timeout: 20000 });
4707
+ const eout = (er.stdout || '') + (er.stderr || '');
4708
+ const encOk = /cp949\.txt/.test(eout) && /CP949|invalid UTF-8/.test(eout) && !/script\.ps1/.test(eout);
4709
+ fs.rmSync(d, { recursive: true, force: true });
4710
+ // UR-0070: shell-guard --shell powershell → ps5-chain 감지(자동감지로는 bash 라 놓쳤을 것)
4711
+ const sr = cp.spawnSync(process.execPath, [CLI, 'shell-guard', 'a && b', '--shell', 'powershell', '--json'], { encoding: 'utf8', timeout: 20000 });
4712
+ let shellOk = false;
4713
+ try { const j = JSON.parse(sr.stdout); shellOk = j.shell === 'powershell' && (j.issues || []).some(i => i.rule === 'ps5-chain'); } catch {}
4714
+ // UR-0071: init non-TTY 출력에 fixed raw ANSI 없음
4715
+ const e2 = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-ansi-'));
4716
+ const ir = cp.spawnSync(process.execPath, [CLI, 'init', e2, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
4717
+ const iout = (ir.stdout || '') + (ir.stderr || '');
4718
+ const ansiOk = !/\x1b\[36m🌐/.test(iout) && !/\x1b\[33m🔗/.test(iout);
4719
+ fs.rmSync(e2, { recursive: true, force: true });
4720
+ ok = encOk && shellOk && ansiOk;
4721
+ } catch {}
4722
+ console.log(ok ? '✓ B(1.9.353) 외부리뷰 P2: encoding CP949/.ps1 BOM + shell-guard --shell + init non-TTY ANSI (UR-0067/0070/0071)' : '✗ P2 마무리 실패');
4723
+ if (!ok) failed++;
4724
+ }
4725
+
4696
4726
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
4697
4727
  if (failed > 0) process.exit(1);