leerness 1.9.402 → 1.9.404

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 CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.404 — 2026-06-07 — reuse autodetect / creds check --json 에러 구조화 (7번째 버그헌트 P2, UR-0105 잔여)
4
+
5
+ **🔌 reuse autodetect / creds check 의 빈·에러 --json 경로도 구조화 JSON — failJson 와이어 확대.**
6
+
7
+ ### 배경
8
+ 버그헌트가 여러 명령의 --json 에러 누출을 지적. UR-0099/0105 에서 핵심(contract/feature/anti-laziness)을 고쳤고, 이번에 reuse autodetect(스캔 디렉토리 없음)·creds check(등록 서비스 없음)를 추가.
9
+
10
+ ### 구현
11
+ - reuse autodetect: `no_scan_dir`, creds check: `no_service` 를 `failJson(has('--json'), ...)` 로. 사람용 출력 보존.
12
+
13
+ ### 검증 (회귀 0)
14
+ - **selftest 149→150 PASS** + **E2E 342→343 PASS** (reuse/creds --json → {ok:false,code} + 사람용 텍스트 보존).
15
+
16
+ ## 1.9.403 — 2026-06-07 — api-skill 에러 exit code 1 (7번째 버그헌트 P2, UR-0107)
17
+
18
+ **🚦 api-skill show/drop 의 실패가 성공(exit 0)으로 보고되던 것 수정 — AI 에이전트의 exit-code 게이트 신뢰성.**
19
+
20
+ ### 배경 (7번째 버그헌트 P2 · 비판검토 후 선별)
21
+ 버그헌트가 여러 exit-code 비일관을 지적. 직접 재현 + **비판 판단**:
22
+ - **수정(명확)**: api-skill show/drop 없는 ID + 인자 누락이 `✗ ...` 출력하면서 exit 0 → 실패를 성공으로 오판(데이터 op 에러). exit 1 로 수정.
23
+ - **미수정(by-design 판단)**: roles/policy/state 의 unknown-subcommand 가 catalog(default list)를 보여주며 exit 0 → `cmd`(no sub)와 동일한 lenient-default 라 defensible. 과엄격 변경 위험으로 제외. web/pc check 의 "미설치" exit 0 도 opt-in 정보성이라 정당(미수정).
24
+
25
+ ### 구현
26
+ - api-skill show(id 누락/not-found), drop(id 누락/not-found), add(url 누락) 에러에 `process.exitCode = 1` 추가. 정상 list/show 는 exit 0 보존.
27
+
28
+ ### 검증 (회귀 0)
29
+ - **selftest 148→149 PASS** (api-skill show/drop/add 에러 exit-code 와이어).
30
+ - **E2E 341→342 PASS** (show/drop NOPE + show id누락 → exit1, list → exit0).
31
+
3
32
  ## 1.9.402 — 2026-06-07 — decisions/lessons MD projection 개행 주입 차단 (7번째 버그헌트 P1-A 잔여, UR-0108)
4
33
 
5
34
  **🛡 데이터 무결성 완결 — decision/lesson 텍스트의 개행이 decisions.md/lessons.md projection 에 위조 블록을 주입하던 것 차단(테이블셀 injection 클러스터 마무리).**
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
- [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.402-green)]() [![tests](https://img.shields.io/badge/e2e-341%2F341-success)]() [![selftest](https://img.shields.io/badge/selftest-148-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-85-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
6
+ [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.404-green)]() [![tests](https://img.shields.io/badge/e2e-343%2F343-success)]() [![selftest](https://img.shields.io/badge/selftest-150-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-85-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
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.402 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.404 하네스를 사용합니다. 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.402는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
528
+ Leerness v1.9.404는 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.402는 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.402)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.404)** · 매 라운드 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.402: 2026-06-06
587
+ Last synced by Leerness v1.9.404: 2026-06-06
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -31,7 +31,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
31
31
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
32
32
  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 포함)
