leerness 1.9.353 → 1.9.355
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 +32 -0
- package/README.md +5 -5
- package/bin/harness.js +15 -8
- package/lib/pure-utils.js +56 -6
- package/package.json +1 -1
- package/scripts/e2e.js +54 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.355 — 2026-06-05 — UR-0075 Phase A: 크로스버전 마이그레이션 가이드 + migrate/update --path
|
|
4
|
+
|
|
5
|
+
**🧩 AI 에이전트용 크로스버전 마이그레이션 가이드(`migrate --guide`) + init/migrate/update `--path` 지원.** (UR-0075 Phase A — 비전 착수, 외부리뷰 버그 전량 해소 후)
|
|
6
|
+
|
|
7
|
+
### 배경
|
|
8
|
+
외부리뷰 P0~P3 전량 해소로 안전 기반 마련 → 비전 착수. 마이그레이션은 leerness 핵심 가치("비파괴 마이그레이션"). 가이드가 `update --path`/`migrate --path` 를 권하므로 정확성 위해 --path 지원을 함께 보강(UR-0059 확장).
|
|
9
|
+
|
|
10
|
+
### 구현
|
|
11
|
+
1. **`_migrationGuideText(version)`**(순수) + **`leerness migrate --guide`/`migrate guide`** — AI 에이전트용 안전 워크플로: 안전 스냅샷(git) → `npx leerness@latest update --check --path <project>`(감지) → `--yes`(임시설치·.harness/archive 백업·신 스키마) → `git diff`/`selftest`/`check` 검증 → canonical JSON 백필 메모 → 롤백.
|
|
12
|
+
2. **init/migrate/update `--path` 지원** (UR-0059 확장): `install(arg('--path', args[1] || cwd))` / `updateCmd(arg('--path', ...))` — 이전엔 `args[1] || cwd` 로 positional 전용·`--path` 무시. 이제 --path > positional > cwd. (가이드의 `update --path` 정확성)
|
|
13
|
+
|
|
14
|
+
### 검증
|
|
15
|
+
- **selftest 102/102 PASS** · **E2E 299→300 PASS** (회귀 0).
|
|
16
|
+
- 실측: `migrate --guide` 가이드 출력(0.원칙~6.롤백) · `migrate guide` subcommand 동일 · `update --check --path B`(cwd A) → B 의 HARNESS_VERSION(1.9.6) 읽음(=--path 동작, 이전 cwd A).
|
|
17
|
+
|
|
18
|
+
## 1.9.354 — 2026-06-05 — 외부리뷰 P3 클러스터 (UR-0072) · 외부리뷰 백로그 소진
|
|
19
|
+
|
|
20
|
+
**🧩 외부 리뷰 P3 핵심 4종 — compareVer pre-release · _classifyCJK 일본어 오판 · scan secrets 파일경로 · requests drop 아이콘.**
|
|
21
|
+
|
|
22
|
+
### 구현
|
|
23
|
+
1. **compareVer pre-release** (Opus P3-4): `1.9.0-beta` < `1.9.0` semver 규칙 적용(이전: `-beta` 무시 → 동일 취급). beta/next 채널 stale-check 정확도.
|
|
24
|
+
2. **_classifyCJK 일본어 오판** (Opus P3-2): CJK 통합 한자(한·중·일 공유)를 무조건 중국어로 세던 것 → **kana 존재 시 일본어 귀속** 휴리스틱. advisory 인코딩 라벨 정확도.
|
|
25
|
+
3. **scan secrets 파일경로** (Codex#10): `scan secrets <file>` 가 `ENOTDIR` 로 실패하던 것 → 파일이면 그 파일만 스캔(basename 표시), 디렉토리면 walk.
|
|
26
|
+
4. **requests drop 아이콘** (Codex#8): 성공 동작에 실패 아이콘 `✗` → `✓`.
|
|
27
|
+
|
|
28
|
+
### 검증
|
|
29
|
+
- **selftest 101/101 PASS** · **E2E 298→299 PASS** (회귀 0).
|
|
30
|
+
- 실측: compareVer beta<release · _classifyCJK 일본어(kana+한자)→japanese·중국어(한자만)→chinese · `scan secrets leak.js` GitLab PAT 감지(ENOTDIR 없음, leak.js 표시) · `requests drop` → ✓.
|
|
31
|
+
|
|
32
|
+
### 비고 (P3 잔여 — cosmetic, UR-0072 후속)
|
|
33
|
+
intent/constraints/requests `.` arg "Unknown subcommand"(핸들러별 default 검증 필요) · skill install <catalog-id>(id 해석 설계) · pulse 라벨 분모 표기 — 소형 UX 폴리시, 별도 처리.
|
|
34
|
+
|
|
3
35
|
## 1.9.353 — 2026-06-05 — 외부리뷰 P2 마무리 3종 (UR-0067/0070/0071) · P2 전량 완료
|
|
4
36
|
|
|
5
37
|
**🧩 외부 리뷰 남은 P2 3건 — 인코딩 정책/CP949 · shell-guard 셸 명시 · init non-TTY ANSI. 외부리뷰 P0/P1/P2 전량 해소.**
|
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.355 하네스를 사용합니다. 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.355는 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.353는 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.355)** · 매 라운드 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.355: 2026-06-05
|
|
588
588
|
<!-- leerness:project-readme:end -->
|
|
589
589
|
|
package/bin/harness.js
CHANGED
|
@@ -21,13 +21,14 @@ const { _isSecretKey, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel,
|
|
|
21
21
|
_detectOptimism: _puDetectOptimism, _computeConfidence: _puComputeConfidence,
|
|
22
22
|
_personaSummaries, _translate,
|
|
23
23
|
_decisionsFromMd, _renderDecisionsMd, _renderLessonsMd,
|
|
24
|
-
_withBuiltinSource, _esc, _roadmapTokenStyles, _parseSkillMd
|
|
24
|
+
_withBuiltinSource, _esc, _roadmapTokenStyles, _parseSkillMd,
|
|
25
|
+
_migrationGuideText } = require('../lib/pure-utils'); // 1.9.318~355 (UR-0025/0053/0075): 순수 유틸 모듈 분리
|
|
25
26
|
// 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
|
|
26
27
|
const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
|
|
27
28
|
// 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
|
|
28
29
|
const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST, _DEFAULT_PLATFORM_CONSTRAINTS, _DEFAULT_DOMAIN_CATALOG, _LSP_LANG_PATTERNS, OPTIMISM_PATTERNS, BUILT_IN_PERSONAS, STRINGS, BUILTIN_CATALOG, ROADMAP_STATUS_LABEL, ROADMAP_STATUS_COLOR, SECRET_PATTERNS, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344 (UR-0025): SKILL_CATALOG_PRESETS 분리
|
|
29
30
|
|
|
30
|
-
const VERSION = '1.9.
|
|
31
|
+
const VERSION = '1.9.355';
|
|
31
32
|
|
|
32
33
|
// 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
|
|
33
34
|
// 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
|
|
@@ -3057,6 +3058,8 @@ function _selfTestCases() {
|
|
|
3057
3058
|
{ name: 'UR-0060(외부리뷰 P1): SECRET_PATTERNS 19종 — GitLab/JWT/DB-URI/SendGrid/AWS-secret/Bearer 보강 + 오탐 가드', run: () => { const c = require('../lib/catalogs'); const hit = s => c.SECRET_PATTERNS.some(p => { p.re.lastIndex = 0; return p.re.test(s); }); const det = hit('glpat-' + 'x'.repeat(20)) && hit('eyJ' + 'x'.repeat(15) + '.eyJ' + 'y'.repeat(15) + '.' + 'z'.repeat(15)) && hit('postgres://u:p@host:5432/db') && hit('SG.' + 'x'.repeat(22) + '.' + 'y'.repeat(43)) && hit('aws_secret_access_key = "' + 'x'.repeat(40) + '"') && hit('Bearer ' + 'x'.repeat(25)); const clean = !hit('const u = "john' + '_doe_2024";') && !hit('https://example.com/path/to/page'); return c.SECRET_PATTERNS.length === 19 && det && clean; } },
|
|
3058
3059
|
{ name: 'UR-0068(외부리뷰 P2): _roadmapParseMilestones 블록 경계 — 다음 milestone status 누출 차단', run: () => { const m = require('../lib/pure-utils'); const r = m._roadmapParseMilestones('### M-0001. A\n\n### M-0002. B\nStatus: done\nProgress: 80%\n'); return r.length === 2 && r[0].status === 'planned' && r[0].progress === 0 && r[1].status === 'done' && r[1].progress === 80; } },
|
|
3059
3060
|
{ name: 'UR-0066(외부리뷰 P2): shell:true 주입 가드 — agents bench task _shellQuoteArg + fetchNpmLatest npm.cmd', run: () => { const m = require('../lib/pure-utils'); const src = read(__filename); const benchQuoted = src.includes('const qTask = ' + '_shellQuoteArg(task)'); const npmCmd = /'win32' \? 'npm\.cmd' : 'npm'/.test(src); const q = m._shellQuoteArg('a & b'); const safe = (process.platform === 'win32' ? q === '"a & b"' : q === "'a & b'"); return benchQuoted && npmCmd && safe; } },
|
|
3061
|
+
{ name: 'UR-0072(외부리뷰 P3): compareVer pre-release + _classifyCJK 한자 kana 귀속', run: () => { const m = require('../lib/pure-utils'); const verOk = m.compareVer('1.9.0-beta', '1.9.0') === -1 && m.compareVer('1.9.0', '1.9.0-beta') === 1 && m.compareVer('1.9.5', '1.9.5') === 0 && m.compareVer('1.9.6', '1.9.5') === 1; const jp = Buffer.from([0xE3, 0x81, 0x82, 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC]); const cn = Buffer.from([0xE4, 0xB8, 0xAD, 0xE5, 0x9B, 0xBD]); const rj = m._classifyCJK(jp, jp.length); const rc = m._classifyCJK(cn, cn.length); const cjkOk = rj.japanese > rj.chinese && rc.chinese > 0 && rc.japanese === 0; return verOk && cjkOk; } },
|
|
3062
|
+
{ name: 'UR-0075 Phase A: 마이그레이션 가이드(_migrationGuideText) + migrate --guide 와이어 + init/migrate/update --path', run: () => { const m = require('../lib/pure-utils'); const g = m._migrationGuideText('1.9.355'); const guideOk = typeof g === 'string' && g.includes('마이그레이션 가이드') && g.includes('update --check --path') && g.includes('selftest') && g.includes('canonical JSON') && g.includes('롤백') && g.includes('1.9.355'); const src = read(__filename); const wired = src.includes("has('--guide') || args[1] === " + "'guide'") && src.includes('install(arg(' + "'--path', args[1] || process.cwd())") && src.includes('updateCmd(arg(' + "'--path', args[1] || process.cwd())"); return guideOk && wired; } },
|
|
3060
3063
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
3061
3064
|
];
|
|
3062
3065
|
}
|
|
@@ -4602,7 +4605,7 @@ function requestsCmd(root, sub, ...rest) {
|
|
|
4602
4605
|
const updated = _updateUserRequest(root, id, { status: 'dropped' });
|
|
4603
4606
|
if (!updated) { console.error(`request not found: ${id}`); process.exit(1); }
|
|
4604
4607
|
if (has('--json')) { log(JSON.stringify(updated, null, 2)); return; }
|
|
4605
|
-
log(yel(
|
|
4608
|
+
log(yel(`✓ dropped ${updated.id}`)); // 1.9.354 (UR-0072 외부리뷰): 성공 동작에 실패 아이콘(✗) 대신 ✓
|
|
4606
4609
|
return;
|
|
4607
4610
|
}
|
|
4608
4611
|
|
|
@@ -7103,13 +7106,16 @@ function* walk(root, base = root, depth = 0, extras = null) {
|
|
|
7103
7106
|
function scanSecrets(root) {
|
|
7104
7107
|
root = absRoot(root);
|
|
7105
7108
|
const findings = [];
|
|
7106
|
-
|
|
7109
|
+
// 1.9.354 (UR-0072 외부리뷰): root 가 파일이면 그 파일만 스캔 (이전: walk 의 readdirSync → ENOTDIR). 디렉토리면 기존 walk.
|
|
7110
|
+
let _iter;
|
|
7111
|
+
try { _iter = fs.statSync(root).isFile() ? [root] : walk(root); } catch { _iter = walk(root); }
|
|
7112
|
+
for (const file of _iter) {
|
|
7107
7113
|
const ext = path.extname(file).toLowerCase();
|
|
7108
7114
|
if (!SCAN_TEXT_EXT.has(ext)) continue;
|
|
7109
7115
|
let text;
|
|
7110
7116
|
try { text = read(file); } catch { continue; }
|
|
7111
7117
|
if (text.length > 1024 * 1024) continue;
|
|
7112
|
-
const fileRel = rel(root, file);
|
|
7118
|
+
const fileRel = (file === root) ? path.basename(file) : rel(root, file); // 1.9.354 (UR-0072): 단일 파일 스캔 시 basename 표시('.' 방지)
|
|
7113
7119
|
// 1.9.350 (UR-0060 외부리뷰): leerness 자기 harness.js(regex 소스) + 생성 secret-policy 템플릿만 제외 — 정확 경로(사용자 파일명 substring false-negative 제거)
|
|
7114
7120
|
if (path.resolve(file) === path.resolve(__filename) || /(^|[\\/])\.(?:harness|leerness)[\\/]secret-policy\.md$/.test(fileRel)) continue;
|
|
7115
7121
|
for (const { name, re } of SECRET_PATTERNS) {
|
|
@@ -20994,7 +21000,7 @@ async function main() {
|
|
|
20994
21000
|
} catch {}
|
|
20995
21001
|
}
|
|
20996
21002
|
// 1.9.276 (GPT-5.5 2차 리뷰): init --dry-run(미리보기) / --minimal(핵심 파일만) / --no-env(.env 생략)
|
|
20997
|
-
if (cmd === 'init') return await install(args[1] || process.cwd(), { force:has('--force'), dry:has('--dry-run'), migration:false, minimal:has('--minimal'), noEnv:has('--no-env') });
|
|
21003
|
+
if (cmd === 'init') return await install(arg('--path', args[1] || process.cwd()), { force:has('--force'), dry:has('--dry-run'), migration:false, minimal:has('--minimal'), noEnv:has('--no-env') }); // 1.9.355 (UR-0075): --path 지원
|
|
20998
21004
|
// 1.9.64: install <skill-id-or-url> 별칭 (= skill install). 자주 쓰는 명령 단축형.
|
|
20999
21005
|
// 단, init이 leerness install . 같은 형태로도 동작하던 옛 호환은 유지 — args[1]이 디렉토리면 init으로 라우팅.
|
|
21000
21006
|
if (cmd === 'install') {
|
|
@@ -21012,8 +21018,9 @@ async function main() {
|
|
|
21012
21018
|
fail(`알 수 없는 install 대상: ${arg1}\n SKILL.md 파일/URL/SKILL.md 포함 디렉토리 필요`);
|
|
21013
21019
|
return process.exit(1);
|
|
21014
21020
|
}
|
|
21015
|
-
if (cmd === 'migrate')
|
|
21016
|
-
if (cmd === '
|
|
21021
|
+
if (cmd === 'migrate' && (has('--guide') || args[1] === 'guide')) { log(_migrationGuideText(VERSION)); return; } // 1.9.355 (UR-0075 Phase A): 크로스버전 마이그레이션 가이드
|
|
21022
|
+
if (cmd === 'migrate') return await install(arg('--path', args[1] || process.cwd()), { force:has('--force'), dry:has('--dry-run'), migration:true }); // 1.9.355 (UR-0075): --path 지원
|
|
21023
|
+
if (cmd === 'update') return await updateCmd(arg('--path', args[1] || process.cwd()), { checkOnly: has('--check'), yes: has('--yes'), force: has('--force') }); // 1.9.355 (UR-0075): --path 지원
|
|
21017
21024
|
if (cmd === 'auto-update' && args[1] === 'install') return autoUpdateInstall(arg('--path', args[2] || process.cwd()));
|
|
21018
21025
|
if (cmd === 'status') return status(arg('--path', args[1] || process.cwd()));
|
|
21019
21026
|
if (cmd === 'verify') return verify(arg('--path', args[1] || process.cwd()));
|
package/lib/pure-utils.js
CHANGED
|
@@ -11,13 +11,18 @@ function _isSecretKey(k) {
|
|
|
11
11
|
|
|
12
12
|
// semver 비교: a>b → 1, a<b → -1, 같음 → 0. (누락 파트/null 안전)
|
|
13
13
|
function compareVer(a, b) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const A = String(a || '0'), B = String(b || '0');
|
|
15
|
+
const sa = A.split('-')[0].split('.').map(n => parseInt(n || '0', 10));
|
|
16
|
+
const sb = B.split('-')[0].split('.').map(n => parseInt(n || '0', 10));
|
|
16
17
|
for (let i = 0; i < 3; i++) {
|
|
17
18
|
const x = sa[i] || 0, y = sb[i] || 0;
|
|
18
19
|
if (x > y) return 1;
|
|
19
20
|
if (x < y) return -1;
|
|
20
21
|
}
|
|
22
|
+
// 1.9.354 (UR-0072 외부리뷰): 숫자 동일 시 pre-release(-beta/-next 등) < 정식 (semver 규칙). 이전: -beta 무시 → 동일 취급.
|
|
23
|
+
const preA = A.includes('-'), preB = B.includes('-');
|
|
24
|
+
if (preA && !preB) return -1;
|
|
25
|
+
if (!preA && preB) return 1;
|
|
21
26
|
return 0;
|
|
22
27
|
}
|
|
23
28
|
|
|
@@ -36,15 +41,17 @@ function parseHarnessVersion(text) {
|
|
|
36
41
|
|
|
37
42
|
// UTF-8 바이트열의 CJK 분류 (한국어/일본어/중국어/기타) — 인코딩 오인식 위험 감지용.
|
|
38
43
|
function _classifyCJK(buf, len) {
|
|
39
|
-
let korean = 0, japanese = 0, chinese = 0, other = 0;
|
|
44
|
+
let korean = 0, japanese = 0, chinese = 0, other = 0, han = 0;
|
|
40
45
|
for (let i = 0; i < Math.min(buf.length, len); i++) {
|
|
41
46
|
const b = buf[i];
|
|
42
47
|
if (b < 0x80) continue;
|
|
43
48
|
if (b >= 0xEA && b <= 0xED) korean++;
|
|
44
|
-
else if (b === 0xE3) japanese++;
|
|
45
|
-
else if (b >= 0xE4 && b <= 0xE9)
|
|
49
|
+
else if (b === 0xE3) japanese++; // kana/기호 (U+3000-3FFF) — 일본어 강한 신호
|
|
50
|
+
else if (b >= 0xE4 && b <= 0xE9) han++; // CJK 통합 한자 — 한·중·일 공유라 모호
|
|
46
51
|
else other++;
|
|
47
52
|
}
|
|
53
|
+
// 1.9.354 (UR-0072 외부리뷰): 한자는 한·중·일 공유라 lead byte 만으로 판별 불가 → kana 가 있으면 일본어, 없으면 중국어로 귀속(휴리스틱). advisory 라벨 일본어 오판 완화.
|
|
54
|
+
if (japanese > 0) japanese += han; else chinese += han;
|
|
48
55
|
return { korean, japanese, chinese, other };
|
|
49
56
|
}
|
|
50
57
|
|
|
@@ -654,5 +661,48 @@ module.exports = {
|
|
|
654
661
|
// 1.9.338 (UR-0025 심층): i18n 순수 조회
|
|
655
662
|
_translate,
|
|
656
663
|
// 1.9.339 (UR-0053): decisions canonical 파서/렌더 (JSON canonical, MD projection)
|
|
657
|
-
_parseDecisionBlock, _decisionsFromMd, _renderDecisionsMd
|
|
664
|
+
_parseDecisionBlock, _decisionsFromMd, _renderDecisionsMd,
|
|
665
|
+
// 1.9.355 (UR-0075 Phase A): 크로스버전 마이그레이션 가이드
|
|
666
|
+
_migrationGuideText
|
|
658
667
|
};
|
|
668
|
+
|
|
669
|
+
// 1.9.355 (UR-0075 Phase A): AI 에이전트용 크로스버전 마이그레이션 안전 워크플로 가이드 (순수 텍스트). 임시설치 + --path + 백업 + diff 검증.
|
|
670
|
+
function _migrationGuideText(version) {
|
|
671
|
+
const v = version || 'latest';
|
|
672
|
+
const L = [
|
|
673
|
+
'# leerness 크로스버전 마이그레이션 가이드 (UR-0075, AI 에이전트용)',
|
|
674
|
+
'',
|
|
675
|
+
'아주 오래된 구버전부터 신규(' + v + ')까지 — 기존 프로젝트의 .harness 내용을 안전·비파괴로 마이그레이션.',
|
|
676
|
+
'',
|
|
677
|
+
'## 0. 원칙',
|
|
678
|
+
'- 비파괴: leerness 는 migrate/update 시 .harness/archive 에 자동 백업. 그래도 git 커밋/브랜치 선행 권장.',
|
|
679
|
+
'- dry-run 우선: 먼저 --check 로 감지, diff 로 확인 후 적용.',
|
|
680
|
+
'',
|
|
681
|
+
'## 1. 안전 스냅샷 (권장)',
|
|
682
|
+
' git add -A && git commit -m "chore: pre-leerness-migration snapshot" # 또는 브랜치: git checkout -b chore/leerness-migrate',
|
|
683
|
+
'',
|
|
684
|
+
'## 2. 신규 버전 감지 (구버전 프로젝트 대상)',
|
|
685
|
+
' npx leerness@latest update --check --path <project> # 현재 버전 vs 최신 비교 (네트워크 비차단, 비파괴)',
|
|
686
|
+
'',
|
|
687
|
+
'## 3. 마이그레이션 적용 (임시설치 = npx 캐시, 격리)',
|
|
688
|
+
' npx leerness@latest update --yes --path <project> # 자동 마이그레이션 (.harness/archive 백업 + 신 스키마 반영)',
|
|
689
|
+
' # 또는: npx leerness@latest migrate <project> --force # 강제 재스캐폴딩(비파괴, 기존 내용 보존)',
|
|
690
|
+
'',
|
|
691
|
+
'## 4. 검증 (필수)',
|
|
692
|
+
' git -C <project> diff # 생성/수정 파일 전수 확인 (예상치 못한 변경 점검)',
|
|
693
|
+
' npx leerness@latest selftest # 코어 무결성 (위치독립, 어디서든 통과)',
|
|
694
|
+
' npx leerness@latest check --path <project> # 프로젝트 무결성',
|
|
695
|
+
' npx leerness@latest doctor # 설치 진단',
|
|
696
|
+
'',
|
|
697
|
+
'## 5. 크로스버전 메모',
|
|
698
|
+
'- decisions/lessons: 구 MD-only → canonical JSON 자동 백필(첫 write 시). decisions.json/lessons.json 이 진실소스, .md 는 projection.',
|
|
699
|
+
'- 아주 구버전: update 가 단계적으로 누적 마이그레이션. 한 번에 안 되면 update --yes 재실행.',
|
|
700
|
+
'- 보호 파일(.harness/protected-files.md): 삭제 금지 — merge/archive/deprecated 마커 사용.',
|
|
701
|
+
'',
|
|
702
|
+
'## 6. 롤백',
|
|
703
|
+
' git -C <project> checkout -- . # git 스냅샷 복원',
|
|
704
|
+
' # 또는 .harness/archive/<timestamp> 에서 수동 복구 · leerness memory restore <surface> <target>',
|
|
705
|
+
''
|
|
706
|
+
];
|
|
707
|
+
return L.join('\n');
|
|
708
|
+
}
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -4723,5 +4723,59 @@ total++;
|
|
|
4723
4723
|
if (!ok) failed++;
|
|
4724
4724
|
}
|
|
4725
4725
|
|
|
4726
|
+
// 1.9.354 회귀 (외부리뷰 P3 UR-0072): compareVer pre-release + _classifyCJK + scan secrets 파일경로 + requests drop ✓
|
|
4727
|
+
total++;
|
|
4728
|
+
{
|
|
4729
|
+
let ok = false;
|
|
4730
|
+
try {
|
|
4731
|
+
const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
|
|
4732
|
+
const pureOk = m.compareVer('1.9.0-beta', '1.9.0') === -1 && m.compareVer('1.9.0', '1.9.0-beta') === 1 && m.compareVer('1.9.6', '1.9.5') === 1
|
|
4733
|
+
&& (() => { const jp = Buffer.from([0xE3, 0x81, 0x82, 0xE6, 0x97, 0xA5]); const r = m._classifyCJK(jp, jp.length); return r.japanese > r.chinese; })();
|
|
4734
|
+
// scan secrets <file> (이전 ENOTDIR) + basename 표시
|
|
4735
|
+
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-p3-'));
|
|
4736
|
+
cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
4737
|
+
fs.writeFileSync(path.join(d, 'leak.js'), 'const k = "glpat-' + 'x'.repeat(20) + '";\n');
|
|
4738
|
+
const fr = cp.spawnSync(process.execPath, [CLI, 'scan', 'secrets', path.join(d, 'leak.js')], { encoding: 'utf8', timeout: 20000 });
|
|
4739
|
+
const fout = (fr.stdout || '') + (fr.stderr || '');
|
|
4740
|
+
const fileScanOk = /GitLab PAT/.test(fout) && /leak\.js/.test(fout) && !/ENOTDIR/.test(fout);
|
|
4741
|
+
// requests drop 성공 아이콘 ✓ (실패 ✗ 아님)
|
|
4742
|
+
cp.spawnSync(process.execPath, [CLI, 'requests', 'add', 'P3 drop test', '--path', d], { encoding: 'utf8', timeout: 20000 });
|
|
4743
|
+
const lj = JSON.parse(cp.spawnSync(process.execPath, [CLI, 'requests', 'list', '--path', d, '--json'], { encoding: 'utf8', timeout: 20000 }).stdout);
|
|
4744
|
+
const newId = (lj.requests || []).filter(r => r.status === 'open').pop();
|
|
4745
|
+
let dropOk = false;
|
|
4746
|
+
if (newId) { const dr = cp.spawnSync(process.execPath, [CLI, 'requests', 'drop', newId.id, '--path', d], { encoding: 'utf8', timeout: 20000 }); const dout = (dr.stdout || '') + (dr.stderr || ''); dropOk = /✓ dropped/.test(dout) && !/✗ dropped/.test(dout); }
|
|
4747
|
+
fs.rmSync(d, { recursive: true, force: true });
|
|
4748
|
+
ok = pureOk && fileScanOk && dropOk;
|
|
4749
|
+
} catch {}
|
|
4750
|
+
console.log(ok ? '✓ B(1.9.354) 외부리뷰 P3: compareVer/_classifyCJK + scan secrets 파일 + requests drop ✓ (UR-0072)' : '✗ P3 클러스터 실패');
|
|
4751
|
+
if (!ok) failed++;
|
|
4752
|
+
}
|
|
4753
|
+
|
|
4754
|
+
// 1.9.355 회귀 (UR-0075 Phase A): migrate --guide 가이드 출력 + update/init/migrate --path 타깃(이전 positional 전용)
|
|
4755
|
+
total++;
|
|
4756
|
+
{
|
|
4757
|
+
let ok = false;
|
|
4758
|
+
try {
|
|
4759
|
+
const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
|
|
4760
|
+
const g = m._migrationGuideText('9.9.9');
|
|
4761
|
+
const pureOk = g.includes('마이그레이션 가이드') && g.includes('update --check --path') && g.includes('selftest') && g.includes('9.9.9');
|
|
4762
|
+
const gr = cp.spawnSync(process.execPath, [CLI, 'migrate', '--guide'], { encoding: 'utf8', timeout: 20000 });
|
|
4763
|
+
const guideOk = /마이그레이션 가이드/.test(gr.stdout || '') && /git/.test(gr.stdout || '');
|
|
4764
|
+
// update --path: A(cwd) 에서 --path B 가 B 의 HARNESS_VERSION 을 읽음(=--path 동작, 이전엔 cwd A)
|
|
4765
|
+
const A = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-mga-'));
|
|
4766
|
+
const Bd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-mgb-'));
|
|
4767
|
+
cp.spawnSync(process.execPath, [CLI, 'init', A, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
4768
|
+
cp.spawnSync(process.execPath, [CLI, 'init', Bd, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
4769
|
+
fs.writeFileSync(path.join(Bd, '.harness', 'HARNESS_VERSION'), '1.9.6\n');
|
|
4770
|
+
const ur = cp.spawnSync(process.execPath, [CLI, 'update', '--check', '--path', Bd], { cwd: A, encoding: 'utf8', timeout: 30000, env: { ...process.env, LEERNESS_OFFLINE: '1' } });
|
|
4771
|
+
const pathOk = /1\.9\.6/.test((ur.stdout || '') + (ur.stderr || ''));
|
|
4772
|
+
fs.rmSync(A, { recursive: true, force: true });
|
|
4773
|
+
fs.rmSync(Bd, { recursive: true, force: true });
|
|
4774
|
+
ok = pureOk && guideOk && pathOk;
|
|
4775
|
+
} catch {}
|
|
4776
|
+
console.log(ok ? '✓ B(1.9.355) UR-0075 Phase A: 마이그레이션 가이드 + update --path 타깃 (UR-0075)' : '✗ UR-0075 가이드 실패');
|
|
4777
|
+
if (!ok) failed++;
|
|
4778
|
+
}
|
|
4779
|
+
|
|
4726
4780
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
4727
4781
|
if (failed > 0) process.exit(1);
|