@yoonion/mimi-seed-mcp 0.24.0 → 0.25.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.
Files changed (287) hide show
  1. package/dist/admob/cli.js +34 -5
  2. package/dist/admob/errors.js +39 -14
  3. package/dist/ai/client.js +35 -14
  4. package/dist/ai/notes.js +14 -3
  5. package/dist/ai/review.js +17 -4
  6. package/dist/android/keystore-store.js +28 -8
  7. package/dist/android/keystore.d.ts +17 -2
  8. package/dist/android/keystore.js +110 -21
  9. package/dist/android/messages.d.ts +13 -11
  10. package/dist/android/messages.js +166 -72
  11. package/dist/android/playstore-sa.js +6 -3
  12. package/dist/appstore/analytics.js +46 -14
  13. package/dist/appstore/app-info-policy.js +7 -1
  14. package/dist/appstore/app-info.js +13 -3
  15. package/dist/appstore/apps.js +7 -1
  16. package/dist/appstore/asset-library-write.js +119 -37
  17. package/dist/appstore/asset-library.js +19 -5
  18. package/dist/appstore/auth.d.ts +2 -0
  19. package/dist/appstore/auth.js +31 -5
  20. package/dist/appstore/client.js +27 -6
  21. package/dist/appstore/declarations.js +22 -6
  22. package/dist/appstore/errors.d.ts +1 -1
  23. package/dist/appstore/errors.js +60 -34
  24. package/dist/appstore/http.d.ts +6 -0
  25. package/dist/appstore/http.js +22 -5
  26. package/dist/appstore/messages.js +86 -28
  27. package/dist/appstore/previews.js +22 -6
  28. package/dist/appstore/product-localization.js +10 -2
  29. package/dist/appstore/product-review.js +29 -10
  30. package/dist/appstore/products.js +20 -6
  31. package/dist/appstore/read-response.js +13 -3
  32. package/dist/appstore/release-target.js +13 -3
  33. package/dist/appstore/release.js +59 -22
  34. package/dist/appstore/review-preview.js +17 -6
  35. package/dist/appstore/review-submission.js +86 -35
  36. package/dist/appstore/sales.js +96 -44
  37. package/dist/appstore/screenshots.js +19 -5
  38. package/dist/appstore/testflight.js +41 -18
  39. package/dist/appstore/upload-parts.js +12 -3
  40. package/dist/appstore/versions.js +22 -10
  41. package/dist/auth/bigquery-auth.js +44 -15
  42. package/dist/auth/bigquery-setup-cli.js +1 -1
  43. package/dist/auth/cli.js +4 -2
  44. package/dist/auth/constants.js +13 -3
  45. package/dist/auth/drive-auth.d.ts +3 -2
  46. package/dist/auth/drive-auth.js +47 -17
  47. package/dist/auth/drive-setup-cli.js +1 -0
  48. package/dist/auth/errors.d.ts +75 -0
  49. package/dist/auth/errors.js +190 -86
  50. package/dist/auth/google-auth.d.ts +3 -1
  51. package/dist/auth/google-auth.js +39 -27
  52. package/dist/auth/playstore-auth.d.ts +1 -0
  53. package/dist/auth/playstore-auth.js +35 -15
  54. package/dist/auth/scopes.d.ts +11 -29
  55. package/dist/auth/scopes.js +38 -11
  56. package/dist/auth/youtube-channel.d.ts +8 -0
  57. package/dist/auth/youtube-channel.js +11 -3
  58. package/dist/bigquery/ids.js +19 -5
  59. package/dist/bigquery/tools.js +24 -8
  60. package/dist/billing/tools.js +22 -6
  61. package/dist/checks/appstore-submission.d.ts +1 -1
  62. package/dist/checks/appstore-submission.js +29 -8
  63. package/dist/checks/plan.js +169 -62
  64. package/dist/checks/release-status.js +10 -2
  65. package/dist/checks/risks.js +230 -63
  66. package/dist/checks/screenshots.d.ts +4 -4
  67. package/dist/checks/screenshots.js +63 -22
  68. package/dist/ci/config.js +8 -5
  69. package/dist/ci/gitlab.js +3 -1
  70. package/dist/core/atomic-write.d.ts +5 -2
  71. package/dist/core/atomic-write.js +8 -4
  72. package/dist/core/catch-scan.d.ts +17 -0
  73. package/dist/core/catch-scan.js +111 -0
  74. package/dist/core/checks/billing.d.ts +5 -0
  75. package/dist/core/checks/billing.js +36 -5
  76. package/dist/core/checks/lockfile.js +2 -0
  77. package/dist/core/checks/release-doctor/fcm.js +1 -0
  78. package/dist/core/checks/release-doctor/files.d.ts +3 -1
  79. package/dist/core/checks/release-doctor/files.js +12 -1
  80. package/dist/core/checks/release-doctor/gradle-apply.js +1 -0
  81. package/dist/core/checks/release-doctor/ios-xcode.js +22 -3
  82. package/dist/core/checks/release-doctor/target-sdk.js +1 -1
  83. package/dist/core/checks/release-doctor/util.d.ts +5 -0
  84. package/dist/core/checks/release-doctor/util.js +56 -0
  85. package/dist/core/checks/release-doctor.js +59 -16
  86. package/dist/core/credential-envelope.d.ts +25 -0
  87. package/dist/core/credential-envelope.js +66 -0
  88. package/dist/core/credential-keystore.d.ts +37 -0
  89. package/dist/core/credential-keystore.js +275 -0
  90. package/dist/core/credential-read.d.ts +33 -0
  91. package/dist/core/credential-read.js +112 -0
  92. package/dist/core/credential-store.d.ts +61 -0
  93. package/dist/core/credential-store.js +240 -0
  94. package/dist/core/http-errors.js +1 -0
  95. package/dist/core/i18n-scan.d.ts +10 -0
  96. package/dist/core/i18n-scan.js +79 -0
  97. package/dist/core/json-file.d.ts +30 -0
  98. package/dist/core/json-file.js +53 -0
  99. package/dist/core/lang.d.ts +14 -0
  100. package/dist/core/lang.js +22 -2
  101. package/dist/core/project-manifest.d.ts +24 -1
  102. package/dist/core/project-manifest.js +27 -16
  103. package/dist/drive/tools.js +86 -34
  104. package/dist/facebook/api.js +3 -1
  105. package/dist/facebook/config.js +11 -3
  106. package/dist/facebook/setup.d.ts +2 -0
  107. package/dist/facebook/setup.js +32 -9
  108. package/dist/firebase/cli.js +39 -5
  109. package/dist/firebase/tools.js +36 -10
  110. package/dist/ga4/cli.js +48 -4
  111. package/dist/ga4/tools.js +4 -2
  112. package/dist/googleads/config.js +24 -8
  113. package/dist/googleads/tools.js +3 -1
  114. package/dist/gsc/tools.js +10 -2
  115. package/dist/helpers.d.ts +4 -2
  116. package/dist/helpers.js +66 -32
  117. package/dist/i18n/manifest-en.d.ts +6 -0
  118. package/dist/i18n/manifest-en.js +53 -0
  119. package/dist/i18n/tools-en/admob.d.ts +25 -0
  120. package/dist/i18n/tools-en/admob.js +24 -0
  121. package/dist/i18n/tools-en/ai.d.ts +14 -0
  122. package/dist/i18n/tools-en/ai.js +13 -0
  123. package/dist/i18n/tools-en/android.d.ts +14 -0
  124. package/dist/i18n/tools-en/android.js +13 -0
  125. package/dist/i18n/tools-en/appstore.d.ts +240 -0
  126. package/dist/i18n/tools-en/appstore.js +239 -0
  127. package/dist/i18n/tools-en/auth.d.ts +16 -0
  128. package/dist/i18n/tools-en/auth.js +15 -0
  129. package/dist/i18n/tools-en/bigquery.d.ts +16 -0
  130. package/dist/i18n/tools-en/bigquery.js +15 -0
  131. package/dist/i18n/tools-en/billing.d.ts +17 -0
  132. package/dist/i18n/tools-en/billing.js +16 -0
  133. package/dist/i18n/tools-en/checks.d.ts +23 -0
  134. package/dist/i18n/tools-en/checks.js +22 -0
  135. package/dist/i18n/tools-en/ci.d.ts +21 -0
  136. package/dist/i18n/tools-en/ci.js +20 -0
  137. package/dist/i18n/tools-en/drive.d.ts +33 -0
  138. package/dist/i18n/tools-en/drive.js +32 -0
  139. package/dist/i18n/tools-en/facebook.d.ts +14 -0
  140. package/dist/i18n/tools-en/facebook.js +13 -0
  141. package/dist/i18n/tools-en/firebase.d.ts +42 -0
  142. package/dist/i18n/tools-en/firebase.js +41 -0
  143. package/dist/i18n/tools-en/ga4.d.ts +35 -0
  144. package/dist/i18n/tools-en/ga4.js +34 -0
  145. package/dist/i18n/tools-en/googleads.d.ts +15 -0
  146. package/dist/i18n/tools-en/googleads.js +14 -0
  147. package/dist/i18n/tools-en/gsc.d.ts +27 -0
  148. package/dist/i18n/tools-en/gsc.js +26 -0
  149. package/dist/i18n/tools-en/iam.d.ts +15 -0
  150. package/dist/i18n/tools-en/iam.js +14 -0
  151. package/dist/i18n/tools-en/index.d.ts +7 -0
  152. package/dist/i18n/tools-en/index.js +58 -0
  153. package/dist/i18n/tools-en/instagram.d.ts +16 -0
  154. package/dist/i18n/tools-en/instagram.js +15 -0
  155. package/dist/i18n/tools-en/jenkins.d.ts +41 -0
  156. package/dist/i18n/tools-en/jenkins.js +40 -0
  157. package/dist/i18n/tools-en/naver.d.ts +10 -0
  158. package/dist/i18n/tools-en/naver.js +9 -0
  159. package/dist/i18n/tools-en/playstore.d.ts +148 -0
  160. package/dist/i18n/tools-en/playstore.js +147 -0
  161. package/dist/i18n/tools-en/registrar.d.ts +6 -0
  162. package/dist/i18n/tools-en/registrar.js +6 -0
  163. package/dist/i18n/tools-en/threads.d.ts +21 -0
  164. package/dist/i18n/tools-en/threads.js +20 -0
  165. package/dist/i18n/tools-en/tiktok.d.ts +21 -0
  166. package/dist/i18n/tools-en/tiktok.js +20 -0
  167. package/dist/i18n/tools-en/video.d.ts +59 -0
  168. package/dist/i18n/tools-en/video.js +58 -0
  169. package/dist/i18n/tools-en/youtube.d.ts +44 -0
  170. package/dist/i18n/tools-en/youtube.js +43 -0
  171. package/dist/iam/key-files.js +13 -3
  172. package/dist/instagram/api.js +19 -5
  173. package/dist/instagram/config.js +11 -3
  174. package/dist/instagram/setup.js +37 -11
  175. package/dist/jenkins/builds.d.ts +2 -2
  176. package/dist/jenkins/builds.js +70 -30
  177. package/dist/jenkins/config.d.ts +5 -0
  178. package/dist/jenkins/config.js +25 -6
  179. package/dist/jenkins/credentials.js +33 -13
  180. package/dist/jenkins/http.js +6 -3
  181. package/dist/jenkins/jobs.js +19 -5
  182. package/dist/jenkins/messages.js +93 -36
  183. package/dist/lib/cli-args.js +13 -7
  184. package/dist/lib/google-errors.js +31 -9
  185. package/dist/lib/http.js +10 -3
  186. package/dist/lib/json-file.d.ts +15 -0
  187. package/dist/lib/json-file.js +65 -0
  188. package/dist/lib/meta-auth.d.ts +1 -1
  189. package/dist/lib/meta-auth.js +26 -8
  190. package/dist/lib/package-name.js +15 -4
  191. package/dist/lib/package-root.js +1 -1
  192. package/dist/lib/paginate.js +10 -2
  193. package/dist/lib/path-containment.js +22 -6
  194. package/dist/lib/resource-id.js +10 -3
  195. package/dist/lib/store-create-result.js +54 -13
  196. package/dist/lib/text-validators.js +20 -5
  197. package/dist/lib/tool-registrar.d.ts +9 -0
  198. package/dist/lib/tool-registrar.js +33 -14
  199. package/dist/lib/tool-text.d.ts +31 -0
  200. package/dist/lib/tool-text.js +52 -0
  201. package/dist/lib/toolsets.js +13 -3
  202. package/dist/lib/url-path.js +3 -1
  203. package/dist/naver/tools.js +138 -46
  204. package/dist/playstore/data-safety.js +16 -4
  205. package/dist/playstore/errors.js +33 -8
  206. package/dist/playstore/financials.js +83 -35
  207. package/dist/playstore/listing.js +7 -1
  208. package/dist/playstore/messages.js +179 -57
  209. package/dist/playstore/products.js +10 -2
  210. package/dist/playstore/recovery.js +10 -2
  211. package/dist/playstore/releases.js +34 -14
  212. package/dist/playstore/reviews.js +14 -4
  213. package/dist/playstore/statistics.js +3 -1
  214. package/dist/prompts.js +160 -50
  215. package/dist/registers/admob.js +36 -11
  216. package/dist/registers/android.js +25 -9
  217. package/dist/registers/appstore/apps.js +22 -6
  218. package/dist/registers/appstore/customer-reviews.js +7 -1
  219. package/dist/registers/appstore/declarations.js +63 -19
  220. package/dist/registers/appstore/media.js +76 -24
  221. package/dist/registers/appstore/metadata.js +26 -8
  222. package/dist/registers/appstore/products.js +53 -19
  223. package/dist/registers/appstore/review-submission.js +31 -9
  224. package/dist/registers/appstore/testflight.js +82 -24
  225. package/dist/registers/appstore/versions.js +88 -30
  226. package/dist/registers/auth.js +343 -90
  227. package/dist/registers/bigquery.js +54 -14
  228. package/dist/registers/billing.js +18 -4
  229. package/dist/registers/checks.js +20 -5
  230. package/dist/registers/ci.js +60 -20
  231. package/dist/registers/drive.js +18 -7
  232. package/dist/registers/facebook.js +31 -9
  233. package/dist/registers/firebase.js +21 -7
  234. package/dist/registers/googleads.js +23 -6
  235. package/dist/registers/gsc.js +3 -1
  236. package/dist/registers/iam.js +44 -13
  237. package/dist/registers/instagram.js +19 -5
  238. package/dist/registers/jenkins.js +43 -14
  239. package/dist/registers/naver.js +13 -3
  240. package/dist/registers/playstore/financials.d.ts +6 -0
  241. package/dist/registers/playstore/financials.js +48 -0
  242. package/dist/registers/playstore/listing.d.ts +15 -0
  243. package/dist/registers/playstore/listing.js +138 -0
  244. package/dist/registers/playstore/media.d.ts +6 -0
  245. package/dist/registers/playstore/media.js +56 -0
  246. package/dist/registers/playstore/products.d.ts +21 -0
  247. package/dist/registers/playstore/products.js +238 -0
  248. package/dist/registers/playstore/recovery.d.ts +11 -0
  249. package/dist/registers/playstore/recovery.js +105 -0
  250. package/dist/registers/playstore/releases.d.ts +8 -0
  251. package/dist/registers/playstore/releases.js +157 -0
  252. package/dist/registers/playstore/reviews.d.ts +6 -0
  253. package/dist/registers/playstore/reviews.js +43 -0
  254. package/dist/registers/playstore/service-accounts.d.ts +13 -0
  255. package/dist/registers/playstore/service-accounts.js +127 -0
  256. package/dist/registers/playstore/shared.d.ts +12 -0
  257. package/dist/registers/playstore/shared.js +24 -0
  258. package/dist/registers/playstore.d.ts +8 -0
  259. package/dist/registers/playstore.js +28 -734
  260. package/dist/registers/threads.js +28 -8
  261. package/dist/registers/tiktok.js +4 -2
  262. package/dist/registers/video.js +3 -1
  263. package/dist/remote-sync.js +80 -28
  264. package/dist/resources.d.ts +0 -8
  265. package/dist/resources.js +73 -32
  266. package/dist/server.d.ts +2 -0
  267. package/dist/server.js +9 -1
  268. package/dist/social/profile-store.js +36 -12
  269. package/dist/social/setup-cli.js +1 -1
  270. package/dist/threads/api.js +23 -6
  271. package/dist/threads/setup.js +42 -14
  272. package/dist/tiktok-business/api.js +13 -3
  273. package/dist/tiktok-business/auth.js +10 -2
  274. package/dist/tiktok-business/config.js +8 -3
  275. package/dist/tiktok-business/posting.d.ts +6 -0
  276. package/dist/tiktok-business/posting.js +118 -36
  277. package/dist/tiktok-business/setup-cli.js +3 -1
  278. package/dist/tools-cli.js +4 -5
  279. package/dist/video/captions.js +3 -1
  280. package/dist/video/files.js +13 -3
  281. package/dist/video/project.js +65 -21
  282. package/dist/video/providers.js +52 -16
  283. package/dist/video/render.js +71 -22
  284. package/dist/video/research.js +10 -2
  285. package/dist/video/schemas.js +19 -5
  286. package/dist/video/youtube-publish.js +62 -32
  287. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import path from 'node:path';
