@yoonion/mimi-seed-mcp 0.23.0 → 0.23.2

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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/assets/agent-guide.md +30 -27
  3. package/dist/ai/notes.js +3 -2
  4. package/dist/ai/review.js +1 -1
  5. package/dist/appstore/app-info-policy.d.ts +27 -0
  6. package/dist/appstore/app-info-policy.js +104 -0
  7. package/dist/appstore/app-info.d.ts +19 -0
  8. package/dist/appstore/app-info.js +68 -0
  9. package/dist/appstore/apps.d.ts +2 -6
  10. package/dist/appstore/apps.js +20 -42
  11. package/dist/appstore/asset-library-write.d.ts +39 -0
  12. package/dist/appstore/asset-library-write.js +282 -0
  13. package/dist/appstore/asset-library.d.ts +28 -0
  14. package/dist/appstore/asset-library.js +204 -0
  15. package/dist/appstore/client.d.ts +4 -3
  16. package/dist/appstore/declarations.js +11 -14
  17. package/dist/appstore/previews.js +3 -29
  18. package/dist/appstore/read-response.d.ts +14 -0
  19. package/dist/appstore/read-response.js +20 -0
  20. package/dist/appstore/release-target.d.ts +49 -0
  21. package/dist/appstore/release-target.js +107 -0
  22. package/dist/appstore/review-submission.d.ts +1 -1
  23. package/dist/appstore/review-submission.js +12 -10
  24. package/dist/appstore/screenshots.d.ts +1 -0
  25. package/dist/appstore/screenshots.js +60 -4
  26. package/dist/appstore/upload-parts.d.ts +11 -0
  27. package/dist/appstore/upload-parts.js +29 -0
  28. package/dist/appstore/versions.d.ts +5 -1
  29. package/dist/appstore/versions.js +18 -16
  30. package/dist/checks/plan.d.ts +1 -0
  31. package/dist/checks/plan.js +89 -71
  32. package/dist/checks/risks.d.ts +18 -2
  33. package/dist/checks/risks.js +280 -177
  34. package/dist/playstore/reviews.d.ts +61 -0
  35. package/dist/playstore/reviews.js +27 -11
  36. package/dist/prompts.d.ts +3 -2
  37. package/dist/prompts.js +109 -88
  38. package/dist/registers/ai.js +2 -2
  39. package/dist/registers/appstore/customer-reviews.js +1 -1
  40. package/dist/registers/appstore/media.js +69 -24
  41. package/dist/registers/appstore/review-submission.js +4 -3
  42. package/dist/registers/appstore/versions.js +8 -4
  43. package/dist/registers/auth.js +1 -1
  44. package/dist/registers/checks.js +18 -8
  45. package/dist/registers/playstore.js +10 -1
  46. package/dist/server.js +7 -1
  47. package/package.json +1 -1
  48. package/tool-manifest.json +5 -2
@@ -1,63 +1,90 @@
1
+ import { z } from 'zod';
1
2
  import { publisher, withEdit } from '../playstore/tools.js';
