leerness 1.9.332 → 1.9.334

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,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.334 — 2026-06-05 — UR-0025(심층): intent-도메인 서브시스템 분리 (Codex 위임·검증)
4
+
5
+ **🤖 남은 백로그 일부를 Codex CLI(gpt-5.5)에 위임하고 독립 검증까지 완료 — intent-도메인 서브시스템의 핵심(데이터 catalog + 순수 매처)을 1.9.333 constraints 패턴 그대로 모듈로 분리.** (사용자 지시: "남은 백로그 일부는 codex cli를 호출해서 업무 할당하고 검증까지 진행")
6
+
7
+ ### 배경 (위임 결정)
8
+ 직전 1.9.333 에서 확립한 "서브시스템 핵심(데이터·순수 로직) 추출" 패턴이 안정적으로 반복 가능 → 동형(同型) 작업인 intent-도메인 추출을 Codex CLI 에 위임. 위임 ≠ 무검증: 작업 명세를 backtick-free 파일로 작성 → `codex exec` 호출 → 결과를 하네스가 **독립 검증**(범위·금지파일·구문·selftest·동작·중복) 후 릴리스 확정.
9
+
10
+ ### 구현 (Codex 수행)
11
+ 1. **`_DEFAULT_DOMAIN_CATALOG`**(5도메인 catalog) → `lib/catalogs.js`(export 추가).
12
+ 2. **`_matchDomain(catalog, text)`**(순수 매처: text 소문자에 alias substring 포함되는 첫 도메인 → `{domain, alias, components}`, 없으면 `{domain:null}`) → `lib/pure-utils.js`. `_detectDomain(text, root)` = `_matchDomain(_loadDomainCatalog(root), text)`.
13
+
14
+ ### 검증 (하네스 독립)
15
+ - **변경 범위 확인**: `bin/harness.js` + `lib/catalogs.js` + `lib/pure-utils.js` 만 변경 (VERSION/e2e/README/CHANGELOG/package.json 미변경 — 명세 금지사항 준수).
16
+ - **무결성**: `node -c` 통과 · selftest 82/82 PASS · **E2E 279/279 PASS** (회귀 0).
17
+ - **동작 실측**: `_matchDomain` game/web/null/no-match 정상 · intent expand("domain: game") 회귀 정상 · catalog 중복 없음 · exports 정상.
18
+ - **테스트 견고화**: import 멤버십 체크(B 1.9.333/1.9.334)를 rigid 정규식 → importBlock 추출 패턴으로 통일 (이후 import 추가에 비의존).
19
+
20
+ ## 1.9.333 — 2026-06-05 — UR-0025(심층): constraints 서브시스템 핵심 분리
21
+
22
+ **🧩 constraints 서브시스템의 핵심(데이터 catalog + 순수 매처)을 모듈로 분리 — command 서브시스템 추출의 안전한 첫 단계.** (사용자 선택: UR-0025 심층)
23
+
24
+ ### 배경 (방향 결정)
25
+ 순수 함수 micro-추출 소진 → 사용자가 "command 서브시스템 심층 추출"을 선택. command 함수의 factory+deps 주입은 **새 패턴 도입**(결정매트릭스: 기존 패턴 유지·안정성 우선)이라 위험 → **phase 1은 서브시스템의 핵심(데이터·순수 로직)을 기존 모듈 패턴으로 추출**, fs/command 박막은 harness 유지.
26
+
27
+ ### 구현 (UR-0025 심층 phase 1)
28
+ 1. **`_DEFAULT_PLATFORM_CONSTRAINTS`**(6플랫폼 제약 catalog, ~57줄) → `lib/catalogs.js`(기존 정적 데이터 모듈).
29
+ 2. **`_matchConstraints(catalog, text)`**(순수 매칭: 플랫폼 alias 매칭 + 제안) → `lib/pure-utils.js`. `_checkRequestConstraints(root, text)` = `_matchConstraints(_loadPlatformConstraints(root), text)` (fs load 만 주입).
30
+ 3. selftest 80→81 · e2e 277→278.
31
+
32
+ ### 검증
33
+ - **selftest 81/81 PASS** · **E2E 278/278 PASS** (회귀 0).
34
+ - 실측: catalog 6플랫폼 · `_matchConstraints(cat, 'stripe 결제')`→matched stripe/total 6 · `(null,…)`→빈 결과 · constraints check + review-request(_checkRequestConstraints) 정상.
35
+ - 비고: command 함수(constraintsCmd) 자체의 lib 이전은 factory 패턴 필요 → 별도 결정. 핵심 데이터·로직은 분리·테스트화 완료.
36
+
3
37
  ## 1.9.332 — 2026-06-05 — UR-0025(증분): lessons.md 파서 분리
4
38
 
5
39
  **🧩 순수 lessons.md 파서(`_parseLessonEntries`)를 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