2
+ import os from 'node:os';
1
3
  import { GOOGLE_PROFILE_ID, listGoogleProfiles, getAuthenticatedClient, getGoogleAuthAttempt } from '../auth/google-auth.js';
2
4
  import { verifyYouTubeChannel, YOUTUBE_CHANNEL_ID } from '../auth/youtube-channel.js';
3
5
  import { z } from 'zod';
@@ -21,60 +23,253 @@ import { readPackageRootText } from '../lib/package-root.js';
21
23
  import { resolveBigQueryAuth } from '../auth/bigquery-auth.js';
22
24
  import { syncRemoteCredentials } from '../remote-sync.js';
23
25
  import { resolveSocialConfigTarget } from '../social/profile-store.js';
24
- import { findProjectManifest, manifestServiceEntries, } from '#core/project-manifest.js';
26
+ import { lookupProjectManifest, manifestServiceEntries, } from '#core/project-manifest.js';
25
27
  import { textResult } from '../lib/mcp-response.js';
26
28
  import { describeToolsets } from '../lib/toolsets.js';
29
+ import { findInvalidJsonFiles } from '../lib/json-file.js';
30
+ import { credentialStoreReport } from '#core/credential-store.js';
31
+ import { catalog } from '#core/lang.js';
32
+ /** 출력 문구 — 도구별로 묶었다. 호출 시점에 언어를 읽는다 (`A()`). */
33
+ const A = catalog({
34
+ // ── 공통: tokens.json 갱신 시각 · Meta 연결 줄 · 매니페스트 줄 ──
35
+ refresh: {
36
+ mtimeFailed: '(파일 mtime 조회 실패)',
37
+ daysAgo: (days, hours) => `${days}d ${hours}h 전 갱신`,
38
+ hoursAgo: (hours) => `${hours}h 전 갱신`,
39
+ over14: `⚠️ 14일 이상 미사용 — Google 정책상 refresh_token revoke 위험. 안전을 위해 'mimi_seed_auth_start' 로 재인증 권장.`,
40
+ over7: `ℹ️ 7일 이상 미사용 — 한 번 더 갱신하지 않으면 곧 revoke 가능. 다음 도구 호출이 자동 갱신해주지만, 장기 미사용 예정이면 미리 인증 갱신 권장.`,
41
+ },
42
+ meta: {
43
+ missing: (padded, fix) => `❌ ${padded} — 미설정 → ${fix} (선택)`,
44
+ expired: (padded, fix) => `❌ ${padded} — 토큰 만료 → ${fix}`,
45
+ expiring: (padded, days, detail, fix) => `⚠️ ${padded} — ${days}일 후 만료 (${detail}) → ${fix}`,
46
+ unknown: (padded, detail) => `⚠️ ${padded} — 설정됨, 만료일 미상 (${detail}) → 계정 조회 도구로 검증`,
47
+ ok: (padded, detail, days) => `✅ ${padded} — 연결됨 (${detail}, ${days}일 남음)`,
48
+ },
49
+ manifestFix: {
50
+ oauth: () => 'mimi_seed_auth_start (Google 로그인 — Firebase/AdMob/Play/GSC/GA4)',
51
+ bigquery: () => 'npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (서비스 계정 권장)',
52
+ playstore: (svc) => svc.packageName
53
+ ? `setup_playstore_connection(packageName="${svc.packageName}")`
54
+ : 'setup_playstore_connection(packageName=...)',
55
+ appstore: () => 'npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth',
56
+ jenkins: () => 'claude mcp add <your-jenkins-mcp> -s user (개인 자격증명 — .mcp.json 금지)',
57
+ },
58
+ manifest: {
59
+ connected: (label, suffix) => `✅ ${label} — 연결됨${suffix}`,
60
+ optional: (label, suffix, note) => `ℹ️ ${label} — (선택)${suffix}${note}`,
61
+ missing: (label, suffix, fix, noteLine) => `❌ ${label} — 미설정${suffix}\n → ${fix}${noteLine}`,
62
+ },
63
+ // ── mimi_seed_status ──
64
+ status: {
65
+ header: (version) => `🌱 Mimi Seed 연결 상태 — local-stdio (@yoonion/mimi-seed-mcp v${version})`,
66
+ accountUnknown: '계정 확인 불가 — 재로그인하면 기록됨',
67
+ oauthOk: (account, min, label) => `✅ Google OAuth — 연결됨 (${account}, ${min}분 남음, ${label})`,
68
+ oauthMissing: '❌ Google OAuth — 미연결 → mimi_seed_auth_start',
69
+ youtubeUpload: '✅ YouTube — 업로드·상태 관리 권한 연결됨',
70
+ youtubeRead: '✅ YouTube — 채널·영상·성과 읽기 권한 연결됨',
71
+ youtubeMissing: '❌ YouTube — 미연결 → mimi_seed_auth_start(domains=["youtube"]) (선택)',
72
+ playOk: (count, detail) => `✅ Play Store SA — ${count}개 등록 (${detail})`,
73
+ playBroken: (broken, total, names) => `⚠️ Play Store SA — ${total}개 중 ${broken}개를 읽을 수 없음 (${names}) — 그 패키지는 SA 로 동작하지 않는다. setup_playstore_connection 으로 다시 등록`,
74
+ playMissing: '⚠️ Play Store SA — 미설정 (선택 — 로컬은 OAuth 로 가능, CI/헤드리스는 필수) → setup_playstore_connection',
75
+ ascOk: (keyId) => `✅ App Store Connect — 연결됨 (keyId: ${keyId})`,
76
+ ascMissing: '❌ App Store Connect — 미설정 → npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth',
77
+ jenkinsOk: (url) => `✅ Jenkins — 연결됨 (${url})`,
78
+ jenkinsMissing: '❌ Jenkins — 미설정 → jenkins_status → jenkins_save_config (선택)',
79
+ ciMissing: '❌ CI — 미설정 → ci_save_config (선택)',
80
+ gadsOk: (customerId) => `⚠️ Google Ads — 설정됨 (customerId: ${customerId})`,
81
+ gadsMissing: '❌ Google Ads — 미설정 → googleads_save_config (선택)',
82
+ tiktokMissing: '❌ TikTok Business — 미설정 → mimi-seed auth tiktok (선택)',
83
+ tiktokRefreshExpired: (openId) => `❌ TikTok Business — refresh token 만료 (${openId}) → mimi-seed auth tiktok`,
84
+ tiktokAccessExpired: (openId) => `⚠️ TikTok Business — 연결됨, 다음 호출에서 access token 자동 갱신 (${openId})`,
85
+ tiktokOk: (openId) => `✅ TikTok Business — Organic API 연결됨 (${openId})`,
86
+ bqSa: (email) => `✅ BigQuery — 서비스 계정 연결됨 (${email})`,
87
+ bqOauth: '⚠️ BigQuery — OAuth fallback (Workspace 재인증 정책 시 끊길 수 있음 → 서비스 계정 권장: mimi-seed-bigquery-auth)',
88
+ bqMissing: '❌ BigQuery — 미설정 → npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (선택)',
89
+ invalidHeader: '── ⚠️ 읽을 수 없는 설정 파일 ─────────────────────',
90
+ invalidReason: (reason) => ` 원인: ${reason}`,
91
+ invalidFix: ' → 해당 연결을 다시 설정하면 파일을 새로 씁니다. 고치기 전 내용을 보존하려면 먼저 백업하세요.',
92
+ storePlain: '🔓 자격증명 저장: 평문 0600 (암호화: 터미널에서 mimi-seed credentials mode keychain)',
93
+ storeEncrypted: (n, left) => `🔐 자격증명 저장: 암호화 (${n}개 파일)${left ? ` — 평문 ${left}개 남음 → mimi-seed credentials encrypt` : ''}`,
94
+ nextOauth: ' 1. mimi_seed_auth_start (Google 계정 로그인 — Firebase/AdMob/GSC 등 필수)',
95
+ nextAsc: ' 2. npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth (App Store 배포 필수)',
96
+ nextHeader: '── 다음 단계 (필수) ─────────────────────────────',
97
+ allDone: '✅ 필수 연결 모두 완료. 앱 출시 작업을 시작할 수 있습니다.',
98
+ thisProject: '이 프로젝트',
99
+ reqHeader: (name) => `── ${name} 요구사항 (.mimi-seed.json) ─────────`,
100
+ teamHint: [
101
+ 'ℹ️ 팀 공유가 목표라면, 각자 로컬 자격증명을 채우는 대신',
102
+ ' 워크스페이스(https://mimi-seed.pryzm.gg) 초대 → PAT 발급 → 원격 MCP 연결도 가능.',
103
+ ],
104
+ },
105
+ // ── mimi_seed_auth_start ──
106
+ start: {
107
+ scopeSome: (list) => `요청 도메인: ${list} — 기존 부여 권한은 유지됨.`,
108
+ scopeAll: (list) => `요청 도메인: 전체 (${list})`,
109
+ linkTitle: '🔐 Google 로그인 링크 (10분 유효):',
110
+ profileLine: (profile, channel) => `로그인 프로필: ${profile ?? '(기본)'} / 대상 채널: ${channel ?? '(로그인 후 확인)'}`,
111
+ outro: [
112
+ 'YouTube는 Google 로그인에서 선택한 개인/브랜드 채널에 연결됩니다. 완료 후 mimi_seed_auth_status(profile=...)로 실제 채널을 확인하세요.',
113
+ '',
114
+ '이 URL을 브라우저에서 열고 Google 계정으로 승인해줘.',
115
+ '완료되면 localhost:9876으로 자동 리다이렉트되고 토큰이 저장돼.',
116
+ '이후 바로 다른 MCP 도구(playstore_*, firebase_* 등) 호출 가능.',
117
+ ],
118
+ },
119
+ // ── mimi_seed_auth_status ──
120
+ authStatus: {
121
+ account: (email) => ` 계정: ${email ?? '(확인 불가 — 재로그인하면 기록됨)'}\n`,
122
+ lastRefresh: (label) => ` 마지막 갱신: ${label}`,
123
+ domainsUnknown: ' 권한 도메인: (구 토큰 — scope 기록 없음. 재로그인하면 기록됨)',
124
+ domains: (list) => ` 권한 도메인: ${list || '(없음)'}`,
125
+ notGranted: (list) => ` 미부여: ${list} → mimi_seed_auth_start(domains=[...]) 로 추가 (기존 권한 유지)`,
126
+ runInTerminal: '터미널에서 실행:\n npx -y @yoonion/mimi-seed-mcp mimi-seed-auth',
127
+ fresh: (min) => `✅ 인증 유효 (${min}분 남음).`,
128
+ refreshed: (min) => `✅ 토큰 만료 → refresh_token으로 자동 갱신 완료 (${min}분 남음).`,
129
+ refreshFailed: '⚠️ 토큰 만료 + 자동 갱신 실패',
130
+ code: (code) => ` 코드: ${code}`,
131
+ reloginInTerminal: '\n\n터미널에서 재로그인:\n npx -y @yoonion/mimi-seed-mcp mimi-seed-auth',
132
+ },
133
+ }, {
134
+ refresh: {
135
+ mtimeFailed: '(could not read file mtime)',
136
+ daysAgo: (days, hours) => `refreshed ${days}d ${hours}h ago`,
137
+ hoursAgo: (hours) => `refreshed ${hours}h ago`,
138
+ over14: `⚠️ Unused for 14+ days — under Google policy the refresh_token may be revoked. To be safe, re-authenticate with 'mimi_seed_auth_start'.`,
139
+ over7: `ℹ️ Unused for 7+ days — it may be revoked soon unless refreshed again. The next tool call refreshes it automatically, but if you expect a long period without use, refresh authentication in advance.`,
140
+ },
141
+ meta: {
142
+ missing: (padded, fix) => `❌ ${padded} — not set up → ${fix} (optional)`,
143
+ expired: (padded, fix) => `❌ ${padded} — token expired → ${fix}`,
144
+ expiring: (padded, days, detail, fix) => `⚠️ ${padded} — expires in ${days} day(s) (${detail}) → ${fix}`,
145
+ unknown: (padded, detail) => `⚠️ ${padded} — set up, expiry unknown (${detail}) → verify with the account lookup tool`,
146
+ ok: (padded, detail, days) => `✅ ${padded} — connected (${detail}, ${days} day(s) left)`,
147
+ },
148
+ manifestFix: {
149
+ oauth: () => 'mimi_seed_auth_start (Google login — Firebase/AdMob/Play/GSC/GA4)',
150
+ bigquery: () => 'npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (service account recommended)',
151
+ playstore: (svc) => svc.packageName
152
+ ? `setup_playstore_connection(packageName="${svc.packageName}")`
153
+ : 'setup_playstore_connection(packageName=...)',
154
+ appstore: () => 'npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth',
155
+ jenkins: () => 'claude mcp add <your-jenkins-mcp> -s user (personal credentials — never in .mcp.json)',
156
+ },
157
+ manifest: {
158
+ connected: (label, suffix) => `✅ ${label} — connected${suffix}`,
159
+ optional: (label, suffix, note) => `ℹ️ ${label} — (optional)${suffix}${note}`,
160
+ missing: (label, suffix, fix, noteLine) => `❌ ${label} — not set up${suffix}\n → ${fix}${noteLine}`,
161
+ },
162
+ status: {
163
+ header: (version) => `🌱 Mimi Seed connection status — local-stdio (@yoonion/mimi-seed-mcp v${version})`,
164
+ accountUnknown: 'account unknown — recorded on next login',
165
+ oauthOk: (account, min, label) => `✅ Google OAuth — connected (${account}, ${min} min left, ${label})`,
166
+ oauthMissing: '❌ Google OAuth — not connected → mimi_seed_auth_start',
167
+ youtubeUpload: '✅ YouTube — upload and status management permission connected',
168
+ youtubeRead: '✅ YouTube — channel, video, and performance read permission connected',
169
+ youtubeMissing: '❌ YouTube — not connected → mimi_seed_auth_start(domains=["youtube"]) (optional)',
170
+ playOk: (count, detail) => `✅ Play Store SA — ${count} registered (${detail})`,
171
+ playBroken: (broken, total, names) => `⚠️ Play Store SA — ${broken} of ${total} cannot be read (${names}) — those packages won't work with an SA. Re-register with setup_playstore_connection`,
172
+ playMissing: '⚠️ Play Store SA — not set up (optional — OAuth works locally; required for CI/headless) → setup_playstore_connection',
173
+ ascOk: (keyId) => `✅ App Store Connect — connected (keyId: ${keyId})`,
174
+ ascMissing: '❌ App Store Connect — not set up → npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth',
175
+ jenkinsOk: (url) => `✅ Jenkins — connected (${url})`,
176
+ jenkinsMissing: '❌ Jenkins — not set up → jenkins_status → jenkins_save_config (optional)',
177
+ ciMissing: '❌ CI — not set up → ci_save_config (optional)',
178
+ gadsOk: (customerId) => `⚠️ Google Ads — set up (customerId: ${customerId})`,
179
+ gadsMissing: '❌ Google Ads — not set up → googleads_save_config (optional)',
180
+ tiktokMissing: '❌ TikTok Business — not set up → mimi-seed auth tiktok (optional)',
181
+ tiktokRefreshExpired: (openId) => `❌ TikTok Business — refresh token expired (${openId}) → mimi-seed auth tiktok`,
182
+ tiktokAccessExpired: (openId) => `⚠️ TikTok Business — connected; the access token refreshes automatically on the next call (${openId})`,
183
+ tiktokOk: (openId) => `✅ TikTok Business — Organic API connected (${openId})`,
184
+ bqSa: (email) => `✅ BigQuery — service account connected (${email})`,
185
+ bqOauth: '⚠️ BigQuery — OAuth fallback (may disconnect under a Workspace re-auth policy → service account recommended: mimi-seed-bigquery-auth)',
186
+ bqMissing: '❌ BigQuery — not set up → npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (optional)',
187
+ invalidHeader: '── ⚠️ Unreadable config files ─────────────────────',
188
+ invalidReason: (reason) => ` Cause: ${reason}`,
189
+ invalidFix: ' → Setting up that connection again rewrites the file. To keep its current contents, back it up first.',
190
+ storePlain: '🔓 Credential storage: plaintext 0600 (to encrypt, run in a terminal: mimi-seed credentials mode keychain)',
191
+ storeEncrypted: (n, left) => `🔐 Credential storage: encrypted (${n} file(s))${left ? ` — ${left} plaintext left → mimi-seed credentials encrypt` : ''}`,
192
+ nextOauth: ' 1. mimi_seed_auth_start (Google account login — required for Firebase/AdMob/GSC, etc.)',
193
+ nextAsc: ' 2. npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth (required for App Store releases)',
194
+ nextHeader: '── Next steps (required) ─────────────────────────────',
195
+ allDone: '✅ All required connections are complete. You can start app release work.',
196
+ thisProject: 'This project',
197
+ reqHeader: (name) => `── ${name} requirements (.mimi-seed.json) ─────────`,
198
+ teamHint: [
199
+ 'ℹ️ If the goal is team sharing, instead of each person filling in local credentials,',
200
+ ' you can also use workspace (https://mimi-seed.pryzm.gg) invite → PAT issuance → remote MCP connection.',
201
+ ],
202
+ },
203
+ start: {
204
+ scopeSome: (list) => `Requested domains: ${list} — existing granted permissions are kept.`,
205
+ scopeAll: (list) => `Requested domains: all (${list})`,
206
+ linkTitle: '🔐 Google login link (valid for 10 minutes):',
207
+ profileLine: (profile, channel) => `Login profile: ${profile ?? '(default)'} / Target channel: ${channel ?? '(checked after login)'}`,
208
+ outro: [
209
+ 'YouTube connects to the personal/brand channel selected during Google login. When done, check the actual channel with mimi_seed_auth_status(profile=...).',
210
+ '',
211
+ 'Open this URL in a browser and approve with your Google account.',
212
+ 'When done, it redirects to localhost:9876 automatically and the token is saved.',
213
+ 'You can then call other MCP tools (playstore_*, firebase_*, etc.) right away.',
214
+ ],
215
+ },
216
+ authStatus: {
217
+ account: (email) => ` Account: ${email ?? '(unknown — recorded on next login)'}\n`,
218
+ lastRefresh: (label) => ` Last refresh: ${label}`,
219
+ domainsUnknown: ' Permission domains: (old token — no scope recorded. Recorded on next login)',
220
+ domains: (list) => ` Permission domains: ${list || '(none)'}`,
221
+ notGranted: (list) => ` Not granted: ${list} → add with mimi_seed_auth_start(domains=[...]) (existing permissions kept)`,
222
+ runInTerminal: 'Run in a terminal:\n npx -y @yoonion/mimi-seed-mcp mimi-seed-auth',
223
+ fresh: (min) => `✅ Authentication valid (${min} min left).`,
224
+ refreshed: (min) => `✅ Token expired → automatically refreshed with refresh_token (${min} min left).`,
225
+ refreshFailed: '⚠️ Token expired + automatic refresh failed',
226
+ code: (code) => ` Code: ${code}`,
227
+ reloginInTerminal: '\n\nLog in again in a terminal:\n npx -y @yoonion/mimi-seed-mcp mimi-seed-auth',
228
+ },
229
+ });
27
230
  /**
28
231
  * tokens.json mtime → "Nd Hh ago" 형식 문자열 + 재인증 권고.
29
232
  * Google 정책: 7일 미사용 시 미인증 앱 refresh_token revoke 가능.
30
233
  * 14일 초과 시 강한 권고, 7일~14일 부드러운 안내.
31
234
  */