2
- import { apiGet } from '../appstore/tools.js';
3
- import { isNotFound } from '../appstore/http.js';
4
- const APPSTORE_EDITABLE_STATES = 'PREPARE_FOR_SUBMISSION,DEVELOPER_REJECTED,METADATA_REJECTED,REJECTED';
5
- export async function checkPlayStoreRisks(auth, packageName, language = 'ko-KR') {
3
+ import { appStorePagination as pagination, getAppStoreResponse, pageIsIncomplete } from '../appstore/read-response.js';
4
+ import { selectAppInfo } from '../appstore/app-info.js';
5
+ import { selectEditableAppStoreVersion, resolveAppStoreVersionBuild } from '../appstore/release-target.js';
6
+ import { includedScreenshotReadiness, indexIncludedPlacements, listMediaPlacements, screenshotPlacementReadiness } from '../appstore/asset-library.js';
7
+ import { checkLegacyScreenshotReadiness } from '../appstore/screenshots.js';
8
+ import { readAppInfoAgeRatingForRelease, readAppInfoPrivacy } from '../appstore/app-info-policy.js';
9
+ import { encodePathSegment } from '../lib/url-path.js';
10
+ import { extractHttpStatus } from '../lib/google-errors.js';
11
+ export function isRiskCheckIncomplete(risk) {
12
+ return risk.code.startsWith('API_ERROR_');
13
+ }
14
+ export async function checkPlayStoreRisks(auth, packageName, language = 'ko-KR', target) {
15
+ return withEdit(auth, packageName, (editId) => checkPlayStoreRisksInEdit(auth, packageName, editId, language, target));
16
+ }
17
+ export async function checkPlayStoreRisksInEdit(auth, packageName, editId, language, target, tracksSnapshot) {
6
18
  const risks = [];
7
- await withEdit(auth, packageName, async (editId) => {
8
- const [listing, phoneScreenshots, icons, details, tracks] = await Promise.all([
9
- publisher().edits.listings.get({ auth, packageName, editId, language }).catch(() => null),
10
- publisher().edits.images.list({ auth, packageName, editId, language, imageType: 'phoneScreenshots' }).catch(() => null),
11
- publisher().edits.images.list({ auth, packageName, editId, language, imageType: 'icon' }).catch(() => null),
12
- publisher().edits.details.get({ auth, packageName, editId }).catch(() => null),
13
- publisher().edits.tracks.list({ auth, packageName, editId }).catch(() => null),
14
- ]);
15
- if (!listing?.data) {
16
- risks.push({ level: 'blocker', code: 'NO_LISTING', title: `${language} 리스팅 없음`, detail: 'Play Console에서 스토어 정보를 입력하세요.', fixUrl: 'https://play.google.com/console/developers' });
17
- }
18
- else {
19
- const { title, shortDescription, fullDescription } = listing.data;
20
- if (!title || title.length < 2) {
21
- risks.push({ level: 'blocker', code: 'NO_TITLE', title: '앱 이름 없음', detail: '제목은 필수 항목입니다.' });
22
- }
23
- else if (title.length > 50) {
24
- risks.push({ level: 'warning', code: 'TITLE_TOO_LONG', title: '앱 이름 50자 초과', detail: `현재 ${title.length}자. Google 가이드라인: 50자 이내.` });
19
+ const [listing, phoneScreenshots, icons, details, tracks] = await Promise.all([
20
+ safeGet(async () => {
21
+ try {
22
+ return await publisher().edits.listings.get({ auth, packageName, editId, language });
25
23
  }
26
- if (!shortDescription || shortDescription.length < 10) {
27
- risks.push({ level: 'warning', code: 'NO_SHORT_DESC', title: '짧은 설명 없음', detail: '짧은 설명은 검색 노출에 영향을 줍니다.' });
28
- }
29
- if (!fullDescription || fullDescription.length < 50) {
30
- risks.push({ level: 'blocker', code: 'NO_FULL_DESC', title: '전체 설명 없음', detail: '전체 설명은 필수 항목입니다.' });
31
- }
32
- else if (fullDescription.length > 4000) {
33
- risks.push({ level: 'warning', code: 'DESC_TOO_LONG', title: '설명 4000자 초과', detail: `현재 ${fullDescription.length}자. 4000자 이내로 줄이세요.` });
24
+ catch (error) {
25
+ if (extractHttpStatus(error) === 404)
26
+ return { data: null };
27
+ throw error;
34
28
  }
29
+ }, risks, 'LISTING', `${language} 리스팅`),
30
+ safeGet(() => publisher().edits.images.list({ auth, packageName, editId, language, imageType: 'phoneScreenshots' }), risks, 'SCREENSHOTS', '전화 스크린샷'),
31
+ safeGet(() => publisher().edits.images.list({ auth, packageName, editId, language, imageType: 'icon' }), risks, 'ICON', '앱 아이콘'),
32
+ safeGet(() => publisher().edits.details.get({ auth, packageName, editId }), risks, 'DETAILS', '앱 연락처'),
33
+ tracksSnapshot ?? safeGet(async () => (await publisher().edits.tracks.list({ auth, packageName, editId })).data.tracks ?? [], risks, 'TRACKS', '릴리스 트랙'),
34
+ ]);
35
+ if (listing && !listing.data) {
36
+ risks.push({ level: 'blocker', code: 'NO_LISTING', title: `${language} 리스팅 없음`, detail: 'Play Console에서 스토어 정보를 입력하세요.', fixUrl: 'https://play.google.com/console/developers' });
37
+ }
38
+ else if (listing?.data) {
39
+ const { title, shortDescription, fullDescription } = listing.data;
40
+ if (!title || title.length < 2) {
41
+ risks.push({ level: 'blocker', code: 'NO_TITLE', title: '앱 이름 없음', detail: '제목은 필수 항목입니다.' });
35
42
  }
36
- const screenCount = phoneScreenshots?.data?.images?.length ?? 0;
37
- if (screenCount === 0) {
38
- risks.push({ level: 'blocker', code: 'NO_SCREENSHOTS', title: '전화 스크린샷 없음', detail: '최소 2장 이상의 스크린샷이 필요합니다.' });
43
+ else if (title.length > 50) {
44
+ risks.push({ level: 'warning', code: 'TITLE_TOO_LONG', title: '앱 이름 50자 초과', detail: `현재 ${title.length}자. Google 가이드라인: 50자 이내.` });
39
45
  }
40
- else if (screenCount < 2) {
41
- risks.push({ level: 'warning', code: 'FEW_SCREENSHOTS', title: `스크린샷 ${screenCount}장 (권장: 4~8장)`, detail: '더 많은 스크린샷이 전환율을 높입니다.' });
46
+ if (!shortDescription || shortDescription.length < 10) {
47
+ risks.push({ level: 'warning', code: 'NO_SHORT_DESC', title: '짧은 설명 없음', detail: '짧은 설명은 검색 노출에 영향을 줍니다.' });
42
48
  }
43
- if (!icons?.data?.images?.length) {
44
- risks.push({ level: 'blocker', code: 'NO_ICON', title: '앱 아이콘 없음', detail: '512×512px PNG 아이콘이 필요합니다.' });
49
+ if (!fullDescription || fullDescription.length < 50) {
50
+ risks.push({ level: 'blocker', code: 'NO_FULL_DESC', title: '전체 설명 없음', detail: '전체 설명은 필수 항목입니다.' });
45
51
  }
46
- if (!details?.data?.contactEmail) {
47
- risks.push({ level: 'warning', code: 'NO_CONTACT_EMAIL', title: '개발자 이메일 없음', detail: 'Play Console에서 개발자 연락처를 설정하세요.' });
52
+ else if (fullDescription.length > 4000) {
53
+ risks.push({ level: 'warning', code: 'DESC_TOO_LONG', title: '설명 4000자 초과', detail: `현재 ${fullDescription.length}자. 4000자 이내로 줄이세요.` });
48
54
  }
49
- const hasBuild = (tracks?.data?.tracks ?? []).some((t) => (t.releases ?? []).some((r) => r.versionCodes && r.versionCodes.length > 0));
50
- if (!hasBuild) {
55
+ }
56
+ const screenCount = phoneScreenshots?.data?.images?.length ?? 0;
57
+ if (phoneScreenshots && screenCount === 0) {
58
+ risks.push({ level: 'blocker', code: 'NO_SCREENSHOTS', title: '전화 스크린샷 없음', detail: '최소 2장 이상의 스크린샷이 필요합니다.' });
59
+ }
60
+ else if (phoneScreenshots && screenCount < 2) {
61
+ risks.push({ level: 'warning', code: 'FEW_SCREENSHOTS', title: `스크린샷 ${screenCount}장 (권장: 4~8장)`, detail: '더 많은 스크린샷이 전환율을 높입니다.' });
62
+ }
63
+ if (icons && !icons.data?.images?.length) {
64
+ risks.push({ level: 'blocker', code: 'NO_ICON', title: '앱 아이콘 없음', detail: '512×512px PNG 아이콘이 필요합니다.' });
65
+ }
66
+ if (details && !details.data?.contactEmail) {
67
+ risks.push({ level: 'warning', code: 'NO_CONTACT_EMAIL', title: '개발자 이메일 없음', detail: 'Play Console에서 개발자 연락처를 설정하세요.' });
68
+ }
69
+ if (tracks) {
70
+ if (target) {
71
+ const targetTrack = tracks.find((track) => track.track === target.track);
72
+ if (!targetTrack?.releases?.some((release) => release.versionCodes?.includes(target.versionCode))) {
73
+ risks.push({
74
+ level: 'blocker',
75
+ code: 'TARGET_BUILD_NOT_FOUND',
76
+ title: '대상 트랙에서 빌드를 찾을 수 없음',
77
+ detail: `${target.track} 트랙에 versionCode ${target.versionCode}가 있는지 확인하세요.`,
78
+ });
79
+ }
80
+ }
81
+ else if (!tracks.some((track) => track.releases?.some((release) => release.versionCodes?.length))) {
51
82
  risks.push({ level: 'blocker', code: 'NO_BUILD', title: '업로드된 빌드 없음', detail: '내부 테스트 트랙에 APK/AAB를 먼저 업로드하세요.' });
52
83
  }
53
- return null;
54
- });
84
+ }
55
85
  return risks;
56
86
  }
57
- // Apple의 ASC API 호출은 권한·필드명·deprecated endpoint 등으로 실패할 수 있다.
58
- // 실패를 silent하게 null로 만들면 후속 check가 false-positive blocker를 토해낸다 —
59
- // 이 헬퍼는 실패 사실을 risks 배열에 warning으로 기록해 사용자에게 노출시키되,
60
- // 호출부는 null을 받아 blocker 분기를 건너뛸 수 있게 해준다.
87
+ // 조회 실패는 리소스가 없다는 응답과 구분한다. 결과를 표시할 때 API_ERROR_ 항목은 점검 미완료로 취급한다.
61
88
  async function safeGet(call, risks, code, title) {
62
89
  try {
63
90
  return await call();
@@ -66,35 +93,118 @@ async function safeGet(call, risks, code, title) {
66
93
  risks.push({
67
94
  level: 'warning',
68
95
  code: `API_ERROR_${code}`,
69
- title: `App Store Connect 조회 실패 — ${title}`,
96
+ title: `조회 실패 — ${title}`,
70
97
  detail: `이 항목은 위험 분석에서 제외됨. 원인: ${e instanceof Error ? e.message : String(e)}`,
71
98
  });
72
99
  return null;
73
100
  }
74
101
  }
75
- const APP_INFO_LIVE_STATE = 'READY_FOR_DISTRIBUTION';
102
+ const idResource = z.object({ id: z.string().min(1) });
103
+ const screenshotPage = pagination.extend({ data: z.array(z.unknown()) });
104
+ const versionLocalizationPage = pagination.extend({
105
+ data: z.array(idResource.extend({
106
+ attributes: z.object({
107
+ locale: z.string().nullish(),
108
+ description: z.string().trim().nullish(),
109
+ whatsNew: z.string().trim().nullish(),
110
+ keywords: z.string().trim().nullish(),
111
+ }).nullish(),
112
+ relationships: z.object({ placements: z.unknown().optional(), appScreenshotSets: z.unknown().optional() }).nullish(),
113
+ })),
114
+ included: z.array(z.unknown()).nullish(),
115
+ });
116
+ function screenshotSetPresence(response) {
117
+ const parsed = screenshotPage.safeParse(response);
118
+ if (!parsed.success)
119
+ return undefined;
120
+ const page = parsed.data;
121
+ if (page.data.some((set) => idResource.safeParse(set).success))
122
+ return true;
123
+ if (page.data.length === 0 && !pageIsIncomplete(page, 0))
124
+ return false;
125
+ return undefined;
126
+ }
127
+ export function appStoreBuildRisk(build) {
128
+ switch (build.status) {
129
+ case 'ready':
130
+ return undefined;
131
+ case 'missing':
132
+ return { level: 'blocker', code: 'NO_BUILD', title: '버전에 연결된 빌드 없음', detail: '대상 버전에 사용할 빌드를 업로드하고 연결하세요.' };
133
+ case 'not-ready':
134
+ return {
135
+ level: 'blocker',
136
+ code: 'BUILD_NOT_READY',
137
+ title: '연결된 빌드 처리 미완료',
138
+ detail: `빌드 ${build.id}의 처리 상태는 ${build.processingState}입니다. App Store Connect에서 처리 결과를 확인하세요.`,
139
+ };
140
+ case 'unknown':
141
+ return { level: 'warning', code: 'API_ERROR_BUILD', title: '연결된 빌드 점검 미완료', detail: build.detail };
142
+ }
143
+ }
76
144
  export async function checkAppStoreRisks(appId, expected = {}) {
77
145
  const risks = [];
78
- const versions = await safeGet(() => apiGet(`/apps/${appId}/appStoreVersions`, {
79
- 'filter[appStoreState]': APPSTORE_EDITABLE_STATES,
80
- 'limit': '5',
81
- }), risks, 'VERSIONS', '편집 가능한 버전 목록');
82
- if (!versions?.data?.length) {
83
- risks.push({ level: 'warning', code: 'NO_EDITABLE_VERSION', title: '편집 가능한 버전 없음', detail: 'App Store Connect에서 새 버전을 만드세요.', fixUrl: 'https://appstoreconnect.apple.com' });
146
+ const selection = await safeGet(() => selectEditableAppStoreVersion(appId, { versionId: expected.versionId }), risks, 'VERSIONS', '편집 가능한 버전 목록');
147
+ if (!selection)
148
+ return risks;
149
+ if (selection.status === 'incomplete' || selection.status === 'ambiguous') {
150
+ risks.push({
151
+ level: 'warning',
152
+ code: selection.status === 'incomplete' ? 'API_ERROR_VERSIONS_INCOMPLETE' : 'API_ERROR_VERSIONS_AMBIGUOUS',
153
+ title: '편집 가능한 버전을 하나로 확인할 수 없음',
154
+ detail: 'App Store Connect에서 대상 플랫폼과 편집 상태를 확인한 뒤 해당 versionId로 다시 점검하세요.',
155
+ });
156
+ return risks;
157
+ }
158
+ if (selection.status === 'missing') {
159
+ if (expected.versionId) {
160
+ risks.push({
161
+ level: 'blocker',
162
+ code: 'TARGET_VERSION_UNVERIFIED',
163
+ title: '대상 버전을 점검할 수 없음',
164
+ detail: '대상 앱의 편집 가능한 버전 목록에서 요청한 버전을 확인하세요.',
165
+ });
166
+ }
167
+ else {
168
+ risks.push({ level: 'blocker', code: 'NO_EDITABLE_VERSION', title: '편집 가능한 버전 없음', detail: 'App Store Connect에서 새 버전을 만드세요.', fixUrl: 'https://appstoreconnect.apple.com' });
169
+ }
84
170
  return risks;
85
171
  }
86
- const versionId = versions.data[0].id;
87
- // 1) 메타데이터·스크린샷·버전 첨부 빌드는 versionId 기반으로 조회.
88
- // 2) 개인정보 URL은 appInfoLocalization 단위(앱 단위)로 조회.
89
- const [locs, attachedBuildRel, appInfos] = await Promise.all([
90
- safeGet(() => apiGet(`/appStoreVersions/${versionId}/appStoreVersionLocalizations`), risks, 'LOCALIZATIONS', '버전 로컬라이제이션'),
91
- safeGet(() => apiGet(`/appStoreVersions/${versionId}/relationships/build`), risks, 'BUILD', '버전 첨부 빌드'),
92
- safeGet(() => apiGet(`/apps/${appId}/appInfos`, { 'fields[appInfos]': 'state', 'limit': '10' }), risks, 'APP_INFO', '앱 정보'),
172
+ const { version } = selection;
173
+ const [build, otherRisks] = await Promise.all([
174
+ resolveAppStoreVersionBuild(version),
175
+ checkAppStoreVersionRisks(appId, version, expected),
176
+ ]);
177
+ const buildRisk = appStoreBuildRisk(build);
178
+ return buildRisk ? [buildRisk, ...otherRisks] : otherRisks;
179
+ }
180
+ export async function checkAppStoreVersionRisks(appId, { id: selectedVersionId, platform }, expected = {}) {
181
+ const risks = [];
182
+ const versionId = encodePathSegment(selectedVersionId);
183
+ // 버전 메타데이터·스크린샷과 앱 단위 개인정보처리방침을 병행 조회한다.
184
+ const [locs, appInfo] = await Promise.all([
185
+ safeGet(() => getAppStoreResponse(versionLocalizationPage, `/appStoreVersions/${versionId}/appStoreVersionLocalizations`, {
186
+ limit: '200',
187
+ include: 'placements,appScreenshotSets',
188
+ 'limit[placements]': '50',
189
+ 'limit[appScreenshotSets]': '1',
190
+ 'fields[appStoreVersionLocalizations]': 'locale,description,whatsNew,keywords,placements,appScreenshotSets',
191
+ 'fields[appAssetLibraryPlacements]': 'placementType,state,image',
192
+ }), risks, 'LOCALIZATIONS', '버전 로컬라이제이션'),
193
+ safeGet(() => selectAppInfo(appId, { privacyPlatform: platform }), risks, 'APP_INFO', '앱 정보'),
93
194
  ]);
94
- if (!locs?.data?.length) {
195
+ if (locs && pageIsIncomplete(locs, locs.data.length)) {
196
+ risks.push({
197
+ level: 'warning',
198
+ code: 'API_ERROR_LOCALIZATIONS_INCOMPLETE',
199
+ title: '버전 로컬라이제이션 목록이 불완전함',
200
+ detail: 'App Store Connect에서 대상 버전의 전체 로컬라이제이션을 확인하세요.',
201
+ });
202
+ }
203
+ else if (locs?.data.length === 0) {
95
204
  risks.push({ level: 'blocker', code: 'NO_LOCALIZATIONS', title: '로컬라이제이션 없음', detail: '메타데이터를 입력하세요.' });
96
205
  }
97
- else {
206
+ if (locs) {
207
+ const placementsById = indexIncludedPlacements(locs.included ?? []);
98
208
  for (const loc of locs.data) {
99
209
  const { locale: rawLocale, description, whatsNew, keywords } = loc.attributes ?? {};
100
210
  const locale = rawLocale ?? loc.id;
@@ -104,126 +214,115 @@ export async function checkAppStoreRisks(appId, expected = {}) {
104
214
  risks.push({ level: 'warning', code: `NO_WHATS_NEW_${locale}`, title: `${locale} 새로운 기능 없음`, detail: '릴리즈 노트를 입력하면 다운로드 전환율이 높아집니다.' });
105
215
  if (!keywords)
106
216
  risks.push({ level: 'warning', code: `NO_KEYWORDS_${locale}`, title: `${locale} 키워드 없음`, detail: '키워드는 검색 노출에 직접 영향을 줍니다.' });
107
- const screenshots = await safeGet(() => apiGet(`/appStoreVersionLocalizations/${loc.id}/appScreenshotSets`), risks, `SCREENSHOTS_${locale}`, `${locale} 스크린샷 셋`);
108
- if (screenshots && !screenshots.data?.length) {
217
+ const screenshots = await safeGet(async () => {
218
+ let readiness = includedScreenshotReadiness(loc.relationships?.placements, placementsById);
219
+ if (readiness === 'unknown') {
220
+ const placements = await listMediaPlacements(loc.id, 'screenshots');
221
+ readiness = placements ? screenshotPlacementReadiness(placements) : 'missing';
222
+ }
223
+ if (readiness === 'missing' && screenshotSetPresence(loc.relationships?.appScreenshotSets) !== false) {
224
+ readiness = await checkLegacyScreenshotReadiness(loc.id);
225
+ }
226
+ if (readiness === 'unknown')
227
+ throw new Error('App Store Connect의 스크린샷 상태를 확인할 수 없습니다.');
228
+ return readiness;
229
+ }, risks, `SCREENSHOTS_${locale}`, `${locale} 스크린샷`);
230
+ if (screenshots === 'missing') {
109
231
  risks.push({
110
232
  level: 'blocker',
111
233
  code: `NO_SCREENSHOTS_${locale}`,
112
234
  title: `${locale} 스크린샷 없음`,
113
- detail: 'iPhone 6.5" 또는 6.9" 스크린샷이 필요합니다.',
235
+ detail: '대상 플랫폼에서 허용하는 스크린샷을 로케일에 배치하세요.',
236
+ });
237
+ }
238
+ else if (screenshots === 'not-ready') {
239
+ risks.push({
240
+ level: 'blocker',
241
+ code: `SCREENSHOTS_NOT_READY_${locale}`,
242
+ title: `${locale} 스크린샷 준비 미완료`,
243
+ detail: '배치된 스크린샷이 처리 중이거나 처리에 실패했습니다. App Store Connect에서 상태를 확인하세요.',
114
244
  });
115
245
  }
116
246
  }
117
247
  }
118
- // 빌드 — 1차: 버전에 첨부된 빌드. 2차 폴백: 앱 전체 빌드 (예전 동작).
119
- // attachedBuildRel?.data가 null이면 "관계 조회 성공 + 첨부 안 됨" 의미.
120
- // attachedBuildRel 자체가 null이면 safeGet 실패 — fall back.
121
- let buildVerdict;
122
- if (attachedBuildRel) {
123
- buildVerdict = attachedBuildRel.data ? 'present' : 'missing';
124
- }
125
- else {
126
- const fallbackBuilds = await safeGet(() => apiGet(`/builds`, {
127
- 'filter[app]': appId,
128
- 'fields[builds]': 'version,uploadedDate,processingState',
129
- 'sort': '-uploadedDate',
130
- 'limit': '5',
131
- }), risks, 'BUILDS_FALLBACK', '앱 빌드 목록(폴백)');
132
- buildVerdict = fallbackBuilds?.data?.length ? 'present' : fallbackBuilds ? 'missing' : 'unknown';
133
- }
134
- if (buildVerdict === 'missing') {
135
- risks.push({ level: 'blocker', code: 'NO_BUILD', title: 'TestFlight 빌드 없음', detail: 'Xcode 또는 Fastlane으로 빌드를 업로드하세요.' });
136
- }
137
- // 개인정보처리방침 — appInfoLocalization 어디 한 곳이라도 URL 또는 in-app 텍스트가 있으면 OK.
138
- // appInfos 조회 자체가 실패하면 unknown으로 두고 blocker 안 띄움 (warning만 기록됨).
139
- if (appInfos) {
140
- const infos = (appInfos.data ?? []);
141
- const stateOf = (i) => i.attributes?.state ?? i.attributes?.appStoreState ?? '';
142
- const editable = infos.find((i) => stateOf(i) !== APP_INFO_LIVE_STATE) ?? infos[0];
143
- if (editable) {
144
- const [localizations, ageRating] = await Promise.all([
145
- safeGet(() => apiGet(`/appInfos/${editable.id}/appInfoLocalizations`, {
146
- 'fields[appInfoLocalizations]': 'locale,privacyPolicyUrl,privacyPolicyText',
147
- 'limit': '200',
148
- }), risks, 'PRIVACY', '개인정보 로컬라이제이션'),
149
- safeGet(async () => {
150
- try {
151
- return await apiGet(`/appInfos/${editable.id}/ageRatingDeclaration`, {
152
- 'fields[ageRatingDeclarations]': 'userGeneratedContent,socialMedia,socialMediaAgeRestricted,ageAssurance',
153
- });
154
- }
155
- catch (error) {
156
- // A 404 means the declaration is genuinely absent, not that the check is unknown.
157
- if (isNotFound(error))
158
- return { data: null };
159
- throw error;
160
- }
161
- }, risks, 'AGE_RATING_SOCIAL', '연령등급 소셜 미디어 응답'),
162
- ]);
163
- if (localizations) {
164
- const locs = (localizations.data ?? []);
165
- const hasPrivacy = locs.some((l) => l.attributes?.privacyPolicyUrl || l.attributes?.privacyPolicyText);
166
- if (!hasPrivacy) {
167
- risks.push({ level: 'blocker', code: 'NO_PRIVACY', title: '개인정보처리방침 URL 없음', detail: 'App Store 가이드라인 5.1.1 — 필수 항목입니다. 모든 로컬라이제이션에서 privacyPolicyUrl 또는 privacyPolicyText 중 하나를 입력하세요.' });
168
- }
169
- }
170
- if (ageRating) {
171
- const declaration = ageRating.data?.attributes ?? {};
172
- if (declaration.socialMedia === undefined || declaration.socialMediaAgeRestricted === undefined) {
173
- risks.push({
174
- level: 'blocker',
175
- code: 'SOCIAL_MEDIA_ANSWERS_MISSING',
176
- title: '연령등급 소셜 미디어 질문 미응답',
177
- detail: '2026년 9월부터 신규 앱·업데이트 제출에 socialMedia와 socialMediaAgeRestricted 응답이 필요합니다.',
178
- fixUrl: 'https://developer.apple.com/news/?id=tlur8uvi',
179
- });
180
- }
181
- if (declaration.socialMediaAgeRestricted === true && declaration.socialMedia !== true) {
182
- risks.push({
183
- level: 'blocker',
184
- code: 'SOCIAL_MEDIA_AGE_RESTRICTION_MISMATCH',
185
- title: '13세 미만 제한 응답 불일치',
186
- detail: 'socialMediaAgeRestricted=true는 socialMedia=true인 앱에서만 의미가 있습니다.',
187
- });
188
- }
189
- if (declaration.socialMediaAgeRestricted === true && declaration.ageAssurance !== true) {
190
- risks.push({
191
- level: 'blocker',
192
- code: 'SOCIAL_MEDIA_AGE_ASSURANCE_MISSING',
193
- title: '13세 미만 소셜 기능 제한에 연령 확인이 없음',
194
- detail: 'Apple은 socialMediaAgeRestricted=true인 경우 최소한 Declared Age Range API로 연령 범위를 확인하도록 요구합니다. ageAssurance 응답과 실제 구현을 확인하세요.',
195
- fixUrl: 'https://developer.apple.com/help/app-store-connect/reference/app-information/age-ratings-values-and-definitions',
196
- });
197
- }
198
- if (expected.socialMedia !== undefined
199
- && declaration.socialMedia !== undefined
200
- && declaration.socialMedia !== expected.socialMedia) {
201
- risks.push({
202
- level: 'blocker',
203
- code: 'SOCIAL_MEDIA_CAPABILITY_MISMATCH',
204
- title: '앱 기능과 App Store 소셜 미디어 응답 불일치',
205
- detail: `프로젝트 기능 선언은 socialMedia=${expected.socialMedia}이지만 App Store Connect는 ${String(declaration.socialMedia)}입니다.`,
206
- });
207
- }
208
- if (expected.socialMediaAgeRestricted !== undefined
209
- && declaration.socialMediaAgeRestricted !== undefined
210
- && declaration.socialMediaAgeRestricted !== expected.socialMediaAgeRestricted) {
211
- risks.push({
212
- level: 'blocker',
213
- code: 'SOCIAL_MEDIA_AGE_GATE_MISMATCH',
214
- title: '13세 미만 기능 제한과 App Store 응답 불일치',
215
- detail: `프로젝트 기능 선언은 socialMediaAgeRestricted=${expected.socialMediaAgeRestricted}이지만 App Store Connect는 ${String(declaration.socialMediaAgeRestricted)}입니다.`,
216
- });
217
- }
218
- if (declaration.userGeneratedContent && declaration.socialMedia === false) {
219
- risks.push({
220
- level: 'warning',
221
- code: 'UGC_WITHOUT_SOCIAL_MEDIA',
222
- title: 'UGC는 있으나 소셜 미디어 기능은 없음으로 응답',
223
- detail: '피드·좋아요·댓글·공유·발견 기능이 있다면 socialMedia 응답을 true로 바꿔야 합니다.',
224
- });
225
- }
226
- }
248
+ if (!appInfo)
249
+ return risks;
250
+ if ('reason' in appInfo) {
251
+ risks.push({
252
+ level: 'warning',
253
+ code: 'API_ERROR_APP_INFO_LINKAGE',
254
+ title: '앱 정보 레코드를 확인할 수 없음',
255
+ detail: appInfo.reason,
256
+ });
257
+ return risks;
258
+ }
259
+ const { target, policy } = appInfo;
260
+ const [hasPrivacy, ageRating] = await Promise.all([
261
+ policy.hasPrivacy ?? safeGet(() => readAppInfoPrivacy(target.id, platform), risks, 'PRIVACY', '개인정보 로컬라이제이션'),
262
+ policy.ageRating ?? safeGet(() => readAppInfoAgeRatingForRelease(target.id), risks, 'AGE_RATING_SOCIAL', '연령등급 소셜 미디어 응답'),
263
+ ]);
264
+ if (hasPrivacy === false) {
265
+ risks.push({ level: 'blocker', code: 'NO_PRIVACY', title: '개인정보처리방침 없음', detail: platform === 'TV_OS' ? '대상 tvOS 앱의 개인정보처리방침 텍스트를 입력하세요.' : '대상 앱의 개인정보처리방침 URL을 입력하세요.' });
266
+ }
267
+ if (ageRating) {
268
+ const attributes = ageRating.data?.attributes;
269
+ const socialMedia = attributes?.socialMedia;
270
+ const socialMediaAgeRestricted = attributes?.socialMediaAgeRestricted;
271
+ const ageAssurance = attributes?.ageAssurance;
272
+ const userGeneratedContent = attributes?.userGeneratedContent;
273
+ if (socialMedia === undefined || socialMediaAgeRestricted === undefined) {
274
+ risks.push({
275
+ level: 'blocker',
276
+ code: 'SOCIAL_MEDIA_ANSWERS_MISSING',
277
+ title: '연령등급 소셜 미디어 질문 미응답',
278
+ detail: '2026년 9월부터 신규 앱·업데이트 제출에 socialMedia와 socialMediaAgeRestricted 응답이 필요합니다.',
279
+ fixUrl: 'https://developer.apple.com/news/?id=tlur8uvi',
280
+ });
281
+ }
282
+ if (socialMediaAgeRestricted === true && socialMedia !== true) {
283
+ risks.push({
284
+ level: 'blocker',
285
+ code: 'SOCIAL_MEDIA_AGE_RESTRICTION_MISMATCH',
286
+ title: '13세 미만 제한 응답 불일치',
287
+ detail: 'socialMediaAgeRestricted=true는 socialMedia=true인 앱에서만 의미가 있습니다.',
288
+ });
289
+ }
290
+ if (socialMediaAgeRestricted === true && ageAssurance !== true) {
291
+ risks.push({
292
+ level: 'blocker',
293
+ code: 'SOCIAL_MEDIA_AGE_ASSURANCE_MISSING',
294
+ title: '13세 미만 소셜 기능 제한에 연령 확인이 없음',
295
+ detail: 'Apple은 socialMediaAgeRestricted=true인 경우 최소한 Declared Age Range API로 연령 범위를 확인하도록 요구합니다. ageAssurance 응답과 실제 구현을 확인하세요.',
296
+ fixUrl: 'https://developer.apple.com/help/app-store-connect/reference/app-information/age-ratings-values-and-definitions',
297
+ });
298
+ }
299
+ if (expected.socialMedia !== undefined
300
+ && socialMedia !== undefined
301
+ && socialMedia !== expected.socialMedia) {
302
+ risks.push({
303
+ level: 'blocker',
304
+ code: 'SOCIAL_MEDIA_CAPABILITY_MISMATCH',
305
+ title: '앱 기능과 App Store 소셜 미디어 응답 불일치',
306
+ detail: `프로젝트 기능 선언은 socialMedia=${expected.socialMedia}이지만 App Store Connect는 ${String(socialMedia)}입니다.`,
307
+ });
308
+ }
309
+ if (expected.socialMediaAgeRestricted !== undefined
310
+ && socialMediaAgeRestricted !== undefined
311
+ && socialMediaAgeRestricted !== expected.socialMediaAgeRestricted) {
312
+ risks.push({
313
+ level: 'blocker',
314
+ code: 'SOCIAL_MEDIA_AGE_GATE_MISMATCH',
315
+ title: '13세 미만 기능 제한과 App Store 응답 불일치',
316
+ detail: `프로젝트 기능 선언은 socialMediaAgeRestricted=${expected.socialMediaAgeRestricted}이지만 App Store Connect는 ${String(socialMediaAgeRestricted)}입니다.`,
317
+ });
318
+ }
319
+ if (userGeneratedContent && socialMedia === false) {
320
+ risks.push({
321
+ level: 'warning',
322
+ code: 'UGC_WITHOUT_SOCIAL_MEDIA',
323
+ title: 'UGC는 있으나 소셜 미디어 기능은 없음으로 응답',
324
+ detail: '피드·좋아요·댓글·공유·발견 기능이 있다면 socialMedia 응답을 true로 바꿔야 합니다.',
325
+ });
227
326
  }
228
327
  }
229
328
  return risks;
@@ -248,7 +347,11 @@ export function formatRisks(risks, platform) {
248
347
  }
249
348
  lines.push('');
250
349
  }
251
- if (blockers.length === 0)
350
+ if (risks.some(isRiskCheckIncomplete)) {
351
+ lines.push('⛔ 점검 미완료 — 조회 실패를 해결한 뒤 다시 점검하세요.');
352
+ }
353
+ else if (blockers.length === 0) {
252
354
  lines.push('✅ 블로커 없음 — 경고 항목 검토 후 제출 가능');
355
+ }
253
356
  return lines.join('\n');
254
357
  }
@@ -1,5 +1,7 @@
1
1
  import type { OAuth2Client, JWT } from 'google-auth-library';
2
2
  import type { androidpublisher_v3 } from '@googleapis/androidpublisher';
3
+ export declare const REVIEW_PAGE_SIZE = 100;
4
+ export declare const DEFAULT_REVIEW_LIMIT = 20;
3
5
  /** 리뷰 목록과, 목록이 잘렸다면 그 이유(아니면 null). 도구 응답은 이걸 쓴다. */
4
6
  export declare function listReviewsWithStatus(auth: OAuth2Client | JWT, packageName: string): Promise<{
5
7
  reviews: {
@@ -52,4 +54,63 @@ export declare function listReviews(auth: OAuth2Client | JWT, packageName: strin
52
54
  deviceMetadata?: undefined;
53
55
  })[] | undefined;
54
56
  }[]>;
57
+ export declare function listReviewsPage(auth: OAuth2Client | JWT, packageName: string, { limit, pageToken, unansweredOnly }: {
58
+ limit?: number;
59
+ pageToken?: string;
60
+ unansweredOnly?: boolean;
61
+ }): Promise<{
62
+ reviews: {
63
+ reviewId: string | null | undefined;
64
+ authorName: string | null | undefined;
65
+ developerComment: {
66
+ text: string | null | undefined;
67
+ lastModified: string | null | undefined;
68
+ } | null;
69
+ comments: ({
70
+ text: string | null | undefined;
71
+ starRating: number | null | undefined;
72
+ lastModified: string | null | undefined;
73
+ deviceMetadata: string | null | undefined;
74
+ developerComment?: undefined;
75
+ } | {
76
+ developerComment: {
77
+ text: string | null | undefined;
78
+ lastModified: string | null | undefined;
79
+ };
80
+ text?: undefined;
81
+ starRating?: undefined;
82
+ lastModified?: undefined;
83
+ deviceMetadata?: undefined;
84
+ })[] | undefined;
85
+ }[];
86
+ nextPageToken: null;
87
+ warning: string;
88
+ } | {
89
+ reviews: {
90
+ reviewId: string | null | undefined;
91
+ authorName: string | null | undefined;
92
+ developerComment: {
93
+ text: string | null | undefined;
94
+ lastModified: string | null | undefined;
95
+ } | null;
96
+ comments: ({
97
+ text: string | null | undefined;
98
+ starRating: number | null | undefined;
99
+ lastModified: string | null | undefined;
100
+ deviceMetadata: string | null | undefined;
101
+ developerComment?: undefined;
102
+ } | {
103
+ developerComment: {
104
+ text: string | null | undefined;
105
+ lastModified: string | null | undefined;
106
+ };
107
+ text?: undefined;
108
+ starRating?: undefined;
109
+ lastModified?: undefined;
110
+ deviceMetadata?: undefined;
111
+ })[] | undefined;
112
+ }[];
113
+ nextPageToken: string | null;
114
+ warning?: undefined;
115
+ }>;
55
116
  export declare function replyToReview(auth: OAuth2Client | JWT, packageName: string, reviewId: string, replyText: string): Promise<androidpublisher_v3.Schema$ReviewsReplyResponse>;