leerness 1.9.352 → 1.9.354

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,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.354 — 2026-06-05 — 외부리뷰 P3 클러스터 (UR-0072) · 외부리뷰 백로그 소진
4
+
5
+ **🧩 외부 리뷰 P3 핵심 4종 — compareVer pre-release · _classifyCJK 일본어 오판 · scan secrets 파일경로 · requests drop 아이콘.**
6
+
7
+ ### 구현
8
+ 1. **compareVer pre-release** (Opus P3-4): `1.9.0-beta` < `1.9.0` semver 규칙 적용(이전: `-beta` 무시 → 동일 취급). beta/next 채널 stale-check 정확도.
9
+ 2. **_classifyCJK 일본어 오판** (Opus P3-2): CJK 통합 한자(한·중·일 공유)를 무조건 중국어로 세던 것 → **kana 존재 시 일본어 귀속** 휴리스틱. advisory 인코딩 라벨 정확도.
10
+ 3. **scan secrets 파일경로** (Codex#10): `scan secrets <file>` 가 `ENOTDIR` 로 실패하던 것 → 파일이면 그 파일만 스캔(basename 표시), 디렉토리면 walk.
11
+ 4. **requests drop 아이콘** (Codex#8): 성공 동작에 실패 아이콘 `✗` → `✓`.
12
+
13
+ ### 검증
14
+ - **selftest 101/101 PASS** · **E2E 298→299 PASS** (회귀 0).
15
+ - 실측: compareVer beta<release · _classifyCJK 일본어(kana+한자)→japanese·중국어(한자만)→chinese · `scan secrets leak.js` GitLab PAT 감지(ENOTDIR 없음, leak.js 표시) · `requests drop` → ✓.
16
+
17
+ ### 비고 (P3 잔여 — cosmetic, UR-0072 후속)
18
+ intent/constraints/requests `.` arg "Unknown subcommand"(핸들러별 default 검증 필요) · skill install <catalog-id>(id 해석 설계) · pulse 라벨 분모 표기 — 소형 UX 폴리시, 별도 처리.
19
+
20
+ ## 1.9.353 — 2026-06-05 — 외부리뷰 P2 마무리 3종 (UR-0067/0070/0071) · P2 전량 완료
21
+
22
+ **🧩 외부 리뷰 남은 P2 3건 — 인코딩 정책/CP949 · shell-guard 셸 명시 · init non-TTY ANSI. 외부리뷰 P0/P1/P2 전량 해소.**
23
+
24
+ ### 구현
25
+ 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.
26
+ 2. **UR-0070 — shell-guard 셸 명시** (Opus P2-4): `--shell powershell|cmd|bash` (+ `--ps-version`) 옵션 — 자동 감지(git-bash 경유 등)가 실제 실행 셸과 달라 PS5.1 `&&` 가드가 무력화되던 문제. AI 에이전트가 대상 셸 지정 가능.
27
+ 3. **UR-0071 — init non-TTY ANSI** (Sonnet F-05): init 완료 안내 5개 raw ANSI(`\x1b[36m/33m/2m`)에 isTTY 가드 — 파이프 출력에 raw escape 누출 방지.
28
+
29
+ ### 검증
30
+ - **selftest 100/100 PASS** · **E2E 297→298 PASS** (회귀 0).
31
+ - 실측: cp949.txt(한글 utf8 미매치) invalid 감지 + script.ps1 BOM 예외 · `shell-guard "a && b" --shell powershell` → ps5-chain 감지 · init 파이프 출력 raw ANSI 0.
32
+
3
33
  ## 1.9.352 — 2026-06-05 — 외부리뷰 P2 정리 3종 (UR-0066/0068/0069)
4
34
 
5
35
  **🧩 외부 리뷰 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.354-green)]() [![tests](https://img.shields.io/badge/e2e-299%2F299-success)]() [![selftest](https://img.shields.io/badge/selftest-101-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.354 하네스를 사용합니다. 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.354는 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.354)** · 매 라운드 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.354: 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.354';
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
  }
@@ -3055,6 +3057,7 @@ function _selfTestCases() {
3055
3057
  { name: 'UR-0060(외부리뷰 P1): SECRET_PATTERNS 19종 — GitLab/JWT/DB-URI/SendGrid/AWS-secret/Bearer 보강 + 오탐 가드', run: () => { const c = require('../lib/catalogs'); const hit = s => c.SECRET_PATTERNS.some(p => { p.re.lastIndex = 0; return p.re.test(s); }); const det = hit('glpat-' + 'x'.repeat(20)) && hit('eyJ' + 'x'.repeat(15) + '.eyJ' + 'y'.repeat(15) + '.' + 'z'.repeat(15)) && hit('postgres://u:p@host:5432/db') && hit('SG.' + 'x'.repeat(22) + '.' + 'y'.repeat(43)) && hit('aws_secret_access_key = "' + 'x'.repeat(40) + '"') && hit('Bearer ' + 'x'.repeat(25)); const clean = !hit('const u = "john' + '_doe_2024";') && !hit('https://example.com/path/to/page'); return c.SECRET_PATTERNS.length === 19 && det && clean; } },
3056
3058
  { name: 'UR-0068(외부리뷰 P2): _roadmapParseMilestones 블록 경계 — 다음 milestone status 누출 차단', run: () => { const m = require('../lib/pure-utils'); const r = m._roadmapParseMilestones('### M-0001. A\n\n### M-0002. B\nStatus: done\nProgress: 80%\n'); return r.length === 2 && r[0].status === 'planned' && r[0].progress === 0 && r[1].status === 'done' && r[1].progress === 80; } },
3057
3059
  { name: 'UR-0066(외부리뷰 P2): shell:true 주입 가드 — agents bench task _shellQuoteArg + fetchNpmLatest npm.cmd', run: () => { const m = require('../lib/pure-utils'); const src = read(__filename); const benchQuoted = src.includes('const qTask = ' + '_shellQuoteArg(task)'); const npmCmd = /'win32' \? 'npm\.cmd' : 'npm'/.test(src); const q = m._shellQuoteArg('a & b'); const safe = (process.platform === 'win32' ? q === '"a & b"' : q === "'a & b'"); return benchQuoted && npmCmd && safe; } },
3060
+ { name: 'UR-0072(외부리뷰 P3): compareVer pre-release + _classifyCJK 한자 kana 귀속', run: () => { const m = require('../lib/pure-utils'); const verOk = m.compareVer('1.9.0-beta', '1.9.0') === -1 && m.compareVer('1.9.0', '1.9.0-beta') === 1 && m.compareVer('1.9.5', '1.9.5') === 0 && m.compareVer('1.9.6', '1.9.5') === 1; const jp = Buffer.from([0xE3, 0x81, 0x82, 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC]); const cn = Buffer.from([0xE4, 0xB8, 0xAD, 0xE5, 0x9B, 0xBD]); const rj = m._classifyCJK(jp, jp.length); const rc = m._classifyCJK(cn, cn.length); const cjkOk = rj.japanese > rj.chinese && rc.chinese > 0 && rc.japanese === 0; return verOk && cjkOk; } },
3058
3061
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3059
3062
  ];
3060
3063
  }