32
235
  function formatLastRefreshHint(lastMs) {
236
+ const m = A().refresh;
33
237
  if (lastMs === null)
34
- return { label: '(파일 mtime 조회 실패)' };
238
+ return { label: m.mtimeFailed };
35
239
  const ageMs = Date.now() - lastMs;
36
240
  const days = Math.floor(ageMs / 86_400_000);
37
241
  const hours = Math.floor((ageMs % 86_400_000) / 3_600_000);
38
- const label = days > 0 ? `${days}d ${hours}h 전 갱신` : `${hours}h 전 갱신`;
242
+ const label = days > 0 ? m.daysAgo(days, hours) : m.hoursAgo(hours);
39
243
  if (days >= 14) {
40
244
  return {
41
245
  label,
42
- recommendation: `⚠️ 14일 이상 미사용 — Google 정책상 refresh_token revoke 위험. 안전을 위해 'mimi_seed_auth_start' 로 재인증 권장.`,
246
+ recommendation: m.over14,
43
247
  };
44
248
  }
45
249
  if (days >= 7) {
46
250
  return {
47
251
  label,
48
- recommendation: `ℹ️ 7일 이상 미사용 — 한 번 더 갱신하지 않으면 곧 revoke 가능. 다음 도구 호출이 자동 갱신해주지만, 장기 미사용 예정이면 미리 인증 갱신 권장.`,
252
+ recommendation: m.over7,
49
253
  };
50
254
  }
51
255
  return { label };
52
256
  }