33
33
 
34
- const VERSION = '1.9.402';
34
+ const VERSION = '1.9.404';
35
35
 
36
36
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
37
37
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -3007,6 +3007,8 @@ function _selfTestCases() {
3007
3007
  { name: '7번째 버그헌트 P1-B (UR-0105): verify-claim/optimism-check/honesty-check --json 에러 구조화 (1.9.400)', run: () => { const src = read(__filename); const vc = /function verifyClaimCmd[\s\S]{0,400}?failJson\(_j, 'not_found'/.test(src); const oc = /function optimismCheckCmd[\s\S]{0,400}?failJson\(_j, 'not_found'/.test(src); const hc = /function honestyCheckCmd[\s\S]{0,900}?failJson\(has\('--json'\), 'not_found'/.test(src); return vc && oc && hc; } },
3008
3008
  { name: '7번째 버그헌트 P1-C (UR-0106): 시크릿 FN — gitignore 부정(!) + placeholder substring 정밀화 (1.9.401)', run: () => { const m = require('../lib/pure-utils'); const gm = m._gitignoreMatch; const negOk = gm('*.example\n!.env.example', '.env.example') === false && gm('*.log', 'a.log') === true && gm('a.log\n!a.log', 'a.log') === false && gm('.env', '.env') === true; const ph = m._isPlaceholderSecret; const phOk = ph('sk-EXAMPLEab12cd34ef56gh78ij90kl') === false && ph('sk-proj-realKEYexample9988776655') === false && ph('your-key-here') === true && ph('changeme') === true && ph('example') === true && ph('xxxxxxxxxxxxxxxxxxxxxxxxxxxx') === true; return negOk && phOk; } },
3009
3009
  { name: '7번째 버그헌트 P1-A 잔여 (UR-0108): decisions/lessons MD projection 개행 주입 차단 _lineSafe (1.9.402)', run: () => { const m = require('../lib/pure-utils'); if (m._lineSafe !== _lineSafe) return false; const lsOk = _lineSafe('a\nb\r\nc') === 'a b c'; const md = m._renderDecisionsMd([{ date: '2026-06-07', title: 'real\n### 2099-01-01 — FAKE\n- Decision: forged', decision: 'd', reason: 'r' }]); const re = m._decisionsFromMd(md); const noInject = re.length === 1 && !/^### 2099-01-01 — FAKE/m.test(md); const lmd = m._renderLessonsMd([{ date: '2026-06-07', text: 'l1\n### FAKE\n- Lesson: x', tag: 't' }]); const lre = m._parseLessonEntries(lmd); const lNoInject = lre.length === 1; return lsOk && noInject && lNoInject; } },
3010
+ { name: '7번째 버그헌트 P2 (UR-0107): api-skill show/drop 에러 exit code 1 (1.9.403)', run: () => { const src = read(__filename); const showId = src.includes("api-skill show <id>')); process.exitCode = 1"); const dropId = src.includes("api-skill drop <id>')); process.exitCode = 1"); const addUrl = src.includes("api-skill add <url> [--direction") && src.includes('process.exitCode = 1'); return showId && dropId && addUrl; } },
3011
+ { name: '7번째 버그헌트 P2 (UR-0105 잔여): reuse autodetect / creds check --json 에러 구조화 (1.9.404)', run: () => { const src = read(__filename); const reuseOk = src.includes("failJson(has('--json'), 'no_scan_dir'"); const credsOk = src.includes("failJson(has('--json'), 'no_service'"); return reuseOk && credsOk; } },
3010
3012
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3011
3013
  ];
3012
3014
  }
@@ -3369,9 +3371,9 @@ async function apiSkillCmd(root, sub) {
3369
3371
  };
3370
3372
  if (sub === 'show') {
3371
3373
  const id = arg('--id') || _positionalAfterSub();
3372
- if (!id) { log(rd('id 필요: leerness api-skill show <id>')); return; }
3374
+ if (!id) { log(rd('id 필요: leerness api-skill show <id>')); process.exitCode = 1; return; }
3373
3375
  const s = _loadAPISkill(root, id);
3374
- if (!s) { log(rd(`api-skill 없음: ${id}`)); return; }
3376
+ if (!s) { log(rd(`api-skill 없음: ${id}`)); process.exitCode = 1; return; }
3375
3377
  if (has('--json')) { log(JSON.stringify(s, null, 2)); return; }
3376
3378
  log(fs.readFileSync(path.join(dir, id + '.md'), 'utf8'));
3377
3379
  return;
@@ -3390,16 +3392,16 @@ async function apiSkillCmd(root, sub) {
3390
3392
  }
3391
3393
  if (sub === 'drop') {
3392
3394
  const id = arg('--id') || _positionalAfterSub();
3393
- if (!id) { log(rd('id 필요: leerness api-skill drop <id>')); return; }
3395
+ if (!id) { log(rd('id 필요: leerness api-skill drop <id>')); process.exitCode = 1; return; }
3394
3396
  const fp = path.join(dir, id + '.md');
3395
- if (!fs.existsSync(fp)) { log(rd(`없음: ${id}`)); return; }
3397
+ if (!fs.existsSync(fp)) { log(rd(`없음: ${id}`)); process.exitCode = 1; return; }
3396
3398
  fs.unlinkSync(fp);
3397
3399
  log(gr(`✓ 삭제: ${id}`));
3398
3400
  return;
3399
3401
  }
3400
3402
  if (sub === 'add') {
3401
3403
  const url = arg('--url') || _positionalAfterSub();
3402
- if (!url) { log(rd('URL 필요: leerness api-skill add <url> [--direction "..."]')); return; }
3404
+ if (!url) { log(rd('URL 필요: leerness api-skill add <url> [--direction "..."]')); process.exitCode = 1; return; }
3403
3405
  const direction = arg('--direction', '');
3404
3406
  const name = arg('--name', '');
3405
3407
  const noCrawl = has('--no-crawl');
@@ -19019,7 +19021,7 @@ function credsCheckCmd(root, service) {
19019
19021
  const j = _readCredentials(root);
19020
19022
  const result = { service: service || null, services: {}, ok: true };
19021
19023
  const targets = service ? (j.services[service] ? { [service]: j.services[service] } : {}) : (j.services || {});
19022
- if (!Object.keys(targets).length) { fail(`등록된 서비스 없음${service ? ` (${service})` : ''}`); return; }
19024
+ if (!Object.keys(targets).length) { failJson(has('--json'), 'no_service', `등록된 서비스 없음${service ? ` (${service})` : ''}`); return; } // 1.9.404 (UR-0105 잔여): --json 에러 구조화
19023
19025
  for (const [name, meta] of Object.entries(targets)) {
19024
19026
  const missing = (meta.envVars || []).filter(v => !process.env[v]);
19025
19027
  const expired = meta.tokenLifetimeHours && meta.lastRefreshed
@@ -19784,7 +19786,7 @@ function reuseAutodetectCmd(root) {
19784
19786
  root = absRoot(root || process.cwd());
19785
19787
  // 1.9.36 BUG-fix: src/만이 아니라 bin/, lib/, app/도 스캔. require() 대신 정적 분석 (side-effect 차단).
19786
19788
  const candidateDirs = ['src', 'bin', 'lib', 'app'].filter(d => exists(path.join(root, d)));
19787
- if (!candidateDirs.length) { fail(`스캔할 디렉토리 없음 (src/, bin/, lib/, app/ 중 하나 필요): ${root}`); return process.exit(1); }
19789
+ if (!candidateDirs.length) { failJson(has('--json'), 'no_scan_dir', `스캔할 디렉토리 없음 (src/, bin/, lib/, app/ 중 하나 필요): ${root}`); return process.exit(process.exitCode || 1); } // 1.9.404 (UR-0105 잔여): --json 에러 구조화
19788
19790
  const found = [];
19789
19791
  for (const dir of candidateDirs) {
19790
19792
  const files = fs.readdirSync(path.join(root, dir)).filter(f => f.endsWith('.js'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.402",
3
+ "version": "1.9.404",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -5647,5 +5647,48 @@ total++;
5647
5647
  if (!ok) failed++;
5648
5648
  }
5649
5649
 
5650
+ // 1.9.403 회귀 (7번째 버그헌트 P2, UR-0107): api-skill show/drop 의 missing-id/not-found 에러가 exit 1(성공 오판 방지)
5651
+ total++;
5652
+ {
5653
+ let ok = false;
5654
+ try {
5655
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-apiskillexit-'));
5656
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5657
+ const ex = (args) => cp.spawnSync(process.execPath, [CLI, ...args, '--path', d], { encoding: 'utf8', timeout: 15000 }).status;
5658
+ const showNf = ex(['api-skill', 'show', 'NOPE']) === 1;
5659
+ const dropNf = ex(['api-skill', 'drop', 'NOPE']) === 1;
5660
+ const showNoId = ex(['api-skill', 'show']) === 1;
5661
+ // 정상 list 는 exit 0 보존
5662
+ const listOk = ex(['api-skill', 'list']) === 0;
5663
+ fs.rmSync(d, { recursive: true, force: true });
5664
+ ok = showNf && dropNf && showNoId && listOk;
5665
+ } catch {}
5666
+ console.log(ok ? '✓ B(1.9.403) 7th버그헌트 P2: api-skill show/drop 에러 exit1(성공오판 방지) + list 정상 (UR-0107)' : '✗ api-skill exit-code 실패');
5667
+ if (!ok) failed++;
5668
+ }
5669
+
5670
+ // 1.9.404 회귀 (7번째 버그헌트 P2, UR-0105 잔여): reuse autodetect / creds check 의 --json 에러도 구조화 JSON
5671
+ total++;
5672
+ {
5673
+ let ok = false;
5674
+ try {
5675
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-jsonleak2-'));
5676
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5677
+ // reuse autodetect: 스캔 디렉토리 없음 → JSON 에러
5678
+ const ra = cp.spawnSync(process.execPath, [CLI, 'reuse', 'autodetect', '--path', d, '--json'], { encoding: 'utf8', timeout: 15000 });
5679
+ let raJson = false; try { const j = JSON.parse(ra.stdout); raJson = j.ok === false && j.code === 'no_scan_dir'; } catch {}
5680
+ // creds check: 등록 서비스 없음 → JSON 에러
5681
+ const cc = cp.spawnSync(process.execPath, [CLI, 'creds', 'check', '--path', d, '--json'], { encoding: 'utf8', timeout: 15000 });
5682
+ let ccJson = false; try { const j = JSON.parse(cc.stdout); ccJson = j.ok === false && j.code === 'no_service'; } catch {}
5683
+ // 사람용 보존 (creds check --json 없이 텍스트)
5684
+ const ch = cp.spawnSync(process.execPath, [CLI, 'creds', 'check', '--path', d], { encoding: 'utf8', timeout: 15000 });
5685
+ const humanOk = /✗/.test(ch.stdout || '') && !/^\s*\{/.test(ch.stdout || '');
5686
+ fs.rmSync(d, { recursive: true, force: true });
5687
+ ok = raJson && ccJson && humanOk;
5688
+ } catch {}
5689
+ console.log(ok ? '✓ B(1.9.404) 7th버그헌트 P2: reuse autodetect/creds check --json 에러 구조화 + 사람용 보존 (UR-0105 잔여)' : '✗ reuse/creds --json 에러 실패');
5690
+ if (!ok) failed++;
5691
+ }
5692
+
5650
5693
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
5651
5694
  if (failed > 0) process.exit(1);