leerness 1.9.359 → 1.9.361
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 +36 -0
- package/README.md +5 -5
- package/bin/harness.js +45 -16
- package/package.json +1 -1
- package/scripts/e2e.js +59 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.361 — 2026-06-06 — 안정화② 외부리뷰 CV-1 --path 라우팅 통일 + CV-3 audit 가드 (UR-0076/0078)
|
|
4
|
+
|
|
5
|
+
**🛠 외부 멀티모델 리뷰 안정화 시리즈 2탄 — 3개 모델 합의 #1 finding(--path 불일치) + audit 오판 수정.**
|
|
6
|
+
|
|
7
|
+
### 배경
|
|
8
|
+
- **CV-1 (P1, 3/3 모델 + 자체검증)**: 다수 명령이 positional / `--path=값` 을 무시하고 cwd 로 silent fallback. 특히 `session close --path X` 가 cwd 에 써서 **wrong-root 쓰기**(데이터 정합 위험).
|
|
9
|
+
- **CV-3 (P1, 2/3 + 자체재현)**: `audit` 가 미초기화/존재하지 않는 경로를 `healthy:true` 로 오판(verify 는 올바르게 exit 1).
|
|
10
|
+
|
|
11
|
+
### 구현
|
|
12
|
+
1. **`arg()` `--path=값` 등호형 지원** (이전엔 `--path 값` 공백형만 — Opus 지적). 전 `arg('--path',...)` 명령에 일괄 적용.
|
|
13
|
+
2. **공통 `_resolveRoot(positional)` 헬퍼**: `--path`(=값 포함) > 유효 positional > cwd. silent cwd fallback 방지.
|
|
14
|
+
3. **적용**: `session close`(wrong-root 쓰기 해소)·`lazy detect`(--path 무시 해소)·`context`·`pulse`·`milestones`·`round-history`(positional 무시 해소). (`health`/`whats-new`/`drift`/`usage` 등 `args[N] || arg('--path',cwd)` 형은 이미 양쪽 처리 → arg() 보강만으로 등호형까지 정상.)
|
|
15
|
+
4. **CV-3**: `audit` 시작부에 root/.harness/AGENTS.md 존재 가드 → 미초기화는 failure 승격(healthy=false, exit 1) — verify 와 일관.
|
|
16
|
+
|
|
17
|
+
### 검증 (회귀 0)
|
|
18
|
+
- **selftest 107→108 PASS** (CV-1 행위 검증: argv 주입으로 `arg('--path=값')` + `_resolveRoot` 우선순위 4종 단언). **E2E 305→307 PASS** (CV-1 행위: cwd=B 에서 `session close --path A` → A 의 handoff 재생성·`context --path=` 등호형 정타깃 / CV-3: 미초기화 audit healthy=false).
|
|
19
|
+
- 실측: `context --path A`/`--path=A`/positional A 모두 A 읽음(cwd 아님). audit 미초기화 → healthy:false failures:1.
|
|
20
|
+
|
|
21
|
+
### 잔여 (후속 라운드)
|
|
22
|
+
나머지 `arg('--path',cwd)` 명령(verify-claim/deps/persona/review 등 — positional 이 path 아닌 인자)은 그대로 두되, --path 등호형은 이제 전체 동작. CV-4(멱등/retention)·CV-5(selftest 행위화 추가)·CV-6(스캐너 FP/FN)·CV-7(help registry) 후속.
|
|
23
|
+
|
|
24
|
+
## 1.9.360 — 2026-06-05 — 안정화① 외부리뷰 CV-2: fetchNpmLatest 신형 Node Windows EINVAL 회피 (UR-0077)
|
|
25
|
+
|
|
26
|
+
**🛠 외부 멀티모델 리뷰(1.9.359) 안정화 시리즈 1탄.** `update --check` 가 신형 Node Windows 에서 `spawn EINVAL` 로 실패하던 회귀를 수정. (Codex+Sonnet 교차검증 + 자체 재현 Node v26.3.0)
|
|
27
|
+
|
|
28
|
+
### 배경 — 외부 리뷰 CV-2 (P1, 2/3 모델 + 자체 재현)
|
|
29
|
+
Node 18.20.2+/20.12.2+/21.7.3+/22+/26 은 `shell:true` 없이 `.cmd` 파일을 spawn 하면 `EINVAL` 을 던진다(CVE-2024-27980 수정 부작용). UR-0066(1.9.352)이 셸 주입 표면 제거를 위해 `npm.cmd` 를 직접 `execFile` 하도록 바꾼 것이 이 환경에서 회귀를 유발 → `update --check` 무력화. 게다가 init 이 SessionStart hook 으로 `update --check` 를 기본 설치하므로 **매 세션 `✗ spawn EINVAL`** 가 출력됐다. 자체 재현: Node v26.3.0 에서 `update --check` → `✗ spawn EINVAL`.
|
|
30
|
+
|
|
31
|
+
### 구현
|
|
32
|
+
1. **`fetchNpmLatest` win 경로 교체**: `npm.cmd` 직접 execFile → **`cmd.exe /d /s /c npm view <pkg> version`**. cmd.exe 는 `.exe` 라 EINVAL 없음, `shell:true` 미사용이라 DEP0190(deprecation) 도 회피. pkg 는 charset 검증(메타문자 0)이라 cmd 주입 불가.
|
|
33
|
+
2. **동기 throw 흡수**: execFile 동기 EINVAL throw 를 `try/catch` 로 `resolve(null)` (이전엔 Promise reject 누수).
|
|
34
|
+
|
|
35
|
+
### 검증 (회귀 0)
|
|
36
|
+
- **selftest 106→107 PASS** (UR-0040/UR-0066 케이스를 cmd.exe args 형태로 갱신 + CV-2 EINVAL 회피 가드 추가). **E2E 304→305 PASS** (행위 가드: `update --check` 가 EINVAL 없이 exit 0).
|
|
37
|
+
- 실측: 수정 후 `update --check` → `npm leerness latest: 1.9.360 → up to date` (EINVAL 소멸).
|
|
38
|
+
|
|
3
39
|
## 1.9.359 — 2026-06-05 — UR-0074: install-safety — 설치 안전 프로필 투명 공개 (공급망 신뢰)
|
|
4
40
|
|
|
5
41
|
**🧩 `leerness install-safety` — 0 런타임 의존성 · 0 install-time 스크립트라는 핵심 안전 속성을 사실 그대로 보고 + 안전 설치 워크플로 안내. 외부리뷰 "설치/릴리스 신뢰성" 우려 선제 대응.** (UR-0074, 안정화 배포 직전)
|
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.361 하네스를 사용합니다. 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.361는 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.359는 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.361)** · 매 라운드 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.361: 2026-06-05
|
|
588
588
|
<!-- leerness:project-readme:end -->
|
|
589
589
|
|
package/bin/harness.js
CHANGED
|
@@ -28,7 +28,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
|
|
|
28
28
|
// 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
|
|
29
29
|
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 분리
|
|
30
30
|
|
|
31
|
-
const VERSION = '1.9.
|
|
31
|
+
const VERSION = '1.9.361';
|
|
32
32
|
|
|
33
33
|
// 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
|
|
34
34
|
// 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
|
|
@@ -232,8 +232,21 @@ function _getAutoLoopRule(root) {
|
|
|
232
232
|
return readRules(root).find(r => r.status === 'active' && /every-round/i.test(r.trigger || '')) || null;
|
|
233
233
|
} catch { return null; }
|
|
234
234
|
}
|
|
235
|
-
function arg(name, def = null) {
|
|
235
|
+
function arg(name, def = null) {
|
|
236
|
+
const i = process.argv.indexOf(name);
|
|
237
|
+
if (i >= 0) return process.argv[i + 1] || true;
|
|
238
|
+
const eq = process.argv.find(a => a.startsWith(name + '=')); // --name=value 형태 (외부리뷰 CV-1/UR-0076)
|
|
239
|
+
return eq ? eq.slice(name.length + 1) : def;
|
|
240
|
+
}
|
|
236
241
|
function has(name) { return process.argv.includes(name); }
|
|
242
|
+
// 공통 root 해석 (외부리뷰 CV-1/UR-0076): --path(=값 포함) 플래그 > 유효 positional > cwd.
|
|
243
|
+
// 여러 dispatcher 가 positional 또는 --path 한쪽만 처리하던 불일치(특히 session close 의 wrong-root 쓰기) 해소.
|
|
244
|
+
function _resolveRoot(positional) {
|
|
245
|
+
const p = arg('--path', null);
|
|
246
|
+
if (p && p !== true) return p;
|
|
247
|
+
if (positional && !String(positional).startsWith('-')) return positional;
|
|
248
|
+
return process.cwd();
|
|
249
|
+
}
|
|
237
250
|
function nonFlagArgs() {
|
|
238
251
|
const out = [];
|
|
239
252
|
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']);
|
|
@@ -3005,7 +3018,7 @@ function _selfTestCases() {
|
|
|
3005
3018
|
{ name: 'lib/mcp-tools: MCP 도구 정의 모듈 단일출처 (_mcpToolCount=모듈 length, Codex #5 영구해소) (UR-0025 1.9.297)', run: () => { const T = require('../lib/mcp-tools'); return Array.isArray(T) && T.length >= 81 && T.every(t => t.name && t.description && t.inputSchema) && T[0].name === 'leerness_handoff' && _mcpToolCount() === T.length && !/const TOOLS = \[/.test(read(__filename)); } },
|
|
3006
3019
|
{ name: 'writeUtf8: 원자적 쓰기(temp→rename) 손상방지 (UR-0038 외부리뷰 3중수렴 1.9.298)', run: () => { const src = read(__filename); return /function writeUtf8\(p, s\)/.test(src) && /fs\.writeFileSync\(tmp,/.test(src) && /fs\.renameSync\(tmp, p\)/.test(src) && /\.tmp-\$\{process\.pid\}/.test(src) && /fs\.unlinkSync\(tmp\)/.test(src); } },
|
|
3007
3020
|
{ name: '_scrubTestEnv: npm test 시크릿 차단(_scrubEnv는 release 토큰 유지) (UR-0039 외부리뷰 1.9.299)', run: () => { const o = { N: process.env.NPM_TOKEN, L: process.env.LEERNESS_NPM_TOKEN }; process.env.NPM_TOKEN = 'sec1'; process.env.LEERNESS_NPM_TOKEN = 'sec2'; const base = _scrubEnv(); const test = _scrubTestEnv(); const r = base.NPM_TOKEN === 'sec1' && base.LEERNESS_NPM_TOKEN === 'sec2' && !test.NPM_TOKEN && !test.LEERNESS_NPM_TOKEN && !!test.PATH; if (o.N === undefined) delete process.env.NPM_TOKEN; else process.env.NPM_TOKEN = o.N; if (o.L === undefined) delete process.env.LEERNESS_NPM_TOKEN; else process.env.LEERNESS_NPM_TOKEN = o.L; return r; } },
|
|
3008
|
-
{ name: 'shell 주입 표면 제거: fetchNpmLatest execFile+pkg검증 + runCommandSafe argList 인용 (UR-0040 외부리뷰 1.9.300)', run: () => { const src = read(__filename); const npmFix = /
|
|
3021
|
+
{ name: 'shell 주입 표면 제거: fetchNpmLatest execFile+pkg검증 + runCommandSafe argList 인용 (UR-0040 외부리뷰 1.9.300)', run: () => { const src = read(__filename); const npmFix = /'view', pkg, 'version'/.test(src) && !/cp\.exec\(.npm view \$\{pkg\}/.test(src) && /패키지명 charset/.test(src) && !/cp\.execFile\('npm', \[[^\]]*\], \{ timeout: 12000, shell:/.test(src); const argFix = /argList\.map\(_shellQuoteArg\)\.join/.test(src); return npmFix && argFix && typeof _shellQuoteArg === 'function'; } },
|
|
3009
3022
|
{ name: 'MCP requiredTier 메타데이터 + 정책 minTier 게이트 (UR-0041 외부리뷰 1.9.301)', run: () => { const T = require('../lib/mcp-tools'); const allValid = T.length >= 81 && T.every(t => PERMISSION_TIERS.includes(t.requiredTier)); const get = n => (T.find(t => t.name === n) || {}).requiredTier; const classOk = get('leerness_state_record') === 'safe-write' && get('leerness_provider_add') === 'safe-write' && get('leerness_web') === 'network' && get('leerness_handoff') === 'read-only' && get('leerness_audit') === 'read-only'; const src = read(__filename); const gateOk = /_tierRank\(minTier\) > _tierRank\(required\)/.test(src) && /_policyEnforce\(targetPath, cliArgs\.join\(' '\), _toolDef/.test(src); return allValid && classOk && gateOk; } },
|
|
3010
3023
|
{ name: 'verify-claim git diff 시맨틱 교차검증: _gitChangedFiles/_claimFileInGit + strict FAIL 통합 (UR-0042 외부리뷰 1.9.302)', run: () => { const fnOk = typeof _gitChangedFiles === 'function' && typeof _claimFileInGit === 'function'; const matchOk = _claimFileInGit('src/api.js', new Set(['src/api.js'])) === true && _claimFileInGit('./src/api.js', new Set(['src/api.js'])) === true && _claimFileInGit('other.js', new Set(['src/api.js'])) === false && _claimFileInGit('x', null) === null; const src = read(__filename); const wired = /git diff 교차검증/.test(src) && /\|\| !gitClaimOk/.test(src) && /_gitChangedFiles\(root\)/.test(src); return fnOk && matchOk && wired; } },
|
|
3011
3024
|
{ name: '_withLock/_updateRun: lost-update 락(O_EXCL+재진입) + 적용 (UR-0043 외부리뷰 1.9.303)', run: () => { const src = read(__filename); const fnOk = typeof _withLock === 'function' && typeof _sleepSyncMs === 'function' && typeof _updateRun === 'function'; const reentrant = /if \(_heldLocks\.has\(lockPath\)\) return fn\(\)/.test(src); const excl = /fs\.openSync\(lockPath, 'wx'\)/.test(src); const applied = /const id = _withLock\(progressPath\(root\)/.test(src) && /_updateRun\(root, curId/.test(src); return fnOk && reentrant && excl && applied; } },
|
|
@@ -3057,13 +3070,15 @@ function _selfTestCases() {
|
|
|
3057
3070
|
{ name: 'UR-0061(외부리뷰 P1): roadmap CSS 값 살균 — :root/</style> breakout 차단', run: () => { const m = require('../lib/pure-utils'); const css = m._roadmapTokenStyles({ 'color.primary': 'red;}' + '</style><script>alert(1)</script>' }, {}); const blocked = !css.includes('<') && !css.includes('>'); const primaryLine = (css.split('\n').find(l => l.includes('--lr-primary')) || ''); const noBreakout = !primaryLine.replace(/;$/, '').includes('}'); const preserved = m._roadmapTokenStyles({ 'color.primary': '#2563eb' }, {}).includes('--lr-primary: #2563eb'); return blocked && noBreakout && preserved; } },
|
|
3058
3071
|
{ 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; } },
|
|
3059
3072
|
{ 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; } },
|
|
3060
|
-
{ name: 'UR-0066(외부리뷰 P2): shell:true 주입 가드 — agents bench task _shellQuoteArg + fetchNpmLatest
|
|
3073
|
+
{ name: 'UR-0066(외부리뷰 P2): shell:true 주입 가드 — agents bench task _shellQuoteArg + fetchNpmLatest cmd.exe args', run: () => { const m = require('../lib/pure-utils'); const src = read(__filename); const benchQuoted = src.includes('const qTask = ' + '_shellQuoteArg(task)'); const npmSafe = /'\/d', '\/s', '\/c', 'npm', 'view'/.test(src); const q = m._shellQuoteArg('a & b'); const safe = (process.platform === 'win32' ? q === '"a & b"' : q === "'a & b'"); return benchQuoted && npmSafe && safe; } },
|
|
3061
3074
|
{ 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; } },
|
|
3062
3075
|
{ name: 'UR-0075 Phase A: 마이그레이션 가이드(_migrationGuideText) + migrate --guide 와이어 + init/migrate/update --path', run: () => { const m = require('../lib/pure-utils'); const g = m._migrationGuideText('1.9.355'); const guideOk = typeof g === 'string' && g.includes('마이그레이션 가이드') && g.includes('update --check --path') && g.includes('selftest') && g.includes('canonical JSON') && g.includes('롤백') && g.includes('1.9.355'); const src = read(__filename); const wired = src.includes("has('--guide') || args[1] === " + "'guide'") && src.includes('install(arg(' + "'--path', args[1] || process.cwd())") && src.includes('updateCmd(arg(' + "'--path', args[1] || process.cwd())"); return guideOk && wired; } },
|
|
3063
3076
|
{ name: 'UR-0075 Phase B: migrate audit(dry-run 스키마 drift) 명령 + 와이어', run: () => { const src = read(__filename); return typeof migrateAuditCmd === 'function' && src.includes('migrateAuditCmd(arg(' + "'--path'") && src.includes("args[1] === " + "'audit'"); } },
|
|
3064
3077
|
{ name: 'UR-0075 Phase C: migrate apply(canonical 백필 비파괴 적용) 명령 + 와이어', run: () => { const src = read(__filename); return typeof migrateApplyCmd === 'function' && src.includes('migrateApplyCmd(arg(' + "'--path'") && src.includes("args[1] === " + "'apply'"); } },
|
|
3065
3078
|
{ name: 'UR-0075 Phase D: migrate plan(임시폴더 설치 후 비교) 명령 + 와이어', run: () => { const src = read(__filename); return typeof migratePlanCmd === 'function' && src.includes('migratePlanCmd(arg(' + "'--path'") && src.includes("args[1] === " + "'plan'"); } },
|
|
3066
3079
|
{ name: 'UR-0074: install-safety(0 런타임 deps · 0 install-script) 사실 가드', run: () => { if (typeof installSafetyCmd !== 'function') return false; let pkg = {}; try { pkg = JSON.parse(read(path.join(__dirname, '..', 'package.json'))); } catch { return false; } const deps = Object.keys(pkg.dependencies || {}).length; const hooks = ['preinstall','install','postinstall'].filter(h => (pkg.scripts||{})[h]).length; return deps === 0 && hooks === 0; } },
|
|
3080
|
+
{ name: 'CV-2/UR-0077: fetchNpmLatest 신형 Node win EINVAL 회피 (cmd.exe + try/catch + windowsHide)', run: () => { if (typeof fetchNpmLatest !== 'function') return false; const src = read(__filename); const i = src.indexOf('function fetchNpmLatest'); if (i < 0) return false; const body = src.slice(i, i + 1600); return body.includes('cmd.exe') && /try \{/.test(body) && body.includes('windowsHide'); } },
|
|
3081
|
+
{ name: 'CV-1/UR-0076: arg() --path=값 파싱 + _resolveRoot(--path>positional>cwd) 행위', run: () => { if (typeof _resolveRoot !== 'function') return false; const save = process.argv; try { process.argv = ['node', 'h', 'context', '--path=/tmp/eqform']; const eq = arg('--path', null) === '/tmp/eqform'; process.argv = ['node', 'h', 'context', 'X', '--path', '/tmp/flag']; const flagWins = _resolveRoot('X') === '/tmp/flag'; process.argv = ['node', 'h', 'context', '/tmp/pos']; const posWins = _resolveRoot('/tmp/pos') === '/tmp/pos'; process.argv = ['node', 'h', 'context']; const cwdFb = _resolveRoot(undefined) === process.cwd(); return eq && flagWins && posWins && cwdFb; } finally { process.argv = save; } } },
|
|
3067
3082
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
3068
3083
|
];
|
|
3069
3084
|
}
|
|
@@ -6927,6 +6942,12 @@ function audit(root, opts = {}) {
|
|
|
6927
6942
|
const _origWrite = process.stdout.write.bind(process.stdout);
|
|
6928
6943
|
if (jsonMode) process.stdout.write = () => true;
|
|
6929
6944
|
try {
|
|
6945
|
+
// 외부리뷰 CV-3/UR-0078: 미초기화/존재하지 않는 경로를 healthy 로 오판하던 것 수정 — 필수 마커 부재 시 failure 승격(verify 와 일관).
|
|
6946
|
+
if (!exists(root) || !exists(path.join(root, '.harness')) || !exists(path.join(root, 'AGENTS.md'))) {
|
|
6947
|
+
failures++;
|
|
6948
|
+
fail(`미초기화 또는 존재하지 않는 경로: ${root} (.harness/AGENTS.md 없음 — leerness init 필요)`);
|
|
6949
|
+
_finding('not_initialized', 'fail', 'uninitialized or missing path (.harness or AGENTS.md absent)', { root });
|
|
6950
|
+
}
|
|
6930
6951
|
const designCands = ['designguide.md','design-guide.md','docs/designguide.md','docs/design-guide.md','.harness/designguide.md'];
|
|
6931
6952
|
const dups = designCands.filter(f => exists(path.join(root,f)));
|
|
6932
6953
|
if (dups.length) { warnings++; warn(`design guide duplicates outside canonical: ${dups.join(', ')} (run: leerness consistency merge-design-guide)`); _finding('design_dup', 'warn', 'design guide duplicates outside canonical', { duplicates: dups }); }
|
|
@@ -15132,12 +15153,20 @@ function fetchNpmLatest(pkg) {
|
|
|
15132
15153
|
// 1.9.300 (UR-0040, 외부리뷰 Sonnet): cp.exec 템플릿리터럴 → execFile(args 배열) + pkg charset 검증 = 셸 주입 이중 차단.
|
|
15133
15154
|
// 이전: `npm view ${pkg} version` 가 셸 문자열이라 pkg 에 메타문자(; && $() 공백)면 주입 가능.
|
|
15134
15155
|
if (!/^@?[a-z0-9][a-z0-9._/-]*$/i.test(String(pkg || ''))) return resolve(null); // 패키지명 charset (메타문자 0)
|
|
15135
|
-
// 1.9.
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15156
|
+
// 1.9.360 (외부리뷰 CV-2/UR-0077): 신형 Node(18.20.2+/20.12.2+/21.7.3+/22+/26)는 shell 없이 .cmd 실행 시
|
|
15157
|
+
// spawn EINVAL(CVE-2024-27980 수정 부작용). UR-0066(1.9.352)의 npm.cmd 직접 execFile 이 이를 유발 → update --check 무력화.
|
|
15158
|
+
// win 은 cmd.exe /d /s /c npm ... 로 호출(cmd.exe 는 .exe 라 EINVAL 없음 · shell:true 미사용으로 DEP0190 도 회피).
|
|
15159
|
+
// pkg 는 charset 검증(메타문자 0)이라 cmd 주입 불가. execFile 동기 throw 도 try/catch 로 흡수(이전엔 Promise reject).
|
|
15160
|
+
const isWin = process.platform === 'win32';
|
|
15161
|
+
const file = isWin ? (process.env.comspec || 'cmd.exe') : 'npm';
|
|
15162
|
+
const cmdArgs = isWin ? ['/d', '/s', '/c', 'npm', 'view', pkg, 'version'] : ['view', pkg, 'version'];
|
|
15163
|
+
try {
|
|
15164
|
+
cp.execFile(file, cmdArgs, { timeout: 12000, windowsHide: true }, (err, stdout) => {
|
|
15165
|
+
if (err) return resolve(null);
|
|
15166
|
+
const v = String(stdout || '').trim();
|
|
15167
|
+
resolve(/^\d+\.\d+\.\d+/.test(v) ? v : null);
|
|
15168
|
+
});
|
|
15169
|
+
} catch { resolve(null); }
|
|
15141
15170
|
});
|
|
15142
15171
|
}
|
|
15143
15172
|
|
|
@@ -21177,7 +21206,7 @@ async function main() {
|
|
|
21177
21206
|
if (cmd === 'check') return preCheck(arg('--path', args[1] || process.cwd()));
|
|
21178
21207
|
if (cmd === 'scan' && args[1] === 'secrets') return scanSecrets(arg('--path', args[2] || process.cwd()));
|
|
21179
21208
|
if (cmd === 'encoding' && args[1] === 'check') return encodingCheck(arg('--path', args[2] || process.cwd()));
|
|
21180
|
-
if (cmd === 'lazy' && args[1] === 'detect') return lazyDetect(args[2]
|
|
21209
|
+
if (cmd === 'lazy' && args[1] === 'detect') return lazyDetect(_resolveRoot(args[2]), { json: has('--json') });
|
|
21181
21210
|
if (cmd === 'memory' && args[1] === 'search') return memorySearch(arg('--path', process.cwd()), args.slice(2).join(' '));
|
|
21182
21211
|
if (cmd === 'handoff') return handoffCmd(arg('--path', args[1] || process.cwd()));
|
|
21183
21212
|
if (cmd === 'reuse-map') return reuseMapCmd(arg('--path', args[1] || process.cwd()));
|
|
@@ -21240,7 +21269,7 @@ async function main() {
|
|
|
21240
21269
|
if (cmd === 'whats-new') return whatsNewCmd(args[1] || arg('--path', process.cwd()));
|
|
21241
21270
|
if (cmd === 'reuse' && args[1] === 'autodetect') return reuseAutodetectCmd(args[2] || arg('--path', process.cwd()));
|
|
21242
21271
|
if (cmd === 'setup-agents' || cmd === 'setup' && args[1] === 'agents') return await setupAgentsCmd(args[1] && args[1] !== 'agents' ? args[1] : (arg('--path', args[2] || process.cwd())));
|
|
21243
|
-
if (cmd === 'session' && args[1] === 'close') return sessionClose(args[2]
|
|
21272
|
+
if (cmd === 'session' && args[1] === 'close') return sessionClose(_resolveRoot(args[2]), { json: has('--json') });
|
|
21244
21273
|
// 1.9.151: viewwork 명령 제거 (사용자 명시 — leerness 와 무관). session close 의 viewworkEmit 콜도 함께 제거.
|
|
21245
21274
|
if (cmd === 'route') return route(args[1] || 'planning');
|
|
21246
21275
|
if (cmd === 'self' && args[1] === 'check') return await selfCheck(absRoot(arg('--path', args[2] || process.cwd())));
|
|
@@ -21292,11 +21321,11 @@ async function main() {
|
|
|
21292
21321
|
// 1.9.220: leerness session-resume — 비정상 종료 감지 + 자율 재개 가이드 (사용자 명시)
|
|
21293
21322
|
if (cmd === 'session-resume') return sessionResumeCmd(arg('--path', process.cwd()));
|
|
21294
21323
|
// 1.9.226: leerness round-history — 자율 라운드 통계 + 다음 마일스톤
|
|
21295
|
-
if (cmd === 'round-history') return roundHistoryCmd(
|
|
21324
|
+
if (cmd === 'round-history') return roundHistoryCmd(_resolveRoot(args[1]));
|
|
21296
21325
|
// 1.9.229: leerness milestones — 도달 마일스톤 + 다음 ETA (1.9.226 확장)
|
|
21297
|
-
if (cmd === 'milestones') return milestonesCmd(
|
|
21326
|
+
if (cmd === 'milestones') return milestonesCmd(_resolveRoot(args[1]));
|
|
21298
21327
|
// 1.9.231: leerness pulse — 한 줄 종합 요약 (10 핵심 지표)
|
|
21299
|
-
if (cmd === 'pulse') return pulseCmd(
|
|
21328
|
+
if (cmd === 'pulse') return pulseCmd(_resolveRoot(args[1]));
|
|
21300
21329
|
// 1.9.233: leerness commands — 카테고리화된 전체 CLI 명령 목록
|
|
21301
21330
|
if (cmd === 'commands') return commandsCmd(arg('--path', process.cwd()));
|
|
21302
21331
|
// 1.9.239: leerness py-check — Python 파일 분석 (사용자 명시 UR-0013)
|
|
@@ -21329,7 +21358,7 @@ async function main() {
|
|
|
21329
21358
|
if (cmd === 'capabilities' || cmd === 'security-surface') return capabilitiesCmd(arg('--path', process.cwd()), { json: has('--json') });
|
|
21330
21359
|
// 1.9.278 (UR-0032): leerness state <show|start|record|verify|handoff> — .leerness/ 구조화 상태 substrate
|
|
21331
21360
|
if (cmd === 'state') return stateCmd(arg('--path', process.cwd()), args[1], ...args.slice(2));
|
|
21332
|
-
if (cmd === 'context') return contextCmd(
|
|
21361
|
+
if (cmd === 'context') return contextCmd(_resolveRoot(args[1]), { json: has('--json') });
|
|
21333
21362
|
if (cmd === 'brief') return briefCmd(arg('--path', process.cwd()), args[1]);
|
|
21334
21363
|
if (cmd === 'about' || cmd === 'identity') return aboutCmd({ json: has('--json') });
|
|
21335
21364
|
// 1.9.281 (UR-0034): leerness policy <show|set|check> — 권한 등급 (opt-in enforced)
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -3329,8 +3329,8 @@ total++;
|
|
|
3329
3329
|
let ok = false;
|
|
3330
3330
|
try {
|
|
3331
3331
|
const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
|
|
3332
|
-
// (1) 소스: cp.exec 템플릿 제거 + execFile args 배열 + argList 인용
|
|
3333
|
-
const srcOk = /
|
|
3332
|
+
// (1) 소스: cp.exec 템플릿 제거 + execFile args 배열(view pkg version) + argList 인용
|
|
3333
|
+
const srcOk = /'view', pkg, 'version'/.test(harnessSrc) && // 1.9.360(CV-2/UR-0077): cmd.exe /d /s /c npm view (args 배열) 형태
|
|
3334
3334
|
!/cp\.exec\(.npm view \$\{pkg\}/.test(harnessSrc) &&
|
|
3335
3335
|
/argList\.map\(_shellQuoteArg\)\.join/.test(harnessSrc);
|
|
3336
3336
|
// (2) 기능 회귀: update --check 가 오프라인(네트워크 무)에서도 crash 없이 종료
|
|
@@ -4868,5 +4868,62 @@ total++;
|
|
|
4868
4868
|
if (!ok) failed++;
|
|
4869
4869
|
}
|
|
4870
4870
|
|
|
4871
|
+
// 1.9.360 회귀 (외부리뷰 CV-2/UR-0077): update --check 가 신형 Node Windows 에서 spawn EINVAL 없이 동작 (cmd.exe 경유)
|
|
4872
|
+
total++;
|
|
4873
|
+
{
|
|
4874
|
+
let ok = false;
|
|
4875
|
+
try {
|
|
4876
|
+
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-einval-'));
|
|
4877
|
+
cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
4878
|
+
const r = cp.spawnSync(process.execPath, [CLI, 'update', d, '--check'], { encoding: 'utf8', timeout: 30000 });
|
|
4879
|
+
const out = (r.stdout || '') + (r.stderr || '');
|
|
4880
|
+
fs.rmSync(d, { recursive: true, force: true });
|
|
4881
|
+
// 핵심 회귀 가드: EINVAL 미발생 + exit 0 (네트워크 유무와 무관 — 오프라인이어도 EINVAL 은 안 나야 함)
|
|
4882
|
+
ok = !out.includes('EINVAL') && r.status === 0;
|
|
4883
|
+
} catch {}
|
|
4884
|
+
console.log(ok ? '✓ B(1.9.360) CV-2: update --check 신형 Node Windows EINVAL 회피 (cmd.exe 경유) (UR-0077)' : '✗ update --check EINVAL 회귀');
|
|
4885
|
+
if (!ok) failed++;
|
|
4886
|
+
}
|
|
4887
|
+
|
|
4888
|
+
// 1.9.361 회귀 (외부리뷰 CV-1/UR-0076): --path 라우팅 통일 — session close --path 가 cwd 아닌 정타깃에 쓰기 + context --path= 등호형
|
|
4889
|
+
total++;
|
|
4890
|
+
{
|
|
4891
|
+
let ok = false;
|
|
4892
|
+
try {
|
|
4893
|
+
const a = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-rootA-'));
|
|
4894
|
+
const b = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-rootB-'));
|
|
4895
|
+
cp.spawnSync(process.execPath, [CLI, 'init', a, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
4896
|
+
cp.spawnSync(process.execPath, [CLI, 'init', b, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
4897
|
+
// A 의 session-handoff 삭제 → cwd=B 에서 session close --path A → A 가 작동하면 A 에 재생성(아니면 cwd B 만 갱신)
|
|
4898
|
+
const aHandoff = path.join(a, '.harness', 'session-handoff.md');
|
|
4899
|
+
fs.rmSync(aHandoff, { force: true });
|
|
4900
|
+
cp.spawnSync(process.execPath, [CLI, 'session', 'close', '--path', a], { cwd: b, encoding: 'utf8', timeout: 30000 });
|
|
4901
|
+
const aRecreated = fs.existsSync(aHandoff);
|
|
4902
|
+
// context --path= 등호형: cdir 에 고유 결정 추가 후 cwd=B 에서 --path=cdir 로 읽기
|
|
4903
|
+
const cdir = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-eq-'));
|
|
4904
|
+
cp.spawnSync(process.execPath, [CLI, 'init', cdir, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
4905
|
+
cp.spawnSync(process.execPath, [CLI, 'decision', 'add', 'EQFORM_DEC_991', '--path', cdir], { encoding: 'utf8', timeout: 20000 });
|
|
4906
|
+
const eqOut = cp.spawnSync(process.execPath, [CLI, 'context', '--path=' + cdir, '--json'], { cwd: b, encoding: 'utf8', timeout: 20000 });
|
|
4907
|
+
const eqOk = (eqOut.stdout || '').includes('EQFORM_DEC_991');
|
|
4908
|
+
[a, b, cdir].forEach(d => { try { fs.rmSync(d, { recursive: true, force: true }); } catch {} });
|
|
4909
|
+
ok = aRecreated && eqOk;
|
|
4910
|
+
} catch {}
|
|
4911
|
+
console.log(ok ? '✓ B(1.9.361) CV-1: --path 라우팅 통일 (session close --path 정타깃 쓰기 / context --path= 등호형) (UR-0076)' : '✗ --path 라우팅 통일 실패');
|
|
4912
|
+
if (!ok) failed++;
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4915
|
+
// 1.9.361 회귀 (외부리뷰 CV-3/UR-0078): audit 가 미초기화/존재하지않는 경로를 healthy 로 오판 안 함 (verify 와 일관)
|
|
4916
|
+
total++;
|
|
4917
|
+
{
|
|
4918
|
+
let ok = false;
|
|
4919
|
+
try {
|
|
4920
|
+
const r = cp.spawnSync(process.execPath, [CLI, 'audit', path.join(os.tmpdir(), 'leerness-no-such-' + total), '--json'], { encoding: 'utf8', timeout: 15000 });
|
|
4921
|
+
const j = JSON.parse(r.stdout);
|
|
4922
|
+
ok = j.healthy === false && j.failures >= 1;
|
|
4923
|
+
} catch {}
|
|
4924
|
+
console.log(ok ? '✓ B(1.9.361) CV-3: audit 미초기화 경로 failure 승격 (healthy=false) (UR-0078)' : '✗ audit 미초기화 가드 실패');
|
|
4925
|
+
if (!ok) failed++;
|
|
4926
|
+
}
|
|
4927
|
+
|
|
4871
4928
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
4872
4929
|
if (failed > 0) process.exit(1);
|