53
257
  function renderMetaConnection(label, config, detail, fix) {
54
258
  const padded = label.padEnd(18);
259
+ const m = A().meta;
55
260
  if (!config)
56
- return `❌ ${padded} — 미설정 → ${fix} (선택)`;
261
+ return m.missing(padded, fix);
57
262
  const freshness = metaTokenFreshness(config.expiresAt);
58
263
  if (freshness.state === 'expired')
59
- return `❌ ${padded} — 토큰 만료 → ${fix}`;
264
+ return m.expired(padded, fix);
60
265
  if (freshness.state === 'expiring') {
61
- return `⚠️ ${padded} — ${freshness.daysRemaining}일 후 만료 (${detail}) → ${fix}`;
266
+ return m.expiring(padded, freshness.daysRemaining, detail, fix);
62
267
  }
63
268
  if (freshness.state === 'unknown') {
64
- return `⚠️ ${padded} — 설정됨, 만료일 미상 (${detail}) → 계정 조회 도구로 검증`;
269
+ return m.unknown(padded, detail);
65
270
  }
66
- return `✅ ${padded} — 연결됨 (${detail}, ${freshness.daysRemaining}일 남음)`;
271
+ return m.ok(padded, detail, freshness.daysRemaining);
67
272
  }
68
- // 매니페스트 서비스별 셋업 명령. status/doctor 가 "정확한 다음 명령"으로 안내한다.
69
- const MANIFEST_FIX = {
70
- oauth: () => 'mimi_seed_auth_start (Google 로그인 — Firebase/AdMob/Play/GSC/GA4)',
71
- bigquery: () => 'npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (서비스 계정 권장)',
72
- playstore: (svc) => svc.packageName
73
- ? `setup_playstore_connection(packageName="${svc.packageName}")`
74
- : 'setup_playstore_connection(packageName=...)',
75
- appstore: () => 'npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth',
76
- jenkins: () => 'claude mcp add <your-jenkins-mcp> -s user (개인 자격증명 — .mcp.json 금지)',
77
- };
78
273
  // 두 MCP 가 모두 'mimi-seed' 로 등록되는 환경에서 에이전트가 프로그램적으로
