leerness 1.9.325 → 1.9.327

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,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.327 — 2026-06-05 — UR-0025(증분): TZ/날짜 포맷 유틸 분리
4
+
5
+ **🧩 순수 TZ/날짜 포맷 함수(`_getLocalTz`/`_formatLocal`)를 lib/pure-utils 로 이전.** (UR-0025 micro-증분 계속)
6
+
7
+ ### 구현 (UR-0025)
8
+ 1. **`_getLocalTz`**(env LEERNESS_TZ / 시스템 tz / Asia/Seoul fallback) + **`_formatLocal`**(ISO UTC → local 표시, 예 "2026-06-05 10:13 KST") → `lib/pure-utils.js`. harness 인라인 제거 → require.
9
+ 2. selftest 74→75 · e2e 271→272.
10
+
11
+ ### 검증
12
+ - **selftest 75/75 PASS** · **E2E 272/272 PASS** (회귀 0, import-블록 견고 패턴).
13
+ - 실측: `_formatLocal('…01:13Z', {tz:'Asia/Seoul'})`→`2026-06-05 10:13 KST`(UTC+9) · dateOnly→`2026-06-05` · 빈값→`?`.
14
+
15
+ ## 1.9.326 — 2026-06-05 — UR-0025(증분): 순수 문자열/셸/env 유틸 3종 분리
16
+
17
+ **🧩 순수 유틸 3종(`_sanitizeFences`/`_shellQuoteArg`/`_detectPwshFromEnv`)을 lib/pure-utils 로 이전.** (사용자 선택: UR-0025 micro-증분 계속)
18
+
19
+ ### 구현 (UR-0025)
20
+ 1. **`_sanitizeFences`**(코드펜스 ``` → ''' 중립화) + **`_shellQuoteArg`**(shell:true spawn 인자 안전 인용, POSIX/Windows) + **`_detectPwshFromEnv`**(pwsh 6/7 신뢰 마커 감지) → `lib/pure-utils.js`. harness 인라인 제거 → require.
21
+ 2. 기존 selftest(B 1.9.300 _shellQuoteArg, B 1.9.314 _detectPwshFromEnv)는 import 경유로 통과 — 동작 동일.
22
+ 3. selftest 73→74 · e2e 270→271.
23
+
24
+ ### 검증
25
+ - **selftest 74/74 PASS** · **E2E 271/271 PASS** (회귀 0 — 이번엔 import-블록 추출 견고 패턴으로 브리틀 회귀 없음).
26
+ - 실측: `_sanitizeFences('a```b')`→`a'''b` · `_detectPwshFromEnv({channel})`→v7 · `_shellQuoteArg` 인용 · shell-guard/session close 소비 명령 정상.
27
+
3
28
  ## 1.9.325 — 2026-06-05 — UR-0025(증분): _classifyIntent 분리 + 모듈화 테스트 견고화
4
29
 
5
30
  **🧩 순수 intent 분류 함수를 lib/pure-utils 로 이전 + 모듈화 회귀 테스트를 import 순서 비의존으로 견고화.**
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.325-green)]() [![tests](https://img.shields.io/badge/e2e-270%2F270-success)]() [![selftest](https://img.shields.io/badge/selftest-73-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.327-green)]() [![tests](https://img.shields.io/badge/e2e-272%2F272-success)]() [![selftest](https://img.shields.io/badge/selftest-75-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.325 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.327 하네스를 사용합니다. 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.325는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.327는 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.325는 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.325)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.327)** · 매 라운드 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.325: 2026-06-05
587
+ Last synced by Leerness v1.9.327: 2026-06-05
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -10,13 +10,15 @@ const readline = require('readline');
10
10
  const { _isSecretKey, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
11
11
  PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
12
12
  _htmlToText, _extractTitle, _extractLinks,
13
- _countDatedBlocks, _extractDecisionBlocks, _classifyIntent } = require('../lib/pure-utils'); // 1.9.318/324/325 (UR-0025): 순수 HTML/메모리/intent 분리
13
+ _countDatedBlocks, _extractDecisionBlocks, _classifyIntent,
14
+ _sanitizeFences, _shellQuoteArg, _detectPwshFromEnv,
15
+ _getLocalTz, _formatLocal } = require('../lib/pure-utils'); // 1.9.318~327 (UR-0025): 순수 HTML/메모리/intent/문자열·셸·env/날짜 분리
14
16
  // 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
15
17
  const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
16
18
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
17
19
  const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
18
20
 
19
- const VERSION = '1.9.325';
21
+ const VERSION = '1.9.327';
20
22
 
21
23
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
22
24
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -157,16 +159,7 @@ function warn(s) { log('⚠ ' + s); }
157
159
  // 1.9.306 (UR-0045, 설치리뷰 3중수렴): fail() 은 오류 신호 → exit code 1 설정 (CI/MCP/에이전트가 실패를 성공으로 오판 방지).
158
160
  // 비치명 경고는 warn() 사용. process.exit 즉시종료가 아니라 exitCode 설정(후속 출력/정리 보존, main 종료 wrapper 가 강제).
159
161
  function fail(s) { log('✗ ' + s); process.exitCode = 1; }
160
- // 1.9.287 (Codex 리뷰 수렴): 임베딩 텍스트의 코드펜스(```)를 중립화해 외부 마크다운(session-handoff)이 깨지지 않게.
161
- // ``` → ''' (펜스가 아닌 표시), 인라인 백틱은 보존. 순수 함수.
162
- function _sanitizeFences(s) { return String(s || '').replace(/```+/g, "'''"); }
163
- // 1.9.289 (Codex gpt-5.5 리뷰 #3 수렴): shell:true spawn 의 인자를 셸-안전하게 인용 — 프롬프트 셸 주입/분리 방지.
164
- // POSIX(sh): single-quote (bulletproof). Windows(cmd.exe): double-quote + inner " 이스케이프 (공백/&|<>() 안전).
165
- function _shellQuoteArg(s) {
166
- s = String(s == null ? '' : s);
167
- if (process.platform === 'win32') return '"' + s.replace(/"/g, '""') + '"';
168
- return "'" + s.replace(/'/g, "'\\''") + "'";
169
- }
162
+ // 1.9.326 (UR-0025): _sanitizeFences / _shellQuoteArg lib/pure-utils.js 로 이동 (순수 문자열/셸 유틸, require 사용).
170
163
  // 1.9.297 (UR-0025 5단계): MCP 도구 수 = lib/mcp-tools.js 모듈 length (진짜 단일 출처).
171
164
  // 이전(1.9.288): __filename regex self-count — 도구 정의가 소스에 있어야만 동작(취약, Codex #5). 이제 tools/list 와 동일 배열을 직접 카운트.
172
165
  function _mcpToolCount() {
@@ -230,40 +223,7 @@ function _withLock(targetPath, fn, opts = {}) {
230
223
  function rel(root, p) { return path.relative(root, p).replace(/\\/g, '/') || '.'; }
231
224
  function today() { return new Date().toISOString().slice(0, 10); }
232
225
  function now() { return new Date().toISOString(); }
233
- // 1.9.204: timezone 보강 (사용자 명시)
234
- // ISO UTC timestamp 저장은 유지 (이식성/일관성) → display 시 사용자 local time 변환
235
- // 환경변수: LEERNESS_TZ (default = 시스템 timezone, fallback: 'Asia/Seoul')
236
- function _getLocalTz() {
237
- if (process.env.LEERNESS_TZ) return process.env.LEERNESS_TZ;
238
- try {
239
- const sys = Intl.DateTimeFormat().resolvedOptions().timeZone;
240
- if (sys && sys !== 'UTC') return sys;
241
- } catch {}
242
- return 'Asia/Seoul';
243
- }
244
- // ISO timestamp → local time 표시 (예: "2026-05-22 10:13 KST")
245
- function _formatLocal(iso, opts) {
246
- if (!iso) return '?';
247
- opts = opts || {};
248
- const tz = opts.tz || _getLocalTz();
249
- try {
250
- const d = typeof iso === 'string' ? new Date(iso) : iso;
251
- if (isNaN(d.getTime())) return String(iso);
252
- const fmt = new Intl.DateTimeFormat('en-CA', {
253
- timeZone: tz,
254
- year: 'numeric', month: '2-digit', day: '2-digit',
255
- hour: '2-digit', minute: '2-digit',
256
- hour12: false
257
- });
258
- const parts = fmt.formatToParts(d);
259
- const get = (t) => (parts.find(p => p.type === t) || {}).value || '';
260
- const date = `${get('year')}-${get('month')}-${get('day')}`;
261
- const time = `${get('hour')}:${get('minute')}`;
262
- // tz 약어 (KST/JST/UTC 등) — 간단 추출
263
- const tzShort = tz === 'Asia/Seoul' ? 'KST' : tz === 'Asia/Tokyo' ? 'JST' : tz === 'UTC' ? 'UTC' : tz.split('/').pop().slice(0, 3);
264
- return opts.dateOnly ? date : `${date} ${time} ${tzShort}`;
265
- } catch { return String(iso); }
266
- }
226
+ // 1.9.327 (UR-0025): _getLocalTz / _formatLocal → lib/pure-utils.js 로 이동 (순수 TZ/날짜 포맷, require 사용).
267
227
  // 자동 모드 활성 여부 (R-XXXX every-round 룰 존재 시 true)
268
228
  function _isAutoLoopActive(root) {
269
229
  try {
@@ -2602,18 +2562,7 @@ function _computeRecentChanges(root, limit = 5) {
2602
2562
  // 배경: 이전엔 powershell.exe(=5.1)만 probe + ComSpec(항상 cmd.exe) 의존 → pwsh7 을 ps5/cmd 로 오판 → && 에 ps5-chain 오탐.
2603
2563
  // 신뢰 마커: POWERSHELL_DISTRIBUTION_CHANNEL(pwsh 런타임 전용, cmd/ps5 미상속) · PSModulePath 의 사용자 모듈 경로
2604
2564
  // (Documents\PowerShell=pwsh7 / Documents\WindowsPowerShell=ps5.1). 시스템 경로는 cmd 도 가져 비신뢰 → 사용자 경로만 판별.
2605
- function _detectPwshFromEnv(e) {
2606
- e = e || process.env;
2607
- const channel = e.POWERSHELL_DISTRIBUTION_CHANNEL || '';
2608
- const pmp = e.PSModulePath || '';
2609
- // pwsh 6/7 (Core) 신뢰 마커: POWERSHELL_DISTRIBUTION_CHANNEL(pwsh 런타임 전용, cmd/ps5 미상속) · pwsh 전용 경로(\PowerShell\7|6\, Documents\PowerShell\).
2610
- // pwsh 오검출은 안전 — pwsh 는 &&/|| 지원 → ps5-chain 오탐을 만들지 않음.
2611
- // ⚠ ps5.1 은 신뢰 가능한 런타임 마커가 없음(Documents\WindowsPowerShell 은 영구 user env → bash/cmd 도 상속) → 자동 판별하지 않음(과경고 방지).
2612
- if (channel || /[\\/]PowerShell[\\/][67][\\/]/i.test(pmp) || /Documents[\\/]+PowerShell[\\/]/i.test(pmp)) {
2613
- return { isPowerShell: true, version: '7', edition: 'Core' };
2614
- }
2615
- return { isPowerShell: false, version: null, edition: null };
2616
- }
2565
+ // 1.9.326 (UR-0025): _detectPwshFromEnv → lib/pure-utils.js 로 이동 (순수 PowerShell env 감지, require 사용).
2617
2566
  function _collectRuntimeEnv() {
2618
2567
  const env = {
2619
2568
  os: { platform: os.platform(), release: os.release(), arch: os.arch() },
@@ -3118,6 +3067,8 @@ function _selfTestCases() {
3118
3067
  { name: 'fresh-init gate 통과: lazy detect 부재신호(handoff/test/progress) done-work 없으면 비차단 (UR-0054 ⑥ 1.9.323)', run: () => { const src = read(__filename); const doneWork = src.includes("const _hasDoneWork = rows.some(r => /^(done|completed|verified)$/i.test(r.status))"); const advisory = src.includes('_ADVISORY_KINDS') && src.includes("'handoff_never_generated'") && src.includes("'no_test_run'"); const blocking = src.includes('const blockingIssues = Math.max(0, issues - advisoryCount)') && src.includes('if (blockingIssues > 0) process.exitCode = 1'); return doneWork && advisory && blocking; } },
3119
3068
  { name: 'lib/pure-utils: 메모리 MD 파서 분리(_countDatedBlocks/_extractDecisionBlocks) + _compareSemver 중복제거 (UR-0025 1.9.324)', run: () => { const m = require('../lib/pure-utils'); const fnOk = typeof m._countDatedBlocks === 'function' && typeof m._extractDecisionBlocks === 'function'; const work = m._countDatedBlocks('```md\n### 2026-01-01 — T\n```\n### 2026-06-05 — R\n') === 1 && m._extractDecisionBlocks('### 2026-06-05 — A\n- Decision: x\n').length === 1; const src = read(__filename); const moved = m._countDatedBlocks === _countDatedBlocks && m._extractDecisionBlocks === _extractDecisionBlocks && !/^function _countDatedBlocks\(/m.test(src) && !/^function _compareSemver\(/m.test(src); return fnOk && work && moved; } },
3120
3069
  { name: 'lib/pure-utils: _classifyIntent 분리 (precise/broad/default 분류) + 인라인 제거 (UR-0025 1.9.325)', run: () => { const m = require('../lib/pure-utils'); const fnOk = typeof m._classifyIntent === 'function'; const work = m._classifyIntent('정확히 그것만').intent === 'precise' && m._classifyIntent('전체 다양한 기능').intent === 'broad' && m._classifyIntent('로그인 구현').intent === 'default'; const moved = m._classifyIntent === _classifyIntent && !/^function _classifyIntent\(/m.test(read(__filename)); return fnOk && work && moved; } },
3070
+ { name: 'lib/pure-utils: 문자열/셸/env 유틸 분리(_sanitizeFences/_shellQuoteArg/_detectPwshFromEnv) (UR-0025 1.9.326)', run: () => { const m = require('../lib/pure-utils'); const fnOk = typeof m._sanitizeFences === 'function' && typeof m._shellQuoteArg === 'function' && typeof m._detectPwshFromEnv === 'function'; const work = m._sanitizeFences('a```b') === "a'''b" && m._detectPwshFromEnv({ POWERSHELL_DISTRIBUTION_CHANNEL: 'X' }).version === '7' && /^['"]/.test(m._shellQuoteArg('a b')); const src = read(__filename); const moved = m._sanitizeFences === _sanitizeFences && !/^function _sanitizeFences\(/m.test(src) && !/^function _shellQuoteArg\(/m.test(src) && !/^function _detectPwshFromEnv\(/m.test(src); return fnOk && work && moved; } },
3071
+ { name: 'lib/pure-utils: TZ/날짜 포맷 분리(_getLocalTz/_formatLocal) + 인라인 제거 (UR-0025 1.9.327)', run: () => { const m = require('../lib/pure-utils'); const fnOk = typeof m._getLocalTz === 'function' && typeof m._formatLocal === 'function'; const work = m._formatLocal('2026-06-05T01:13:00.000Z', { tz: 'Asia/Seoul' }) === '2026-06-05 10:13 KST' && m._formatLocal('2026-06-05T01:13:00.000Z', { tz: 'Asia/Seoul', dateOnly: true }) === '2026-06-05' && m._formatLocal('') === '?'; const src = read(__filename); const moved = m._formatLocal === _formatLocal && !/^function _formatLocal\(/m.test(src) && !/^function _getLocalTz\(/m.test(src); return fnOk && work && moved; } },
3121
3072
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3122
3073
  ];
3123
3074
  }
package/lib/pure-utils.js CHANGED
@@ -233,6 +233,57 @@ function _classifyIntent(text) {
233
233
  return { intent, signals, preciseCount, broadCount };
234
234
  }
235
235
 
236
+ // 1.9.326 (UR-0025): 순수 문자열/셸/env 유틸.
237
+ // 코드펜스(```) 중립화 — 임베딩 텍스트가 외부 마크다운을 깨지 않게. (``` → ''', 인라인 백틱 보존)
238
+ function _sanitizeFences(s) { return String(s || '').replace(/```+/g, "'''"); }
239
+ // shell:true spawn 인자 셸-안전 인용 — POSIX(sh) single-quote / Windows(cmd) double-quote + inner " 이스케이프.
240
+ function _shellQuoteArg(s) {
241
+ s = String(s == null ? '' : s);
242
+ if (process.platform === 'win32') return '"' + s.replace(/"/g, '""') + '"';
243
+ return "'" + s.replace(/'/g, "'\\''") + "'";
244
+ }
245
+ // Windows PowerShell 실행 env 감지 — pwsh 6/7 신뢰 마커(POWERSHELL_DISTRIBUTION_CHANNEL / pwsh 전용 경로)만 판별(ps5.1 자동판별 안 함).
246
+ function _detectPwshFromEnv(e) {
247
+ e = e || process.env;
248
+ const channel = e.POWERSHELL_DISTRIBUTION_CHANNEL || '';
249
+ const pmp = e.PSModulePath || '';
250
+ if (channel || /[\\/]PowerShell[\\/][67][\\/]/i.test(pmp) || /Documents[\\/]+PowerShell[\\/]/i.test(pmp)) {
251
+ return { isPowerShell: true, version: '7', edition: 'Core' };
252
+ }
253
+ return { isPowerShell: false, version: null, edition: null };
254
+ }
255
+
256
+ // 1.9.327 (UR-0025): 순수 TZ/날짜 포맷 — ISO UTC 저장 유지, 표시 시 local 변환 (env LEERNESS_TZ / 시스템 tz / Asia/Seoul fallback).
257
+ function _getLocalTz() {
258
+ if (process.env.LEERNESS_TZ) return process.env.LEERNESS_TZ;
259
+ try {
260
+ const sys = Intl.DateTimeFormat().resolvedOptions().timeZone;
261
+ if (sys && sys !== 'UTC') return sys;
262
+ } catch {}
263
+ return 'Asia/Seoul';
264
+ }
265
+ function _formatLocal(iso, opts) {
266
+ if (!iso) return '?';
267
+ opts = opts || {};
268
+ const tz = opts.tz || _getLocalTz();
269
+ try {
270
+ const d = typeof iso === 'string' ? new Date(iso) : iso;
271
+ if (isNaN(d.getTime())) return String(iso);
272
+ const fmt = new Intl.DateTimeFormat('en-CA', {
273
+ timeZone: tz,
274
+ year: 'numeric', month: '2-digit', day: '2-digit',
275
+ hour: '2-digit', minute: '2-digit',
276
+ hour12: false
277
+ });
278
+ const parts = fmt.formatToParts(d);
279
+ const get = (t) => (parts.find(p => p.type === t) || {}).value || '';
280
+ const date = `${get('year')}-${get('month')}-${get('day')}`;
281
+ const time = `${get('hour')}:${get('minute')}`;
282
+ const tzShort = tz === 'Asia/Seoul' ? 'KST' : tz === 'Asia/Tokyo' ? 'JST' : tz === 'UTC' ? 'UTC' : tz.split('/').pop().slice(0, 3);
283
+ return opts.dateOnly ? date : `${date} ${time} ${tzShort}`;
284
+ } catch { return String(iso); }
285
+ }
286
+
236
287
  module.exports = {
237
288
  _isSecretKey, compareVer, parseHarnessVersion,
238
289
  _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
@@ -243,5 +294,9 @@ module.exports = {
243
294
  // 1.9.324 (UR-0025): 순수 메모리 MD 파서
244
295
  _countDatedBlocks, _extractDecisionBlocks,
245
296
  // 1.9.325 (UR-0025): 순수 intent 분류
246
- _classifyIntent
297
+ _classifyIntent,
298
+ // 1.9.326 (UR-0025): 순수 문자열/셸/env 유틸
299
+ _sanitizeFences, _shellQuoteArg, _detectPwshFromEnv,
300
+ // 1.9.327 (UR-0025): 순수 TZ/날짜 포맷
301
+ _getLocalTz, _formatLocal
247
302
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.325",
3
+ "version": "1.9.327",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -3947,5 +3947,49 @@ total++;
3947
3947
  if (!ok) failed++;
3948
3948
  }
3949
3949
 
3950
+ // 1.9.326 회귀 (UR-0025 모듈화): 순수 문자열/셸/env 유틸 3종 lib/pure-utils 분리 + harness 인라인 제거
3951
+ total++;
3952
+ {
3953
+ let ok = false;
3954
+ try {
3955
+ const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
3956
+ const fnOk = typeof m._sanitizeFences === 'function' && typeof m._shellQuoteArg === 'function' && typeof m._detectPwshFromEnv === 'function';
3957
+ const work = m._sanitizeFences('a```b') === "a'''b"
3958
+ && m._detectPwshFromEnv({ POWERSHELL_DISTRIBUTION_CHANNEL: 'X' }).version === '7'
3959
+ && m._detectPwshFromEnv({}).isPowerShell === false
3960
+ && /^['"]/.test(m._shellQuoteArg('a b'));
3961
+ const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
3962
+ const _puImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/pure-utils'\)/) || [''])[0]; // import 순서 비의존
3963
+ const movedOut = !/function _sanitizeFences\(/.test(harnessSrc) && !/function _shellQuoteArg\(/.test(harnessSrc) && !/function _detectPwshFromEnv\(/.test(harnessSrc)
3964
+ && _puImp.includes('_sanitizeFences') && _puImp.includes('_shellQuoteArg') && _puImp.includes('_detectPwshFromEnv');
3965
+ // 소비 명령 회귀: shell-guard (_detectPwshFromEnv 사용) + session close (_sanitizeFences 사용)
3966
+ const sg = cp.spawnSync(process.execPath, [CLI, 'shell-guard', 'echo hi', '--json'], { encoding: 'utf8', timeout: 15000 });
3967
+ const cmdOk = sg.status === 0 && /"shell"/.test(sg.stdout || '');
3968
+ ok = fnOk && work && movedOut && cmdOk;
3969
+ } catch {}
3970
+ console.log(ok ? '✓ B(1.9.326) lib/pure-utils 문자열/셸/env 유틸 분리: 모듈 단일출처 + 인라인 제거 + shell-guard (UR-0025)' : '✗ 문자열/셸/env 유틸 분리 실패');
3971
+ if (!ok) failed++;
3972
+ }
3973
+
3974
+ // 1.9.327 회귀 (UR-0025 모듈화): TZ/날짜 포맷 2종 lib/pure-utils 분리 + harness 인라인 제거
3975
+ total++;
3976
+ {
3977
+ let ok = false;
3978
+ try {
3979
+ const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
3980
+ const fnOk = typeof m._getLocalTz === 'function' && typeof m._formatLocal === 'function';
3981
+ const work = m._formatLocal('2026-06-05T01:13:00.000Z', { tz: 'Asia/Seoul' }) === '2026-06-05 10:13 KST' // UTC→KST +9h
3982
+ && m._formatLocal('2026-06-05T01:13:00.000Z', { tz: 'Asia/Seoul', dateOnly: true }) === '2026-06-05'
3983
+ && m._formatLocal('') === '?' && typeof m._getLocalTz() === 'string';
3984
+ const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
3985
+ const _puImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/pure-utils'\)/) || [''])[0]; // import 순서 비의존
3986
+ const movedOut = !/function _formatLocal\(/.test(harnessSrc) && !/function _getLocalTz\(/.test(harnessSrc)
3987
+ && _puImp.includes('_getLocalTz') && _puImp.includes('_formatLocal');
3988
+ ok = fnOk && work && movedOut;
3989
+ } catch {}
3990
+ console.log(ok ? '✓ B(1.9.327) lib/pure-utils TZ/날짜 포맷 분리: 모듈 단일출처 + 인라인 제거 (UR-0025)' : '✗ TZ/날짜 포맷 분리 실패');
3991
+ if (!ok) failed++;
3992
+ }
3993
+
3950
3994
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
3951
3995
  if (failed > 0) process.exit(1);