leerness 1.9.325 → 1.9.326
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 +13 -0
- package/README.md +5 -5
- package/bin/harness.js +6 -24
- package/lib/pure-utils.js +23 -1
- package/package.json +1 -1
- package/scripts/e2e.js +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.326 — 2026-06-05 — UR-0025(증분): 순수 문자열/셸/env 유틸 3종 분리
|
|
4
|
+
|
|
5
|
+
**🧩 순수 유틸 3종(`_sanitizeFences`/`_shellQuoteArg`/`_detectPwshFromEnv`)을 lib/pure-utils 로 이전.** (사용자 선택: UR-0025 micro-증분 계속)
|
|
6
|
+
|
|
7
|
+
### 구현 (UR-0025)
|
|
8
|
+
1. **`_sanitizeFences`**(코드펜스 ``` → ''' 중립화) + **`_shellQuoteArg`**(shell:true spawn 인자 안전 인용, POSIX/Windows) + **`_detectPwshFromEnv`**(pwsh 6/7 신뢰 마커 감지) → `lib/pure-utils.js`. harness 인라인 제거 → require.
|
|
9
|
+
2. 기존 selftest(B 1.9.300 _shellQuoteArg, B 1.9.314 _detectPwshFromEnv)는 import 경유로 통과 — 동작 동일.
|
|
10
|
+
3. selftest 73→74 · e2e 270→271.
|
|
11
|
+
|
|
12
|
+
### 검증
|
|
13
|
+
- **selftest 74/74 PASS** · **E2E 271/271 PASS** (회귀 0 — 이번엔 import-블록 추출 견고 패턴으로 브리틀 회귀 없음).
|
|
14
|
+
- 실측: `_sanitizeFences('a```b')`→`a'''b` · `_detectPwshFromEnv({channel})`→v7 · `_shellQuoteArg` 인용 · shell-guard/session close 소비 명령 정상.
|
|
15
|
+
|
|
3
16
|
## 1.9.325 — 2026-06-05 — UR-0025(증분): _classifyIntent 분리 + 모듈화 테스트 견고화
|
|
4
17
|
|
|
5
18
|
**🧩 순수 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
|
-
[](https://www.npmjs.com/package/leerness) [](https://www.npmjs.com/package/leerness) []() []() []() []() []() []()
|
|
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.
|
|
474
|
+
이 프로젝트는 Leerness v1.9.326 하네스를 사용합니다. 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.
|
|
528
|
+
Leerness v1.9.326는 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.
|
|
549
|
+
현재 누적: **70 라운드 (1.9.40 → 1.9.326)** · 매 라운드 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.
|
|
587
|
+
Last synced by Leerness v1.9.326: 2026-06-05
|
|
588
588
|
<!-- leerness:project-readme:end -->
|
|
589
589
|
|
package/bin/harness.js
CHANGED
|
@@ -10,13 +10,14 @@ 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
|
|
13
|
+
_countDatedBlocks, _extractDecisionBlocks, _classifyIntent,
|
|
14
|
+
_sanitizeFences, _shellQuoteArg, _detectPwshFromEnv } = require('../lib/pure-utils'); // 1.9.318~326 (UR-0025): 순수 HTML/메모리/intent/문자열·셸·env 분리
|
|
14
15
|
// 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
|
|
15
16
|
const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
|
|
16
17
|
// 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
|
|
17
18
|
const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
|
|
18
19
|
|
|
19
|
-
const VERSION = '1.9.
|
|
20
|
+
const VERSION = '1.9.326';
|
|
20
21
|
|
|
21
22
|
// 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
|
|
22
23
|
// 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
|
|
@@ -157,16 +158,7 @@ function warn(s) { log('⚠ ' + s); }
|
|
|
157
158
|
// 1.9.306 (UR-0045, 설치리뷰 3중수렴): fail() 은 오류 신호 → exit code 1 설정 (CI/MCP/에이전트가 실패를 성공으로 오판 방지).
|
|
158
159
|
// 비치명 경고는 warn() 사용. process.exit 즉시종료가 아니라 exitCode 설정(후속 출력/정리 보존, main 종료 wrapper 가 강제).
|
|
159
160
|
function fail(s) { log('✗ ' + s); process.exitCode = 1; }
|
|
160
|
-
// 1.9.
|
|
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
|
-
}
|
|
161
|
+
// 1.9.326 (UR-0025): _sanitizeFences / _shellQuoteArg → lib/pure-utils.js 로 이동 (순수 문자열/셸 유틸, require 사용).
|
|
170
162
|
// 1.9.297 (UR-0025 5단계): MCP 도구 수 = lib/mcp-tools.js 모듈 length (진짜 단일 출처).
|
|
171
163
|
// 이전(1.9.288): __filename regex self-count — 도구 정의가 소스에 있어야만 동작(취약, Codex #5). 이제 tools/list 와 동일 배열을 직접 카운트.
|
|
172
164
|
function _mcpToolCount() {
|
|
@@ -2602,18 +2594,7 @@ function _computeRecentChanges(root, limit = 5) {
|
|
|
2602
2594
|
// 배경: 이전엔 powershell.exe(=5.1)만 probe + ComSpec(항상 cmd.exe) 의존 → pwsh7 을 ps5/cmd 로 오판 → && 에 ps5-chain 오탐.
|
|
2603
2595
|
// 신뢰 마커: POWERSHELL_DISTRIBUTION_CHANNEL(pwsh 런타임 전용, cmd/ps5 미상속) · PSModulePath 의 사용자 모듈 경로
|
|
2604
2596
|
// (Documents\PowerShell=pwsh7 / Documents\WindowsPowerShell=ps5.1). 시스템 경로는 cmd 도 가져 비신뢰 → 사용자 경로만 판별.
|
|
2605
|
-
|
|
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
|
-
}
|
|
2597
|
+
// 1.9.326 (UR-0025): _detectPwshFromEnv → lib/pure-utils.js 로 이동 (순수 PowerShell env 감지, require 사용).
|
|
2617
2598
|
function _collectRuntimeEnv() {
|
|
2618
2599
|
const env = {
|
|
2619
2600
|
os: { platform: os.platform(), release: os.release(), arch: os.arch() },
|
|
@@ -3118,6 +3099,7 @@ function _selfTestCases() {
|
|
|
3118
3099
|
{ 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
3100
|
{ 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
3101
|
{ 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; } },
|
|
3102
|
+
{ 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; } },
|
|
3121
3103
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
3122
3104
|
];
|
|
3123
3105
|
}
|
package/lib/pure-utils.js
CHANGED
|
@@ -233,6 +233,26 @@ 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
|
+
|
|
236
256
|
module.exports = {
|
|
237
257
|
_isSecretKey, compareVer, parseHarnessVersion,
|
|
238
258
|
_classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
|
|
@@ -243,5 +263,7 @@ module.exports = {
|
|
|
243
263
|
// 1.9.324 (UR-0025): 순수 메모리 MD 파서
|
|
244
264
|
_countDatedBlocks, _extractDecisionBlocks,
|
|
245
265
|
// 1.9.325 (UR-0025): 순수 intent 분류
|
|
246
|
-
_classifyIntent
|
|
266
|
+
_classifyIntent,
|
|
267
|
+
// 1.9.326 (UR-0025): 순수 문자열/셸/env 유틸
|
|
268
|
+
_sanitizeFences, _shellQuoteArg, _detectPwshFromEnv
|
|
247
269
|
};
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -3947,5 +3947,29 @@ 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
|
+
|
|
3950
3974
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
3951
3975
|
if (failed > 0) process.exit(1);
|