79
274
  // 어느 서버인지 판별할 수 있도록 status 첫 줄에 자기소개를 넣는다.
80
275
  const { version: PKG_VERSION } = JSON.parse(readPackageRootText('package.json'));
@@ -106,16 +301,24 @@ function renderManifestLine(id, svc, connected, required) {
106
301
  const label = id.padEnd(10);
107
302
  const detail = manifestServiceDetail(id, svc);
108
303
  const detailSuffix = detail ? ` (${detail})` : '';
304
+ const m = A().manifest;
109
305
  if (connected)
110
- return `✅ ${label} — 연결됨${detailSuffix}`;
306
+ return m.connected(label, detailSuffix);
111
307
  if (!required) {
112
308
  const note = svc.note ? ` — ${svc.note}` : '';
113
- return `ℹ️ ${label} — (선택)${detailSuffix}${note}`;
309
+ return m.optional(label, detailSuffix, note);
114
310
  }
115
- const fix = MANIFEST_FIX[id](svc);
311
+ // 매니페스트 서비스별 셋업 명령 — status/doctor 가 "정확한 다음 명령"으로 안내한다.
312
+ const fix = A().manifestFix[id](svc);
116
313
  const noteLine = svc.note ? `\n ${svc.note}` : '';
117
- return `❌ ${label} — 미설정${detailSuffix}\n → ${fix}${noteLine}`;
314
+ return m.missing(label, detailSuffix, fix, noteLine);
118
315
  }