- [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.332-green)]() [![tests](https://img.shields.io/badge/e2e-277%2F277-success)]() [![selftest](https://img.shields.io/badge/selftest-80-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-83-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.334-green)]() [![tests](https://img.shields.io/badge/e2e-279%2F279-success)]() [![selftest](https://img.shields.io/badge/selftest-82-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-83-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.332 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.334 하네스를 사용합니다. 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.332는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
528
+ Leerness v1.9.334는 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.332는 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.332)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.334)** · 매 라운드 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.332: 2026-06-05
587
+ Last synced by Leerness v1.9.334: 2026-06-05
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -16,13 +16,13 @@ const { _isSecretKey, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel,
16
16
  _roadmapMapStatus, _roadmapParseMilestones, _roadmapParseTokens,
17
17
  _BRIEF_FIELDS, _briefFilled,
18
18
  BRIEF_START, BRIEF_END, _briefReadmeBlock, _briefBlueprint,
19
- _parseLessonEntries } = require('../lib/pure-utils'); // 1.9.318~332 (UR-0025): 순수 유틸 모듈 분리
19
+ _parseLessonEntries, _matchConstraints, _matchDomain } = require('../lib/pure-utils'); // 1.9.318~333 (UR-0025): 순수 유틸 모듈 분리
20
20
  // 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
21
21
  const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
22
22
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
23
- const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST } = require('../lib/catalogs');
23
+ const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST, _DEFAULT_PLATFORM_CONSTRAINTS, _DEFAULT_DOMAIN_CATALOG } = require('../lib/catalogs'); // 1.9.333 (UR-0025): constraints catalog 분리
24
24
 
25
- const VERSION = '1.9.332';
25
+ const VERSION = '1.9.334';
26
26
 
27
27
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
28
28
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -3077,6 +3077,8 @@ function _selfTestCases() {
3077
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
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
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; } },
3080
+ { name: 'UR-0025 심층: constraints catalog→lib/catalogs + _matchConstraints→pure-utils 분리 (1.9.333)', run: () => { const c = require('../lib/catalogs'); const m = require('../lib/pure-utils'); const catOk = c._DEFAULT_PLATFORM_CONSTRAINTS && Object.keys(c._DEFAULT_PLATFORM_CONSTRAINTS.platforms).length === 6 && !!c._DEFAULT_PLATFORM_CONSTRAINTS.platforms.stripe; const r = m._matchConstraints(c._DEFAULT_PLATFORM_CONSTRAINTS, 'stripe 결제'); const work = r.matched.length === 1 && r.matched[0].platform === 'stripe' && r.totalPlatforms === 6 && m._matchConstraints(null, 'x').matched.length === 0; const src = read(__filename); const moved = _DEFAULT_PLATFORM_CONSTRAINTS === c._DEFAULT_PLATFORM_CONSTRAINTS && _matchConstraints === m._matchConstraints && !/const _DEFAULT_PLATFORM_CONSTRAINTS = \{/.test(src) && src.includes('_matchConstraints(_loadPlatformConstraints(root), text)'); return catOk && work && moved; } },
3081
+ { name: 'UR-0025 심층(Codex 위임·검증): intent domain catalog→lib/catalogs + _matchDomain→pure-utils 분리 (1.9.334)', run: () => { const c = require('../lib/catalogs'); const m = require('../lib/pure-utils'); const catOk = c._DEFAULT_DOMAIN_CATALOG && Object.keys(c._DEFAULT_DOMAIN_CATALOG.domains).length === 5 && !!c._DEFAULT_DOMAIN_CATALOG.domains.game; const r = m._matchDomain(c._DEFAULT_DOMAIN_CATALOG, 'unity 게임'); const work = r.domain === 'game' && Array.isArray(r.components) && m._matchDomain(c._DEFAULT_DOMAIN_CATALOG, 'zzz없음').domain === null && m._matchDomain(null, 'x').domain === null; const src = read(__filename); const moved = _DEFAULT_DOMAIN_CATALOG === c._DEFAULT_DOMAIN_CATALOG && _matchDomain === m._matchDomain && !/const _DEFAULT_DOMAIN_CATALOG = \{/.test(src) && src.includes('_matchDomain(_loadDomainCatalog(root), text)'); return catOk && work && moved; } },
3080
3082
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3081
3083
  ];
3082
3084
  }
