leerness 1.9.383 → 1.9.385
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 +38 -0
- package/README.md +5 -5
- package/bin/harness.js +26 -25
- package/lib/pure-utils.js +19 -1
- package/package.json +1 -1
- package/scripts/e2e.js +55 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.385 — 2026-06-06 — 5번째 외부평가: contract verify markdown bullet 함수 파서 (UR-0086)
|
|
4
|
+
|
|
5
|
+
**📐 `contract verify` spec 파서가 markdown bullet `- name(args)` 함수 선언을 감지 — 실제 누락을 통과시키던 false-negative 해소.**
|
|
6
|
+
|
|
7
|
+
### 배경 (5번째 외부평가, GPT-5.5 web · "참고하되 맹신 X")
|
|
8
|
+
spec 파서가 `function name(...)` 와 backtick `` `name(` `` 만 추출하고 markdown bullet 목록(`- add(a,b)`)은 미감지. 자체 재현: bullet 3개 spec + impl 1개 export → `specFunctions: []`, `missingFunctions: []`, `ok: true`(실제론 2개 누락). **재현 후 수정**.
|
|
9
|
+
|
|
10
|
+
### 구현
|
|
11
|
+
1. **`_parseContractSpec(specText)` 순수 추출**(lib/pure-utils.js, UR-0025): `{ declared, mentioned, fields }`.
|
|
12
|
+
- **declared**(강선언, 누락검사 대상): `function name(` + markdown bullet `- name(args)` / `* ` / `1. `.
|
|
13
|
+
- **mentioned**(약언급, 표시만): backtick `` `name(` `` — 산문 인라인 언급 오탐 방지 위해 관대(기존 동작 유지).
|
|
14
|
+
2. **bullet 패턴**: `^\s*(?:[-*+]|\d+\.)\s+name(` — name 직후 `(`(공백 불허) + ASCII 식별자만 → 산문 `- 합계 (a+b)` / `- foo: bar(x)` / `**bold**` 오탐 0.
|
|
15
|
+
3. **missing-검출 잠재 FN 수정**: 기존 `specText.includes('function '+fn)` 가드가 bullet/backtick 추출명을 무력화 → `declaredSpec` 기준으로 교체(bullet 함수도 누락 감지, backtick 관대 유지).
|
|
16
|
+
|
|
17
|
+
### 검증 (회귀 0)
|
|
18
|
+
- **selftest 130→131 PASS** (bullet/asterisk/numbered 감지 + reference-equality + 산문 FP 0 + 인라인 제거 확인).
|
|
19
|
+
- **E2E 329→330 PASS** (bullet spec 3함수 감지 + subtract/multiply 누락 + add 보존 + backtick 관대 + 산문 FP 0).
|
|
20
|
+
- 실측 8/8 FP/감지 케이스 + 기존 B(1.9.35) `function bar`/`isCritical` 무회귀.
|
|
21
|
+
|
|
22
|
+
## 1.9.384 — 2026-06-06 — 5번째 외부평가: status/verify --json 구조화 출력 일관성 (UR-0085)
|
|
23
|
+
|
|
24
|
+
**🔌 `status --json` / `verify --json` 이 사람용 텍스트 → 구조화 JSON — AI 에이전트 자동화용 출력 일관성 확보.**
|
|
25
|
+
|
|
26
|
+
### 배경 (5번째 외부평가, GPT-5.5 web, 1.9.382 · "참고하되 맹신 X")
|
|
27
|
+
외부 평가가 #1 AI-에이전트 리스크로 지목: audit/health/task list 는 `--json` 시 JSON 인데 `status --json` 은 "Leerness: 1.9.x / Files: 56/56", `verify --json` 은 "✓ verify passed" 처럼 **사람용 텍스트**를 그대로 냄. 자체 재현으로 확인 후 수정.
|
|
28
|
+
|
|
29
|
+
### 구현
|
|
30
|
+
1. **status --json**: `{ version, language, minimal, total, present, missing[], healthy }` 구조화 출력(없으면 기존 사람용 유지).
|
|
31
|
+
2. **verify --json**: 실패를 `failures[]` 로 먼저 수집 → `{ ok, failures[], healthy }` 출력. **exit code 1 보존**(JSON·사람용 양쪽 모두 실패 시 exit 1).
|
|
32
|
+
3. 사람용 출력/동작 무변경(--json 없을 때 기존 `✗ ...` 메시지 + exit code 그대로).
|
|
33
|
+
|
|
34
|
+
### 검증 (회귀 0)
|
|
35
|
+
- **selftest 129→130 PASS** (status --json behavioral 파싱(total/present/healthy/missing) + verify --json 와이어 확인).
|
|
36
|
+
- **E2E 328→329 PASS** (status --json 구조 + verify --json pass(exit0)/fail(exit1) + 사람용 verify fail(exit1, JSON 아님) 보존).
|
|
37
|
+
- 실측: pass `{ok:true,failures:0}` exit0 / AGENTS.md 삭제 `{ok:false,failures:3}` exit1 / 사람용 `✗ ...` exit1.
|
|
38
|
+
|
|
39
|
+
### 5번째 외부평가 후속 (UR-0086 contract spec markdown-bullet 파서, UR-0087 secret .env.bad 정책)은 검증 후 별도 라운드.
|
|
40
|
+
|
|
3
41
|
## 1.9.383 — 2026-06-06 — UR-0025 큰 핸들러 모듈화 토대②: lib/io.js fs 프리미티브 분리
|
|
4
42
|
|
|
5
43
|
**🧩 lib/io.js 에 파일 I/O 프리미티브 추가 — 핸들러를 별도 lib 모듈로 분리할 토대 완비(io 14종).**
|
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.385 하네스를 사용합니다. 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.385는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
|
|
529
529
|
|
|
530
530
|
```jsonc
|
|
531
531
|
// 카테고리별
|
|
@@ -546,7 +546,7 @@ Leerness v1.9.383는 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.385)** · 매 라운드 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.385: 2026-06-06
|
|
588
588
|
<!-- leerness:project-readme:end -->
|
|
589
589
|
|
package/bin/harness.js
CHANGED
|
@@ -23,13 +23,13 @@ const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _merg
|
|
|
23
23
|
_personaSummaries, _translate,
|
|
24
24
|
_decisionsFromMd, _renderDecisionsMd, _renderLessonsMd,
|
|
25
25
|
_withBuiltinSource, _esc, _roadmapTokenStyles, _parseSkillMd,
|
|
26
|
-
_migrationGuideText } = require('../lib/pure-utils'); // 1.9.318~
|
|
26
|
+
_migrationGuideText, _parseContractSpec } = require('../lib/pure-utils'); // 1.9.318~385 (UR-0025/0053/0075/0086): 순수 유틸 모듈 분리
|
|
27
27
|
// 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
|
|
28
28
|
const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
|
|
29
29
|
// 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
|
|
30
30
|
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, MERGE_OVERWRITE_FILES, MINIMAL_SKIP_KEYS, REQUIRED_WORKSPACE_FILES, KEYWORD_STOPWORDS, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344/368/369 (UR-0025): catalog 분리 (MERGE_OVERWRITE_FILES/MINIMAL_SKIP_KEYS 포함)
|
|
31
31
|
|
|
32
|
-
const VERSION = '1.9.
|
|
32
|
+
const VERSION = '1.9.385';
|
|
33
33
|
|
|
34
34
|
// 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
|
|
35
35
|
// 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
|
|
@@ -2986,6 +2986,8 @@ function _selfTestCases() {
|
|
|
2986
2986
|
{ name: 'UR-0025: KEYWORD_STOPWORDS 단일출처 — handoff/lessons 키워드 stopwords 2중 중복 제거 (1.9.381)', run: () => { const c = require('../lib/catalogs'); if (KEYWORD_STOPWORDS !== c.KEYWORD_STOPWORDS) return false; const setOk = c.KEYWORD_STOPWORDS instanceof Set && c.KEYWORD_STOPWORDS.has('작업') && c.KEYWORD_STOPWORDS.has('task') && !c.KEYWORD_STOPWORDS.has('고유단어') && c.KEYWORD_STOPWORDS.size >= 25; const usesConst = (read(__filename).match(/const stopwords = KEYWORD_STOPWORDS;/g) || []).length >= 2 && !/const stopwords = new Set\(\[/.test(read(__filename)); return setOk && usesConst; } },
|
|
2987
2987
|
{ name: 'UR-0025 큰핸들러토대: lib/io.js 프리미티브(log/ok/warn/fail/today/now) 모듈 분리 + 동작 (1.9.382)', run: () => { const io = require('../lib/io'); const exportsOk = ['log', 'ok', 'warn', 'fail', 'today', 'now'].every(k => typeof io[k] === 'function') && io.log === log && io.fail === fail && io.now === now; const todayOk = /^\d{4}-\d{2}-\d{2}$/.test(io.today()) && /^\d{4}-\d{2}-\d{2}T/.test(io.now()); const src = read(__filename); const moved = src.includes("require('../lib/io')") && !/^function fail\(s\) \{ log/m.test(src) && !/^function now\(\) \{ return new Date/m.test(src); let exitOk = false; const saved = process.exitCode; const _w = process.stdout.write; try { process.stdout.write = () => true; process.exitCode = 0; io.fail('probe'); exitOk = process.exitCode === 1; } finally { process.stdout.write = _w; process.exitCode = saved; } return exportsOk && todayOk && moved && exitOk; } },
|
|
2988
2988
|
{ name: 'UR-0025 큰핸들러토대: lib/io.js fs 프리미티브(read/writeUtf8/exists/mkdirp/append/rel/absRoot) 분리 + round-trip (1.9.383)', run: () => { const io = require('../lib/io'); const exp = ['absRoot', 'exists', 'read', 'readBuf', 'mkdirp', 'writeUtf8', 'append', 'rel'].every(k => typeof io[k] === 'function') && io.read === read && io.writeUtf8 === writeUtf8 && io.exists === exists; const src = read(__filename); const moved = !/^function writeUtf8\(p, s\) \{/m.test(src) && !/^function read\(p\) \{/m.test(src) && !/^function exists\(p\) \{/m.test(src); const tmp = fs.mkdtempSync(path.join(os.tmpdir(), '__leerness_io_')); let rt = false; try { const f = path.join(tmp, 'a', 'b.txt'); io.writeUtf8(f, '한글RT'); rt = io.exists(f) && io.read(f) === '한글RT' && io.rel(tmp, f) === 'a/b.txt'; } finally { try { fs.rmSync(tmp, { recursive: true, force: true }); } catch {} } return exp && moved && rt; } },
|
|
2989
|
+
{ name: '5th외부평가/UR-0085: status --json 구조화 출력 + verify --json 와이어 (1.9.384)', run: () => { if (typeof status !== 'function' || typeof verify !== 'function') return false; const tmp = fs.mkdtempSync(path.join(os.tmpdir(), '__leerness_sj_')); const save = process.argv; const _w = process.stdout.write; let so = ''; try { fs.mkdirSync(path.join(tmp, '.harness'), { recursive: true }); process.argv = ['node', 'h', 'status', tmp, '--json']; process.stdout.write = s => { so += s; return true; }; status(tmp); } catch {} finally { process.stdout.write = _w; process.argv = save; try { fs.rmSync(tmp, { recursive: true, force: true }); } catch {} } let sj; try { sj = JSON.parse(so); } catch {} const statusOk = !!sj && typeof sj.total === 'number' && typeof sj.present === 'number' && 'healthy' in sj && Array.isArray(sj.missing); const src = read(__filename); const verifyWired = /function verify\(root\) \{[\s\S]*?has\('--json'\)[\s\S]*?JSON\.stringify\(\{ ok:/.test(src); return statusOk && verifyWired; } },
|
|
2990
|
+
{ name: '5th외부평가/UR-0086: _parseContractSpec markdown bullet 함수 감지 + 순수 추출 (1.9.385)', run: () => { const m = require('../lib/pure-utils'); if (m._parseContractSpec !== _parseContractSpec) return false; const p = _parseContractSpec('# Spec\n- add(a,b)\n* subtract(a,b)\n1. multiply(a,b)\nfunction legacy(x)\n`mentioned(`\ntick.amount\n'); const declOk = ['add', 'subtract', 'multiply', 'legacy'].every(n => p.declared.includes(n)) && p.declared.length === 4; const menOk = p.mentioned.includes('mentioned') && !p.declared.includes('mentioned'); const fieldOk = p.fields.includes('amount'); const fpOk = _parseContractSpec('- 합계 (a+b)\n- result (total)\n- foo: bar(x)\n**bold**').declared.length === 0; const src = read(__filename); const moved = src.includes('_parseContractSpec(specText)') && !/specText\.matchAll\(\/function/.test(src); return declOk && menOk && fieldOk && fpOk && moved; } },
|
|
2989
2991
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
2990
2992
|
];
|
|
2991
2993
|
}
|
|
@@ -6745,6 +6747,8 @@ function status(root) {
|
|
|
6745
6747
|
try { const mf = path.join(root, '.harness/manifest.json'); if (exists(mf)) isMinimal = !!JSON.parse(read(mf)).minimal; } catch {}
|
|
6746
6748
|
const files = Object.keys(coreFiles(root, lang, [], { minimal: isMinimal }));
|
|
6747
6749
|
const missing = files.filter(f => !exists(path.join(root,f)));
|
|
6750
|
+
// 1.9.384 (5번째 외부평가/UR-0085): --json 일관성 — AI 에이전트용 구조화 출력.
|
|
6751
|
+
if (has('--json')) { log(JSON.stringify({ version: ver, language: lang, minimal: isMinimal, total: files.length, present: files.length - missing.length, missing, healthy: missing.length === 0 }, null, 2)); return; }
|
|
6748
6752
|
log(`Leerness: ${ver}${isMinimal ? ' (minimal)' : ''}`);
|
|
6749
6753
|
log(`Files: ${files.length - missing.length}/${files.length}`);
|
|
6750
6754
|
if (missing.length) missing.forEach(x => warn('missing: ' + x));
|
|
@@ -6752,15 +6756,17 @@ function status(root) {
|
|
|
6752
6756
|
}
|
|
6753
6757
|
function verify(root) {
|
|
6754
6758
|
root = absRoot(root);
|
|
6755
|
-
|
|
6759
|
+
// 1.9.384 (5번째 외부평가/UR-0085): 실패를 먼저 수집 → --json 구조화 출력 + 사람용 분기 (exit code 일관 유지).
|
|
6760
|
+
const failures = [];
|
|
6756
6761
|
const required = REQUIRED_WORKSPACE_FILES; // 1.9.380 (UR-0025): lib/catalogs 단일출처
|
|
6757
|
-
for (const f of required) { if (!exists(path.join(root,f)))
|
|
6762
|
+
for (const f of required) { if (!exists(path.join(root,f))) failures.push(`missing: ${f}`); }
|
|
6758
6763
|
const g = exists(path.join(root,'.harness/guideline.md')) ? read(path.join(root,'.harness/guideline.md')) : '';
|
|
6759
|
-
if (!g.includes('plan.md') || !g.includes('progress-tracker.md'))
|
|
6764
|
+
if (!g.includes('plan.md') || !g.includes('progress-tracker.md')) failures.push('guideline.md must reference plan.md and progress-tracker.md');
|
|
6760
6765
|
const a = exists(path.join(root,'AGENTS.md')) ? read(path.join(root,'AGENTS.md')) : '';
|
|
6761
|
-
if (!a.includes('protected-files.md'))
|
|
6762
|
-
if (!a.includes('anti-lazy-work-policy.md'))
|
|
6763
|
-
if (
|
|
6766
|
+
if (!a.includes('protected-files.md')) failures.push('AGENTS.md must reference protected-files.md');
|
|
6767
|
+
if (!a.includes('anti-lazy-work-policy.md')) failures.push('AGENTS.md must reference anti-lazy-work-policy.md');
|
|
6768
|
+
if (has('--json')) { log(JSON.stringify({ ok: failures.length === 0, failures, healthy: failures.length === 0 }, null, 2)); if (failures.length) process.exitCode = 1; return; }
|
|
6769
|
+
if (failures.length) { failures.forEach(f => fail(f)); process.exitCode = 1; } else ok('verify passed');
|
|
6764
6770
|
}
|
|
6765
6771
|
// 1.9.356 (UR-0075 Phase B): migrate audit — 비파괴 dry-run 스키마 drift 리포트(버전/ canonical JSON 백필/누락 파일). 실제 변경 X.
|
|
6766
6772
|
function migrateAuditCmd(root, opts = {}) {
|
|
@@ -20160,18 +20166,13 @@ function contractVerifyCmd(specPath, implPath) {
|
|
|
20160
20166
|
if (!exists(specFile)) { fail(`spec 파일 없음: ${specFile}`); return process.exit(1); }
|
|
20161
20167
|
if (!exists(implFile)) { fail(`impl 파일 없음: ${implFile}`); return process.exit(1); }
|
|
20162
20168
|
const specText = read(specFile);
|
|
20163
|
-
// spec
|
|
20164
|
-
//
|
|
20165
|
-
//
|
|
20166
|
-
|
|
20167
|
-
const
|
|
20168
|
-
const
|
|
20169
|
-
|
|
20170
|
-
for (const m of specText.matchAll(/function\s+([A-Za-z_$][\w$]*)\s*\(/g)) fnSpec.add(m[1]);
|
|
20171
|
-
// backtick에 싸인 함수 호출 같은 형태: `xxx(`
|
|
20172
|
-
for (const m of specText.matchAll(/`([A-Za-z_$][\w$]*)\s*\(/g)) fnSpec.add(m[1]);
|
|
20173
|
-
// 필드: tick.<name>
|
|
20174
|
-
for (const m of specText.matchAll(/tick\.([A-Za-z_$][\w$]*)/g)) fieldSpec.add(m[1]);
|
|
20169
|
+
// 1.9.385 (UR-0086, 5th외부평가): spec 함수/필드 추출을 순수 파서 _parseContractSpec 로 위임.
|
|
20170
|
+
// declared(강선언): function 시그니처 + markdown bullet "- name(args)" — 누락검사 대상.
|
|
20171
|
+
// mentioned(약언급): backtick `name(` — 표시만(기존 관대성 유지, 산문 인라인 언급 오탐 방지).
|
|
20172
|
+
const parsedSpec = _parseContractSpec(specText);
|
|
20173
|
+
const declaredSpec = new Set(parsedSpec.declared);
|
|
20174
|
+
const fnSpec = new Set([...parsedSpec.declared, ...parsedSpec.mentioned]); // 표시용 전체
|
|
20175
|
+
const fieldSpec = new Set(parsedSpec.fields);
|
|
20175
20176
|
// 1.9.36 BUG-fix: require()는 side-effect 실행 위험 (CLI 스크립트는 require로 실행됨).
|
|
20176
20177
|
// 대신 정적 소스 분석 — module.exports = { foo, bar } / exports.foo = ... / module.exports.foo = ... 패턴 grep.
|
|
20177
20178
|
const implSrc = read(implFile);
|
|
@@ -20186,12 +20187,12 @@ function contractVerifyCmd(specPath, implPath) {
|
|
|
20186
20187
|
// pattern 2: exports.foo = / module.exports.foo =
|
|
20187
20188
|
for (const m of implSrc.matchAll(/(?:module\.)?exports\.([A-Za-z_$][\w$]*)\s*=/g)) implExports.add(m[1]);
|
|
20188
20189
|
// pattern 3: function foo + module.exports에 포함되었는지는 위에서 처리됨
|
|
20189
|
-
// 검사: spec
|
|
20190
|
+
// 검사: spec 강선언(function 시그니처 + markdown bullet) 함수 중 impl exports에 없는 것.
|
|
20191
|
+
// 1.9.385 (UR-0086): 기존 `specText.includes('function '+fn)` 가드는 bullet/backtick 추출명을 무력화하던 잠재 FN.
|
|
20192
|
+
// → declaredSpec(강선언) 기준으로 교체: bullet 함수도 누락 감지, backtick 약언급은 관대(검사 제외) 유지.
|
|
20190
20193
|
const missing = [];
|
|
20191
|
-
for (const fn of
|
|
20192
|
-
if (implExports.has(fn))
|
|
20193
|
-
// spec에 'function fnName('이 있지만 impl exports에 없으면 미구현
|
|
20194
|
-
if (specText.includes(`function ${fn}`) && !implExports.has(fn)) missing.push(fn);
|
|
20194
|
+
for (const fn of declaredSpec) {
|
|
20195
|
+
if (!implExports.has(fn)) missing.push(fn);
|
|
20195
20196
|
}
|
|
20196
20197
|
const fieldMissing = [];
|
|
20197
20198
|
for (const f of fieldSpec) {
|
package/lib/pure-utils.js
CHANGED
|
@@ -925,7 +925,9 @@ module.exports = {
|
|
|
925
925
|
// 1.9.339 (UR-0053): decisions canonical 파서/렌더 (JSON canonical, MD projection)
|
|
926
926
|
_parseDecisionBlock, _decisionsFromMd, _renderDecisionsMd,
|
|
927
927
|
// 1.9.355 (UR-0075 Phase A): 크로스버전 마이그레이션 가이드
|
|
928
|
-
_migrationGuideText
|
|
928
|
+
_migrationGuideText,
|
|
929
|
+
// 1.9.385 (UR-0086, 5th외부평가): contract spec 순수 파서 (markdown bullet 함수 선언 감지)
|
|
930
|
+
_parseContractSpec
|
|
929
931
|
};
|
|
930
932
|
|
|
931
933
|
// 1.9.355 (UR-0075 Phase A): AI 에이전트용 크로스버전 마이그레이션 안전 워크플로 가이드 (순수 텍스트). 임시설치 + --path + 백업 + diff 검증.
|
|
@@ -968,3 +970,19 @@ function _migrationGuideText(version) {
|
|
|
968
970
|
];
|
|
969
971
|
return L.join('\n');
|
|
970
972
|
}
|
|
973
|
+
|
|
974
|
+
// 1.9.385 (UR-0086, 5번째 외부평가): contract spec 함수/필드 추출 — 순수 파서.
|
|
975
|
+
// declared(강선언, 검사 대상): "function name(" + markdown bullet "- name(args)" / "* " / "1. ".
|
|
976
|
+
// mentioned(약언급, 표시만): backtick `name(` — 산문 인라인 언급일 수 있어 누락검사 제외(기존 관대성 유지).
|
|
977
|
+
// fields: tick.name. bullet 패턴은 name 직후 '(' (공백 불허) → 산문 "- 합 (a+b)" 오탐 방지, ASCII 식별자만.
|
|
978
|
+
function _parseContractSpec(specText) {
|
|
979
|
+
const s = specText || '';
|
|
980
|
+
const declared = new Set();
|
|
981
|
+
const mentioned = new Set();
|
|
982
|
+
const fields = new Set();
|
|
983
|
+
for (const m of s.matchAll(/function\s+([A-Za-z_$][\w$]*)\s*\(/g)) declared.add(m[1]);
|
|
984
|
+
for (const m of s.matchAll(/^\s*(?:[-*+]|\d+\.)\s+([A-Za-z_$][\w$]*)\(/gm)) declared.add(m[1]);
|
|
985
|
+
for (const m of s.matchAll(/`([A-Za-z_$][\w$]*)\s*\(/g)) mentioned.add(m[1]);
|
|
986
|
+
for (const m of s.matchAll(/tick\.([A-Za-z_$][\w$]*)/g)) fields.add(m[1]);
|
|
987
|
+
return { declared: [...declared], mentioned: [...mentioned], fields: [...fields] };
|
|
988
|
+
}
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -5340,5 +5340,60 @@ total++;
|
|
|
5340
5340
|
if (!ok) failed++;
|
|
5341
5341
|
}
|
|
5342
5342
|
|
|
5343
|
+
// 1.9.384 회귀 (5번째 외부평가/UR-0085): status/verify --json 구조화 출력 일관성 — pass JSON + fail JSON(exit1) + 사람용 exit1 유지
|
|
5344
|
+
total++;
|
|
5345
|
+
{
|
|
5346
|
+
let ok = false;
|
|
5347
|
+
try {
|
|
5348
|
+
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-svjson-'));
|
|
5349
|
+
cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
5350
|
+
const sr = cp.spawnSync(process.execPath, [CLI, 'status', d, '--json'], { encoding: 'utf8', timeout: 15000 });
|
|
5351
|
+
const sj = JSON.parse(sr.stdout);
|
|
5352
|
+
const statusOk = typeof sj.total === 'number' && sj.present === sj.total && sj.healthy === true && Array.isArray(sj.missing) && sj.missing.length === 0;
|
|
5353
|
+
const vr = cp.spawnSync(process.execPath, [CLI, 'verify', d, '--json'], { encoding: 'utf8', timeout: 15000 });
|
|
5354
|
+
const vj = JSON.parse(vr.stdout);
|
|
5355
|
+
const verifyPassOk = vj.ok === true && Array.isArray(vj.failures) && vj.failures.length === 0 && vr.status === 0;
|
|
5356
|
+
fs.rmSync(path.join(d, 'AGENTS.md'), { force: true });
|
|
5357
|
+
const vr2 = cp.spawnSync(process.execPath, [CLI, 'verify', d, '--json'], { encoding: 'utf8', timeout: 15000 });
|
|
5358
|
+
const vj2 = JSON.parse(vr2.stdout);
|
|
5359
|
+
const verifyFailOk = vj2.ok === false && vj2.failures.length >= 1 && vr2.status === 1; // --json 실패도 exit1
|
|
5360
|
+
const vr3 = cp.spawnSync(process.execPath, [CLI, 'verify', d], { encoding: 'utf8', timeout: 15000 }); // 사람용 분기 보존
|
|
5361
|
+
const humanFailOk = vr3.status === 1 && /✗/.test((vr3.stdout || '') + (vr3.stderr || '')) && !/^\s*\{/.test(vr3.stdout || '');
|
|
5362
|
+
fs.rmSync(d, { recursive: true, force: true });
|
|
5363
|
+
ok = statusOk && verifyPassOk && verifyFailOk && humanFailOk;
|
|
5364
|
+
} catch {}
|
|
5365
|
+
console.log(ok ? '✓ B(1.9.384) 5th외부평가: status/verify --json 구조화 일관성 (pass/fail JSON+exit1, 사람용 보존, UR-0085)' : '✗ status/verify --json 일관성 실패');
|
|
5366
|
+
if (!ok) failed++;
|
|
5367
|
+
}
|
|
5368
|
+
|
|
5369
|
+
// 1.9.385 회귀 (5번째 외부평가/UR-0086): contract verify spec 파서가 markdown bullet "- name(args)" 함수 선언 감지 + backtick 약언급 관대 유지
|
|
5370
|
+
total++;
|
|
5371
|
+
{
|
|
5372
|
+
let ok = false;
|
|
5373
|
+
try {
|
|
5374
|
+
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-contract-bullet-'));
|
|
5375
|
+
const spec = path.join(d, 'spec.md');
|
|
5376
|
+
const impl = path.join(d, 'impl.js');
|
|
5377
|
+
fs.writeFileSync(spec, '# Calc API\n\n함수 목록:\n- add(a, b): 합\n- subtract(a, b): 차\n- multiply(a, b): 곱\n', 'utf8');
|
|
5378
|
+
fs.writeFileSync(impl, '"use strict";\nfunction add(a,b){return a+b}\nmodule.exports={add};\n', 'utf8');
|
|
5379
|
+
const r = cp.spawnSync(process.execPath, [CLI, 'contract', 'verify', spec, impl, '--json'], { encoding: 'utf8', timeout: 10000 });
|
|
5380
|
+
const j = JSON.parse(r.stdout);
|
|
5381
|
+
const bulletOk = j.specFunctions.includes('add') && j.specFunctions.includes('subtract') && j.specFunctions.includes('multiply') &&
|
|
5382
|
+
j.missingFunctions.includes('subtract') && j.missingFunctions.includes('multiply') && !j.missingFunctions.includes('add') && j.ok === false;
|
|
5383
|
+
// backtick 약언급은 누락검사 제외(관대) + 산문 bullet FP 방지 회귀
|
|
5384
|
+
const spec2 = path.join(d, 'spec2.md');
|
|
5385
|
+
const impl2 = path.join(d, 'impl2.js');
|
|
5386
|
+
fs.writeFileSync(spec2, '# S\n\n`onlyMentioned(` 는 인라인 언급\nfunction realFn(x) {}\n- 합계 (a + b) 계산\n', 'utf8');
|
|
5387
|
+
fs.writeFileSync(impl2, '"use strict";\nfunction realFn(x){return x}\nmodule.exports={realFn};\n', 'utf8');
|
|
5388
|
+
const r2 = cp.spawnSync(process.execPath, [CLI, 'contract', 'verify', spec2, impl2, '--json'], { encoding: 'utf8', timeout: 10000 });
|
|
5389
|
+
const j2 = JSON.parse(r2.stdout);
|
|
5390
|
+
const lenientOk = !j2.missingFunctions.includes('onlyMentioned') && !j2.specFunctions.includes('합계') && j2.ok === true; // mentioned 관대 + 산문 FP 0
|
|
5391
|
+
fs.rmSync(d, { recursive: true, force: true });
|
|
5392
|
+
ok = bulletOk && lenientOk;
|
|
5393
|
+
} catch {}
|
|
5394
|
+
console.log(ok ? '✓ B(1.9.385) 5th외부평가: contract verify markdown bullet 함수 감지 + backtick 관대 + 산문 FP 0 (UR-0086)' : '✗ contract bullet 파서 실패');
|
|
5395
|
+
if (!ok) failed++;
|
|
5396
|
+
}
|
|
5397
|
+
|
|
5343
5398
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
5344
5399
|
if (failed > 0) process.exit(1);
|