leerness 1.9.330 → 1.9.332
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 +29 -0
- package/README.md +5 -5
- package/bin/harness.js +14 -43
- package/lib/pure-utils.js +47 -1
- package/package.json +1 -1
- package/scripts/e2e.js +52 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.332 — 2026-06-05 — UR-0025(증분): lessons.md 파서 분리
|
|
4
|
+
|
|
5
|
+
**🧩 순수 lessons.md 파서(`_parseLessonEntries`)를 lib/pure-utils 로 이전 (인라인 파싱 → 재사용 가능 단일 출처).** (UR-0025 micro-증분 계속)
|
|
6
|
+
|
|
7
|
+
### 구현 (UR-0025)
|
|
8
|
+
1. **`_parseLessonEntries(text)`** — lessons.md 블록(### 날짜)→엔트리 `{date, text, tag}` 파싱 → `lib/pure-utils.js`. `lessonListCmd` 의 인라인 루프를 헬퍼 호출로 교체(필터는 명령에 유지). decision/roadmap 파서와 동일 패턴.
|
|
9
|
+
2. selftest 79→80 · e2e 276→277.
|
|
10
|
+
|
|
11
|
+
### 검증
|
|
12
|
+
- **selftest 80/80 PASS** · **E2E 277/277 PASS** (회귀 0).
|
|
13
|
+
- 실측: `_parseLessonEntries` 2엔트리(date/text/tag, 미존재 tag=null) · lesson save+list "total 1, tag lock" 정상.
|
|
14
|
+
|
|
15
|
+
### 비고 (UR-0025)
|
|
16
|
+
lib/pure-utils 누적 ~38종. 순수 함수/인라인 파서 추출은 사실상 한계 — 남은 harness.js 는 command/fs/state 결합이라 추가 분리는 dependency 주입을 동반(아키텍처). UR-0025 는 실질적으로 안전 추출 범위를 소진했으며, 다음 방향(서브시스템 심층 분리 / UR-0053 / UR-0054 ② / 일단락)은 사용자 결정을 권장.
|
|
17
|
+
|
|
18
|
+
## 1.9.331 — 2026-06-05 — UR-0025(서브시스템): brief 빌더 분리 (VERSION 주입)
|
|
19
|
+
|
|
20
|
+
**🧩 project-brief 텍스트 빌더(`_briefReadmeBlock`/`_briefBlueprint`) + 마커(BRIEF_START/END)를 lib/pure-utils 로 이전 — brief 순수 레이어 완성.** (사용자 선택: UR-0025 서브시스템 추출)
|
|
21
|
+
|
|
22
|
+
### 구현 (UR-0025)
|
|
23
|
+
1. **`_briefReadmeBlock`**(README 개요 블록) + **`_briefBlueprint`**(복사용 청사진) + **`BRIEF_START`/`BRIEF_END`** 마커 → `lib/pure-utils.js`. 이제 brief 순수 레이어(config·채움·빌더·마커) 전부 pure-utils 단일 소스.
|
|
24
|
+
2. **VERSION 결합 해소**: `_briefBlueprint(root, brief)` → **`_briefBlueprint(brief, version)`** (VERSION 을 인자 주입 — pure 유지). harness 호출부 + selftest 2건 시그니처 갱신.
|
|
25
|
+
3. **multi-touch 안전 처리**: BRIEF_START/END 는 `_syncBriefReadme`(fs, harness 유지)도 사용 → import back. 호출처/선택검사 모두 갱신, e2e 견고 패턴(import-블록)으로 회귀 차단.
|
|
26
|
+
4. selftest 78→79 · e2e 275→276.
|
|
27
|
+
|
|
28
|
+
### 검증
|
|
29
|
+
- **selftest 79/79 PASS** · **E2E 276/276 PASS** (회귀 0 — brief 4종 307·308·330·331 green).
|
|
30
|
+
- 실측: `_briefBlueprint(b, '9.9.9')`→"leerness v9.9.9"(주입) · brief export blueprint · README project-brief 마커 sync 정상.
|
|
31
|
+
|
|
3
32
|
## 1.9.330 — 2026-06-05 — UR-0025(증분): project-brief config 분리
|
|
4
33
|
|
|
5
34
|
**🧩 project-brief 필드 config(`_BRIEF_FIELDS`) + 채움 카운트(`_briefFilled`)를 lib/pure-utils 로 이전.** (UR-0025 micro-증분 계속)
|
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.332 하네스를 사용합니다. 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.332는 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.330는 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.332)** · 매 라운드 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.332: 2026-06-05
|
|
588
588
|
<!-- leerness:project-readme:end -->
|
|
589
589
|
|
package/bin/harness.js
CHANGED
|
@@ -14,13 +14,15 @@ const { _isSecretKey, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel,
|
|
|
14
14
|
_sanitizeFences, _shellQuoteArg, _detectPwshFromEnv,
|
|
15
15
|
_getLocalTz, _formatLocal, _truncate, _splitList,
|
|
16
16
|
_roadmapMapStatus, _roadmapParseMilestones, _roadmapParseTokens,
|
|
17
|
-
_BRIEF_FIELDS, _briefFilled
|
|
17
|
+
_BRIEF_FIELDS, _briefFilled,
|
|
18
|
+
BRIEF_START, BRIEF_END, _briefReadmeBlock, _briefBlueprint,
|
|
19
|
+
_parseLessonEntries } = require('../lib/pure-utils'); // 1.9.318~332 (UR-0025): 순수 유틸 모듈 분리
|
|
18
20
|
// 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
|
|
19
21
|
const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
|
|
20
22
|
// 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
|
|
21
23
|
const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
|
|
22
24
|
|
|
23
|
-
const VERSION = '1.9.
|
|
25
|
+
const VERSION = '1.9.332';
|
|
24
26
|
|
|
25
27
|
// 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
|
|
26
28
|
// 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
|
|
@@ -68,8 +70,7 @@ const MARK = '<!-- leerness:managed -->';
|
|
|
68
70
|
const README_START = '<!-- leerness:project-readme:start -->';
|
|
69
71
|
const README_END = '<!-- leerness:project-readme:end -->';
|
|
70
72
|
// 1.9.307 (UR-0055 사용자명시): 프로젝트 청사진(brief) — README 개요 섹션 마커.
|
|
71
|
-
|
|
72
|
-
const BRIEF_END = '<!-- leerness:project-brief:end -->';
|
|
73
|
+
// 1.9.331 (UR-0025): BRIEF_START/BRIEF_END + brief 빌더 → lib/pure-utils.js 로 이동 (require 사용).
|
|
73
74
|
|
|
74
75
|
// 1.9.10: leerness-skillpack 동적 로드 (선택). 없으면 BUILTIN 사용.
|
|
75
76
|
function _tryLoadSkillpack() {
|
|
@@ -3050,8 +3051,8 @@ function _selfTestCases() {
|
|
|
3050
3051
|
{ name: 'lib/analyzers: 분석/검증 함수 4종 모듈 단일출처 분리 (UR-0025 1.9.304)', run: () => { const m = require('../lib/analyzers'); return m._evidenceQuality === _evidenceQuality && m._shellGuardAnalyze === _shellGuardAnalyze && m._parseEvidenceStats === _parseEvidenceStats && m._claimFileInGit === _claimFileInGit && !/function _evidenceQuality\(evidence\) \{/.test(read(__filename)) && !/function _shellGuardAnalyze\(cmd, ctx\) \{/.test(read(__filename)); } },
|
|
3051
3052
|
{ name: 'honesty-check: AI 인식론적 정직성 3차원 + MCP/CLI/strict 통합 (사용자명시 1.9.305)', run: () => { const h = _epistemicHonestyCheck; const d1 = h('이 기능은 항상 정상 동작합니다').findings.some(f => f.dim === 'pretend-knowledge'); const d2 = h('아마 될 것 같습니다. 구현 완료했습니다').findings.some(f => f.dim === 'premature-judgment'); const d3 = h('이 API 의 rate limit 은 초당 5회입니다').findings.some(f => f.dim === 'no-info-gathering'); const clean = h('src/api.js 수정, 12/12 통과 (Exit: 0)').ok === true; const src = read(__filename); const wired = require('../lib/mcp-tools').some(t => t.name === 'leerness_honesty_check') && /if \(cmd === 'honesty-check'\)/.test(src) && /honestyFindings = _epistemicHonestyCheck/.test(src); return d1 && d2 && d3 && clean && wired; } },
|
|
3052
3053
|
{ name: 'exit code 일관성: fail()→exitCode 1 + unknown 명령 안내 (UR-0045 설치리뷰 1.9.306)', run: () => { const src = read(__filename); return /function fail\(s\) \{ log\('✗ ' \+ s\); process\.exitCode = 1; \}/.test(src) && /알 수 없는 명령: \$\{cmd\}/.test(src) && /if \(cmd === 'help' \|\| cmd === 'commands'/.test(src); } },
|
|
3053
|
-
{ name: 'brief: 프로젝트 청사진 set/show/export + README 개요 섹션 (UR-0055 사용자명시 1.9.307)', run: () => { const src = read(__filename); const fnOk = typeof briefCmd === 'function' && typeof _loadBrief === 'function' && typeof _briefBlueprint === 'function' && _BRIEF_FIELDS.length === 10; const b = { project: 'X', intro: 'i', purpose: 'p', problem: '', features: ['f1', 'f2'], stack: ['s'], architecture: '', users: [], success: [], nonGoals: [], currentState: '' }; const bp = _briefBlueprint(
|
|
3054
|
-
{ name: 'brief 2단계: update --direction 이력 + MCP leerness_brief + context 통합 (UR-0055 1.9.308)', run: () => { const src = read(__filename); const b = { project: 'X', intro: '', purpose: '', problem: '', features: [], stack: [], architecture: '', users: [], success: [], nonGoals: [], currentState: '', directionHistory: ['2026-06-04: 확대'] }; const bpOk = /개발 방향 이력/.test(_briefBlueprint(
|
|
3054
|
+
{ name: 'brief: 프로젝트 청사진 set/show/export + README 개요 섹션 (UR-0055 사용자명시 1.9.307)', run: () => { const src = read(__filename); const fnOk = typeof briefCmd === 'function' && typeof _loadBrief === 'function' && typeof _briefBlueprint === 'function' && _BRIEF_FIELDS.length === 10; const b = { project: 'X', intro: 'i', purpose: 'p', problem: '', features: ['f1', 'f2'], stack: ['s'], architecture: '', users: [], success: [], nonGoals: [], currentState: '' }; const bp = _briefBlueprint(b, VERSION); const bpOk = /Blueprint/.test(bp) && /소개 \(Intro\)/.test(bp) && /f1/.test(bp) && /신규 프로젝트 시작 가이드/.test(bp); const rb = _briefReadmeBlock(b); const rbOk = rb.includes(BRIEF_START) && rb.includes(BRIEF_END) && /프로젝트 개요/.test(rb) && /\*\*목적\*\*/.test(rb); return fnOk && bpOk && rbOk && /if \(cmd === 'brief'\)/.test(src); } },
|
|
3055
|
+
{ name: 'brief 2단계: update --direction 이력 + MCP leerness_brief + context 통합 (UR-0055 1.9.308)', run: () => { const src = read(__filename); const b = { project: 'X', intro: '', purpose: '', problem: '', features: [], stack: [], architecture: '', users: [], success: [], nonGoals: [], currentState: '', directionHistory: ['2026-06-04: 확대'] }; const bpOk = /개발 방향 이력/.test(_briefBlueprint(b, VERSION)) && /최근 개발 방향 변경/.test(_briefReadmeBlock(b)); const histWired = /sub === 'update'/.test(src) && /brief\.directionHistory \|\| \[\]\), `\$\{today\(\)\}/.test(src); const mcpOk = require('../lib/mcp-tools').some(t => t.name === 'leerness_brief'); const ctxOk = /brief: \{ intro:/.test(src); return bpOk && histWired && mcpOk && ctxOk; } },
|
|
3055
3056
|
{ name: 'verify-claim: done 주장 evidence 기본강제 + --lenient + MCP/json 도달 (UR-0048 설치리뷰 critical 1.9.309)', run: () => { const src = read(__filename); const def = /const mustHaveEvidence = !has\('--lenient'\) && \(isDoneClaim \|\| has\('--require-evidence'\)\)/.test(src); const threshold = /has\('--require-evidence'\) \? evq\.ok : \(evq\.hasFile \|\| evq\.hasTest \|\| evq\.hasLog\)/.test(src); const jsonWired = /evidenceComplete:/.test(src) && /!evidenceQualityOk\) return process\.exit\(1\)/.test(src); const mcpLenient = !!require('../lib/mcp-tools').find(t => t.name === 'leerness_verify_claim').inputSchema.properties.lenient; return def && threshold && jsonWired && mcpLenient; } },
|
|
3056
3057
|
{ name: '입력 스키마 검증: task status/rule trigger 무효값 거부 + every-round 보존 (UR-0046 설치리뷰 1.9.310)', run: () => { const src = read(__filename); const sets = TASK_STATUSES.has('done') && TASK_STATUSES.has('in-progress') && !TASK_STATUSES.has('nonsense') && RULE_TRIGGERS.has('every-round') && RULE_TRIGGERS.has('every-update') && !RULE_TRIGGERS.has('not-a-trigger'); const helper = typeof _validateChoice === 'function' && _validateChoice('done', TASK_STATUSES, 'x') === true; const wired = /_validateChoice\(arg\('--status', null\), TASK_STATUSES/.test(src) && /_validateChoice\(trigger, RULE_TRIGGERS/.test(src); return sets && helper && wired; } },
|
|
3057
3058
|
{ name: 'init 가드: 미초기화 write 차단 + 다중마커 판별 + --force 우회 (UR-0047 설치리뷰 1.9.311)', run: () => { const src = read(__filename); const fnOk = typeof _isInitialized === 'function' && typeof _requireInit === 'function'; const liveOk = _isInitialized('.') === true; const emptyOk = _isInitialized(path.join(os.tmpdir(), '__leerness_noinit_marker__')) === false; const wired = ["task add", "task update", "plan add", "decision add", "rule add", "lesson save", "brief set"].every(l => src.includes(`_requireInit(root, '${l}')`)) && !src.includes("_requireInit(root, 'state " + "start')"); const force = /if \(_isInitialized\(root\) \|\| has\('--force'\)\) return true/.test(src); return fnOk && liveOk && emptyOk && wired && force; } },
|
|
@@ -3074,6 +3075,8 @@ function _selfTestCases() {
|
|
|
3074
3075
|
{ name: 'lib/pure-utils: 문자열 유틸 분리(_truncate/_splitList) + 인라인 제거 (UR-0025 1.9.328)', run: () => { const m = require('../lib/pure-utils'); const work = m._truncate('hello world', 8) === 'hello w…' && m._truncate('hi', 8) === 'hi' && JSON.stringify(m._splitList('a, b ,c,')) === '["a","b","c"]'; const src = read(__filename); const moved = m._truncate === _truncate && m._splitList === _splitList && !/^function _truncate\(/m.test(src) && !/^function _splitList\(/m.test(src); return work && moved; } },
|
|
3075
3076
|
{ name: 'lib/pure-utils: roadmap MD 파서 분리(_roadmapMapStatus/Milestones/Tokens) + 인라인 제거 (UR-0025 1.9.329)', run: () => { const m = require('../lib/pure-utils'); const work = m._roadmapMapStatus('REQUESTED') === 'planned' && m._roadmapMapStatus('done') === 'done' && m._roadmapParseMilestones('### M-0001. 로그인\nStatus: in-progress\nProgress: 40%')[0].progress === 40 && m._roadmapParseTokens('| color | #fff |').color === '#fff'; const src = read(__filename); const moved = m._roadmapMapStatus === _roadmapMapStatus && !/^function _roadmapMapStatus\(/m.test(src) && !/^function _roadmapParseMilestones\(/m.test(src) && !/^function _roadmapParseTokens\(/m.test(src); return work && moved; } },
|
|
3076
3077
|
{ name: 'lib/pure-utils: project-brief config 분리(_BRIEF_FIELDS/_briefFilled) + 인라인 제거 (UR-0025 1.9.330)', run: () => { const m = require('../lib/pure-utils'); const cfgOk = Array.isArray(m._BRIEF_FIELDS) && m._BRIEF_FIELDS.length === 10 && m._BRIEF_FIELDS[0].key === 'intro'; const work = m._briefFilled({ intro: 'x', features: ['a'] }) === 2 && m._briefFilled({}) === 0; const src = read(__filename); const moved = m._briefFilled === _briefFilled && m._BRIEF_FIELDS === _BRIEF_FIELDS && !/^const _BRIEF_FIELDS = \[/m.test(src) && !/^function _briefFilled\(/m.test(src); return cfgOk && work && moved; } },
|
|
3078
|
+
{ name: 'lib/pure-utils: brief 빌더 분리(_briefReadmeBlock/_briefBlueprint + BRIEF 마커, VERSION 주입) (UR-0025 1.9.331)', run: () => { const m = require('../lib/pure-utils'); const fnOk = typeof m._briefReadmeBlock === 'function' && typeof m._briefBlueprint === 'function' && m.BRIEF_START.includes('project-brief:start'); const b = { project: 'X', intro: 'i', features: ['f1'] }; const rb = m._briefReadmeBlock(b); const bp = m._briefBlueprint(b, '9.9.9'); const work = rb.includes(m.BRIEF_START) && rb.includes(m.BRIEF_END) && /f1/.test(rb) && /Blueprint/.test(bp) && /leerness v9\.9\.9/.test(bp); const src = read(__filename); const moved = m._briefBlueprint === _briefBlueprint && m.BRIEF_START === BRIEF_START && !/^function _briefReadmeBlock\(/m.test(src) && !/^function _briefBlueprint\(/m.test(src) && !/^const BRIEF_START =/m.test(src); return fnOk && work && moved; } },
|
|
3079
|
+
{ name: 'lib/pure-utils: lessons.md 파서 분리(_parseLessonEntries) + 인라인 제거 (UR-0025 1.9.332)', run: () => { const m = require('../lib/pure-utils'); const r = m._parseLessonEntries('### 2026-06-05\n- Lesson: A\n- Tag: t\n\n### 2026-06-04\n- Lesson: B'); const work = r.length === 2 && r[0].text === 'A' && r[0].tag === 't' && r[1].tag === null && r[0].date === '2026-06-05'; const src = read(__filename); const moved = m._parseLessonEntries === _parseLessonEntries && !/^function _parseLessonEntries\(/m.test(src) && src.includes('for (const lesson of _parseLessonEntries(text))'); return work && moved; } },
|
|
3077
3080
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
3078
3081
|
];
|
|
3079
3082
|
}
|
|
@@ -6602,17 +6605,8 @@ function lessonListCmd(root, opts = {}) {
|
|
|
6602
6605
|
}
|
|
6603
6606
|
const text = read(lp);
|
|
6604
6607
|
const lessons = [];
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
const dateMatch = block.match(/^### (\d{4}-\d{2}-\d{2}[^\n]*)/);
|
|
6608
|
-
const lessonMatch = block.match(/- Lesson:[ \t]*(.+)/);
|
|
6609
|
-
const tagMatch = block.match(/- Tag:[ \t]*(.+)/);
|
|
6610
|
-
if (!lessonMatch) continue;
|
|
6611
|
-
const lesson = {
|
|
6612
|
-
date: dateMatch ? dateMatch[1].trim() : null,
|
|
6613
|
-
text: lessonMatch[1].trim(),
|
|
6614
|
-
tag: tagMatch ? tagMatch[1].trim() : null,
|
|
6615
|
-
};
|
|
6608
|
+
// 1.9.332 (UR-0025): 블록→엔트리 파싱은 순수 _parseLessonEntries (lib/pure-utils), 필터는 명령에 유지.
|
|
6609
|
+
for (const lesson of _parseLessonEntries(text)) {
|
|
6616
6610
|
if (tagFilter && lesson.tag !== tagFilter) continue;
|
|
6617
6611
|
// 1.9.139: query 필터 — lesson text 또는 tag 매칭
|
|
6618
6612
|
if (queryRe && !queryRe.test(lesson.text) && !queryRe.test(lesson.tag || '')) continue;
|
|
@@ -18251,18 +18245,7 @@ function _saveBrief(root, brief) {
|
|
|
18251
18245
|
writeUtf8(_briefPath(root), fm('project-brief', ['프로젝트 목적 확인', '신규 기능 판단', '계획 수립'], ['프로젝트 목적 변경', '사용자/범위 변경'], body));
|
|
18252
18246
|
}
|
|
18253
18247
|
// 1.9.330 (UR-0025): _briefFilled → lib/pure-utils.js 로 이동 (순수 derivation, require 사용).
|
|
18254
|
-
|
|
18255
|
-
const L = [BRIEF_START, '## 프로젝트 개요', ''];
|
|
18256
|
-
if (brief.intro) L.push(brief.intro, '');
|
|
18257
|
-
if (brief.purpose) L.push(`**목적**: ${brief.purpose}`, '');
|
|
18258
|
-
if (brief.problem) L.push(`**해결 문제**: ${brief.problem}`, '');
|
|
18259
|
-
if (brief.features && brief.features.length) { L.push('**핵심 기능**'); brief.features.forEach(x => L.push(`- ${x}`)); L.push(''); }
|
|
18260
|
-
if (brief.stack && brief.stack.length) L.push(`**기술 스택**: ${brief.stack.join(', ')}`, '');
|
|
18261
|
-
if (brief.directionHistory && brief.directionHistory.length) { L.push('**최근 개발 방향 변경**'); brief.directionHistory.slice(-3).forEach(x => L.push(`- ${x}`)); L.push(''); }
|
|
18262
|
-
if (_briefFilled(brief) === 0) L.push('_아직 개요 미입력 — `leerness brief set --intro "..." --purpose "..."` 로 작성._', '');
|
|
18263
|
-
L.push('<sub>이 섹션은 `leerness brief` 로 관리됩니다. 전체 청사진(복사용): `leerness brief export`.</sub>', BRIEF_END);
|
|
18264
|
-
return L.join('\n');
|
|
18265
|
-
}
|
|
18248
|
+
// 1.9.331 (UR-0025): _briefReadmeBlock → lib/pure-utils.js
|
|
18266
18249
|
function _syncBriefReadme(root, brief) {
|
|
18267
18250
|
const p = path.join(absRoot(root), 'README.md');
|
|
18268
18251
|
const existing = exists(p) ? read(p) : '';
|
|
@@ -18274,19 +18257,7 @@ function _syncBriefReadme(root, brief) {
|
|
|
18274
18257
|
else updated = `# ${brief.project}\n\n${block}\n`;
|
|
18275
18258
|
writeUtf8(p, updated);
|
|
18276
18259
|
}
|
|
18277
|
-
|
|
18278
|
-
const L = [`# ${brief.project} — 프로젝트 청사진 (Blueprint)`,
|
|
18279
|
-
`> 이 문서만으로 프로젝트를 기초부터 재구성할 수 있도록 작성. \`leerness brief export\` 생성 (leerness v${VERSION}).`, ''];
|
|
18280
|
-
const sec = (h, v, multi) => { if (multi ? (v && v.length) : v) { L.push(`## ${h}`, multi ? v.map(x => `- ${x}`).join('\n') : v, ''); } };
|
|
18281
|
-
sec('소개 (Intro)', brief.intro); sec('목적 (Purpose)', brief.purpose); sec('해결 문제 (Problem)', brief.problem);
|
|
18282
|
-
sec('핵심 기능 (Features)', brief.features, true); sec('기술 스택 (Tech Stack)', brief.stack, true);
|
|
18283
|
-
sec('아키텍처 (Architecture)', brief.architecture); sec('사용자 (Users)', brief.users, true);
|
|
18284
|
-
sec('성공 기준 (Success Criteria)', brief.success, true); sec('비목표 (Non-Goals)', brief.nonGoals, true);
|
|
18285
|
-
sec('현재 상태 (Current State)', brief.currentState);
|
|
18286
|
-
sec('개발 방향 이력 (Direction History)', brief.directionHistory, true);
|
|
18287
|
-
L.push('---', '## 신규 프로젝트 시작 가이드', '', '1. 위 소개·목적·기능·아키텍처·스택을 신규 레포의 계획으로 복사.', '2. `leerness init .` 후 이 파일을 `.harness/project-brief.md` 로 복사하거나 `leerness brief set` 으로 재입력.', '3. Features 를 `leerness plan add` / `leerness task add` 로 분해.', '');
|
|
18288
|
-
return L.join('\n');
|
|
18289
|
-
}
|
|
18260
|
+
// 1.9.331 (UR-0025): _briefBlueprint → lib/pure-utils.js (VERSION 은 인자 주입).
|
|
18290
18261
|
function briefCmd(root, sub) {
|
|
18291
18262
|
root = absRoot(root || process.cwd());
|
|
18292
18263
|
const isTty = process.stdout && process.stdout.isTTY;
|
|
@@ -18315,7 +18286,7 @@ function briefCmd(root, sub) {
|
|
|
18315
18286
|
}
|
|
18316
18287
|
if (sub === 'export') {
|
|
18317
18288
|
const brief = _loadBrief(root);
|
|
18318
|
-
const bp = _briefBlueprint(
|
|
18289
|
+
const bp = _briefBlueprint(brief, VERSION); // 1.9.331 (UR-0025): VERSION 주입
|
|
18319
18290
|
const out = arg('--out', null);
|
|
18320
18291
|
if (out) { const op = path.isAbsolute(out) ? out : path.join(root, out); writeUtf8(op, bp); ok(`blueprint export → ${rel(root, op)} (${_briefFilled(brief)}/${_BRIEF_FIELDS.length} 필드)`); return; }
|
|
18321
18292
|
log(bp);
|
package/lib/pure-utils.js
CHANGED
|
@@ -332,6 +332,48 @@ const _BRIEF_FIELDS = [
|
|
|
332
332
|
{ key: 'currentState', h: 'Current State', label: '현재 상태', flag: 'current-state', multi: false },
|
|
333
333
|
];
|
|
334
334
|
function _briefFilled(brief) { return _BRIEF_FIELDS.filter(f => (f.multi ? (brief[f.key] && brief[f.key].length) : brief[f.key])).length; }
|
|
335
|
+
// 1.9.331 (UR-0025): project-brief 텍스트 빌더 (순수) — README 개요 블록 / 복사용 청사진. VERSION 은 인자로 주입.
|
|
336
|
+
const BRIEF_START = '<!-- leerness:project-brief:start -->';
|
|
337
|
+
const BRIEF_END = '<!-- leerness:project-brief:end -->';
|
|
338
|
+
function _briefReadmeBlock(brief) {
|
|
339
|
+
const L = [BRIEF_START, '## 프로젝트 개요', ''];
|
|
340
|
+
if (brief.intro) L.push(brief.intro, '');
|
|
341
|
+
if (brief.purpose) L.push(`**목적**: ${brief.purpose}`, '');
|
|
342
|
+
if (brief.problem) L.push(`**해결 문제**: ${brief.problem}`, '');
|
|
343
|
+
if (brief.features && brief.features.length) { L.push('**핵심 기능**'); brief.features.forEach(x => L.push(`- ${x}`)); L.push(''); }
|
|
344
|
+
if (brief.stack && brief.stack.length) L.push(`**기술 스택**: ${brief.stack.join(', ')}`, '');
|
|
345
|
+
if (brief.directionHistory && brief.directionHistory.length) { L.push('**최근 개발 방향 변경**'); brief.directionHistory.slice(-3).forEach(x => L.push(`- ${x}`)); L.push(''); }
|
|
346
|
+
if (_briefFilled(brief) === 0) L.push('_아직 개요 미입력 — `leerness brief set --intro "..." --purpose "..."` 로 작성._', '');
|
|
347
|
+
L.push('<sub>이 섹션은 `leerness brief` 로 관리됩니다. 전체 청사진(복사용): `leerness brief export`.</sub>', BRIEF_END);
|
|
348
|
+
return L.join('\n');
|
|
349
|
+
}
|
|
350
|
+
function _briefBlueprint(brief, version) {
|
|
351
|
+
const L = [`# ${brief.project} — 프로젝트 청사진 (Blueprint)`,
|
|
352
|
+
`> 이 문서만으로 프로젝트를 기초부터 재구성할 수 있도록 작성. \`leerness brief export\` 생성 (leerness v${version || '?'}).`, ''];
|
|
353
|
+
const sec = (h, v, multi) => { if (multi ? (v && v.length) : v) { L.push(`## ${h}`, multi ? v.map(x => `- ${x}`).join('\n') : v, ''); } };
|
|
354
|
+
sec('소개 (Intro)', brief.intro); sec('목적 (Purpose)', brief.purpose); sec('해결 문제 (Problem)', brief.problem);
|
|
355
|
+
sec('핵심 기능 (Features)', brief.features, true); sec('기술 스택 (Tech Stack)', brief.stack, true);
|
|
356
|
+
sec('아키텍처 (Architecture)', brief.architecture); sec('사용자 (Users)', brief.users, true);
|
|
357
|
+
sec('성공 기준 (Success Criteria)', brief.success, true); sec('비목표 (Non-Goals)', brief.nonGoals, true);
|
|
358
|
+
sec('현재 상태 (Current State)', brief.currentState);
|
|
359
|
+
sec('개발 방향 이력 (Direction History)', brief.directionHistory, true);
|
|
360
|
+
L.push('---', '## 신규 프로젝트 시작 가이드', '', '1. 위 소개·목적·기능·아키텍처·스택을 신규 레포의 계획으로 복사.', '2. `leerness init .` 후 이 파일을 `.harness/project-brief.md` 로 복사하거나 `leerness brief set` 으로 재입력.', '3. Features 를 `leerness plan add` / `leerness task add` 로 분해.', '');
|
|
361
|
+
return L.join('\n');
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// 1.9.332 (UR-0025): 순수 lessons.md 파서 — 블록(### 날짜)→엔트리 {date, text, tag}. 필터는 호출측.
|
|
365
|
+
function _parseLessonEntries(text) {
|
|
366
|
+
const out = [];
|
|
367
|
+
for (const block of String(text || '').split(/\n(?=### )/)) {
|
|
368
|
+
if (!block.startsWith('### ')) continue;
|
|
369
|
+
const dateMatch = block.match(/^### (\d{4}-\d{2}-\d{2}[^\n]*)/);
|
|
370
|
+
const lessonMatch = block.match(/- Lesson:[ \t]*(.+)/);
|
|
371
|
+
const tagMatch = block.match(/- Tag:[ \t]*(.+)/);
|
|
372
|
+
if (!lessonMatch) continue;
|
|
373
|
+
out.push({ date: dateMatch ? dateMatch[1].trim() : null, text: lessonMatch[1].trim(), tag: tagMatch ? tagMatch[1].trim() : null });
|
|
374
|
+
}
|
|
375
|
+
return out;
|
|
376
|
+
}
|
|
335
377
|
|
|
336
378
|
module.exports = {
|
|
337
379
|
_isSecretKey, compareVer, parseHarnessVersion,
|
|
@@ -353,5 +395,9 @@ module.exports = {
|
|
|
353
395
|
// 1.9.329 (UR-0025): 순수 roadmap MD 파서
|
|
354
396
|
_roadmapMapStatus, _roadmapParseMilestones, _roadmapParseTokens,
|
|
355
397
|
// 1.9.330 (UR-0025): project-brief 필드 config + 채움 카운트
|
|
356
|
-
_BRIEF_FIELDS, _briefFilled
|
|
398
|
+
_BRIEF_FIELDS, _briefFilled,
|
|
399
|
+
// 1.9.331 (UR-0025): project-brief 텍스트 빌더 + 마커
|
|
400
|
+
BRIEF_START, BRIEF_END, _briefReadmeBlock, _briefBlueprint,
|
|
401
|
+
// 1.9.332 (UR-0025): 순수 lessons.md 파서
|
|
402
|
+
_parseLessonEntries
|
|
357
403
|
};
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -4055,5 +4055,57 @@ total++;
|
|
|
4055
4055
|
if (!ok) failed++;
|
|
4056
4056
|
}
|
|
4057
4057
|
|
|
4058
|
+
// 1.9.331 회귀 (UR-0025 서브시스템): brief 빌더(_briefReadmeBlock/_briefBlueprint)+마커 lib/pure-utils 분리 + brief export/sync 회귀
|
|
4059
|
+
total++;
|
|
4060
|
+
{
|
|
4061
|
+
let ok = false;
|
|
4062
|
+
try {
|
|
4063
|
+
const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
|
|
4064
|
+
const b = { project: 'X', intro: 'i', features: ['f1'] };
|
|
4065
|
+
const work = typeof m._briefReadmeBlock === 'function' && typeof m._briefBlueprint === 'function'
|
|
4066
|
+
&& m._briefReadmeBlock(b).includes(m.BRIEF_START) && /f1/.test(m._briefReadmeBlock(b))
|
|
4067
|
+
&& /Blueprint/.test(m._briefBlueprint(b, '9.9.9')) && /leerness v9\.9\.9/.test(m._briefBlueprint(b, '9.9.9')); // VERSION 주입
|
|
4068
|
+
const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
|
|
4069
|
+
const _puImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/pure-utils'\)/) || [''])[0]; // import 순서 비의존
|
|
4070
|
+
const movedOut = !/function _briefReadmeBlock\(/.test(harnessSrc) && !/function _briefBlueprint\(/.test(harnessSrc) && !/^const BRIEF_START =/m.test(harnessSrc)
|
|
4071
|
+
&& _puImp.includes('_briefReadmeBlock') && _puImp.includes('_briefBlueprint') && _puImp.includes('BRIEF_START');
|
|
4072
|
+
// 소비 명령 회귀: brief set → export(blueprint) + README sync(markers)
|
|
4073
|
+
const bd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-briefsub-'));
|
|
4074
|
+
cp.spawnSync(process.execPath, [CLI, 'init', bd, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
|
|
4075
|
+
cp.spawnSync(process.execPath, [CLI, 'brief', 'set', '--intro', 'X', '--features', 'a,b', '--path', bd], { encoding: 'utf8', timeout: 20000 });
|
|
4076
|
+
const ex = cp.spawnSync(process.execPath, [CLI, 'brief', 'export', '--path', bd], { encoding: 'utf8', timeout: 20000 });
|
|
4077
|
+
const readmeOk = /project-brief:start/.test(fs.readFileSync(path.join(bd, 'README.md'), 'utf8'));
|
|
4078
|
+
const cmdOk = /Blueprint/.test(ex.stdout || '') && readmeOk;
|
|
4079
|
+
ok = work && movedOut && cmdOk;
|
|
4080
|
+
fs.rmSync(bd, { recursive: true, force: true });
|
|
4081
|
+
} catch {}
|
|
4082
|
+
console.log(ok ? '✓ B(1.9.331) lib/pure-utils brief 빌더 분리: 모듈 단일출처 + 인라인 제거 + brief export/README sync (UR-0025)' : '✗ brief 빌더 분리 실패');
|
|
4083
|
+
if (!ok) failed++;
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
// 1.9.332 회귀 (UR-0025 모듈화): lessons.md 파서(_parseLessonEntries) lib/pure-utils 분리 + lesson list 회귀
|
|
4087
|
+
total++;
|
|
4088
|
+
{
|
|
4089
|
+
let ok = false;
|
|
4090
|
+
try {
|
|
4091
|
+
const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
|
|
4092
|
+
const r = m._parseLessonEntries('### 2026-06-05\n- Lesson: A\n- Tag: t\n\n### 2026-06-04\n- Lesson: B');
|
|
4093
|
+
const work = typeof m._parseLessonEntries === 'function' && r.length === 2 && r[0].text === 'A' && r[0].tag === 't' && r[1].tag === null;
|
|
4094
|
+
const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
|
|
4095
|
+
const _puImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/pure-utils'\)/) || [''])[0]; // import 순서 비의존
|
|
4096
|
+
const movedOut = !/function _parseLessonEntries\(/.test(harnessSrc) && _puImp.includes('_parseLessonEntries');
|
|
4097
|
+
// 소비 명령 회귀: lesson save + list --json
|
|
4098
|
+
const ld = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-lesson-'));
|
|
4099
|
+
cp.spawnSync(process.execPath, [CLI, 'init', ld, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
|
|
4100
|
+
cp.spawnSync(process.execPath, [CLI, 'lesson', 'save', '락 reentrant', '--tag', 'lock', '--path', ld], { encoding: 'utf8', timeout: 20000 });
|
|
4101
|
+
const lr = cp.spawnSync(process.execPath, [CLI, 'lesson', 'list', '--path', ld, '--json'], { encoding: 'utf8', timeout: 20000 });
|
|
4102
|
+
let cmdOk = false; try { const j = JSON.parse(lr.stdout); cmdOk = j.total === 1 && j.lessons[0].tag === 'lock'; } catch {}
|
|
4103
|
+
ok = work && movedOut && cmdOk;
|
|
4104
|
+
fs.rmSync(ld, { recursive: true, force: true });
|
|
4105
|
+
} catch {}
|
|
4106
|
+
console.log(ok ? '✓ B(1.9.332) lib/pure-utils lessons 파서 분리: 모듈 단일출처 + 인라인 제거 + lesson list (UR-0025)' : '✗ lessons 파서 분리 실패');
|
|
4107
|
+
if (!ok) failed++;
|
|
4108
|
+
}
|
|
4109
|
+
|
|
4058
4110
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
4059
4111
|
if (failed > 0) process.exit(1);
|