@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
package/README.md CHANGED
@@ -149,7 +149,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
149
149
  <!-- generated:readme-tools-table:start — edit scripts/docs-spec.mjs, then npm run plugin:sync -->
150
150
  | 영역 | 도구 수 | 주요 도구 |
151
151
  |------|---------|-----------|
152
- | App Store Connect | 63 | `appstore_submit_for_review` / `appstore_get_weekly_insight` / `appstore_update_product_review_note` / `appstore_upload_product_review_screenshot` |
152
+ | App Store Connect | 64 | `appstore_submit_for_review` / `appstore_get_weekly_insight` / `appstore_update_product_review_note` / `appstore_upload_product_review_screenshot` |
153
153
  | Google Play | 38 | `playstore_submit_release` / `playstore_promote_release` / `playstore_replace_images` / `playstore_reply_review` / `playstore_verify_service_account` |
154
154
  | Firebase | 21 | `firebase_create_project` / `firebase_get_remote_config_overview` / `firebase_get_android_config` / `firebase_create_ios_app` |
155
155
  | AdMob | 7 | `admob_list_apps` / `admob_create_ad_unit` / `admob_get_today_earnings` / `admob_get_report` |
@@ -29,22 +29,18 @@ loaded"), and it is easy to wrongly conclude "this tool doesn't exist."
29
29
  ToolSearch(query="select:<tool_name>[,<tool_name>...]")
