leerness 1.9.316 → 1.9.318
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 +33 -0
- package/README.md +5 -5
- package/bin/harness.js +32 -66
- package/lib/pure-utils.js +44 -1
- package/package.json +1 -1
- package/scripts/e2e.js +48 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.318 — 2026-06-04 — UR-0025: HTML 파싱 유틸 모듈 분리 + 락 테스트 격리
|
|
4
|
+
|
|
5
|
+
**🧩 점진적 비파괴 모듈화(UR-0025) 한 단계 + pre-wake-audit critical 조사 결과 정리.**
|
|
6
|
+
|
|
7
|
+
### pre-wake-audit critical 조사 (요청)
|
|
8
|
+
매 라운드 관찰된 `pre-wake-audit critical 1` 을 조사 → **버그 아님**. `missing-user-requests` 가 미답 백로그 **3건**(UR-0025 모듈화 / UR-0044 ToolRegistry / UR-0053 JSON store)을 **정확히 보고**하는 정상 동작 (drift 마커와 달리 오발화 아님). 클리어하려면 백로그를 진행해야 함 → 가장 안전·확립된 UR-0025 를 진행.
|
|
9
|
+
|
|
10
|
+
### 구현 (UR-0025)
|
|
11
|
+
1. **순수 HTML 파싱 유틸 3종 → `lib/pure-utils.js` 분리**: `_htmlToText` / `_extractTitle` / `_extractLinks` (api-skill 문서 수집용, fs/네트워크 의존 0, URL·regex 만). harness.js 인라인 정의 제거 → require 로 동일 사용.
|
|
12
|
+
2. **락 테스트 격리(테스트 품질)**: B(1.9.303) 동시 task add 락 테스트가 전체 e2e 부하 + review-request 내부 spawn(~550ms×6) 오버헤드로 **타임아웃 플래키** → `--no-review` 로 동시성만 격리(락 로직은 격리 실행 0.4s/6 보존 검증). 제품 락 로직 변경 없음.
|
|
13
|
+
3. selftest 65→66 · e2e 262→263.
|
|
14
|
+
|
|
15
|
+
### 검증
|
|
16
|
+
- **selftest 66/66 PASS** · **E2E 263/263 PASS** (회귀 0).
|
|
17
|
+
- 실측: 모듈 `_htmlToText('<p>Hello <b>World</b></p>')` → `Hello World` · `_extractTitle`(엔티티 디코드) · `_extractLinks`(same-domain only) · harness 인라인 제거 확인 · api-skill 명령 정상 로드.
|
|
18
|
+
|
|
19
|
+
## 1.9.317 — 2026-06-04 — UR-0051: 텔레메트리 분리 (설치리뷰)
|
|
20
|
+
|
|
21
|
+
**📊 내부 auto-call 이 usage 통계를 오염시켜 거짓 skill 추천을 유발하던 결함 수정.**
|
|
22
|
+
|
|
23
|
+
### 배경 (설치리뷰)
|
|
24
|
+
"텔레메트리 오염 — 내부 auto-call 이 사용자명령 집계 → 거짓 skill 추천 + task add ~550ms". leerness 가 자기 자신을 spawn 하는 내부 auto-call(`task add` → `review-request`, MCP `callLeerness`, session close/handoff/drift 자동 보조 호출 등 ~20곳)이 dispatch 의 usage 카운터에 **사용자 명령처럼 집계** → `skill suggest`(명령 빈도 기반)가 거짓 후보 추천.
|
|
25
|
+
|
|
26
|
+
### 구현 (UR-0051)
|
|
27
|
+
1. **`LEERNESS_INTERNAL=1` 마커**: 모든 내부 self-spawn(`cp.spawnSync(process.execPath, [__filename, …])`)의 env 에 마킹 (~20곳). 공통 env 프래그먼트 일괄 적용 + env 없던 3곳(task add/session close 자동) 보강.
|
|
28
|
+
2. **usage 집계 가드**: dispatch 의 `_bumpUsage` 호출 조건에 `process.env.LEERNESS_INTERNAL !== '1'` 추가 — 내부 호출은 집계 제외.
|
|
29
|
+
3. selftest 64→65 · e2e 261→262.
|
|
30
|
+
|
|
31
|
+
### 검증
|
|
32
|
+
- **selftest 65/65 PASS** · **E2E 262/262 PASS** (회귀 0 — ~20곳 마킹에도 모든 auto-call 정상).
|
|
33
|
+
- 실측: `task add` 1회 → usage `{task:1}` (이전엔 `review-request` 도 집계) · 일반 drift 1→2 집계, **`LEERNESS_INTERNAL=1` drift → 미집계(2 유지)**.
|
|
34
|
+
- 범위: usage(skill 추천) 오염 제거. task add 지연(~550ms, review-request spawn 자체)은 별도 — 후속 캐싱/비동기화 검토 여지.
|
|
35
|
+
|
|
3
36
|
## 1.9.316 — 2026-06-04 — 🐛 drift 'session close 누락' 영구 오발화 버그 (자가 발견)
|
|
4
37
|
|
|
5
38
|
**🔧 session close 직후에도 drift 가 `session close 누락`(13일)을 보고하던 버그 수정 — 4라운드 연속 관찰된 leerness 자체 정확성 결함.**
|
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.318 하네스를 사용합니다. 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.318는 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.316는 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.318)** · 매 라운드 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.318: 2026-06-04
|
|
588
588
|
<!-- leerness:project-readme:end -->
|
|
589
589
|
|
package/bin/harness.js
CHANGED
|
@@ -8,13 +8,14 @@ const os = require('os'); // 1.9.178: _publishToNpm 에서 os.tmpdir() 사용 (
|
|
|
8
8
|
const readline = require('readline');
|
|
9
9
|
// 1.9.274 (UR-0025 1단계): 순수 유틸 함수 모듈 분리 (require-based, 비파괴). selftest 7종이 동작 검증.
|
|
10
10
|
const { _isSecretKey, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
|
|
11
|
-
PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord
|
|
11
|
+
PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
|
|
12
|
+
_htmlToText, _extractTitle, _extractLinks } = require('../lib/pure-utils'); // 1.9.318 (UR-0025): 순수 HTML 파싱 유틸 분리
|
|
12
13
|
// 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
|
|
13
14
|
const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
|
|
14
15
|
// 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
|
|
15
16
|
const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
|
|
16
17
|
|
|
17
|
-
const VERSION = '1.9.
|
|
18
|
+
const VERSION = '1.9.318';
|
|
18
19
|
|
|
19
20
|
// 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
|
|
20
21
|
// 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
|
|
@@ -2517,7 +2518,7 @@ function agentModeCmd(root, sub) {
|
|
|
2517
2518
|
const yl = s => isTty ? `\x1b[33m${s}\x1b[0m` : s;
|
|
2518
2519
|
const dm = s => isTty ? `\x1b[2m${s}\x1b[0m` : s;
|
|
2519
2520
|
function spawnChild(args, opts) {
|
|
2520
|
-
return cp.spawnSync(process.execPath, [__filename, ...args], Object.assign({ encoding: 'utf8', cwd: root, env: { ...process.env, LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1' } }, opts || {}));
|
|
2521
|
+
return cp.spawnSync(process.execPath, [__filename, ...args], Object.assign({ encoding: 'utf8', cwd: root, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1' } }, opts || {}));
|
|
2521
2522
|
}
|
|
2522
2523
|
if (!sub || sub === 'help') {
|
|
2523
2524
|
log(cy(`# leerness agent-mode (1.9.239) — 자율 모드 전용 통합 명령`));
|
|
@@ -3115,6 +3116,8 @@ function _selfTestCases() {
|
|
|
3115
3116
|
{ name: 'PowerShell 감지: pwsh7(channel/Documents\\PowerShell/install) + ps5.1 영구경로 과경고 안함 (UR-0052 설치리뷰 1.9.314)', run: () => { const f = _detectPwshFromEnv; const pwsh7a = f({ POWERSHELL_DISTRIBUTION_CHANNEL: 'MSI:Windows 10' }).version === '7'; const pwsh7b = f({ PSModulePath: 'C:\\Users\\me\\Documents\\PowerShell\\Modules' }).version === '7'; const pwsh7c = f({ PSModulePath: 'C:\\Program Files\\PowerShell\\7\\Modules' }).version === '7'; const noFalsePs5 = f({ PSModulePath: 'C:\\Users\\me\\Documents\\WindowsPowerShell\\Modules' }).isPowerShell === false; const cmdSys = f({ PSModulePath: 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\Modules' }).isPowerShell === false; const empty = f({}).isPowerShell === false; const src = read(__filename); const wired = src.includes('const fromEnv = _detectPwshFromEnv()') && src.includes('const pwshEnv = _detectPwshFromEnv()'); return pwsh7a && pwsh7b && pwsh7c && noFalsePs5 && cmdSys && empty && wired; } },
|
|
3116
3117
|
{ name: 'doc/surface 정합: doctor 명령 + stale MCP 카운트 동적화(commands/banner) (UR-0054 설치리뷰 1.9.315)', run: () => { const src = read(__filename); const doctorOk = typeof doctorCmd === 'function' && /cmd === 'doctor'/.test(src) && /# leerness doctor/.test(src); const dynCount = /MCP 도구: \$\{_mcpToolCount\(\)\}/.test(src) && /외부 AI 통합 \(MCP \$\{_mcpToolCount\(\)\} 도구\)/.test(src); return doctorOk && dynCount; } },
|
|
3117
3118
|
{ name: 'drift 마커 버그: session-handoff 프론트매터는 ^--- 일 때만 + drift 최신 Last generated (1.9.316)', run: () => { const src = read(__filename); const writeFix = src.includes('if (/^---\\r?\\n/.test(cur))') && src.includes('writeUtf8(handoffPath(root), frontmatter + block)'); const readFix = src.includes('matchAll(/Last generated') && src.includes('allGen[allGen.length - 1]'); return writeFix && readFix; } },
|
|
3119
|
+
{ name: '텔레메트리 분리: 내부 auto-call(LEERNESS_INTERNAL) usage 집계 제외 + 주요 spawn 마킹 (UR-0051 설치리뷰 1.9.317)', run: () => { const src = read(__filename); const guard = src.includes("process.env.LEERNESS_INTERNAL !== '1'"); const marked = (src.match(/LEERNESS_INTERNAL: '1'/g) || []).length >= 10; const reviewMarked = /'review-request'[\s\S]{0,200}LEERNESS_INTERNAL: '1'/.test(src); return guard && marked && reviewMarked; } },
|
|
3120
|
+
{ name: 'lib/pure-utils: HTML 파싱 유틸 3종 모듈 분리 + 동작 + 인라인 제거 (UR-0025 1.9.318)', run: () => { const m = require('../lib/pure-utils'); const fnOk = typeof m._htmlToText === 'function' && typeof m._extractTitle === 'function' && typeof m._extractLinks === 'function'; const work = m._htmlToText('<p>Hello <b>World</b></p>') === 'Hello World' && m._extractTitle('<html><title>My & Page</title></html>') === 'My & Page' && m._extractLinks('<a href="/a">A</a><a href="https://other.com/b">B</a>', 'https://x.com/').length === 1; const moved = m._htmlToText === _htmlToText && !/^function _htmlToText\(html\) \{/m.test(read(__filename)); return fnOk && work && moved; } },
|
|
3118
3121
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
3119
3122
|
];
|
|
3120
3123
|
}
|
|
@@ -3324,45 +3327,7 @@ function _fetchUrl(url, opts = {}) {
|
|
|
3324
3327
|
go(url, 0);
|
|
3325
3328
|
});
|
|
3326
3329
|
}
|
|
3327
|
-
|
|
3328
|
-
if (!html) return '';
|
|
3329
|
-
return html
|
|
3330
|
-
.replace(/<script[\s\S]*?<\/script>/gi, '')
|
|
3331
|
-
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
|
3332
|
-
.replace(/<!--[\s\S]*?-->/g, '')
|
|
3333
|
-
.replace(/<br\s*\/?>/gi, '\n')
|
|
3334
|
-
.replace(/<\/?(p|div|li|h[1-6]|tr|td|pre)[^>]*>/gi, '\n')
|
|
3335
|
-
.replace(/<[^>]+>/g, ' ')
|
|
3336
|
-
.replace(/ /g, ' ').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'")
|
|
3337
|
-
.replace(/&#(\d+);/g, (_, n) => String.fromCharCode(parseInt(n, 10)))
|
|
3338
|
-
.replace(/[ \t]+/g, ' ').replace(/\n\s*\n\s*\n+/g, '\n\n').trim();
|
|
3339
|
-
}
|
|
3340
|
-
function _extractTitle(html) {
|
|
3341
|
-
const m = (html || '').match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
3342
|
-
if (!m) return '';
|
|
3343
|
-
return _htmlToText(m[1]).slice(0, 200);
|
|
3344
|
-
}
|
|
3345
|
-
function _extractLinks(html, baseUrl, maxLinks) {
|
|
3346
|
-
if (!html) return [];
|
|
3347
|
-
const base = new URL(baseUrl);
|
|
3348
|
-
const found = new Map();
|
|
3349
|
-
const re = /<a\s+[^>]*href=["']([^"']+)["'][^>]*>([\s\S]*?)<\/a>/gi;
|
|
3350
|
-
let m;
|
|
3351
|
-
while ((m = re.exec(html)) !== null) {
|
|
3352
|
-
let href = m[1];
|
|
3353
|
-
if (!href || href.startsWith('#') || href.startsWith('javascript:') || href.startsWith('mailto:')) continue;
|
|
3354
|
-
let abs;
|
|
3355
|
-
try { abs = new URL(href, baseUrl).toString(); } catch { continue; }
|
|
3356
|
-
const u = new URL(abs);
|
|
3357
|
-
if (u.hostname !== base.hostname) continue; // same-domain only
|
|
3358
|
-
if (abs === baseUrl) continue;
|
|
3359
|
-
if (found.has(abs)) continue;
|
|
3360
|
-
const text = _htmlToText(m[2]).slice(0, 120);
|
|
3361
|
-
found.set(abs, { url: abs, text });
|
|
3362
|
-
if (found.size >= (maxLinks || 10)) break;
|
|
3363
|
-
}
|
|
3364
|
-
return Array.from(found.values());
|
|
3365
|
-
}
|
|
3330
|
+
// 1.9.318 (UR-0025): _htmlToText / _extractTitle / _extractLinks → lib/pure-utils.js 로 이동 (순수 함수, require 로 사용).
|
|
3366
3331
|
async function _collectAPIDoc(url, opts = {}) {
|
|
3367
3332
|
const direction = opts.direction || '';
|
|
3368
3333
|
const noCrawl = opts.noCrawl;
|
|
@@ -5890,7 +5855,7 @@ async function nextActionCmd(root, sub, ...rest) {
|
|
|
5890
5855
|
state.queue.splice(n, 1);
|
|
5891
5856
|
_writeNextActionQueue(root, state.queue);
|
|
5892
5857
|
// leerness task add 호출
|
|
5893
|
-
const taskResult = cp.spawnSync(process.execPath, [__filename, 'task', 'add', taskTitle, '--path', root], { encoding: 'utf8', timeout: 8000 });
|
|
5858
|
+
const taskResult = cp.spawnSync(process.execPath, [__filename, 'task', 'add', taskTitle, '--path', root], { encoding: 'utf8', timeout: 8000, env: { ...process.env, LEERNESS_INTERNAL: '1' } });
|
|
5894
5859
|
if (taskResult.status === 0) {
|
|
5895
5860
|
const m = (taskResult.stdout || '').match(/T-\d{4}/);
|
|
5896
5861
|
log(` ✓ task 추가: ${m ? m[0] : '?'} — "${taskTitle}"`);
|
|
@@ -6411,7 +6376,7 @@ function taskAdd(root, text) {
|
|
|
6411
6376
|
const t0 = Date.now();
|
|
6412
6377
|
const r = cp.spawnSync(process.execPath, [__filename, 'review-request', text, '--path', absRoot(root), '--json'], {
|
|
6413
6378
|
encoding: 'utf8', timeout: 15000,
|
|
6414
|
-
env: { ...process.env, LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' }
|
|
6379
|
+
env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' }
|
|
6415
6380
|
});
|
|
6416
6381
|
if (r.status === 0 && r.stdout) {
|
|
6417
6382
|
const j = JSON.parse(r.stdout);
|
|
@@ -7918,7 +7883,7 @@ function handoff(root) {
|
|
|
7918
7883
|
// 1) drift level (가벼운 check)
|
|
7919
7884
|
try {
|
|
7920
7885
|
const r = cp.spawnSync(process.execPath, [__filename, 'drift', 'check', root, '--json'],
|
|
7921
|
-
{ encoding: 'utf8', timeout: 8000, env: { ...process.env, LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
7886
|
+
{ encoding: 'utf8', timeout: 8000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
7922
7887
|
const j = JSON.parse(r.stdout.trim());
|
|
7923
7888
|
if (j.level) parts.push(`drift ${j.level.replace(/^[^\w]+/, '')} (${j.score})`);
|
|
7924
7889
|
} catch {}
|
|
@@ -8516,7 +8481,7 @@ function handoff(root) {
|
|
|
8516
8481
|
if (!has('--no-brainstorm-hits') && !has('--quiet') && process.env.LEERNESS_NO_BRAINSTORM_HITS !== '1') {
|
|
8517
8482
|
try {
|
|
8518
8483
|
const r = cp.spawnSync(process.execPath, [__filename, 'brainstorm', keyword, '--path', root, '--json'],
|
|
8519
|
-
{ encoding: 'utf8', timeout: 8000, env: { ...process.env, LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
8484
|
+
{ encoding: 'utf8', timeout: 8000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
8520
8485
|
const bj = JSON.parse(r.stdout);
|
|
8521
8486
|
const hits = bj.hits || {};
|
|
8522
8487
|
const items = [];
|
|
@@ -9019,7 +8984,7 @@ function handoff(root) {
|
|
|
9019
8984
|
if (process.env.LEERNESS_AUTO_SECURITY_FIX === '1') {
|
|
9020
8985
|
try {
|
|
9021
8986
|
const r = cp.spawnSync(process.execPath, [__filename, 'audit', root, '--fix'],
|
|
9022
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
8987
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
9023
8988
|
if (r.status === 0) {
|
|
9024
8989
|
log(dim(` ✓ 자동 회복 (LEERNESS_AUTO_SECURITY_FIX=1): audit --fix 완료`));
|
|
9025
8990
|
} else {
|
|
@@ -9264,7 +9229,7 @@ function handoffCmd(root) {
|
|
|
9264
9229
|
if (has('--auto-recover') && sevStale) {
|
|
9265
9230
|
log(dim(` 🔧 --auto-recover 활성 — session close 자동 실행 중...`));
|
|
9266
9231
|
try {
|
|
9267
|
-
const r = cp.spawnSync(process.execPath, [__filename, 'session', 'close', absR0], { encoding: 'utf8', timeout: 60000 });
|
|
9232
|
+
const r = cp.spawnSync(process.execPath, [__filename, 'session', 'close', absR0], { encoding: 'utf8', timeout: 60000, env: { ...process.env, LEERNESS_INTERNAL: '1' } });
|
|
9268
9233
|
if (r.status === 0) {
|
|
9269
9234
|
log(dim(` ✓ session close 자동 완료 (다음 라운드부터 healthy)`));
|
|
9270
9235
|
const s2 = _readUsageStats(absR0);
|
|
@@ -12302,7 +12267,7 @@ function sessionClose(root, opts = {}) {
|
|
|
12302
12267
|
// 1) skill suggest
|
|
12303
12268
|
try {
|
|
12304
12269
|
const r = cp.spawnSync(process.execPath, [__filename, 'skill', 'suggest', '--path', root, '--min', '3', '--json'],
|
|
12305
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
12270
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
12306
12271
|
const j = JSON.parse(r.stdout);
|
|
12307
12272
|
if (j.candidates && j.candidates.length) {
|
|
12308
12273
|
log(dim(' 📌 신규 skill 후보 (Hermes-style 자동 학습):'));
|
|
@@ -12313,7 +12278,7 @@ function sessionClose(root, opts = {}) {
|
|
|
12313
12278
|
// 2) drift check
|
|
12314
12279
|
try {
|
|
12315
12280
|
const r = cp.spawnSync(process.execPath, [__filename, 'drift', 'check', root, '--json'],
|
|
12316
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
12281
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
12317
12282
|
const j = JSON.parse(r.stdout.trim());
|
|
12318
12283
|
if (j.level) {
|
|
12319
12284
|
log(dim(` 🩺 drift 상태: ${j.level} ${j.score}/200`));
|
|
@@ -15740,7 +15705,7 @@ function driftCheckCmd(root, opts = {}) {
|
|
|
15740
15705
|
log(`🔒 --auto-fix 활성 (1.9.82) — 보안 신호 회복: audit --fix 자동 실행 중...`);
|
|
15741
15706
|
try {
|
|
15742
15707
|
const r = cp.spawnSync(process.execPath, [__filename, 'audit', root, '--fix'],
|
|
15743
|
-
{ encoding: 'utf8', timeout: 30000, env: { ...process.env, LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
15708
|
+
{ encoding: 'utf8', timeout: 30000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
15744
15709
|
if (r.status === 0) {
|
|
15745
15710
|
log(`✓ audit --fix 완료 — .gitignore + .env.example 동기화`);
|
|
15746
15711
|
// 재검사 (보안 신호 회복 확인)
|
|
@@ -15853,7 +15818,7 @@ function driftCheckCmd(root, opts = {}) {
|
|
|
15853
15818
|
log('');
|
|
15854
15819
|
log(`🔧 --auto-fix 활성 — session close 자동 실행 중...`);
|
|
15855
15820
|
try {
|
|
15856
|
-
const r = cp.spawnSync(process.execPath, [__filename, 'session', 'close', root], { encoding: 'utf8', timeout: 60000 });
|
|
15821
|
+
const r = cp.spawnSync(process.execPath, [__filename, 'session', 'close', root], { encoding: 'utf8', timeout: 60000, env: { ...process.env, LEERNESS_INTERNAL: '1' } });
|
|
15857
15822
|
if (r.status === 0) {
|
|
15858
15823
|
log(`✓ session close 자동 완료`);
|
|
15859
15824
|
// autoResolved 카운트
|
|
@@ -16134,7 +16099,7 @@ function skillPublishCmd(root) {
|
|
|
16134
16099
|
if (!has('--no-security-check') && !has('--force')) {
|
|
16135
16100
|
try {
|
|
16136
16101
|
const r = cp.spawnSync(process.execPath, [__filename, 'health', root, '--json'],
|
|
16137
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
16102
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
16138
16103
|
const j = JSON.parse(r.stdout.trim());
|
|
16139
16104
|
if (j.issues && j.issues.length > 0) {
|
|
16140
16105
|
log(`🚨 보안 사전 점검 (1.9.98): ${j.issues.length}건 issue 발견`);
|
|
@@ -16217,11 +16182,11 @@ const BENCHMARK_SCENARIOS = {
|
|
|
16217
16182
|
setup: (dir) => {
|
|
16218
16183
|
// 빈 evidence로 done task 생성
|
|
16219
16184
|
cp.spawnSync(process.execPath, [__filename, 'task', 'add', '거짓 완료된 작업', '--status', 'done', '--evidence', '', '--path', dir],
|
|
16220
|
-
{ encoding: 'utf8', timeout: 10000, env: { ...process.env, LEERNESS_NO_PROMPT: '1' } });
|
|
16185
|
+
{ encoding: 'utf8', timeout: 10000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1' } });
|
|
16221
16186
|
},
|
|
16222
16187
|
measure: (dir) => {
|
|
16223
16188
|
const r = cp.spawnSync(process.execPath, [__filename, 'lazy', 'detect', dir],
|
|
16224
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
16189
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
16225
16190
|
const detected = /✗ |found.*issue|증거 없는|empty/.test(r.stdout);
|
|
16226
16191
|
return { detected, exit: r.status, sample: r.stdout.slice(0, 200) };
|
|
16227
16192
|
}
|
|
@@ -16236,7 +16201,7 @@ const BENCHMARK_SCENARIOS = {
|
|
|
16236
16201
|
measure: (dir) => {
|
|
16237
16202
|
const r = cp.spawnSync(process.execPath, [__filename, 'contract', 'verify',
|
|
16238
16203
|
path.join(dir, 'mismatch-spec.md'), path.join(dir, 'mismatch-impl.js'), '--json'],
|
|
16239
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
16204
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_DRIFT_CHECK: '1' } });
|
|
16240
16205
|
let j = null;
|
|
16241
16206
|
try { j = JSON.parse(r.stdout); } catch {}
|
|
16242
16207
|
const detected = j && j.missingFunctions && j.missingFunctions.includes('missingFn');
|
|
@@ -16256,7 +16221,7 @@ const BENCHMARK_SCENARIOS = {
|
|
|
16256
16221
|
},
|
|
16257
16222
|
measure: (dir) => {
|
|
16258
16223
|
const r = cp.spawnSync(process.execPath, [__filename, 'drift', 'check', dir, '--json'],
|
|
16259
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
16224
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
16260
16225
|
let j = null;
|
|
16261
16226
|
try { j = JSON.parse(r.stdout.trim()); } catch {}
|
|
16262
16227
|
const detected = j && (j.level === '🔴 critical' || j.level === '🟠 attention');
|
|
@@ -16275,7 +16240,7 @@ const BENCHMARK_SCENARIOS = {
|
|
|
16275
16240
|
measure: (dir) => {
|
|
16276
16241
|
const r = cp.spawnSync(process.execPath, [__filename, 'skill', 'install',
|
|
16277
16242
|
path.join(dir, 'bom-test.md'), '--path', dir],
|
|
16278
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_PROMPT: '1' } });
|
|
16243
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1' } });
|
|
16279
16244
|
const f = path.join(dir, '.harness', 'skills', 'bom-test', 'SKILL.md');
|
|
16280
16245
|
return { detected: r.status === 0 && exists(f), sample: r.stdout.slice(0, 200) };
|
|
16281
16246
|
}
|
|
@@ -16312,7 +16277,7 @@ async function _benchmarkMeasure(root, task) {
|
|
|
16312
16277
|
const t1 = Date.now();
|
|
16313
16278
|
cp.spawnSync(process.execPath, [__filename, 'audit', root, '--fix'], {
|
|
16314
16279
|
encoding: 'utf8', timeout: 15000,
|
|
16315
|
-
env: { ...process.env, LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' }
|
|
16280
|
+
env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' }
|
|
16316
16281
|
});
|
|
16317
16282
|
const verifyTime = Date.now() - t1;
|
|
16318
16283
|
results.push({
|
|
@@ -16782,7 +16747,7 @@ function mcpServeCmd(root) {
|
|
|
16782
16747
|
const r = cp.spawnSync(process.execPath, [__filename, ...cliArgs], {
|
|
16783
16748
|
encoding: 'utf8',
|
|
16784
16749
|
timeout: 60000,
|
|
16785
|
-
env: { ...process.env, LEERNESS_NO_BANNER: '1', LEERNESS_NO_STALE_CHECK: '1', LEERNESS_NO_DRIFT_CHECK: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_WORKFLOW_GUIDE: '1' }
|
|
16750
|
+
env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_STALE_CHECK: '1', LEERNESS_NO_DRIFT_CHECK: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_WORKFLOW_GUIDE: '1' }
|
|
16786
16751
|
});
|
|
16787
16752
|
return { ok: r.status === 0, exit: r.status, stdout: r.stdout || '', stderr: r.stderr || '' };
|
|
16788
16753
|
}
|
|
@@ -18917,7 +18882,7 @@ async function _agentRepl(root, opts) {
|
|
|
18917
18882
|
try {
|
|
18918
18883
|
const hf = cp.spawnSync(process.execPath, [__filename, 'handoff', root, '--compact', '--no-drift-check', '--no-headline'], {
|
|
18919
18884
|
encoding: 'utf8', timeout: 8000,
|
|
18920
|
-
env: { ...process.env, LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1', LEERNESS_NO_LESSONS: '1' }
|
|
18885
|
+
env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1', LEERNESS_NO_LESSONS: '1' }
|
|
18921
18886
|
});
|
|
18922
18887
|
if (hf.status === 0 && hf.stdout) {
|
|
18923
18888
|
const preview = hf.stdout.split('\n').slice(0, 4).map(l => l.replace(/^\s+/, '')).filter(Boolean).slice(0, 3).join(' · ');
|
|
@@ -19659,7 +19624,7 @@ async function agentCmd(root, taskArg) {
|
|
|
19659
19624
|
log(`permission mode: ${perms.mode || 'basic'}`);
|
|
19660
19625
|
// handoff 자동 회수 (compact 모드)
|
|
19661
19626
|
try {
|
|
19662
|
-
const hf = cp.spawnSync(process.execPath, [__filename, 'handoff', root, '--compact', '--no-drift-check'], { encoding: 'utf8', timeout: 10000, env: { ...process.env, LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1' } });
|
|
19627
|
+
const hf = cp.spawnSync(process.execPath, [__filename, 'handoff', root, '--compact', '--no-drift-check'], { encoding: 'utf8', timeout: 10000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1' } });
|
|
19663
19628
|
if (hf.status === 0 && hf.stdout) {
|
|
19664
19629
|
const preview = hf.stdout.split('\n').slice(0, 6).join('\n');
|
|
19665
19630
|
log('\n[handoff context (preview)]\n' + preview);
|
|
@@ -19886,7 +19851,7 @@ async function incidentHandleCmd(root, id) {
|
|
|
19886
19851
|
const keywords = String(err).toLowerCase().match(/[\w가-힣]{4,}/g) || [];
|
|
19887
19852
|
if (keywords.length) {
|
|
19888
19853
|
const r = cp.spawnSync(process.execPath, [__filename, 'lessons', '--path', root, '--query', keywords[0], '--limit', '3'],
|
|
19889
|
-
{ encoding: 'utf8', timeout: 8000, env: { ...process.env, LEERNESS_NO_PROMPT: '1' } });
|
|
19854
|
+
{ encoding: 'utf8', timeout: 8000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1' } });
|
|
19890
19855
|
if (r.status === 0 && /총 \d+건 발견/.test(r.stdout)) {
|
|
19891
19856
|
const block = r.stdout.split('\n').slice(0, 12).join('\n');
|
|
19892
19857
|
log(`\n📚 관련 lessons:\n${block}`);
|
|
@@ -20027,7 +19992,7 @@ function healthCmd(root) {
|
|
|
20027
19992
|
// 1) drift level
|
|
20028
19993
|
try {
|
|
20029
19994
|
const r = cp.spawnSync(process.execPath, [__filename, 'drift', 'check', root, '--json'],
|
|
20030
|
-
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
19995
|
+
{ encoding: 'utf8', timeout: 15000, env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '0' } });
|
|
20031
19996
|
const j = JSON.parse(r.stdout.trim());
|
|
20032
19997
|
out.checks.drift = { level: j.level, score: j.score, firedCount: (j.fired || []).length };
|
|
20033
19998
|
} catch { out.checks.drift = { error: 'drift check 실패' }; }
|
|
@@ -21152,7 +21117,7 @@ function reviewRequestCmd(root, request) {
|
|
|
21152
21117
|
try {
|
|
21153
21118
|
const r = cp.spawnSync(process.execPath, [__filename, 'brainstorm', text, '--path', root, '--json'], {
|
|
21154
21119
|
encoding: 'utf8', timeout: 12000,
|
|
21155
|
-
env: { ...process.env, LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' }
|
|
21120
|
+
env: { ...process.env, LEERNESS_INTERNAL: '1', LEERNESS_NO_BANNER: '1', LEERNESS_NO_PROMPT: '1', LEERNESS_NO_DRIFT_CHECK: '1' }
|
|
21156
21121
|
});
|
|
21157
21122
|
if (r.stdout) {
|
|
21158
21123
|
const j = JSON.parse(r.stdout);
|
|
@@ -21540,7 +21505,8 @@ async function main() {
|
|
|
21540
21505
|
}
|
|
21541
21506
|
if (has('--help') || has('-h')) return help();
|
|
21542
21507
|
// 1.9.38 (B): 사용 통계 카운터 — usage stats 명령 자체와 비차단 경로는 제외
|
|
21543
|
-
|
|
21508
|
+
// 1.9.317 (UR-0051, 설치리뷰): 내부 auto-call(LEERNESS_INTERNAL=1) 은 usage 집계 제외 — 텔레메트리 오염(거짓 skill 추천) 방지.
|
|
21509
|
+
if (process.env.LEERNESS_INTERNAL !== '1' && cmd !== 'usage' && cmd !== 'init' && cmd !== 'migrate' && cmd !== '--version' && cmd !== '--help') {
|
|
21544
21510
|
try {
|
|
21545
21511
|
const root = absRoot(arg('--path', args[1] && !args[1].startsWith('-') ? args[1] : process.cwd()));
|
|
21546
21512
|
if (exists(path.join(root, '.harness'))) _bumpUsage(root, cmd);
|
package/lib/pure-utils.js
CHANGED
|
@@ -155,9 +155,52 @@ function _newRunRecord(opts = {}) {
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// 1.9.318 (UR-0025): 순수 HTML 파싱 유틸 (api-skill 문서 수집용) — fs/네트워크 의존 0, URL/regex 만 사용.
|
|
159
|
+
function _htmlToText(html) {
|
|
160
|
+
if (!html) return '';
|
|
161
|
+
return html
|
|
162
|
+
.replace(/<script[\s\S]*?<\/script>/gi, '')
|
|
163
|
+
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
|
164
|
+
.replace(/<!--[\s\S]*?-->/g, '')
|
|
165
|
+
.replace(/<br\s*\/?>/gi, '\n')
|
|
166
|
+
.replace(/<\/?(p|div|li|h[1-6]|tr|td|pre)[^>]*>/gi, '\n')
|
|
167
|
+
.replace(/<[^>]+>/g, ' ')
|
|
168
|
+
.replace(/ /g, ' ').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'")
|
|
169
|
+
.replace(/&#(\d+);/g, (_, n) => String.fromCharCode(parseInt(n, 10)))
|
|
170
|
+
.replace(/[ \t]+/g, ' ').replace(/\n\s*\n\s*\n+/g, '\n\n').trim();
|
|
171
|
+
}
|
|
172
|
+
function _extractTitle(html) {
|
|
173
|
+
const m = (html || '').match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
174
|
+
if (!m) return '';
|
|
175
|
+
return _htmlToText(m[1]).slice(0, 200);
|
|
176
|
+
}
|
|
177
|
+
function _extractLinks(html, baseUrl, maxLinks) {
|
|
178
|
+
if (!html) return [];
|
|
179
|
+
const base = new URL(baseUrl);
|
|
180
|
+
const found = new Map();
|
|
181
|
+
const re = /<a\s+[^>]*href=["']([^"']+)["'][^>]*>([\s\S]*?)<\/a>/gi;
|
|
182
|
+
let m;
|
|
183
|
+
while ((m = re.exec(html)) !== null) {
|
|
184
|
+
let href = m[1];
|
|
185
|
+
if (!href || href.startsWith('#') || href.startsWith('javascript:') || href.startsWith('mailto:')) continue;
|
|
186
|
+
let abs;
|
|
187
|
+
try { abs = new URL(href, baseUrl).toString(); } catch { continue; }
|
|
188
|
+
const u = new URL(abs);
|
|
189
|
+
if (u.hostname !== base.hostname) continue; // same-domain only
|
|
190
|
+
if (abs === baseUrl) continue;
|
|
191
|
+
if (found.has(abs)) continue;
|
|
192
|
+
const text = _htmlToText(m[2]).slice(0, 120);
|
|
193
|
+
found.set(abs, { url: abs, text });
|
|
194
|
+
if (found.size >= (maxLinks || 10)) break;
|
|
195
|
+
}
|
|
196
|
+
return Array.from(found.values());
|
|
197
|
+
}
|
|
198
|
+
|
|
158
199
|
module.exports = {
|
|
159
200
|
_isSecretKey, compareVer, parseHarnessVersion,
|
|
160
201
|
_classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
|
|
161
202
|
// 1.9.283 (UR-0025 2단계)
|
|
162
|
-
PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord
|
|
203
|
+
PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
|
|
204
|
+
// 1.9.318 (UR-0025): 순수 HTML 파싱 유틸
|
|
205
|
+
_htmlToText, _extractTitle, _extractLinks
|
|
163
206
|
};
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -3411,7 +3411,8 @@ total++;
|
|
|
3411
3411
|
cp.spawnSync(process.execPath, [CLI, 'init', lDir, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
|
|
3412
3412
|
const N = 6;
|
|
3413
3413
|
const procs = [];
|
|
3414
|
-
|
|
3414
|
+
// 1.9.318: --no-review 로 review-request 내부 spawn(~550ms×N) 제외 — 락(동시성) 자체만 격리 검증 (전체 e2e 부하 시 타임아웃 플래키 방지)
|
|
3415
|
+
for (let i = 0; i < N; i++) procs.push(cp.spawn(process.execPath, [CLI, 'task', 'add', 'LOCKTEST-' + i, '--path', lDir, '--no-review'], { stdio: 'ignore' }));
|
|
3415
3416
|
const ptPath = path.join(lDir, '.harness', 'progress-tracker.md');
|
|
3416
3417
|
// 자식들이 OS 프로세스로 독립 진행 → 부모는 파일을 sync 폴링(원자쓰기라 부분읽기 없음)
|
|
3417
3418
|
const start = Date.now(); let found = 0;
|
|
@@ -3752,5 +3753,51 @@ total++;
|
|
|
3752
3753
|
if (!ok) failed++;
|
|
3753
3754
|
}
|
|
3754
3755
|
|
|
3756
|
+
// 1.9.317 회귀 (UR-0051 설치리뷰): 텔레메트리 분리 — 내부 auto-call(LEERNESS_INTERNAL)이 usage 집계 오염 안 함
|
|
3757
|
+
total++;
|
|
3758
|
+
{
|
|
3759
|
+
let ok = false;
|
|
3760
|
+
try {
|
|
3761
|
+
const td = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-telem-'));
|
|
3762
|
+
cp.spawnSync(process.execPath, [CLI, 'init', td, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
|
|
3763
|
+
const usagePath = path.join(td, '.harness', 'cache', 'usage-stats.json');
|
|
3764
|
+
const cmds = () => { try { return JSON.parse(fs.readFileSync(usagePath, 'utf8')).commands || {}; } catch { return {}; } };
|
|
3765
|
+
// task add → 내부 review-request auto-call 이 usage 오염 안 함 (task 만 집계, review-request 없음)
|
|
3766
|
+
cp.spawnSync(process.execPath, [CLI, 'task', 'add', '텔레메트리 테스트', '--path', td], { encoding: 'utf8', timeout: 20000 });
|
|
3767
|
+
const afterTask = cmds();
|
|
3768
|
+
const noPollution = afterTask.task >= 1 && !afterTask['review-request'];
|
|
3769
|
+
// LEERNESS_INTERNAL=1 호출은 미집계 (일반 호출은 집계)
|
|
3770
|
+
cp.spawnSync(process.execPath, [CLI, 'drift', 'check', '--path', td], { encoding: 'utf8', timeout: 20000 });
|
|
3771
|
+
const d1 = cmds().drift || 0;
|
|
3772
|
+
cp.spawnSync(process.execPath, [CLI, 'drift', 'check', '--path', td], { encoding: 'utf8', timeout: 20000, env: { ...process.env, LEERNESS_INTERNAL: '1' } });
|
|
3773
|
+
const d2 = cmds().drift || 0;
|
|
3774
|
+
const internalSkip = d1 >= 1 && d2 === d1; // 일반=증가, INTERNAL=증가없음
|
|
3775
|
+
ok = noPollution && internalSkip;
|
|
3776
|
+
fs.rmSync(td, { recursive: true, force: true });
|
|
3777
|
+
} catch {}
|
|
3778
|
+
console.log(ok ? '✓ B(1.9.317) 텔레메트리 분리: task add review-request 오염 없음 + LEERNESS_INTERNAL 미집계 (UR-0051)' : '✗ 텔레메트리 분리 실패');
|
|
3779
|
+
if (!ok) failed++;
|
|
3780
|
+
}
|
|
3781
|
+
|
|
3782
|
+
// 1.9.318 회귀 (UR-0025 모듈화): HTML 파싱 유틸 3종 lib/pure-utils 분리 + harness 인라인 제거 + 동작 보존 + 소비명령 로드
|
|
3783
|
+
total++;
|
|
3784
|
+
{
|
|
3785
|
+
let ok = false;
|
|
3786
|
+
try {
|
|
3787
|
+
const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
|
|
3788
|
+
const fnOk = typeof m._htmlToText === 'function' && typeof m._extractTitle === 'function' && typeof m._extractLinks === 'function';
|
|
3789
|
+
const work = m._htmlToText('<p>a <b>b</b></p>') === 'a b'
|
|
3790
|
+
&& m._extractTitle('<title>T & U</title>') === 'T & U'
|
|
3791
|
+
&& m._extractLinks('<a href="/x">x</a><a href="https://o.com/y">y</a>', 'https://h.com/').length === 1; // same-domain only
|
|
3792
|
+
const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
|
|
3793
|
+
const movedOut = !/function _htmlToText\(html\) \{/.test(harnessSrc) && /_htmlToText, _extractTitle, _extractLinks \} = require\('\.\.\/lib\/pure-utils'\)/.test(harnessSrc);
|
|
3794
|
+
const r = cp.spawnSync(process.execPath, [CLI, 'api-skill'], { encoding: 'utf8', timeout: 15000 }); // 소비 명령 로드
|
|
3795
|
+
const cmdOk = /api-skill/.test(r.stdout || '');
|
|
3796
|
+
ok = fnOk && work && movedOut && cmdOk;
|
|
3797
|
+
} catch {}
|
|
3798
|
+
console.log(ok ? '✓ B(1.9.318) lib/pure-utils HTML 유틸 분리: 모듈 단일출처 + 인라인 제거 + api-skill 로드 (UR-0025)' : '✗ HTML 유틸 분리 실패');
|
|
3799
|
+
if (!ok) failed++;
|
|
3800
|
+
}
|
|
3801
|
+
|
|
3755
3802
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
3756
3803
|
if (failed > 0) process.exit(1);
|