@s2life/mcp 0.2.0 → 0.3.0

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/README.md CHANGED
@@ -35,6 +35,20 @@ claude mcp add s2life -- npx -y @s2life/mcp
35
35
 
36
36
  `which_component`는 순수 문자열 매칭이다. NFKC·소문자·공백 제거 후 전체 이름 일치 +2000, 설명 안 이름 포함 +1000, 키워드 +20(한 글자는 +4), 설명 단어의 useWhen 일치 +5, purpose 일치 +2를 합산한다. 동점은 이름순이며 기본 5개(최대 10개)를 반환한다. 단어별 의미 추론·동의어 추론은 하지 않는다. 점수 근거·useWhen·dont를 같이 주므로 호출자가 후보를 비교한다. 무매칭은 `isError: true`와 `list_components` 안내로 반환한다.
37
37
 
38
+ `manifest.json`은 파생 필드를 항목마다 반복하지 않고 최상위 `derived`에 복원 규칙을 보관한다.
39
+ `importTemplate`의 `NAME`은 항목 이름이고, 전체 소스 경로는 `sourceRoot + source`다.
40
+ 생략한 `kind`는 `kindDefault`, 생략한 prop의 `required`는 `requiredDefault`다.
41
+ 선택 prop의 타입에는 `optionalTypeSuffix`를 붙인다. `optionalTypeSuffixExceptions`는
42
+ 이미 undefined를 포함해 검사기가 접미사를 생략한 타입 별칭 목록이며 실제 추출 결과에서 생성한다.
43
+ `derived.description`에도 이 규칙이 있어 매니페스트만 읽어도 복원할 수 있다.
44
+
45
+ `design://components`는 `{ derived, components }` 형태로 이 규칙과 압축된 항목을 함께 보낸다.
46
+ 크기 예산 80,000바이트는 이 객체 전체의 compact UTF-8 JSON을 잰다(전체 매니페스트는 160,000바이트).
47
+ `get_component`·`list_components`는 `catalog.mjs`로 기본값·경로·import·타입 표기를 복원해
48
+ 이전 응답을 유지한다. 부품의 부모 의도 합치기는 기존과 동일하며 저장 항목은 변경하지 않는다.
49
+ 생성기는 모든 항목을 복원해 원본과 깊은 비교하고, 단위 테스트는 고정 기준선의 상세 8개·목록 99개를
50
+ 실제 stdio 응답과 비교한다. 기준선은 `docs/qa/fixtures/get-component-baseline.json`이다.
51
+
38
52
  검증 명령:
39
53
 
40
54
  ```sh
package/catalog.mjs ADDED
@@ -0,0 +1,18 @@
1
+ // 저장 형태의 기본값은 매니페스트에서 읽는다. 도구 응답과 원래 타입 표기를 함께 보존한다.
2
+ export function restoreComponent(component, derived) {
3
+ const { kind, source, props, extends: bases, slots, ...intent } = component;
4
+ return {
5
+ ...intent,
6
+ kind: kind ?? derived.kindDefault,
7
+ source: derived.sourceRoot + source,
8
+ props: props.map(({ name, type, required = derived.requiredDefault, ...details }) => ({
9
+ name,
10
+ type: !required && !derived.optionalTypeSuffixExceptions.includes(type) ? type + derived.optionalTypeSuffix : type,
11
+ required,
12
+ ...details,
13
+ })),
14
+ extends: bases,
15
+ slots,
16
+ import: derived.importTemplate.replace('NAME', component.name),
17
+ };
18
+ }