leerness 1.9.332 → 1.9.333
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 +17 -0
- package/README.md +5 -5
- package/bin/harness.js +7 -76
- package/lib/catalogs.js +60 -1
- package/lib/pure-utils.js +21 -1
- package/package.json +1 -1
- package/scripts/e2e.js +25 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.333 — 2026-06-05 — UR-0025(심층): constraints 서브시스템 핵심 분리
|
|
4
|
+
|
|
5
|
+
**🧩 constraints 서브시스템의 핵심(데이터 catalog + 순수 매처)을 모듈로 분리 — command 서브시스템 추출의 안전한 첫 단계.** (사용자 선택: UR-0025 심층)
|
|
6
|
+
|
|
7
|
+
### 배경 (방향 결정)
|
|
8
|
+
순수 함수 micro-추출 소진 → 사용자가 "command 서브시스템 심층 추출"을 선택. command 함수의 factory+deps 주입은 **새 패턴 도입**(결정매트릭스: 기존 패턴 유지·안정성 우선)이라 위험 → **phase 1은 서브시스템의 핵심(데이터·순수 로직)을 기존 모듈 패턴으로 추출**, fs/command 박막은 harness 유지.
|
|
9
|
+
|
|
10
|
+
### 구현 (UR-0025 심층 phase 1)
|
|
11
|
+
1. **`_DEFAULT_PLATFORM_CONSTRAINTS`**(6플랫폼 제약 catalog, ~57줄) → `lib/catalogs.js`(기존 정적 데이터 모듈).
|
|
12
|
+
2. **`_matchConstraints(catalog, text)`**(순수 매칭: 플랫폼 alias 매칭 + 제안) → `lib/pure-utils.js`. `_checkRequestConstraints(root, text)` = `_matchConstraints(_loadPlatformConstraints(root), text)` (fs load 만 주입).
|
|
13
|
+
3. selftest 80→81 · e2e 277→278.
|
|
14
|
+
|
|
15
|
+
### 검증
|
|
16
|
+
- **selftest 81/81 PASS** · **E2E 278/278 PASS** (회귀 0).
|
|
17
|
+
- 실측: catalog 6플랫폼 · `_matchConstraints(cat, 'stripe 결제')`→matched stripe/total 6 · `(null,…)`→빈 결과 · constraints check + review-request(_checkRequestConstraints) 정상.
|
|
18
|
+
- 비고: command 함수(constraintsCmd) 자체의 lib 이전은 factory 패턴 필요 → 별도 결정. 핵심 데이터·로직은 분리·테스트화 완료.
|
|
19
|
+
|
|
3
20
|
## 1.9.332 — 2026-06-05 — UR-0025(증분): lessons.md 파서 분리
|
|
4
21
|
|
|
5
22
|
**🧩 순수 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
|
-
[](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.333 하네스를 사용합니다. 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.333는 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.
|
|
549
|
+
현재 누적: **70 라운드 (1.9.40 → 1.9.333)** · 매 라운드 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.333: 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~
|
|
19
|
+
_parseLessonEntries, _matchConstraints } = 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 } = require('../lib/catalogs'); // 1.9.333 (UR-0025): constraints catalog 분리
|
|
24
24
|
|
|
25
|
-
const VERSION = '1.9.
|
|
25
|
+
const VERSION = '1.9.333';
|
|
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,7 @@ 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; } },
|
|
3080
3081
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
3081
3082
|
];
|
|
3082
3083
|
}
|
|
@@ -3754,63 +3755,7 @@ function roundHistoryCmd(root) {
|
|
|
3754
3755
|
// .harness/platform-constraints.json 에 플랫폼별 제약 catalog 저장 → 요청 텍스트 키워드 매칭 → 적용 가능한 제약 보고
|
|
3755
3756
|
// 기본 catalog 6종: Stripe / OpenAI / Anthropic / GitHub / Discord / Twitter
|
|
3756
3757
|
function _platformConstraintsPath(root) { return path.join(root, '.harness', 'platform-constraints.json'); }
|
|
3757
|
-
|
|
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
|
-
};
|
|
3758
|
+
// 1.9.333 (UR-0025 심층): _DEFAULT_PLATFORM_CONSTRAINTS → lib/catalogs.js 로 이동 (순수 데이터, require 사용).
|
|
3814
3759
|
function _loadPlatformConstraints(root) {
|
|
3815
3760
|
try {
|
|
3816
3761
|
const fp = _platformConstraintsPath(root);
|
|
@@ -3834,23 +3779,9 @@ function _writePlatformConstraints(root, catalog) {
|
|
|
3834
3779
|
} catch { return false; }
|
|
3835
3780
|
}
|
|
3836
3781
|
// 사용자 요청 텍스트에서 플랫폼 alias 매칭 → 적용 제약 목록 반환
|
|
3782
|
+
// 1.9.333 (UR-0025 심층): 매칭 로직은 순수 _matchConstraints(catalog, text) (lib/pure-utils) — fs(load)는 여기서 주입.
|
|
3837
3783
|
function _checkRequestConstraints(root, text) {
|
|
3838
|
-
|
|
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 };
|
|
3784
|
+
return _matchConstraints(_loadPlatformConstraints(root), text);
|
|
3854
3785
|
}
|
|
3855
3786
|
|
|
3856
3787
|
// 1.9.209: pre-wake sub-agent audit (사용자 명시)
|
package/lib/catalogs.js
CHANGED
|
@@ -57,4 +57,63 @@ const REUSE_CHECKLIST = [
|
|
|
57
57
|
'제어: 핵심 로직이면 외부 의존 리스크를 감수할 가치가 있는가'
|
|
58
58
|
];
|
|
59
59
|
|
|
60
|
-
|
|
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
|
+
module.exports = { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST, _DEFAULT_PLATFORM_CONSTRAINTS };
|
package/lib/pure-utils.js
CHANGED
|
@@ -375,6 +375,24 @@ 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
|
+
|
|
378
396
|
module.exports = {
|
|
379
397
|
_isSecretKey, compareVer, parseHarnessVersion,
|
|
380
398
|
_classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
|
|
@@ -399,5 +417,7 @@ module.exports = {
|
|
|
399
417
|
// 1.9.331 (UR-0025): project-brief 텍스트 빌더 + 마커
|
|
400
418
|
BRIEF_START, BRIEF_END, _briefReadmeBlock, _briefBlueprint,
|
|
401
419
|
// 1.9.332 (UR-0025): 순수 lessons.md 파서
|
|
402
|
-
_parseLessonEntries
|
|
420
|
+
_parseLessonEntries,
|
|
421
|
+
// 1.9.333 (UR-0025 심층): 순수 플랫폼 제약 매칭
|
|
422
|
+
_matchConstraints
|
|
403
423
|
};
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -4107,5 +4107,30 @@ 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
|
+
const movedOut = !/const _DEFAULT_PLATFORM_CONSTRAINTS = \{/.test(harnessSrc) && harnessSrc.includes('_matchConstraints(_loadPlatformConstraints(root), text)')
|
|
4122
|
+
&& /_DEFAULT_PLATFORM_CONSTRAINTS \} = require\('\.\.\/lib\/catalogs'\)/.test(harnessSrc);
|
|
4123
|
+
// 소비 명령 회귀: constraints check (review-request 도 _checkRequestConstraints 사용)
|
|
4124
|
+
const cd = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-con-'));
|
|
4125
|
+
cp.spawnSync(process.execPath, [CLI, 'init', cd, '--yes', '--language', 'ko', '--skills', 'recommended'], { encoding: 'utf8', timeout: 30000 });
|
|
4126
|
+
const cr = cp.spawnSync(process.execPath, [CLI, 'constraints', 'check', 'stripe 결제 구현', '--path', cd], { encoding: 'utf8', timeout: 20000 });
|
|
4127
|
+
const cmdOk = /stripe|플랫폼 매칭/.test(cr.stdout || '');
|
|
4128
|
+
ok = work && movedOut && cmdOk;
|
|
4129
|
+
fs.rmSync(cd, { recursive: true, force: true });
|
|
4130
|
+
} catch {}
|
|
4131
|
+
console.log(ok ? '✓ B(1.9.333) UR-0025 심층: constraints catalog/_matchConstraints 분리 + constraints check 회귀 (UR-0025)' : '✗ constraints 서브시스템 분리 실패');
|
|
4132
|
+
if (!ok) failed++;
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4110
4135
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
4111
4136
|
if (failed > 0) process.exit(1);
|