316
+ /** 깨진 프로젝트 매니페스트 안내 — reason 은 core 의 언어 중립 코드. */
317
+ const MF = catalog({
318
+ invalid: (file, reason) => `❌ 프로젝트 매니페스트를 읽을 수 없어 요구사항을 점검하지 못했습니다: ${file} (${{ unreadable: '읽기 실패', 'invalid-json': 'JSON 형식 오류', 'not-an-object': '객체가 아님' }[reason]}) — 파일을 고친 뒤 다시 확인하세요.`,
319
+ }, {
320
+ invalid: (file, reason) => `❌ Cannot read the project manifest, so its requirements were not checked: ${file} (${{ unreadable: 'unreadable', 'invalid-json': 'invalid JSON', 'not-an-object': 'not an object' }[reason]}) — fix the file and check again.`,
321
+ });
119
322
  export function registerAuthTools(server) {
120
323
  // ── 전체 연결 상태 진단 ────────────────────────────────────────────────────
121
324
  server.tool('mimi_seed_status', [
@@ -124,8 +327,9 @@ export function registerAuthTools(server) {
124
327
  '설정 상태를 한 번에 스캔해 ✅ / ❌ 트래픽 라이트 리포트와 번호 매긴 다음 단계를 반환합니다.',
125
328
  '미설정 서비스마다 어떤 도구를 호출하면 되는지 구체적으로 알려줍니다.',
126
329
  ].join(' '), {}, async () => {
330
+ const m = A().status;
127
331
  const lines = [
128
- `🌱 Mimi Seed 연결 상태 — local-stdio (@yoonion/mimi-seed-mcp v${PKG_VERSION})`,
332
+ m.header(PKG_VERSION),
129
333
  // 도메인을 꺼 둔 서버에서 "도구가 없다" 를 연결 문제로 오해하지 않게 켜진 toolset 을 밝힌다.
130
334
  `🧰 Toolsets: ${describeToolsets(server.toolsets, server.manifest)}`,
131
335
  '',
@@ -136,52 +340,61 @@ export function registerAuthTools(server) {
136
340
  const min = Math.round(oauthResult.msUntilExpiry / 60_000);
137
341
  const hint = formatLastRefreshHint(getTokensLastRefreshMs());
138
342
  // 계정을 함께 보여야 "다른 계정으로 로그인돼 있음" 을 여기서 알아챈다.
139
- const account = (await resolveAccountEmail()) ?? '계정 확인 불가 — 재로그인하면 기록됨';
140
- lines.push(`✅ Google OAuth — 연결됨 (${account}, ${min}분 남음, ${hint.label})`);
343
+ const account = (await resolveAccountEmail()) ?? m.accountUnknown;
344
+ lines.push(m.oauthOk(account, min, hint.label));
141
345
  if (hint.recommendation)
142
346
  lines.push(` ${hint.recommendation}`);
143
347
  }
144
348
  else {
145
- lines.push('❌ Google OAuth — 미연결 → mimi_seed_auth_start');
349
+ lines.push(m.oauthMissing);
146
350
  }
147
351
  const grantedDomains = summarizeGrantedDomains(getStoredTokens()?.scope).granted;
148
352
  const youtubeGranted = grantedDomains.includes('youtube') || grantedDomains.includes('youtube_analytics');
149
353
  if (youtubeGranted && (oauthResult.status === 'fresh' || oauthResult.status === 'refreshed')) {
150
354
  lines.push(grantedDomains.includes('youtube')
151
- ? '✅ YouTube — 업로드·상태 관리 권한 연결됨'
152
- : '✅ YouTube — 채널·영상·성과 읽기 권한 연결됨');
355
+ ? m.youtubeUpload
356
+ : m.youtubeRead);
153
357
  }
154
358
  else {
155
- lines.push('❌ YouTube — 미연결 → mimi_seed_auth_start(domains=["youtube"]) (선택)');
359
+ lines.push(m.youtubeMissing);
156
360
  }
157
361
  // 2. Play Store SA
158
362
  const saInfo = listRegisteredServiceAccounts();
159
363
  const saCount = saInfo.perPackage.length + (saInfo.default ? 1 : 0);
160
- if (saCount > 0) {
364
+ // listRegisteredServiceAccounts 는 읽을 수 없는 키 파일을 clientEmail: null 로 준다 — 파일이 있다고 ✅ 로 보이면
365
+ // 그 패키지의 SA 호출이 실패할 때까지 모른다. 깨진 것을 세어 따로 밝힌다.
366
+ const brokenSa = [
367
+ ...saInfo.perPackage.filter((p) => !p.clientEmail).map((p) => p.packageName),
368
+ ...(saInfo.default && !saInfo.default.clientEmail ? ['(default)'] : []),
369
+ ];
370
+ if (brokenSa.length > 0) {
371
+ lines.push(m.playBroken(brokenSa.length, saCount, brokenSa.join(', ')));
372
+ }
373
+ else if (saCount > 0) {
161
374
  const pkgs = saInfo.perPackage.map((p) => p.packageName).join(', ');
162
375
  const detail = pkgs || saInfo.default?.clientEmail || '(default)';
163
- lines.push(`✅ Play Store SA — ${saCount}개 등록 (${detail})`);
376
+ lines.push(m.playOk(saCount, detail));
164
377
  }
165
378
  else {
166
379
  // SA 는 CI/헤드리스 전용 — 로컬은 OAuth(androidpublisher scope)로 대부분의 Play 작업이 된다.
167
380
  // (helpers.ts requirePlayStoreAuth 가 SA → OAuth 로 폴백한다.) "필수"로 표기하면 안 된다.
168
- lines.push('⚠️ Play Store SA — 미설정 (선택 — 로컬은 OAuth 로 가능, CI/헤드리스는 필수) → setup_playstore_connection');
381
+ lines.push(m.playMissing);
169
382
  }
170
383
  // 3. App Store Connect
171
384
  const asc = getAppStoreCredentials();
172
385
  if (asc) {
173
- lines.push(`✅ App Store Connect — 연결됨 (keyId: ${asc.keyId})`);
386
+ lines.push(m.ascOk(asc.keyId));
174
387
  }
175
388
  else {
176
- lines.push('❌ App Store Connect — 미설정 → npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth');
389
+ lines.push(m.ascMissing);
177
390
  }
178
391
  // 4. Jenkins
179
392
  const jenkins = loadJenkinsConfig();
180
393
  if (jenkins) {
181
- lines.push(`✅ Jenkins — 연결됨 (${jenkins.url})`);
394
+ lines.push(m.jenkinsOk(jenkins.url));
182
395
  }
183
396
  else {
184
- lines.push('❌ Jenkins — 미설정 → jenkins_status → jenkins_save_config (선택)');
397
+ lines.push(m.jenkinsMissing);
185
398
  }
186
399
  // 5. CI (GitHub/GitLab)
187
400
  const ci = loadCiConfig();
@@ -189,74 +402,116 @@ export function registerAuthTools(server) {
189
402
  lines.push(`✅ CI — ${ci.provider} (${ci.owner}/${ci.repo})`);
190
403
  }
191
404
  else {
192
- lines.push('❌ CI — 미설정 → ci_save_config (선택)');
405
+ lines.push(m.ciMissing);
193
406
  }
194
407
  // 6. Google Ads
195
408
  const gads = loadGoogleAdsConfig();
196
409
  if (gads) {
197
- lines.push(`⚠️ Google Ads — 설정됨 (customerId: ${gads.customerId})`);
410
+ lines.push(m.gadsOk(gads.customerId));
198
411
  }
199
412
  else {
200
- lines.push('❌ Google Ads — 미설정 → googleads_save_config (선택)');
201
- }
202
- // 7. Facebook
203
- const fb = loadFacebookConfig();
204
- lines.push(renderMetaConnection('Facebook', fb, `pageId: ${fb?.pageId ?? ''}`, 'mimi-seed auth facebook'));
205
- // 8. Instagram
206
- const igTarget = resolveSocialConfigTarget('instagram');
207
- const ig = loadInstagramConfig();
208
- lines.push(renderMetaConnection('Instagram', ig, `${igTarget.profile ? `profile: ${igTarget.profile}, ` : ''}userId: ${ig?.userId ?? ''}`, `mimi-seed auth instagram${igTarget.profile ? ` --profile ${igTarget.profile}` : ''}`));
209
- // 9. Threads
210
- const threadsTarget = resolveSocialConfigTarget('threads');
211
- const threads = loadThreadsConfig();
212
- lines.push(renderMetaConnection('Threads', threads, `${threadsTarget.profile ? `profile: ${threadsTarget.profile}, ` : ''}userId: ${threads?.userId ?? ''}`, `mimi-seed auth threads${threadsTarget.profile ? ` --profile ${threadsTarget.profile}` : ''}`));
413
+ lines.push(m.gadsMissing);
414
+ }
415
+ // 7–9. Meta 소셜 — 프로필 결정이 throw 하면(깨진 .mimi-seed.json · 잘못된 socialProfiles) 상태 리포트 전체를
416
+ // 죽이지 않고 그 줄에 원인을 보인다. 게시 도구는 같은 경우에 실패한다(기본 계정으로 폴백하지 않는다).
417
+ const socialLine = (label, render) => {
418
+ try {
419
+ lines.push(render());
420
+ }
421
+ catch (error) {
422
+ lines.push(`❌ ${label.padEnd(17)} — ${error instanceof Error ? error.message : String(error)}`);
423
+ }
424
+ };
425
+ socialLine('Facebook', () => {
426
+ const fb = loadFacebookConfig();
427
+ return renderMetaConnection('Facebook', fb, `pageId: ${fb?.pageId ?? ''}`, 'mimi-seed auth facebook');
428
+ });
429
+ socialLine('Instagram', () => {
430
+ const igTarget = resolveSocialConfigTarget('instagram');
431
+ const ig = loadInstagramConfig();
432
+ return renderMetaConnection('Instagram', ig, `${igTarget.profile ? `profile: ${igTarget.profile}, ` : ''}userId: ${ig?.userId ?? ''}`, `mimi-seed auth instagram${igTarget.profile ? ` --profile ${igTarget.profile}` : ''}`);
433
+ });
434
+ socialLine('Threads', () => {
435
+ const threadsTarget = resolveSocialConfigTarget('threads');
436
+ const threads = loadThreadsConfig();
437
+ return renderMetaConnection('Threads', threads, `${threadsTarget.profile ? `profile: ${threadsTarget.profile}, ` : ''}userId: ${threads?.userId ?? ''}`, `mimi-seed auth threads${threadsTarget.profile ? ` --profile ${threadsTarget.profile}` : ''}`);
438
+ });
213
439
  // 10. TikTok Business — 네트워크 없이 refresh token 만료 상태까지 판정.
214
440
  const tiktok = loadTikTokBusinessConfig();
215
441
  const tiktokFreshness = tiktokTokenFreshness(tiktok);
216
442
  if (!tiktok) {
217
- lines.push('❌ TikTok Business — 미설정 → mimi-seed auth tiktok (선택)');
443
+ lines.push(m.tiktokMissing);
218
444
  }
219
445
  else if (tiktokFreshness.state === 'refresh_expired') {
220
- lines.push(`❌ TikTok Business — refresh token 만료 (${tiktok.openId}) → mimi-seed auth tiktok`);
446
+ lines.push(m.tiktokRefreshExpired(tiktok.openId));
221
447
  }
222
448
  else if (tiktokFreshness.state === 'access_expired') {
223
- lines.push(`⚠️ TikTok Business — 연결됨, 다음 호출에서 access token 자동 갱신 (${tiktok.openId})`);
449
+ lines.push(m.tiktokAccessExpired(tiktok.openId));
224
450
  }
225
451
  else {
226
- lines.push(`✅ TikTok Business — Organic API 연결됨 (${tiktok.openId})`);
452
+ lines.push(m.tiktokOk(tiktok.openId));
227
453
  }
228
454
  // 11. BigQuery — resolveBigQueryAuth 기준(서비스 계정 우선, OAuth fallback).
229
455
  // 이전엔 SA 파일만 검사해 OAuth fallback 이 살아있어도 ❌ 로 오표기했다.
230
- const bqAuth = resolveBigQueryAuth();
231
- if (bqAuth?.source === 'service-account') {
232
- lines.push(`✅ BigQuery — 서비스 계정 연결됨 (${bqAuth.clientEmail ?? ''})`);
456
+ let bqAuth = null;
457
+ let bqProblem = null;
458
+ try {
459
+ bqAuth = resolveBigQueryAuth();
460
+ }
461
+ catch (error) {
462
+ bqProblem = error instanceof Error ? error.message : String(error);
463
+ }
464
+ if (bqProblem) {
465
+ lines.push(`❌ BigQuery — ${bqProblem}`);
466
+ }
467
+ else if (bqAuth?.source === 'service-account') {
468
+ lines.push(m.bqSa(bqAuth.clientEmail ?? ''));
233
469
  }
234
470
  else if (bqAuth?.source === 'user-oauth') {
235
- lines.push('⚠️ BigQuery — OAuth fallback (Workspace 재인증 정책 시 끊길 수 있음 → 서비스 계정 권장: mimi-seed-bigquery-auth)');
471
+ lines.push(m.bqOauth);
236
472
  }
237
473
  else {
238
- lines.push('❌ BigQuery — 미설정 → npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (선택)');
474
+ lines.push(m.bqMissing);
475
+ }
476
+ // 12. 깨진 설정 파일 — 로더는 "없음"과 "깨짐"을 둘 다 null 로 돌려주므로 위 줄들은 ❌ 미설정으로만 보인다.
477
+ // 어느 파일이 왜 못 읽히는지는 여기서 따로 밝힌다 (잘린 쓰기 · 손으로 고친 문법 오류 · 권한).
478
+ const invalidFiles = findInvalidJsonFiles(path.join(os.homedir(), '.mimi-seed'));
479
+ if (invalidFiles.length > 0) {
480
+ lines.push('', m.invalidHeader);
481
+ for (const { file, reason } of invalidFiles)
482
+ lines.push(`❌ ${file}`, m.invalidReason(reason));
483
+ lines.push(m.invalidFix);
239
484
  }
485
+ // 13. 저장 방식 — 봉투 파일이 있을 때만 키 저장소를 부른다(키를 만들지는 않는다). 잠긴 파일은 위 12 가 이미 짚는다.
486
+ const store = credentialStoreReport();
487
+ const sealed = store.files.filter((f) => f.state === 'encrypted').length;
488
+ const plain = store.files.filter((f) => f.state === 'plaintext').length;
489
+ lines.push('', store.effective === 'file' && sealed === 0 ? m.storePlain : m.storeEncrypted(sealed, store.effective === 'file' ? 0 : plain));
240
490
  // 다음 단계 안내
241
491
  const missing = [];
242
492
  if (oauthResult.status !== 'fresh' && oauthResult.status !== 'refreshed') {
243
- missing.push(' 1. mimi_seed_auth_start (Google 계정 로그인 — Firebase/AdMob/GSC 등 필수)');
493
+ missing.push(m.nextOauth);
244
494
  }
245
495
  if (!asc) {
246
- missing.push(' 2. npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth (App Store 배포 필수)');
496
+ missing.push(m.nextAsc);
247
497
  }
248
498
  // Play SA 는 "다음 단계 (필수)" 에 넣지 않는다 — OAuth 로 대부분의 Play 작업이 되므로.
249
499
  // CI/헤드리스에서만 필요하고, 그 안내는 위 상태 줄(⚠️)에 이미 있다.
250
500
  if (missing.length > 0) {
251
- lines.push('', '── 다음 단계 (필수) ─────────────────────────────', ...missing);
501
+ lines.push('', m.nextHeader, ...missing);
252
502
  }
253
503
  else {
254
- lines.push('', '✅ 필수 연결 모두 완료. 앱 출시 작업을 시작할 수 있습니다.');
504
+ lines.push('', m.allDone);
255
505
  }
256
506
  // ── 프로젝트 매니페스트(.mimi-seed.json) 기반 요구사항 ────────────────────
257
507
  // 이 저장소가 "무엇을 필요로 하는가"를 선언해두면, 범용 스캔 대신
258
508
  // "이 프로젝트에서 너한테 빠진 것 + 정확한 셋업 명령"을 팀원별로 보여준다.
259
- const loaded = findProjectManifest();
509
+ const manifestLookup = lookupProjectManifest();
510
+ if (manifestLookup.state === 'invalid') {
511
+ // 깨진 매니페스트를 "없음"으로 보면 팀 요구사항 점검이 조용히 사라진다 — 점검하지 못했다고 밝힌다.
512
+ lines.push('', MF().invalid(manifestLookup.filePath, manifestLookup.reason));
513
+ }
514
+ const loaded = manifestLookup.state === 'ok' ? manifestLookup.loaded : null;
260
515
  if (loaded) {
261
516
  const oauthOk = oauthResult.status === 'fresh' || oauthResult.status === 'refreshed';
262
517
  const playstoreCovers = (pkg) => saCount > 0 &&
@@ -268,8 +523,8 @@ export function registerAuthTools(server) {
268
523
  appstore: !!asc,
269
524
  jenkins: !!jenkins,
270
525
  };
271
- const projName = loaded.manifest.displayName ?? loaded.manifest.project ?? '이 프로젝트';
272
- const reqLines = ['', `── ${projName} 요구사항 (.mimi-seed.json) ─────────`];
526
+ const projName = loaded.manifest.displayName ?? loaded.manifest.project ?? m.thisProject;
527
+ const reqLines = ['', m.reqHeader(projName)];
273
528
  let anyMissing = false;
274
529
  for (const [id, svc] of manifestServiceEntries(loaded.manifest)) {
275
530
  const required = svc.required !== false;
@@ -279,7 +534,7 @@ export function registerAuthTools(server) {
279
534
  anyMissing = true;
280
535
  }
281
536
  if (anyMissing) {
282
- reqLines.push('', 'ℹ️ 팀 공유가 목표라면, 각자 로컬 자격증명을 채우는 대신', ' 워크스페이스(https://mimi-seed.pryzm.gg) 초대 → PAT 발급 → 원격 MCP 연결도 가능.');
537
+ reqLines.push('', ...m.teamHint);
283
538
  }
284
539
  lines.push(...reqLines);
285
540
  }
@@ -313,21 +568,18 @@ export function registerAuthTools(server) {
313
568
  const { url, wait } = startAuth(clientId, clientSecret, { domains, profile, expectedChannelId });
314
569
  // fire-and-forget — 토큰은 콜백 서버가 자동 저장
315
570
  wait.then(() => { }, (err) => { console.error('[mimi-seed auth]', err.message); });
571
+ const m = A().start;
316
572
  const scopeLine = domains?.length
317
- ? `요청 도메인: ${domains.map((d) => `${d} (${AUTH_DOMAINS[d].label})`).join(', ')} — 기존 부여 권한은 유지됨.`
318
- : `요청 도메인: 전체 (${DOMAIN_IDS.join(', ')})`;
573
+ ? m.scopeSome(domains.map((d) => `${d} (${AUTH_DOMAINS[d].label})`).join(', '))
574
+ : m.scopeAll(DOMAIN_IDS.join(', '));
319
575
  return textResult([
320
- '🔐 Google 로그인 링크 (10분 유효):',
576
+ m.linkTitle,
321
577
  '',
322
578
  url,
323
579
  '',
324
580
  scopeLine,
325
- `로그인 프로필: ${profile ?? '(기본)'} / 대상 채널: ${expectedChannelId ?? '(로그인 후 확인)'}`,
326
- 'YouTube는 Google 로그인에서 선택한 개인/브랜드 채널에 연결됩니다. 완료 후 mimi_seed_auth_status(profile=...)로 실제 채널을 확인하세요.',
327
- '',
328
- '이 URL을 브라우저에서 열고 Google 계정으로 승인해줘.',
329
- '완료되면 localhost:9876으로 자동 리다이렉트되고 토큰이 저장돼.',
330
- '이후 바로 다른 MCP 도구(playstore_*, firebase_* 등) 호출 가능.',
581
+ m.profileLine(profile, expectedChannelId),
582
+ ...m.outro,
331
583
  ]);
332
584
  });
333
585
  server.tool('mimi_seed_auth_status', 'Mimi Seed MCP 인증 상태 확인 (만료 시 refresh_token으로 자동 갱신 시도)', {
@@ -346,12 +598,13 @@ export function registerAuthTools(server) {
346
598
  const accountEmail = await resolveAccountEmail(profile);
347
599
  return textResult(JSON.stringify({ profile, status: result.status, accountEmail, youtubeChannel: channel, loginAttempt, profiles }));
348
600
  }
601
+ const m = A().authStatus;
349
602
  const r = await ensureFreshAccessToken();
350
603
  const refreshHint = formatLastRefreshHint(getTokensLastRefreshMs());
351
604
  const accountLine = r.status === 'fresh' || r.status === 'refreshed'
352
- ? ` 계정: ${(await resolveAccountEmail()) ?? '(확인 불가 — 재로그인하면 기록됨)'}\n`
605
+ ? m.account(await resolveAccountEmail())
353
606
  : '';
354
- const refreshLine = `${accountLine} 마지막 갱신: ${refreshHint.label}\nGoogle profiles: ${JSON.stringify(profiles)}`;
607
+ const refreshLine = `${accountLine}${m.lastRefresh(refreshHint.label)}\nGoogle profiles: ${JSON.stringify(profiles)}`;
355
608
  const recommendation = refreshHint.recommendation ? `\n\n${refreshHint.recommendation}` : '';
356
609
  // 도메인 선택형 로그인 이후 토큰은 전체 권한이 아닐 수 있다 — 부여 현황을 함께
357
610
  // 보여준다. 유효/갱신된 상태에서만 쓰므로 그 두 arm 에서만 계산한다(불필요한 토큰
@@ -360,12 +613,12 @@ export function registerAuthTools(server) {
360
613
  const summary = summarizeGrantedDomains(getStoredTokens()?.scope);
361
614
  const domainLines = [];
362
615
  if (!summary.known) {
363
- domainLines.push(' 권한 도메인: (구 토큰 — scope 기록 없음. 재로그인하면 기록됨)');
616
+ domainLines.push(m.domainsUnknown);
364
617
  }
365
618
  else {
366
- domainLines.push(` 권한 도메인: ${summary.granted.join(', ') || '(없음)'}`);
619
+ domainLines.push(m.domains(summary.granted.join(', ')));
367
620
  if (summary.missing.length > 0) {
368
- domainLines.push(` 미부여: ${summary.missing.join(', ')} → mimi_seed_auth_start(domains=[...]) 로 추가 (기존 권한 유지)`);
621
+ domainLines.push(m.notGranted(summary.missing.join(', ')));
369
622
  }
370
623
  }
371
624
  return `\n${domainLines.join('\n')}`;
@@ -375,24 +628,24 @@ export function registerAuthTools(server) {
375
628
  return textResult(`❌ [${r.error.code}] ${r.error.message}\n` +
376
629
  (r.error.hint ? `→ ${r.error.hint}\n\n` : '\n') +
377
630
  `Google profiles: ${JSON.stringify(profiles)}\n` +
378
- '터미널에서 실행:\n npx -y @yoonion/mimi-seed-mcp mimi-seed-auth');
631
+ m.runInTerminal);
379
632
  case 'fresh': {
380
633
  const min = Math.round(r.msUntilExpiry / 60000);
381
- return textResult(`✅ 인증 유효 (${min}분 남음).\n${refreshLine}${domainStatusBlock()}${recommendation}`);
634
+ return textResult(`${m.fresh(min)}\n${refreshLine}${domainStatusBlock()}${recommendation}`);
382
635
  }
383
636
  case 'refreshed': {
384
637
  const min = Math.round(r.msUntilExpiry / 60000);
385
- return textResult(`✅ 토큰 만료 → refresh_token으로 자동 갱신 완료 (${min}분 남음).\n${refreshLine}${domainStatusBlock()}${recommendation}`);
638
+ return textResult(`${m.refreshed(min)}\n${refreshLine}${domainStatusBlock()}${recommendation}`);
386
639
  }
387
640
  case 'expired_refresh_failed':
388
- return textResult(`⚠️ 토큰 만료 + 자동 갱신 실패\n` +
389
- ` 코드: ${r.error.code}\n` +
641
+ return textResult(`${m.refreshFailed}\n` +
642
+ `${m.code(r.error.code)}\n` +
390
643
  ` ${r.error.message}\n` +
391
644
  (r.error.hint ? ` → ${r.error.hint}\n` : '') +
392
645
  `${refreshLine}` +
393
646
  // 재로그인 안내는 그것이 실제 해법일 때만 (네트워크/설정 조회 실패엔 무의미)
394
647
  (r.error.needsReauth
395
- ? '\n\n터미널에서 재로그인:\n npx -y @yoonion/mimi-seed-mcp mimi-seed-auth'
648
+ ? m.reloginInTerminal
396
649
  : ''));
397
650
  }
398
651
  });