30
30
  ```
31
31
 
32
- - Batch every tool you expect to use in one `select:` call — schemas stay loaded for
33
- the rest of the session.
32
+ - Batch only the schemas needed for the current step. Load write, recovery, and auxiliary tools when that step comes up.
34
33
  - If `select:` returns no match, fall back to a keyword search
35
34
  (`ToolSearch(query="playstore release promote")`) — exact names sometimes differ.
36
35
  - Only if a tool is absent from the deferred list **and** unsearchable is it truly
37
36
  unregistered. Then check the MCP server is connected (see §2), do **not** silently
38
37
  pivot to raw `curl` / `fastlane`.
39
38
 
40
- Other harnesses (Codex with the bundled plugin, Claude Desktop) typically expose the
41
- tools directly — but the *call order* and *safety rules* below still apply.
39
+ Use the MCP client's native discovery when tools are deferred. If the required schema is already visible, call the tool directly.
42
40
 
43
41
  ### Ready-made `select:` batches
44
42
 
45
- Every registered tool appears in at least one batch below (the table is generated from the tool manifest, and a
46
- new tool lands in its domain's batch automatically), so a task you can name is a batch you can paste. Pick the
47
- row for the job; batching two rows in one `select:` call is fine.
43
+ Use the table to find tool names, then select only the active tools needed for the current step. The table is generated from the full manifest. Check the runtime catalog if this server limits its toolsets.
48
44
 
49
45
  <!-- generated:select-batches:start — edit scripts/docs-spec.mjs, then npm run plugin:sync -->
50
46
  | Goal | `ToolSearch` query |
@@ -61,9 +57,9 @@ row for the job; batching two rows in one `select:` call is fine.
61
57
  | Pre-submission declarations (both stores) | `select:appstore_get_age_rating,appstore_update_age_rating,appstore_declare_encryption,appstore_get_availability,appstore_set_territory_availability,playstore_upload_data_safety` |
62
58
  | TestFlight external testing | `select:appstore_beta_status,appstore_update_beta_review_detail,appstore_update_beta_test_info,appstore_update_whats_to_test,appstore_submit_beta_review,appstore_set_beta_group_build,appstore_add_beta_testers,appstore_notify_beta_testers,appstore_list_beta_groups,appstore_list_builds` |
63
59
  | App Store review submission (the bundle) | `select:appstore_list_review_submissions,appstore_add_version_to_review_submission,appstore_remove_review_submission_item,appstore_update_version_string,appstore_cancel_review` |
64
- | App Store preview videos | `select:appstore_list_previews,appstore_upload_preview,appstore_delete_preview,appstore_get_metadata` |
60
+ | App Store preview videos | `select:appstore_list_previews,appstore_upload_preview,appstore_delete_preview,appstore_reorder_media_placements,appstore_get_metadata` |
65
61
  | Play post-release recovery | `select:playstore_list_recovery_actions,playstore_create_recovery_action,playstore_deploy_recovery_action,playstore_cancel_recovery_action,playstore_list_tracks` |
66
- | App Store screenshots | `select:appstore_list_app_info_localizations,appstore_get_metadata,appstore_list_screenshots,appstore_upload_screenshot,appstore_delete_screenshot,appstore_delete_screenshot_set,screenshot_validate` |
62
+ | App Store screenshots | `select:appstore_list_app_info_localizations,appstore_get_metadata,appstore_list_screenshots,appstore_upload_screenshot,appstore_delete_screenshot,appstore_delete_screenshot_set,appstore_reorder_media_placements,screenshot_validate` |
67
63
  | App Store app info + review notes | `select:appstore_get_app_info,appstore_update_app_info_localization,appstore_create_app_info_localization,appstore_update_localization,appstore_get_review_notes,appstore_update_review_notes` |
68
64
  | App Store reviews | `select:appstore_list_reviews,appstore_reply_review,generate_review_reply` |
69
65
  | App Store IAP (products + review metadata) | `select:appstore_list_products,appstore_create_inapp_purchase,appstore_create_subscription,appstore_update_product,appstore_list_product_localizations,appstore_update_product_localization,appstore_update_product_review_note,appstore_upload_product_review_screenshot,appstore_add_product_to_review,appstore_delete_product` |
@@ -96,12 +92,11 @@ row for the job; batching two rows in one `select:` call is fine.
96
92
 
97
93
  ---
98
94
 
99
- ## 1. Always start with `mimi_seed_status`
95
+ ## 1. Connection diagnostics
100
96
 
101
- Before any task, call **`mimi_seed_status`** — the setup doctor. It scans your service
102
- credentials (Google OAuth · Play SA · App Store · Jenkins · CI · Google Ads · Facebook · Instagram ·
103
- Threads · TikTok Business · BigQuery) and returns a ✅/❌ report plus the exact next tool to call for anything
104
- missing. This avoids a late `401`/`403` deep into a workflow.
97
+ Start a targeted read with the relevant domain tool. For first-time setup or an explicit connection check,
98
+ call **`mimi_seed_status`** to scan service configuration. If the domain tool returns an authentication
99
+ problem, follow its recovery guidance and use `mimi_seed_status` when further diagnosis is needed.
105
100
 
106
101
  > If the repo has a **`.mimi-seed.json`** manifest at its root, `mimi_seed_status` (and
107
102
  > `mimi-seed doctor`) additionally report **which project-required services this teammate is
@@ -241,18 +236,26 @@ per-domain inventory is [`docs/domain/tool-catalog.md`](domain/tool-catalog.md).
241
236
 
242
237
  ### Play Store release / promote
243
238
  1. `playstore_list_tracks` — see current track/version state.
244
- 2. `playstore_check_submission_risks` (or `playstore_plan_release`) — surface blockers.
245
- 3. Write missing listing/notes (`playstore_update_listing`, `playstore_update_release_notes` — omit `versionCode` for the latest
246
- release; `syncTracks` only works without `versionCode` — `playstore_upload_image`).
239
+ 2. Check the selected track and version code with `playstore_check_submission_risks`. Report blockers or incomplete checks and stop the release workflow.
240
+ 3. Show the exact target, locales, and note text for approval before `playstore_update_release_notes`. Apply to the approved version code in the approved track.
247
241
  4. `playstore_promote_release` / `playstore_submit_release` **without** `confirm` → show the returned dry-run preview to the user →
248
242
  after an explicit go-ahead, call again with the same arguments plus `confirm: true` (see §5). This applies to every status, including `draft`.
249
243
 
250
244
  ### App Store TestFlight → review
251
- 1. `appstore_list_apps` → `appstore_list_versions` (or `appstore_create_version`).
252
- 2. `appstore_list_builds` → `appstore_attach_build` (omit `buildId` to attach the latest `processingState=VALID` build).
253
- 3. `appstore_update_whats_new`, screenshots if needed.
254
- 4. `appstore_check_submission_risks` → `appstore_submit_for_review` without `confirm` (dry-run preview) → user approves →
255
- same call with `confirm: true`.
245
+ 1. Resolve the app and exact platform/version with `appstore_list_versions`. Use the requested version and platform filters when known.
246
+ 2. When a build attachment is requested, verify and obtain approval for the exact build and version before `appstore_attach_build`.
247
+ 3. Run `appstore_check_submission_risks` for the selected version. Report blockers or incomplete checks and stop. If requested, apply approved release notes to the same version.
248
+ 4. For requested submissions, show the `appstore_submit_for_review` preview and get explicit approval before confirming with the same arguments.
249
+
250
+ ### App Store product page media
251
+
252
+ Use the screenshot or preview listing to identify the version localization and its existing placements.
253
+ For Asset Library uploads, use the placement group. When the result reports `status: "processing"`, wait for
254
+ Apple to finish processing and call the same upload tool with the returned `assetId` and the same target to
255
+ create the placement. A `status: "placed"` result identifies the saved placement. Run the submission risk
256
+ check before submitting.
257
+ If the upload committed but placement failed, reuse the returned asset ID. To reorder a group, include all
258
+ of its placement IDs in the requested sequence, including both screenshots and previews when present.
256
259
 
257
260
  ### Service account key → Play / Jenkins (secrets stay on disk)
258
261
  1. `iam_create_service_account` (or reuse one) → `iam_create_key`. The key is written to
@@ -271,8 +274,8 @@ per-domain inventory is [`docs/domain/tool-catalog.md`](domain/tool-catalog.md).
271
274
  `~/.mimi-seed/keystores/` only**. Never read `signing.json` into the chat to copy a value.
272
275
 
273
276
  ### Release notes from git
274
- `generate_release_notes_from_commits` (pass commit array + locales) → review with user →
275
- `playstore_update_release_notes` / `appstore_update_whats_new`.
277
+ Draft from the relevant commits. Load `generate_release_notes_from_commits` when the user asks for SDK generation.
278
+ For an application request, show the exact target version, locales, and draft. Apply the approved text with the corresponding store tool.
276
279
 
277
280
  ### YouTube content insights → one experiment
278
281
  Use `youtube_get_content_insights` for a bounded evidence brief: current and equal-length preceding
@@ -416,12 +419,12 @@ General rules:
416
419
 
417
420
  ## 7. Slash commands & MCP resources
418
421
 
419
- Available in any MCP client as native slash commands:
422
+ MCP clients that surface prompts can expose these as slash commands. The deploy and review prompts appear when the server enables a matching workflow.
420
423
 
421
- - `/mimi-seed:getting-started` — first-run onboarding: status scan → capability tour → first read-only action
424
+ - `/mimi-seed:getting-started` — connection scan and a first read aligned with the user's goal
422
425
  - `/mimi-seed:deploy` — blockers → release notes → apply to stores
423
426
  - `/mimi-seed:health` — auth status + readiness summary
424
- - `/mimi-seed:review-inbox` — fetch unanswered reviews → draft replies
427
+ - `/mimi-seed:review-inbox` — fetch recent reviews in a bounded page and draft replies for unanswered reviews
425
428
 
426
429
  MCP resources: `mimi-seed://auth/status` (live token state) · `mimi-seed://agent/guide`