@@ -3754,63 +3756,7 @@ function roundHistoryCmd(root) {
3754
3756
  // .harness/platform-constraints.json 에 플랫폼별 제약 catalog 저장 → 요청 텍스트 키워드 매칭 → 적용 가능한 제약 보고
3755
3757
  // 기본 catalog 6종: Stripe / OpenAI / Anthropic / GitHub / Discord / Twitter
3756
3758
  function _platformConstraintsPath(root) { return path.join(root, '.harness', 'platform-constraints.json'); }
3757
- const _DEFAULT_PLATFORM_CONSTRAINTS = {
3758
- version: '1.9.208',
3759
- platforms: {
3760
- stripe: {
3761
- aliases: ['stripe', 'stripe api', 'payment', '결제'],
3762
- docs: 'https://stripe.com/docs/rate-limits',
3763
- constraints: [
3764
- { kind: 'rate-limit', detail: 'read: 100 req/s, write: 100 req/s (live mode), test mode: 25 req/s' },
3765
- { kind: 'idempotency', detail: 'Idempotency-Key 헤더 24h 유지 — 중복 결제 방지 필수' },
3766
- { kind: 'webhook', detail: 'webhook 서명 검증 필수 (Stripe-Signature header + endpoint secret)' }
3767
- ]
3768
- },
3769
- openai: {
3770
- aliases: ['openai', 'gpt', 'chatgpt', 'gpt-4', 'gpt-3'],
3771
- docs: 'https://platform.openai.com/docs/guides/rate-limits',
3772
- constraints: [
3773
- { kind: 'rate-limit', detail: 'tier-based: Free 3 RPM / Tier 1 500 RPM / Tier 5 10,000 RPM' },
3774
- { kind: 'token-limit', detail: 'TPM (tokens/min) 별도 — 큰 입력 시 RPM 도달 전 차단 가능' },
3775
- { kind: 'cost', detail: 'gpt-4: $30/$60 per 1M input/output tokens — 대량 호출 전 비용 추정 필수' }
3776
- ]
3777
- },
3778
- anthropic: {
3779
- aliases: ['anthropic', 'claude', 'claude api', 'sonnet', 'opus', 'haiku'],
3780
- docs: 'https://docs.anthropic.com/claude/reference/rate-limits',
3781
- constraints: [
3782
- { kind: 'rate-limit', detail: 'tier-based: Free 5 RPM / Tier 1 50 RPM / Tier 4 4,000 RPM' },
3783
- { kind: 'context-window', detail: 'claude-sonnet 200K context, claude-opus 200K, 1M tier 별도' },
3784
- { kind: 'cost', detail: 'sonnet: $3/$15 per 1M tokens (1M context tier 2x)' }
3785
- ]
3786
- },
3787
- github: {
3788
- aliases: ['github', 'github api', 'gh api', 'octokit'],
3789
- docs: 'https://docs.github.com/en/rest/rate-limit',
3790
- constraints: [
3791
- { kind: 'rate-limit', detail: 'authenticated: 5,000 req/hr, unauthenticated: 60 req/hr' },
3792
- { kind: 'rate-limit', detail: 'search API: 30 req/min (authenticated)' },
3793
- { kind: 'secondary', detail: 'secondary rate limit — concurrent + content creation 별도 가드' }
3794
- ]
3795
- },
3796
- discord: {
3797
- aliases: ['discord', 'discord api', 'discord bot'],
3798
- docs: 'https://discord.com/developers/docs/topics/rate-limits',
3799
- constraints: [
3800
- { kind: 'rate-limit', detail: 'global: 50 req/s, per-route 별도' },
3801
- { kind: 'invalid', detail: '10,000 invalid req/10min → 1h ban 위험' }
3802
- ]
3803
- },
3804
- twitter: {
3805
- aliases: ['twitter', 'twitter api', 'x api', 'x.com api'],
3806
- docs: 'https://developer.twitter.com/en/docs/twitter-api/rate-limits',
3807
- constraints: [
3808
- { kind: 'rate-limit', detail: 'tier-based: Free 1,500 posts/month, Basic 50,000 posts/month' },
3809
- { kind: 'auth', detail: 'OAuth 2.0 PKCE 필수 (user context), App-only는 별도 endpoint' }
3810
- ]
3811
- }
3812
- }
3813
- };
3759
+ // 1.9.333 (UR-0025 심층): _DEFAULT_PLATFORM_CONSTRAINTS lib/catalogs.js 로 이동 (순수 데이터, require 사용).
3814
3760
  function _loadPlatformConstraints(root) {
3815
3761
  try {
3816
3762
  const fp = _platformConstraintsPath(root);
@@ -3834,23 +3780,9 @@ function _writePlatformConstraints(root, catalog) {
3834
3780
  } catch { return false; }
3835
3781
  }
3836
3782
  // 사용자 요청 텍스트에서 플랫폼 alias 매칭 → 적용 제약 목록 반환
3783
+ // 1.9.333 (UR-0025 심층): 매칭 로직은 순수 _matchConstraints(catalog, text) (lib/pure-utils) — fs(load)는 여기서 주입.
3837
3784
  function _checkRequestConstraints(root, text) {
3838
- if (!text || typeof text !== 'string') return { matched: [], suggestions: [] };
3839
- const catalog = _loadPlatformConstraints(root);
3840
- const lower = text.toLowerCase();
3841
- const matched = [];
3842
- for (const [pid, plat] of Object.entries(catalog.platforms)) {
3843
- const aliases = plat.aliases || [];
3844
- const hit = aliases.find(a => lower.includes(a.toLowerCase()));
3845
- if (hit) matched.push({ platform: pid, matchedAlias: hit, docs: plat.docs, constraints: plat.constraints });
3846
- }
3847
- // suggestions — 보편 키워드 (api/rate/limit/integration) 시 catalog 검토 권장
3848
- const suggestions = [];
3849
- const generic = /\bapi\b|연동|integration|호출|rate|limit|quota|webhook/i.test(text);
3850
- if (generic && matched.length === 0) {
3851
- suggestions.push('일반적 API 연동 키워드 감지 — leerness constraints list 로 사전 등록된 플랫폼 catalog 확인 권장');
3852
- }
3853
- return { matched, suggestions, totalPlatforms: Object.keys(catalog.platforms).length };
3785
+ return _matchConstraints(_loadPlatformConstraints(root), text);
3854
3786
  }
3855
3787
 
3856
3788
  // 1.9.209: pre-wake sub-agent audit (사용자 명시)
@@ -4408,73 +4340,7 @@ function _buildWorkspaceReferenceGuide(root, dirName) {
4408
4340
  // 3원칙: (1) Always-Off Opt-In, (2) Dry-run 기본 (실행 X), (3) 명시 vs 추론 분리 라벨링
4409
4341
  // .harness/domain-catalog.json 사용자 편집 가능 + default catalog 5종 (game/web/api/cli/data)
4410
4342
  function _domainCatalogPath(root) { return path.join(root, '.harness', 'domain-catalog.json'); }
4411
- const _DEFAULT_DOMAIN_CATALOG = {
4412
- version: '1.9.213',
4413
- domains: {
4414
- game: {
4415
- aliases: ['게임', 'game', 'unity', 'unreal', 'godot', 'phaser', 'gamedev'],
4416
- components: [
4417
- { key: 'map', desc: '맵/타일 시스템 + 영역/스폰' },
4418
- { key: 'character', desc: '캐릭터/스프라이트 + 애니메이션 상태머신' },
4419
- { key: 'gameLoop', desc: '게임 루프 (tick/render/update)' },
4420
- { key: 'collision', desc: '충돌 감지 (AABB/SAT/grid)' },
4421
- { key: 'camera', desc: '카메라 follow + 영역 제한' },
4422
- { key: 'hud', desc: 'HUD/UI (HP/score/inventory)' },
4423
- { key: 'audio', desc: '사운드 매니저 (BGM/SFX)' },
4424
- { key: 'save', desc: '저장/로드 (slot 시스템)' },
4425
- { key: 'menu', desc: '메뉴 (메인/일시정지/설정)' },
4426
- { key: 'input', desc: '입력 핸들러 (키보드/패드/터치)' }
4427
- ]
4428
- },
4429
- web: {
4430
- aliases: ['웹', 'web', 'website', 'webapp', 'nextjs', 'react', 'vue', 'svelte', 'frontend'],
4431
- components: [
4432
- { key: 'routing', desc: '라우팅 (path/dynamic/nested)' },
4433
- { key: 'state', desc: '상태 관리 (context/redux/zustand)' },
4434
- { key: 'auth', desc: '인증 (OAuth/JWT/session)' },
4435
- { key: 'api', desc: 'API 클라이언트 (fetch/axios/tanstack-query)' },
4436
- { key: 'db', desc: 'DB 연동 (ORM/migration/seed)' },
4437
- { key: 'ui', desc: 'UI 컴포넌트 라이브러리' },
4438
- { key: 'test', desc: '테스트 (unit/e2e/visual)' },
4439
- { key: 'deploy', desc: '배포 (Vercel/Netlify/Cloudflare)' }
4440
- ]
4441
- },
4442
- api: {
4443
- aliases: ['api', 'rest', 'graphql', 'endpoint', 'backend', 'server'],
4444
- components: [
4445
- { key: 'endpoint', desc: '엔드포인트 라우팅 + HTTP method' },
4446
- { key: 'auth', desc: '인증/인가 (API key/OAuth/JWT)' },
4447
- { key: 'rate-limit', desc: 'rate limit (RPS/RPM/token bucket)' },
4448
- { key: 'validation', desc: '입력 검증 (zod/joi/yup)' },
4449
- { key: 'error', desc: '에러 핸들링 + 응답 형식' },
4450
- { key: 'logging', desc: '로깅 + 모니터링 (structured logs)' },
4451
- { key: 'docs', desc: 'API 문서 (OpenAPI/Swagger)' }
4452
- ]
4453
- },
4454
- cli: {
4455
- aliases: ['cli', 'command-line', 'tool', 'utility', 'shell'],
4456
- components: [
4457
- { key: 'argParser', desc: '인자 파싱 (yargs/commander/clipanion)' },
4458
- { key: 'help', desc: 'help / man / examples 텍스트' },
4459
- { key: 'config', desc: '설정 파일 + env 변수' },
4460
- { key: 'output', desc: '출력 (TTY 색상/JSON/quiet)' },
4461
- { key: 'error', desc: '에러 처리 + exit code 규약' },
4462
- { key: 'completion', desc: 'shell completion (bash/zsh/fish)' }
4463
- ]
4464
- },
4465
- data: {
4466
- aliases: ['data', 'pipeline', 'etl', 'analytics', 'ingest'],
4467
- components: [
4468
- { key: 'ingest', desc: '데이터 수집 (file/API/stream)' },
4469
- { key: 'transform', desc: '변환 (cleaning/normalization/joining)' },
4470
- { key: 'storage', desc: '저장소 (parquet/db/blob)' },
4471
- { key: 'query', desc: '쿼리/분석 (SQL/aggregations)' },
4472
- { key: 'validation', desc: '데이터 검증 (schema/contracts)' },
4473
- { key: 'lineage', desc: '데이터 lineage 추적' }
4474
- ]
4475
- }
4476
- }
4477
- };
4343
+ // 1.9.333 패턴 적용: _DEFAULT_DOMAIN_CATALOG lib/catalogs.js 로 이동 (순수 데이터, require 사용).
4478
4344
  function _loadDomainCatalog(root) {
4479
4345
  try {
4480
4346
  const fp = _domainCatalogPath(root);
@@ -4497,17 +4363,7 @@ function _writeDomainCatalog(root, catalog) {
4497
4363
  }
4498
4364
  // 1.9.325 (UR-0025): _classifyIntent → lib/pure-utils.js 로 이동 (순수 intent 분류, require 사용).
4499
4365
  function _detectDomain(text, root) {
4500
- if (!text) return { domain: null, alias: null };
4501
- const lower = text.toLowerCase();
4502
- const catalog = _loadDomainCatalog(root);
4503
- for (const [domain, info] of Object.entries(catalog.domains)) {
4504
- for (const a of info.aliases || []) {
4505
- if (lower.includes(a.toLowerCase())) {
4506
- return { domain, alias: a, components: info.components };
4507
- }
4508
- }
4509
- }
4510
- return { domain: null, alias: null };
4366
+ return _matchDomain(_loadDomainCatalog(root), text);
4511
4367
  }
4512
4368
  function _inferScopeExpansion(text, root) {
4513
4369
  const classify = _classifyIntent(text);
package/lib/catalogs.js CHANGED
@@ -57,4 +57,132 @@ const REUSE_CHECKLIST = [
57
57
  '제어: 핵심 로직이면 외부 의존 리스크를 감수할 가치가 있는가'
58
58
  ];
59
59
 
60
- module.exports = { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST };
60
+ // 1.9.333 (UR-0025 심층): 플랫폼/API 제약 기본 catalog (순수 데이터) — constraints 서브시스템 핵심 데이터.
61
+ const _DEFAULT_PLATFORM_CONSTRAINTS = {
62
+ version: '1.9.208',
63
+ platforms: {
64
+ stripe: {
65
+ aliases: ['stripe', 'stripe api', 'payment', '결제'],
66
+ docs: 'https://stripe.com/docs/rate-limits',
67
+ constraints: [
68
+ { kind: 'rate-limit', detail: 'read: 100 req/s, write: 100 req/s (live mode), test mode: 25 req/s' },
69
+ { kind: 'idempotency', detail: 'Idempotency-Key 헤더 24h 유지 — 중복 결제 방지 필수' },
70
+ { kind: 'webhook', detail: 'webhook 서명 검증 필수 (Stripe-Signature header + endpoint secret)' }
71
+ ]
72
+ },
73
+ openai: {
74
+ aliases: ['openai', 'gpt', 'chatgpt', 'gpt-4', 'gpt-3'],
75
+ docs: 'https://platform.openai.com/docs/guides/rate-limits',
76
+ constraints: [
77
+ { kind: 'rate-limit', detail: 'tier-based: Free 3 RPM / Tier 1 500 RPM / Tier 5 10,000 RPM' },
78
+ { kind: 'token-limit', detail: 'TPM (tokens/min) 별도 — 큰 입력 시 RPM 도달 전 차단 가능' },
79
+ { kind: 'cost', detail: 'gpt-4: $30/$60 per 1M input/output tokens — 대량 호출 전 비용 추정 필수' }
80
+ ]
81
+ },
82
+ anthropic: {
83
+ aliases: ['anthropic', 'claude', 'claude api', 'sonnet', 'opus', 'haiku'],
84
+ docs: 'https://docs.anthropic.com/claude/reference/rate-limits',
85
+ constraints: [
86
+ { kind: 'rate-limit', detail: 'tier-based: Free 5 RPM / Tier 1 50 RPM / Tier 4 4,000 RPM' },
87
+ { kind: 'context-window', detail: 'claude-sonnet 200K context, claude-opus 200K, 1M tier 별도' },
88
+ { kind: 'cost', detail: 'sonnet: $3/$15 per 1M tokens (1M context tier 2x)' }
89
+ ]
90
+ },
91
+ github: {
92
+ aliases: ['github', 'github api', 'gh api', 'octokit'],
93
+ docs: 'https://docs.github.com/en/rest/rate-limit',
94
+ constraints: [
95
+ { kind: 'rate-limit', detail: 'authenticated: 5,000 req/hr, unauthenticated: 60 req/hr' },
96
+ { kind: 'rate-limit', detail: 'search API: 30 req/min (authenticated)' },
97
+ { kind: 'secondary', detail: 'secondary rate limit — concurrent + content creation 별도 가드' }
98
+ ]
99
+ },
100
+ discord: {
101
+ aliases: ['discord', 'discord api', 'discord bot'],
102
+ docs: 'https://discord.com/developers/docs/topics/rate-limits',
103
+ constraints: [
104
+ { kind: 'rate-limit', detail: 'global: 50 req/s, per-route 별도' },
105
+ { kind: 'invalid', detail: '10,000 invalid req/10min → 1h ban 위험' }
106
+ ]
107
+ },
108
+ twitter: {
109
+ aliases: ['twitter', 'twitter api', 'x api', 'x.com api'],
110
+ docs: 'https://developer.twitter.com/en/docs/twitter-api/rate-limits',
111
+ constraints: [
112
+ { kind: 'rate-limit', detail: 'tier-based: Free 1,500 posts/month, Basic 50,000 posts/month' },
113
+ { kind: 'auth', detail: 'OAuth 2.0 PKCE 필수 (user context), App-only는 별도 endpoint' }
114
+ ]
115
+ }
116
+ }
117
+ };
118
+
119
+ // 1.9.333 패턴 적용: intent 도메인 기본 catalog (순수 데이터) — intent-domain 서브시스템 핵심 데이터.
120
+ const _DEFAULT_DOMAIN_CATALOG = {
121
+ version: '1.9.213',
122
+ domains: {
123
+ game: {
124
+ aliases: ['게임', 'game', 'unity', 'unreal', 'godot', 'phaser', 'gamedev'],
125
+ components: [
126
+ { key: 'map', desc: '맵/타일 시스템 + 영역/스폰' },
127
+ { key: 'character', desc: '캐릭터/스프라이트 + 애니메이션 상태머신' },
128
+ { key: 'gameLoop', desc: '게임 루프 (tick/render/update)' },
129
+ { key: 'collision', desc: '충돌 감지 (AABB/SAT/grid)' },
130
+ { key: 'camera', desc: '카메라 follow + 영역 제한' },
131
+ { key: 'hud', desc: 'HUD/UI (HP/score/inventory)' },
132
+ { key: 'audio', desc: '사운드 매니저 (BGM/SFX)' },
133
+ { key: 'save', desc: '저장/로드 (slot 시스템)' },
134
+ { key: 'menu', desc: '메뉴 (메인/일시정지/설정)' },
135
+ { key: 'input', desc: '입력 핸들러 (키보드/패드/터치)' }
136
+ ]
137
+ },
138
+ web: {
139
+ aliases: ['웹', 'web', 'website', 'webapp', 'nextjs', 'react', 'vue', 'svelte', 'frontend'],
140
+ components: [
141
+ { key: 'routing', desc: '라우팅 (path/dynamic/nested)' },
142
+ { key: 'state', desc: '상태 관리 (context/redux/zustand)' },
143
+ { key: 'auth', desc: '인증 (OAuth/JWT/session)' },
144
+ { key: 'api', desc: 'API 클라이언트 (fetch/axios/tanstack-query)' },
145
+ { key: 'db', desc: 'DB 연동 (ORM/migration/seed)' },
146
+ { key: 'ui', desc: 'UI 컴포넌트 라이브러리' },
147
+ { key: 'test', desc: '테스트 (unit/e2e/visual)' },
148
+ { key: 'deploy', desc: '배포 (Vercel/Netlify/Cloudflare)' }
149
+ ]
150
+ },
151
+ api: {
152
+ aliases: ['api', 'rest', 'graphql', 'endpoint', 'backend', 'server'],
153
+ components: [
154
+ { key: 'endpoint', desc: '엔드포인트 라우팅 + HTTP method' },
155
+ { key: 'auth', desc: '인증/인가 (API key/OAuth/JWT)' },
156
+ { key: 'rate-limit', desc: 'rate limit (RPS/RPM/token bucket)' },
157
+ { key: 'validation', desc: '입력 검증 (zod/joi/yup)' },
158
+ { key: 'error', desc: '에러 핸들링 + 응답 형식' },
159
+ { key: 'logging', desc: '로깅 + 모니터링 (structured logs)' },
160
+ { key: 'docs', desc: 'API 문서 (OpenAPI/Swagger)' }
161
+ ]
162
+ },
163
+ cli: {
164
+ aliases: ['cli', 'command-line', 'tool', 'utility', 'shell'],
165
+ components: [
166
+ { key: 'argParser', desc: '인자 파싱 (yargs/commander/clipanion)' },
167
+ { key: 'help', desc: 'help / man / examples 텍스트' },
168
+ { key: 'config', desc: '설정 파일 + env 변수' },
169
+ { key: 'output', desc: '출력 (TTY 색상/JSON/quiet)' },
170
+ { key: 'error', desc: '에러 처리 + exit code 규약' },
171
+ { key: 'completion', desc: 'shell completion (bash/zsh/fish)' }
172
+ ]
173
+ },
174
+ data: {
175
+ aliases: ['data', 'pipeline', 'etl', 'analytics', 'ingest'],
176
+ components: [
177
+ { key: 'ingest', desc: '데이터 수집 (file/API/stream)' },
178
+ { key: 'transform', desc: '변환 (cleaning/normalization/joining)' },
179
+ { key: 'storage', desc: '저장소 (parquet/db/blob)' },
180
+ { key: 'query', desc: '쿼리/분석 (SQL/aggregations)' },
181
+ { key: 'validation', desc: '데이터 검증 (schema/contracts)' },
182
+ { key: 'lineage', desc: '데이터 lineage 추적' }
183
+ ]
184
+ }
185
+ }
186
+ };
187
+
188
+ module.exports = { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST, _DEFAULT_PLATFORM_CONSTRAINTS, _DEFAULT_DOMAIN_CATALOG };
package/lib/pure-utils.js CHANGED
@@ -375,6 +375,38 @@ function _parseLessonEntries(text) {
375
375
  return out;
376
376
  }
377
377
 
378
+ // 1.9.333 (UR-0025 심층): 순수 플랫폼 제약 매칭 — catalog + 텍스트 → 매칭 플랫폼/제약/제안 (fs 의존 0, catalog 주입).
379
+ function _matchConstraints(catalog, text) {
380
+ if (!text || typeof text !== 'string' || !catalog || !catalog.platforms) return { matched: [], suggestions: [] };
381
+ const lower = text.toLowerCase();
382
+ const matched = [];
383
+ for (const [pid, plat] of Object.entries(catalog.platforms)) {
384
+ const aliases = plat.aliases || [];
385
+ const hit = aliases.find(a => lower.includes(a.toLowerCase()));
386
+ if (hit) matched.push({ platform: pid, matchedAlias: hit, docs: plat.docs, constraints: plat.constraints });
387
+ }
388
+ const suggestions = [];
389
+ const generic = /\bapi\b|연동|integration|호출|rate|limit|quota|webhook/i.test(text);
390
+ if (generic && matched.length === 0) {
391
+ suggestions.push('일반적 API 연동 키워드 감지 — leerness constraints list 로 사전 등록된 플랫폼 catalog 확인 권장');
392
+ }
393
+ return { matched, suggestions, totalPlatforms: Object.keys(catalog.platforms).length };
394
+ }
395
+
396
+ // 1.9.333 패턴 적용: 순수 도메인 매칭 — catalog + 텍스트 → 첫 매칭 domain/alias/components (fs 의존 0, catalog 주입).
397
+ function _matchDomain(catalog, text) {
398
+ if (!text || typeof text !== 'string' || !catalog || !catalog.domains) return { domain: null, alias: null };
399
+ const lower = text.toLowerCase();
400
+ for (const [domain, info] of Object.entries(catalog.domains)) {
401
+ for (const a of info.aliases || []) {
402
+ if (lower.includes(a.toLowerCase())) {
403
+ return { domain, alias: a, components: info.components };
404
+ }
405
+ }
406
+ }
407
+ return { domain: null, alias: null };
408
+ }
409
+
378
410
  module.exports = {
379
411
  _isSecretKey, compareVer, parseHarnessVersion,
380
412
  _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
@@ -399,5 +431,9 @@ module.exports = {
399
431
  // 1.9.331 (UR-0025): project-brief 텍스트 빌더 + 마커
400
432
  BRIEF_START, BRIEF_END, _briefReadmeBlock, _briefBlueprint,
401
433
  // 1.9.332 (UR-0025): 순수 lessons.md 파서
402
- _parseLessonEntries
434
+ _parseLessonEntries,
435
+ // 1.9.333 (UR-0025 심층): 순수 플랫폼 제약 매칭
436
+ _matchConstraints,
437
+ // 1.9.333 패턴 적용: 순수 도메인 매칭
438
+ _matchDomain
403
439
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.332",
3
+ "version": "1.9.334",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -4107,5 +4107,58 @@ total++;
4107
4107
  if (!ok) failed++;
4108
4108
  }
4109
4109
 
4110
+ // 1.9.333 회귀 (UR-0025 심층): constraints 서브시스템 핵심 분리 — catalog→lib/catalogs + _matchConstraints→pure-utils + constraints 명령 회귀
4111
+ total++;
4112
+ {
4113
+ let ok = false;
4114
+ try {
4115
+ const c = require(path.resolve(__dirname, '..', 'lib', 'catalogs.js'));
4116
+ const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
4117
+ const catOk = c._DEFAULT_PLATFORM_CONSTRAINTS && Object.keys(c._DEFAULT_PLATFORM_CONSTRAINTS.platforms).length === 6;
4118
+ const r = m._matchConstraints(c._DEFAULT_PLATFORM_CONSTRAINTS, 'stripe 결제');
4119
+ const work = catOk && r.matched.length === 1 && r.matched[0].platform === 'stripe' && r.totalPlatforms === 6 && m._matchConstraints(null, 'x').matched.length === 0;
4120
+ const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
4121
+ // 1.9.334: catalogs import 블록 추출 후 이름 포함 확인(순서/추가 비의존 — 이후 import 추가 허용)
4122
+ const _catImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/catalogs'\)/) || [''])[0];
4123
+ const movedOut = !/const _DEFAULT_PLATFORM_CONSTRAINTS = \{/.test(harnessSrc) && harnessSrc.includes('_matchConstraints(_loadPlatformConstraints(root), text)')
4124
+ && _catImp.includes('_DEFAULT_PLATFORM_CONSTRAINTS');
4125
+ // 소비 명령 회귀: constraints check (review-request 도 _checkRequestConstraints 사용)
4126
+ const cd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-con-'));
4127
+ cp.spawnSync(process.execPath, [CLI, 'init', cd, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
4128
+ const cr = cp.spawnSync(process.execPath, [CLI, 'constraints', 'check', 'stripe 결제 구현', '--path', cd], { encoding: 'utf8', timeout: 20000 });
4129
+ const cmdOk = /stripe|플랫폼 매칭/.test(cr.stdout || '');
4130
+ ok = work && movedOut && cmdOk;
4131
+ fs.rmSync(cd, { recursive: true, force: true });
4132
+ } catch {}
4133
+ console.log(ok ? '✓ B(1.9.333) UR-0025 심층: constraints catalog/_matchConstraints 분리 + constraints check 회귀 (UR-0025)' : '✗ constraints 서브시스템 분리 실패');
4134
+ if (!ok) failed++;
4135
+ }
4136
+
4137
+ // 1.9.334 회귀 (UR-0025 심층, Codex 위임·검증): intent domain catalog→lib/catalogs + _matchDomain→pure-utils + intent expand 회귀
4138
+ total++;
4139
+ {
4140
+ let ok = false;
4141
+ try {
4142
+ const c = require(path.resolve(__dirname, '..', 'lib', 'catalogs.js'));
4143
+ const m = require(path.resolve(__dirname, '..', 'lib', 'pure-utils.js'));
4144
+ const catOk = c._DEFAULT_DOMAIN_CATALOG && Object.keys(c._DEFAULT_DOMAIN_CATALOG.domains).length === 5;
4145
+ const r = m._matchDomain(c._DEFAULT_DOMAIN_CATALOG, 'unity 게임');
4146
+ const work = catOk && typeof m._matchDomain === 'function' && r.domain === 'game' && Array.isArray(r.components) && m._matchDomain(null, 'x').domain === null;
4147
+ const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
4148
+ const _catImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/catalogs'\)/) || [''])[0]; // import 순서/추가 비의존
4149
+ const movedOut = !/const _DEFAULT_DOMAIN_CATALOG = \{/.test(harnessSrc) && harnessSrc.includes('_matchDomain(_loadDomainCatalog(root), text)')
4150
+ && _catImp.includes('_DEFAULT_DOMAIN_CATALOG');
4151
+ // 소비 명령 회귀: intent expand 도메인 감지(_detectDomain → _matchDomain)
4152
+ const id = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-dom-'));
4153
+ cp.spawnSync(process.execPath, [CLI, 'init', id, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
4154
+ const ir = cp.spawnSync(process.execPath, [CLI, 'intent', 'expand', 'unity 게임 맵', '--path', id], { encoding: 'utf8', timeout: 20000 });
4155
+ const cmdOk = /game/.test(ir.stdout || '');
4156
+ ok = work && movedOut && cmdOk;
4157
+ fs.rmSync(id, { recursive: true, force: true });
4158
+ } catch {}
4159
+ console.log(ok ? '✓ B(1.9.334) UR-0025 심층(Codex 위임·검증): domain catalog/_matchDomain 분리 + intent expand 회귀 (UR-0025)' : '✗ domain 서브시스템 분리 실패');
4160
+ if (!ok) failed++;
4161
+ }
4162
+
4110
4163
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
4111
4164
  if (failed > 0) process.exit(1);