@@ -3150,7 +3153,8 @@ function shellGuardCmd(root, cmd, opts = {}) {
3150
3153
  const yl = s => isTty ? `\x1b[33m${s}\x1b[0m` : s;
3151
3154
  const rd = s => isTty ? `\x1b[31m${s}\x1b[0m` : s;
3152
3155
  const dm = s => isTty ? `\x1b[2m${s}\x1b[0m` : s;
3153
- const ctx = _detectShellCtx();
3156
+ // 1.9.353 (UR-0070 외부리뷰): --shell 로 대상 셸 명시 — 자동 감지(git-bash 경유 등)가 실제 실행 셸과 달라 PS5.1 && 가드가 무력화되는 것 방지
3157
+ const ctx = opts.shell ? { shell: opts.shell, psVersion: opts.shell === 'powershell' ? (opts.psVersion || '5') : null } : _detectShellCtx();
3154
3158
  // record 모드: 실패한 명령 기록
3155
3159
  if (opts.record) {
3156
3160
  if (!cmd) { fail('shell-guard --record 에는 --cmd "<명령>" 필요'); return; }
@@ -4599,7 +4603,7 @@ function requestsCmd(root, sub, ...rest) {
4599
4603
  const updated = _updateUserRequest(root, id, { status: 'dropped' });
4600
4604
  if (!updated) { console.error(`request not found: ${id}`); process.exit(1); }
4601
4605
  if (has('--json')) { log(JSON.stringify(updated, null, 2)); return; }
4602
- log(yel(`✗ dropped ${updated.id}`));
4606
+ log(yel(`✓ dropped ${updated.id}`)); // 1.9.354 (UR-0072 외부리뷰): 성공 동작에 실패 아이콘(✗) 대신 ✓
4603
4607
  return;
4604
4608
  }
4605
4609
 
@@ -7100,13 +7104,16 @@ function* walk(root, base = root, depth = 0, extras = null) {
7100
7104
  function scanSecrets(root) {
7101
7105
  root = absRoot(root);
7102
7106
  const findings = [];
7103
- for (const file of walk(root)) {
7107
+ // 1.9.354 (UR-0072 외부리뷰): root 가 파일이면 그 파일만 스캔 (이전: walk 의 readdirSync → ENOTDIR). 디렉토리면 기존 walk.
7108
+ let _iter;
7109
+ try { _iter = fs.statSync(root).isFile() ? [root] : walk(root); } catch { _iter = walk(root); }
7110
+ for (const file of _iter) {
7104
7111
  const ext = path.extname(file).toLowerCase();
7105
7112
  if (!SCAN_TEXT_EXT.has(ext)) continue;
7106
7113
  let text;
7107
7114
  try { text = read(file); } catch { continue; }
7108
7115
  if (text.length > 1024 * 1024) continue;
7109
- const fileRel = rel(root, file);
7116
+ const fileRel = (file === root) ? path.basename(file) : rel(root, file); // 1.9.354 (UR-0072): 단일 파일 스캔 시 basename 표시('.' 방지)
7110
7117
  // 1.9.350 (UR-0060 외부리뷰): leerness 자기 harness.js(regex 소스) + 생성 secret-policy 템플릿만 제외 — 정확 경로(사용자 파일명 substring false-negative 제거)
7111
7118
  if (path.resolve(file) === path.resolve(__filename) || /(^|[\\/])\.(?:harness|leerness)[\\/]secret-policy\.md$/.test(fileRel)) continue;
7112
7119
  for (const { name, re } of SECRET_PATTERNS) {
@@ -7139,7 +7146,7 @@ function encodingCheck(root) {
7139
7146
  if (buf.length === 0) continue;
7140
7147
  if (buf.length > 5 * 1024 * 1024) continue;
7141
7148
  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' }); }
7149
+ 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
7150
  else if ((buf[0] === 0xFF && buf[1] === 0xFE) || (buf[0] === 0xFE && buf[1] === 0xFF)) { warnings++; findings.push({ file: fileRel, issue: 'UTF-16 BOM' }); }
7144
7151
  let nul = false; for (let i = 0; i < Math.min(buf.length, 4096); i++) if (buf[i] === 0) { nul = true; break; }
7145
7152
  if (nul) { warnings++; findings.push({ file: fileRel, issue: 'NUL byte (binary in text path)' }); }
@@ -7147,13 +7154,13 @@ function encodingCheck(root) {
7147
7154
  const text = buf.toString('utf8').replace(/^/, '');
7148
7155
  if (!/^@?chcp\s+65001/i.test(text.split(/\r?\n/, 1)[0] || '')) { warnings++; findings.push({ file: fileRel, issue: '.bat missing chcp 65001' }); }
7149
7156
  }
7157
+ // 1.9.353 (UR-0067 외부리뷰): 가-힣 게이트 제거 — CP949/Latin-1 등 invalid UTF-8 은 한글 포함 여부와 무관하게 round-trip 불일치로 감지(이전: 한글 없으면 통과 = false negative). 유효 UTF-8 은 byte-exact round-trip 이라 오탐 없음.
7150
7158
  try {
7151
7159
  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
- }
7160
+ const reBuf = Buffer.from(text, 'utf8');
7161
+ const hasBOM = buf[0] === 0xEF && buf[1] === 0xBB && buf[2] === 0xBF;
7162
+ if (!reBuf.equals(buf) && !hasBOM) {
7163
+ warnings++; findings.push({ file: fileRel, issue: 'invalid UTF-8 roundtrip (CP949/mojibake 의심)' });
7157
7164
  }
7158
7165
  } catch {}
7159
7166
  }
@@ -21158,7 +21165,7 @@ async function main() {
21158
21165
  if (cmd === 'shell-guard' || cmd === 'shellguard') {
21159
21166
  const cmdArg = arg('--cmd', args[1] && !args[1].startsWith('-') ? args[1] : '');
21160
21167
  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') });
21168
+ 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
21169
  }
21163
21170
  // 1.9.265: leerness slash-commands [agent] — CLI 에이전트별 슬래시 명령어 레지스트리 (사용자 명시 UR-0021)
21164
21171
  if (cmd === 'slash-commands' || cmd === 'slash' || cmd === 'agent-slash') {
package/lib/pure-utils.js CHANGED
@@ -11,13 +11,18 @@ function _isSecretKey(k) {
11
11
 
12
12
  // semver 비교: a>b → 1, a<b → -1, 같음 → 0. (누락 파트/null 안전)
13
13
  function compareVer(a, b) {
14
- const sa = String(a || '0').split('.').map(n => parseInt(n || '0', 10));
15
- const sb = String(b || '0').split('.').map(n => parseInt(n || '0', 10));
14
+ const A = String(a || '0'), B = String(b || '0');
15
+ const sa = A.split('-')[0].split('.').map(n => parseInt(n || '0', 10));
16
+ const sb = B.split('-')[0].split('.').map(n => parseInt(n || '0', 10));
16
17
  for (let i = 0; i < 3; i++) {
17
18
  const x = sa[i] || 0, y = sb[i] || 0;
18
19
  if (x > y) return 1;
19
20
  if (x < y) return -1;
20
21
  }
22
+ // 1.9.354 (UR-0072 외부리뷰): 숫자 동일 시 pre-release(-beta/-next 등) < 정식 (semver 규칙). 이전: -beta 무시 → 동일 취급.
23
+ const preA = A.includes('-'), preB = B.includes('-');
24
+ if (preA && !preB) return -1;
25
+ if (!preA && preB) return 1;
21
26
  return 0;
22
27
  }
23
28
 
@@ -36,15 +41,17 @@ function parseHarnessVersion(text) {
36
41
 
37
42
  // UTF-8 바이트열의 CJK 분류 (한국어/일본어/중국어/기타) — 인코딩 오인식 위험 감지용.
38
43
  function _classifyCJK(buf, len) {
39
- let korean = 0, japanese = 0, chinese = 0, other = 0;
44
+ let korean = 0, japanese = 0, chinese = 0, other = 0, han = 0;
40
45
  for (let i = 0; i < Math.min(buf.length, len); i++) {
41
46
  const b = buf[i];
42
47
  if (b < 0x80) continue;
43
48
  if (b >= 0xEA && b <= 0xED) korean++;
44
- else if (b === 0xE3) japanese++;
45
- else if (b >= 0xE4 && b <= 0xE9) chinese++;
49
+ else if (b === 0xE3) japanese++; // kana/기호 (U+3000-3FFF) — 일본어 강한 신호
50
+ else if (b >= 0xE4 && b <= 0xE9) han++; // CJK 통합 한자 — 한·중·일 공유라 모호
46
51
  else other++;
47
52
  }
53
+ // 1.9.354 (UR-0072 외부리뷰): 한자는 한·중·일 공유라 lead byte 만으로 판별 불가 → kana 가 있으면 일본어, 없으면 중국어로 귀속(휴리스틱). advisory 라벨 일본어 오판 완화.
54
+ if (japanese > 0) japanese += han; else chinese += han;
48
55
  return { korean, japanese, chinese, other };
49
56
  }
50
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.352",
3
+ "version": "1.9.354",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -4693,5 +4693,63 @@ 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
+
4726
+ // 1.9.354 회귀 (외부리뷰 P3 UR-0072): compareVer pre-release + _classifyCJK + scan secrets 파일경로 + requests drop ✓
4727
+ total++;
4728
+ {
4729
+ let ok = false;
4730
+ try {
4731
+ const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
4732
+ const pureOk = m.compareVer('1.9.0-beta', '1.9.0') === -1 && m.compareVer('1.9.0', '1.9.0-beta') === 1 && m.compareVer('1.9.6', '1.9.5') === 1
4733
+ && (() => { const jp = Buffer.from([0xE3, 0x81, 0x82, 0xE6, 0x97, 0xA5]); const r = m._classifyCJK(jp, jp.length); return r.japanese > r.chinese; })();
4734
+ // scan secrets <file> (이전 ENOTDIR) + basename 표시
4735
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-p3-'));
4736
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
4737
+ fs.writeFileSync(path.join(d, 'leak.js'), 'const k = "glpat-' + 'x'.repeat(20) + '";\n');
4738
+ const fr = cp.spawnSync(process.execPath, [CLI, 'scan', 'secrets', path.join(d, 'leak.js')], { encoding: 'utf8', timeout: 20000 });
4739
+ const fout = (fr.stdout || '') + (fr.stderr || '');
4740
+ const fileScanOk = /GitLab PAT/.test(fout) && /leak\.js/.test(fout) && !/ENOTDIR/.test(fout);
4741
+ // requests drop 성공 아이콘 ✓ (실패 ✗ 아님)
4742
+ cp.spawnSync(process.execPath, [CLI, 'requests', 'add', 'P3 drop test', '--path', d], { encoding: 'utf8', timeout: 20000 });
4743
+ const lj = JSON.parse(cp.spawnSync(process.execPath, [CLI, 'requests', 'list', '--path', d, '--json'], { encoding: 'utf8', timeout: 20000 }).stdout);
4744
+ const newId = (lj.requests || []).filter(r => r.status === 'open').pop();
4745
+ let dropOk = false;
4746
+ if (newId) { const dr = cp.spawnSync(process.execPath, [CLI, 'requests', 'drop', newId.id, '--path', d], { encoding: 'utf8', timeout: 20000 }); const dout = (dr.stdout || '') + (dr.stderr || ''); dropOk = /✓ dropped/.test(dout) && !/✗ dropped/.test(dout); }
4747
+ fs.rmSync(d, { recursive: true, force: true });
4748
+ ok = pureOk && fileScanOk && dropOk;
4749
+ } catch {}
4750
+ console.log(ok ? '✓ B(1.9.354) 외부리뷰 P3: compareVer/_classifyCJK + scan secrets 파일 + requests drop ✓ (UR-0072)' : '✗ P3 클러스터 실패');
4751
+ if (!ok) failed++;
4752
+ }
4753
+
4696
4754
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
4697
4755
  if (failed > 0) process.exit(1);