427
430
  (this guide, served over MCP) · `mimi-seed://tools/catalog` (the tools this server registered,
package/dist/ai/notes.js CHANGED
@@ -16,7 +16,8 @@ function commitsToText(commits) {
16
16
  export async function generateReleaseNotesFromCommits(commits, opts = {}) {
17
17
  const client = await requireApiKey();
18
18
  const { appName = '앱', tones = [...RELEASE_NOTE_TONES], locales = [], maxTokens = RELEASE_NOTES_MAX_TOKENS } = opts;
19
- const commitsText = commitsToText(commits.slice(0, 50));
19
+ const usedCommits = commits.slice(0, 50);
20
+ const commitsText = commitsToText(usedCommits);
20
21
  const localeList = locales.length > 0
21
22
  ? locales.map((l) => `"${l}": "${LOCALE_NAMES[l] ?? l}로 번역된 간결한 버전"`).join(',\n ')
22
23
  : '';
@@ -45,7 +46,7 @@ ${commitsText}
45
46
  return {
46
47
  tones: parsed.tones ?? [],
47
48
  localized: parsed.localized ?? {},
48
- rawCommitsUsed: commits.length,
49
+ rawCommitsUsed: usedCommits.length,
49
50
  };
50
51
  }
51
52
  export function formatGeneratedNotes(result) {
package/dist/ai/review.js CHANGED
@@ -44,6 +44,6 @@ export function formatReviewReply(result) {
44
44
  '',
45
45
  `⚠ ${result.note}`,
46
46
  '',
47
- '이 답변이 마음에 들면 playstore_reply_review 도구로 게시하세요.',
47
+ '게시 요청이 있으면 원래 스토어에서 해당 리뷰의 미리보기를 보여주고 명시 승인을 받으세요.',
48
48
  ].join('\n');
49
49
  }
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ import type { AppStorePlatform } from './release-target.js';
3
+ export declare const appInfoReleasePolicyQuery: {
4
+ include: string;
5
+ 'limit[appInfoLocalizations]': string;
6
+ 'fields[appInfos]': string;
7
+ 'fields[appInfoLocalizations]': string;
8
+ 'fields[ageRatingDeclarations]': string;
9
+ };
10
+ declare const ageRatingResponse: z.ZodObject<{
11
+ data: z.ZodNullable<z.ZodObject<{
12
+ attributes: z.ZodObject<{
13
+ userGeneratedContent: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>;
14
+ socialMedia: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>;
15
+ socialMediaAgeRestricted: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>;
16
+ ageAssurance: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean | undefined, boolean | null | undefined>>;
17
+ }, z.core.$strip>;
18
+ }, z.core.$strip>>;
19
+ }, z.core.$strip>;
20
+ export interface IncludedAppInfoPolicy {
21
+ hasPrivacy?: true;
22
+ ageRating?: z.infer<typeof ageRatingResponse>;
23
+ }
24
+ export declare function readIncludedAppInfoPolicy(relationships: unknown, included: unknown, platform: AppStorePlatform): IncludedAppInfoPolicy;
25
+ export declare function readAppInfoPrivacy(appInfoId: string, platform: AppStorePlatform): Promise<boolean>;
26
+ export declare function readAppInfoAgeRatingForRelease(appInfoId: string): Promise<z.infer<typeof ageRatingResponse>>;
27
+ export {};
@@ -0,0 +1,104 @@
1
+ import { z } from 'zod';
2
+ import { encodePathSegment } from '../lib/url-path.js';
3
+ import { isNotFound } from './http.js';
4
+ import { appStorePagination, getAppStoreResponse, pageIsIncomplete } from './read-response.js';
5
+ const privacyFields = 'privacyPolicyUrl,privacyPolicyText';
6
+ const ageRatingFields = 'userGeneratedContent,socialMedia,socialMediaAgeRestricted,ageAssurance';
7
+ export const appInfoReleasePolicyQuery = {
8
+ include: 'appInfoLocalizations,ageRatingDeclaration',
9
+ 'limit[appInfoLocalizations]': '10',
10
+ 'fields[appInfos]': 'state,appInfoLocalizations,ageRatingDeclaration',
11
+ 'fields[appInfoLocalizations]': privacyFields,
12
+ 'fields[ageRatingDeclarations]': ageRatingFields,
13
+ };
14
+ const privacyAttributes = z.object({
15
+ privacyPolicyUrl: z.string().trim().nullish(),
16
+ privacyPolicyText: z.string().trim().nullish(),
17
+ });
18
+ const privacyLocalizationPage = appStorePagination.extend({
19
+ data: z.array(z.object({ attributes: privacyAttributes.nullish() })),
20
+ });
21
+ const ageAnswer = z.boolean().nullish().transform((value) => value ?? undefined);
22
+ const ageRatingAttributes = z.object({
23
+ userGeneratedContent: ageAnswer,
24
+ socialMedia: ageAnswer,
25
+ socialMediaAgeRestricted: ageAnswer,
26
+ ageAssurance: ageAnswer,
27
+ });
28
+ const ageRatingResponse = z.object({ data: z.object({ attributes: ageRatingAttributes }).nullable() });
29
+ const resourceId = z.string().min(1);
30
+ const includedResources = z.array(z.unknown());
31
+ const includedResource = z.object({
32
+ id: resourceId,
33
+ type: z.enum(['appInfoLocalizations', 'ageRatingDeclarations']),
34
+ attributes: z.unknown().optional(),
35
+ });
36
+ const appInfoPolicyRelationships = z.object({
37
+ appInfoLocalizations: z.unknown().optional(),
38
+ ageRatingDeclaration: z.unknown().optional(),
39
+ });
40
+ const localizationLinks = z.object({
41
+ data: z.array(z.object({ type: z.literal('appInfoLocalizations'), id: resourceId })),
42
+ });
43
+ const ageRatingLink = z.object({
44
+ data: z.object({ type: z.literal('ageRatingDeclarations'), id: resourceId }),
45
+ });
46
+ function hasPrivacyPolicy(platform, attributes) {
47
+ return Boolean(platform === 'TV_OS' ? attributes?.privacyPolicyText : attributes?.privacyPolicyUrl);
48
+ }
49
+ export function readIncludedAppInfoPolicy(relationships, included, platform) {
50
+ const links = appInfoPolicyRelationships.safeParse(relationships);
51
+ const resources = includedResources.safeParse(included);
52
+ if (!links.success || !resources.success)
53
+ return {};
54
+ const byId = new Map();
55
+ for (const raw of resources.data) {
56
+ const row = includedResource.safeParse(raw);
57
+ if (row.success) {
58
+ const key = `${row.data.type}:${row.data.id}`;
59
+ byId.set(key, byId.has(key) ? undefined : row.data.attributes);
60
+ }
61
+ }
62
+ // Included localizations can be partial, so only a linked policy can settle the privacy check.
63
+ const policy = {};
64
+ const localizations = localizationLinks.safeParse(links.data.appInfoLocalizations);
65
+ if (localizations.success && localizations.data.data.some(({ id }) => {
66
+ const attributes = privacyAttributes.safeParse(byId.get(`appInfoLocalizations:${id}`));
67
+ return attributes.success && hasPrivacyPolicy(platform, attributes.data);
68
+ })) {
69
+ policy.hasPrivacy = true;
70
+ }
71
+ const ageLink = ageRatingLink.safeParse(links.data.ageRatingDeclaration);
72
+ if (!ageLink.success)
73
+ return policy;
74
+ const age = ageRatingAttributes.safeParse(byId.get(`ageRatingDeclarations:${ageLink.data.data.id}`));
75
+ if (!age.success)
76
+ return policy;
77
+ const { socialMedia, socialMediaAgeRestricted, userGeneratedContent, ageAssurance } = age.data;
78
+ if (socialMedia !== undefined && socialMediaAgeRestricted !== undefined
79
+ && (socialMedia || userGeneratedContent !== undefined)
80
+ && (!socialMediaAgeRestricted || ageAssurance !== undefined)) {
81
+ policy.ageRating = { data: { attributes: age.data } };
82
+ }
83
+ return policy;
84
+ }
85
+ export async function readAppInfoPrivacy(appInfoId, platform) {
86
+ const localizations = await getAppStoreResponse(privacyLocalizationPage, `/appInfos/${encodePathSegment(appInfoId)}/appInfoLocalizations`, { 'fields[appInfoLocalizations]': privacyFields, limit: '200' });
87
+ if (localizations.data.some(({ attributes }) => hasPrivacyPolicy(platform, attributes)))
88
+ return true;
89
+ if (pageIsIncomplete(localizations, localizations.data.length)) {
90
+ throw new Error('App Store Connect의 개인정보 로컬라이제이션 목록이 불완전합니다.');
91
+ }
92
+ return false;
93
+ }
94
+ export async function readAppInfoAgeRatingForRelease(appInfoId) {
95
+ try {
96
+ return await getAppStoreResponse(ageRatingResponse, `/appInfos/${encodePathSegment(appInfoId)}/ageRatingDeclaration`, { 'fields[ageRatingDeclarations]': ageRatingFields });
97
+ }
98
+ catch (error) {
99
+ // An explicit 404 confirms that this app info has no declaration.
100
+ if (isNotFound(error))
101
+ return { data: null };
102
+ throw error;
103
+ }
104
+ }
@@ -0,0 +1,19 @@
1
+ import { type IncludedAppInfoPolicy } from './app-info-policy.js';
2
+ import type { AppStorePlatform } from './release-target.js';
3
+ export interface AppInfoRecord {
4
+ id: string;
5
+ state?: string;
6
+ ageRating?: string;
7
+ }
8
+ export declare function listAppInfoRecords(appId: string): Promise<AppInfoRecord[]>;
9
+ type AppInfoSelection = {
10
+ target: AppInfoRecord;
11
+ policy: IncludedAppInfoPolicy;
12
+ } | {
13
+ reason: string;
14
+ };
15
+ export declare function selectAppInfo(appId: string, options?: {
16
+ privacyPlatform?: AppStorePlatform;
17
+ }): Promise<AppInfoSelection>;
18
+ export declare function requireAppInfo(appId: string): Promise<AppInfoRecord>;
19
+ export {};
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ import { encodePathSegment } from '../lib/url-path.js';
3
+ import { appInfoReleasePolicyQuery, readIncludedAppInfoPolicy } from './app-info-policy.js';
4
+ import { appStorePagination, getAppStoreResponse, pageIsIncomplete } from './read-response.js';
5
+ const appInfoPage = appStorePagination.extend({
6
+ data: z.array(z.object({
7
+ id: z.string().min(1),
8
+ type: z.literal('appInfos').optional(),
9
+ attributes: z.object({
10
+ state: z.string().nullish(),
11
+ appStoreState: z.string().nullish(),
12
+ appStoreAgeRating: z.string().nullish(),
13
+ }).nullish(),
14
+ relationships: z.unknown().optional(),
15
+ })),
16
+ included: z.unknown().optional(),
17
+ });
18
+ const editableStates = new Set(['PREPARE_FOR_SUBMISSION', 'DEVELOPER_REJECTED', 'REJECTED', 'METADATA_REJECTED']);
19
+ const reviewStates = new Set(['READY_FOR_REVIEW', 'WAITING_FOR_REVIEW', 'IN_REVIEW', 'ACCEPTED', 'PENDING_RELEASE', 'PENDING_DEVELOPER_RELEASE']);
20
+ const replacedStates = new Set(['REPLACED_WITH_NEW_INFO', 'REPLACED_WITH_NEW_VERSION']);
21
+ function readAppInfoPage(appId, params) {
22
+ return getAppStoreResponse(appInfoPage, `/apps/${encodePathSegment(appId)}/appInfos`, {
23
+ 'fields[appInfos]': 'state',
24
+ limit: '200',
25
+ ...params,
26
+ });
27
+ }
28
+ function toAppInfoRecord({ id, attributes }) {
29
+ return {
30
+ id,
31
+ state: attributes?.state ?? attributes?.appStoreState ?? undefined,
32
+ ageRating: attributes?.appStoreAgeRating ?? undefined,
33
+ };
34
+ }
35
+ export async function listAppInfoRecords(appId) {
36
+ const page = await readAppInfoPage(appId, { 'fields[appInfos]': 'state,appStoreAgeRating' });
37
+ return page.data.map(toAppInfoRecord);
38
+ }
39
+ export async function selectAppInfo(appId, options = {}) {
40
+ const { privacyPlatform } = options;
41
+ const page = await readAppInfoPage(appId, privacyPlatform ? appInfoReleasePolicyQuery : {});
42
+ const ids = new Set(page.data.map(({ id }) => id));
43
+ if (ids.size !== page.data.length || pageIsIncomplete(page, page.data.length)) {
44
+ return { reason: 'App Store Connect의 앱 정보 목록이 불완전합니다.' };
45
+ }
46
+ const records = page.data.map((row) => ({ record: toAppInfoRecord(row), relationships: row.relationships }));
47
+ const current = records.filter(({ record: { state } }) => !state || !replacedStates.has(state));
48
+ if (current.length === 0)
49
+ return { reason: '현재 사용할 수 있는 앱 정보 레코드가 없습니다.' };
50
+ // Prefer a draft, then a version under review. Keep the single current-record fallback
51
+ // for published apps and older responses that omit state.
52
+ const editable = current.filter(({ record: { state } }) => state && editableStates.has(state));
53
+ const inReview = editable.length === 0
54
+ ? current.filter(({ record: { state } }) => state && reviewStates.has(state))
55
+ : [];
56
+ const candidates = editable.length > 0 ? editable : inReview.length > 0 ? inReview : current;
57
+ if (candidates.length !== 1)
58
+ return { reason: '대상 앱 정보 레코드를 하나로 확정할 수 없습니다.' };
59
+ const { record: target, relationships } = candidates[0];
60
+ const policy = privacyPlatform ? readIncludedAppInfoPolicy(relationships, page.included, privacyPlatform) : {};
61
+ return { target, policy };
62
+ }
63
+ export async function requireAppInfo(appId) {
64
+ const selection = await selectAppInfo(appId);
65
+ if ('reason' in selection)
66
+ throw new Error(selection.reason);
67
+ return selection.target;
68
+ }
@@ -22,11 +22,7 @@ export declare function listBetaGroups(appId: string): Promise<{
22
22
  publicLink: string | undefined;
23
23
  publicLinkEnabled: boolean | undefined;
24
24
  }[]>;
25
- export declare function getAppInfo(appId: string): Promise<{
26
- id: string;
27
- state: string | undefined;
28
- ageRating: string | undefined;
29
- }[]>;
25
+ export declare function getAppInfo(appId: string): Promise<import("./app-info.js").AppInfoRecord[]>;
30
26
  export interface AppInfoLocalizationFields {
31
27
  name?: string;
32
28
  subtitle?: string;
@@ -75,7 +71,7 @@ export declare function listCustomerReviews(appId: string, opts?: ListCustomerRe
75
71
  body: string | undefined;
76
72
  lastModifiedDate: string | undefined;
77
73
  state: string | undefined;
78
- } | null;
74
+ } | null | undefined;
79
75
  }[]>;
80
76
  export declare function createReviewResponse(reviewId: string, responseBody: string): Promise<any>;
81
77
  export {};
@@ -1,12 +1,13 @@
1
1
  // App Store Connect — 앱·앱 정보(로컬라이제이션)·TestFlight 베타 그룹·고객 리뷰.
2
2
  // appstore/tools.ts 가 이 모듈을 그대로 re-export 한다 — 호출부는 tools.js 경로를 계속 쓴다.
3
3
  import { apiGet, apiPatch, apiPost } from './client.js';
4
+ import { listAppInfoRecords, requireAppInfo } from './app-info.js';
4
5
  import { encodePathSegment } from '../lib/url-path.js';
5
6
  export async function listApps() {
6
- const data = (await apiGet('/apps', {
7
+ const data = await apiGet('/apps', {
7
8
  'fields[apps]': 'name,bundleId,sku,primaryLocale,contentRightsDeclaration',
8
9
  'limit': '200',
9
- }));
10
+ });
10
11
  return (data.data ?? []).map((a) => ({
11
12
  id: a.id,
12
13
  name: a.attributes?.name,
@@ -16,17 +17,17 @@ export async function listApps() {
16
17
  }));
17
18
  }
18
19
  export async function getApp(appId) {
19
- const data = (await apiGet(`/apps/${encodePathSegment(appId)}`, {
20
+ const data = await apiGet(`/apps/${encodePathSegment(appId)}`, {
20
21
  'fields[apps]': 'name,bundleId,sku,primaryLocale,contentRightsDeclaration',
21
22
  'include': 'appStoreVersions',
22
- }));
23
+ });
23
24
  return data.data;
24
25
  }
25
26
  // ─── TestFlight 베타 그룹 ───
26
27
  export async function listBetaGroups(appId) {
27
- const data = (await apiGet(`/apps/${encodePathSegment(appId)}/betaGroups`, {
28
+ const data = await apiGet(`/apps/${encodePathSegment(appId)}/betaGroups`, {
28
29
  'fields[betaGroups]': 'name,isInternalGroup,publicLink,publicLinkEnabled',
29
- }));
30
+ });
30
31
  return (data.data ?? []).map((g) => ({
31
32
  id: g.id,
32
33
  name: g.attributes?.name,
@@ -36,36 +37,11 @@ export async function listBetaGroups(appId) {
36
37
  }));
37
38
  }
38
39
  // ─── 앱 정보 (카테고리 등) ───
39
- // AppInfoState — READY_FOR_DISTRIBUTION이 라이브 버전, 그 외(PREPARE_FOR_SUBMISSION /
40
- // DEVELOPER_REJECTED 등)가 편집 가능한 appInfo.
41
- const APP_INFO_LIVE_STATE = 'READY_FOR_DISTRIBUTION';
42
40
  export async function getAppInfo(appId) {
43
- const data = (await apiGet(`/apps/${encodePathSegment(appId)}/appInfos`, {
44
- 'fields[appInfos]': 'state,appStoreAgeRating,brazilAgeRating',
45
- }));
46
- return (data.data ?? []).map((i) => ({
47
- id: i.id,
48
- // 새 필드명 state, 옛 필드명 appStoreState 모두 케어
49
- state: i.attributes?.state ?? i.attributes?.appStoreState,
50
- ageRating: i.attributes?.appStoreAgeRating,
51
- }));
52
- }
53
- async function findEditableAppInfoId(appId) {
54
- const data = await apiGet(`/apps/${encodePathSegment(appId)}/appInfos`, {
55
- 'fields[appInfos]': 'state',
56
- 'limit': '10',
57
- });
58
- const infos = (data?.data ?? []);
59
- if (infos.length === 0) {
60
- throw new Error(`앱 ${appId}에 appInfos가 없어. 앱 ID 확인 필요.`);
61
- }
62
- const stateOf = (i) => i.attributes?.state ?? i.attributes?.appStoreState ?? '';
63
- const editable = infos.find((i) => stateOf(i) !== APP_INFO_LIVE_STATE);
64
- const target = editable ?? infos[0];
65
- return { appInfoId: target.id, state: stateOf(target) };
41
+ return listAppInfoRecords(appId);
66
42
  }
67
43
  export async function listAppInfoLocalizations(appId, locale) {
68
- const { appInfoId, state } = await findEditableAppInfoId(appId);
44
+ const { id: appInfoId, state = '' } = await requireAppInfo(appId);
69
45
  const data = await apiGet(`/appInfos/${encodePathSegment(appInfoId)}/appInfoLocalizations`, {
70
46
  'fields[appInfoLocalizations]': 'locale,name,subtitle,privacyPolicyUrl,privacyPolicyText',
71
47
  'limit': '200',
@@ -96,7 +72,7 @@ export async function updateAppInfoLocalization(localizationId, fields) {
96
72
  }
97
73
  export async function createAppInfoLocalization(appId, locale, fields) {
98
74
  const attributes = Object.fromEntries(Object.entries(fields).filter(([, v]) => v !== undefined));
99
- const { appInfoId, state } = await findEditableAppInfoId(appId);
75
+ const { id: appInfoId, state = '' } = await requireAppInfo(appId);
100
76
  const data = await apiPost('/appInfoLocalizations', {
101
77
  data: {
102
78
  type: 'appInfoLocalizations',
@@ -123,7 +99,7 @@ export async function createAppInfoLocalization(appId, locale, fields) {
123
99
  export async function listCustomerReviews(appId, opts = {}) {
124
100
  // `fields[customerReviews]` 는 JSON:API sparse fieldset 이라 관계에도 적용된다 — `response` 를 빼면
125
101
  // relationships.response 가 응답에서 사라져 include 된 답변을 리뷰에 붙일 수 없고, 모든 리뷰가 미답변
126
- // (response: null)으로 보인다. 그러면 "미답변에만 답하기" 흐름이 기존 답변을 교체한다.
102
+ // 으로 오판할 수 있다. 응답에서는 명시적인 null만 미답변으로 표시한다.
127
103
  const params = {
128
104
  'sort': '-createdDate',
129
105
  'limit': String(opts.limit ?? 50),
@@ -135,7 +111,7 @@ export async function listCustomerReviews(appId, opts = {}) {
135
111
  params['filter[territory]'] = opts.territory;
136
112
  if (opts.rating != null)
137
113
  params['filter[rating]'] = String(opts.rating);
138
- const data = (await apiGet(`/apps/${encodePathSegment(appId)}/customerReviews`, params));
114
+ const data = await apiGet(`/apps/${encodePathSegment(appId)}/customerReviews`, params);
139
115
  // include로 가져온 답변 매핑
140
116
  const responses = new Map();
141
117
  for (const inc of data.included ?? []) {
@@ -144,7 +120,8 @@ export async function listCustomerReviews(appId, opts = {}) {
144
120
  }
145
121
  }
146
122
  return (data.data ?? []).map((r) => {
147
- const respId = r.relationships?.response?.data?.id;
123
+ const responseLinkage = r.relationships?.response?.data;
124
+ const respId = responseLinkage?.id;
148
125
  const resp = respId ? responses.get(respId) : null;
149
126
  return {
150
127
  id: r.id,
@@ -154,13 +131,14 @@ export async function listCustomerReviews(appId, opts = {}) {
154
131
  nickname: r.attributes?.reviewerNickname,
155
132
  createdDate: r.attributes?.createdDate,
156
133
  territory: r.attributes?.territory,
157
- response: resp
134
+ // 관계가 있으면 included 본문이 누락돼도 미답변으로 분류하지 않는다.
135
+ response: respId
158
136
  ? {
159
- body: resp.responseBody,
160
- lastModifiedDate: resp.lastModifiedDate,
161
- state: resp.state,
137
+ body: resp?.responseBody,
138
+ lastModifiedDate: resp?.lastModifiedDate,
139
+ state: resp?.state,
162
140
  }
163
- : null,
141
+ : responseLinkage === null ? null : undefined,
164
142
  };
165
143
  });
166
144
  }
@@ -0,0 +1,39 @@
1
+ type PlacementType = 'APP_SCREENSHOT' | 'APP_PREVIEW';
2
+ type PlacementTarget = {
3
+ localizationId: string;
4
+ placementGroup: string;
5
+ };
6
+ type UploadedMedia = {
7
+ assetId: string;
8
+ placementGroup: string;
9
+ } & ({
10
+ status: 'processing';
11
+ assetState: 'UPLOAD_COMPLETE';
12
+ message: string;
13
+ } | {
14
+ status: 'placed';
15
+ placementId: string;
16
+ reusedPlacement: boolean;
17
+ assetState?: string;
18
+ placementState?: string;
19
+ });
20
+ export declare function uploadAndPlaceMedia(args: PlacementTarget & {
21
+ placementType: PlacementType;
22
+ filePath?: string;
23
+ assetId?: string;
24
+ previewFrameTimeCode?: string;
25
+ }): Promise<UploadedMedia>;
26
+ export declare function reorderMediaPlacements(args: PlacementTarget & {
27
+ placementIds: string[];
28
+ }): Promise<{
29
+ changed: boolean;
30
+ placementGroup: string;
31
+ placementIds: string[];
32
+ orderingRequestId?: undefined;
33
+ } | {
34
+ changed: boolean;
35
+ orderingRequestId: string;
36
+ placementGroup: string;
37
+ placementIds: string[];
38
+ }>;
39
+ export {};