@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.
- package/dist/admob/cli.js +34 -5
- package/dist/admob/errors.js +39 -14
- package/dist/ai/client.js +35 -14
- package/dist/ai/notes.js +14 -3
- package/dist/ai/review.js +17 -4
- package/dist/android/keystore-store.js +28 -8
- package/dist/android/keystore.d.ts +17 -2
- package/dist/android/keystore.js +110 -21
- package/dist/android/messages.d.ts +13 -11
- package/dist/android/messages.js +166 -72
- package/dist/android/playstore-sa.js +6 -3
- package/dist/appstore/analytics.js +46 -14
- package/dist/appstore/app-info-policy.js +7 -1
- package/dist/appstore/app-info.js +13 -3
- package/dist/appstore/apps.js +7 -1
- package/dist/appstore/asset-library-write.js +119 -37
- package/dist/appstore/asset-library.js +19 -5
- package/dist/appstore/auth.d.ts +2 -0
- package/dist/appstore/auth.js +31 -5
- package/dist/appstore/client.js +27 -6
- package/dist/appstore/declarations.js +22 -6
- package/dist/appstore/errors.d.ts +1 -1
- package/dist/appstore/errors.js +60 -34
- package/dist/appstore/http.d.ts +6 -0
- package/dist/appstore/http.js +22 -5
- package/dist/appstore/messages.js +86 -28
- package/dist/appstore/previews.js +22 -6
- package/dist/appstore/product-localization.js +10 -2
- package/dist/appstore/product-review.js +29 -10
- package/dist/appstore/products.js +20 -6
- package/dist/appstore/read-response.js +13 -3
- package/dist/appstore/release-target.js +13 -3
- package/dist/appstore/release.js +59 -22
- package/dist/appstore/review-preview.js +17 -6
- package/dist/appstore/review-submission.js +86 -35
- package/dist/appstore/sales.js +96 -44
- package/dist/appstore/screenshots.js +19 -5
- package/dist/appstore/testflight.js +41 -18
- package/dist/appstore/upload-parts.js +12 -3
- package/dist/appstore/versions.js +22 -10
- package/dist/auth/bigquery-auth.js +44 -15
- package/dist/auth/bigquery-setup-cli.js +1 -1
- package/dist/auth/cli.js +4 -2
- package/dist/auth/constants.js +13 -3
- package/dist/auth/drive-auth.d.ts +3 -2
- package/dist/auth/drive-auth.js +47 -17
- package/dist/auth/drive-setup-cli.js +1 -0
- package/dist/auth/errors.d.ts +75 -0
- package/dist/auth/errors.js +190 -86
- package/dist/auth/google-auth.d.ts +3 -1
- package/dist/auth/google-auth.js +39 -27
- package/dist/auth/playstore-auth.d.ts +1 -0
- package/dist/auth/playstore-auth.js +35 -15
- package/dist/auth/scopes.d.ts +11 -29
- package/dist/auth/scopes.js +38 -11
- package/dist/auth/youtube-channel.d.ts +8 -0
- package/dist/auth/youtube-channel.js +11 -3
- package/dist/bigquery/ids.js +19 -5
- package/dist/bigquery/tools.js +24 -8
- package/dist/billing/tools.js +22 -6
- package/dist/checks/appstore-submission.d.ts +1 -1
- package/dist/checks/appstore-submission.js +29 -8
- package/dist/checks/plan.js +169 -62
- package/dist/checks/release-status.js +10 -2
- package/dist/checks/risks.js +230 -63
- package/dist/checks/screenshots.d.ts +4 -4
- package/dist/checks/screenshots.js +63 -22
- package/dist/ci/config.js +8 -5
- package/dist/ci/gitlab.js +3 -1
- package/dist/core/atomic-write.d.ts +5 -2
- package/dist/core/atomic-write.js +8 -4
- package/dist/core/catch-scan.d.ts +17 -0
- package/dist/core/catch-scan.js +111 -0
- package/dist/core/checks/billing.d.ts +5 -0
- package/dist/core/checks/billing.js +36 -5
- package/dist/core/checks/lockfile.js +2 -0
- package/dist/core/checks/release-doctor/fcm.js +1 -0
- package/dist/core/checks/release-doctor/files.d.ts +3 -1
- package/dist/core/checks/release-doctor/files.js +12 -1
- package/dist/core/checks/release-doctor/gradle-apply.js +1 -0
- package/dist/core/checks/release-doctor/ios-xcode.js +22 -3
- package/dist/core/checks/release-doctor/target-sdk.js +1 -1
- package/dist/core/checks/release-doctor/util.d.ts +5 -0
- package/dist/core/checks/release-doctor/util.js +56 -0
- package/dist/core/checks/release-doctor.js +59 -16
- package/dist/core/credential-envelope.d.ts +25 -0
- package/dist/core/credential-envelope.js +66 -0
- package/dist/core/credential-keystore.d.ts +37 -0
- package/dist/core/credential-keystore.js +275 -0
- package/dist/core/credential-read.d.ts +33 -0
- package/dist/core/credential-read.js +112 -0
- package/dist/core/credential-store.d.ts +61 -0
- package/dist/core/credential-store.js +240 -0
- package/dist/core/http-errors.js +1 -0
- package/dist/core/i18n-scan.d.ts +10 -0
- package/dist/core/i18n-scan.js +79 -0
- package/dist/core/json-file.d.ts +30 -0
- package/dist/core/json-file.js +53 -0
- package/dist/core/lang.d.ts +14 -0
- package/dist/core/lang.js +22 -2
- package/dist/core/project-manifest.d.ts +24 -1
- package/dist/core/project-manifest.js +27 -16
- package/dist/drive/tools.js +86 -34
- package/dist/facebook/api.js +3 -1
- package/dist/facebook/config.js +11 -3
- package/dist/facebook/setup.d.ts +2 -0
- package/dist/facebook/setup.js +32 -9
- package/dist/firebase/cli.js +39 -5
- package/dist/firebase/tools.js +36 -10
- package/dist/ga4/cli.js +48 -4
- package/dist/ga4/tools.js +4 -2
- package/dist/googleads/config.js +24 -8
- package/dist/googleads/tools.js +3 -1
- package/dist/gsc/tools.js +10 -2
- package/dist/helpers.d.ts +4 -2
- package/dist/helpers.js +66 -32
- package/dist/i18n/manifest-en.d.ts +6 -0
- package/dist/i18n/manifest-en.js +53 -0
- package/dist/i18n/tools-en/admob.d.ts +25 -0
- package/dist/i18n/tools-en/admob.js +24 -0
- package/dist/i18n/tools-en/ai.d.ts +14 -0
- package/dist/i18n/tools-en/ai.js +13 -0
- package/dist/i18n/tools-en/android.d.ts +14 -0
- package/dist/i18n/tools-en/android.js +13 -0
- package/dist/i18n/tools-en/appstore.d.ts +240 -0
- package/dist/i18n/tools-en/appstore.js +239 -0
- package/dist/i18n/tools-en/auth.d.ts +16 -0
- package/dist/i18n/tools-en/auth.js +15 -0
- package/dist/i18n/tools-en/bigquery.d.ts +16 -0
- package/dist/i18n/tools-en/bigquery.js +15 -0
- package/dist/i18n/tools-en/billing.d.ts +17 -0
- package/dist/i18n/tools-en/billing.js +16 -0
- package/dist/i18n/tools-en/checks.d.ts +23 -0
- package/dist/i18n/tools-en/checks.js +22 -0
- package/dist/i18n/tools-en/ci.d.ts +21 -0
- package/dist/i18n/tools-en/ci.js +20 -0
- package/dist/i18n/tools-en/drive.d.ts +33 -0
- package/dist/i18n/tools-en/drive.js +32 -0
- package/dist/i18n/tools-en/facebook.d.ts +14 -0
- package/dist/i18n/tools-en/facebook.js +13 -0
- package/dist/i18n/tools-en/firebase.d.ts +42 -0
- package/dist/i18n/tools-en/firebase.js +41 -0
- package/dist/i18n/tools-en/ga4.d.ts +35 -0
- package/dist/i18n/tools-en/ga4.js +34 -0
- package/dist/i18n/tools-en/googleads.d.ts +15 -0
- package/dist/i18n/tools-en/googleads.js +14 -0
- package/dist/i18n/tools-en/gsc.d.ts +27 -0
- package/dist/i18n/tools-en/gsc.js +26 -0
- package/dist/i18n/tools-en/iam.d.ts +15 -0
- package/dist/i18n/tools-en/iam.js +14 -0
- package/dist/i18n/tools-en/index.d.ts +7 -0
- package/dist/i18n/tools-en/index.js +58 -0
- package/dist/i18n/tools-en/instagram.d.ts +16 -0
- package/dist/i18n/tools-en/instagram.js +15 -0
- package/dist/i18n/tools-en/jenkins.d.ts +41 -0
- package/dist/i18n/tools-en/jenkins.js +40 -0
- package/dist/i18n/tools-en/naver.d.ts +10 -0
- package/dist/i18n/tools-en/naver.js +9 -0
- package/dist/i18n/tools-en/playstore.d.ts +148 -0
- package/dist/i18n/tools-en/playstore.js +147 -0
- package/dist/i18n/tools-en/registrar.d.ts +6 -0
- package/dist/i18n/tools-en/registrar.js +6 -0
- package/dist/i18n/tools-en/threads.d.ts +21 -0
- package/dist/i18n/tools-en/threads.js +20 -0
- package/dist/i18n/tools-en/tiktok.d.ts +21 -0
- package/dist/i18n/tools-en/tiktok.js +20 -0
- package/dist/i18n/tools-en/video.d.ts +59 -0
- package/dist/i18n/tools-en/video.js +58 -0
- package/dist/i18n/tools-en/youtube.d.ts +44 -0
- package/dist/i18n/tools-en/youtube.js +43 -0
- package/dist/iam/key-files.js +13 -3
- package/dist/instagram/api.js +19 -5
- package/dist/instagram/config.js +11 -3
- package/dist/instagram/setup.js +37 -11
- package/dist/jenkins/builds.d.ts +2 -2
- package/dist/jenkins/builds.js +70 -30
- package/dist/jenkins/config.d.ts +5 -0
- package/dist/jenkins/config.js +25 -6
- package/dist/jenkins/credentials.js +33 -13
- package/dist/jenkins/http.js +6 -3
- package/dist/jenkins/jobs.js +19 -5
- package/dist/jenkins/messages.js +93 -36
- package/dist/lib/cli-args.js +13 -7
- package/dist/lib/google-errors.js +31 -9
- package/dist/lib/http.js +10 -3
- package/dist/lib/json-file.d.ts +15 -0
- package/dist/lib/json-file.js +65 -0
- package/dist/lib/meta-auth.d.ts +1 -1
- package/dist/lib/meta-auth.js +26 -8
- package/dist/lib/package-name.js +15 -4
- package/dist/lib/package-root.js +1 -1
- package/dist/lib/paginate.js +10 -2
- package/dist/lib/path-containment.js +22 -6
- package/dist/lib/resource-id.js +10 -3
- package/dist/lib/store-create-result.js +54 -13
- package/dist/lib/text-validators.js +20 -5
- package/dist/lib/tool-registrar.d.ts +9 -0
- package/dist/lib/tool-registrar.js +33 -14
- package/dist/lib/tool-text.d.ts +31 -0
- package/dist/lib/tool-text.js +52 -0
- package/dist/lib/toolsets.js +13 -3
- package/dist/lib/url-path.js +3 -1
- package/dist/naver/tools.js +138 -46
- package/dist/playstore/data-safety.js +16 -4
- package/dist/playstore/errors.js +33 -8
- package/dist/playstore/financials.js +83 -35
- package/dist/playstore/listing.js +7 -1
- package/dist/playstore/messages.js +179 -57
- package/dist/playstore/products.js +10 -2
- package/dist/playstore/recovery.js +10 -2
- package/dist/playstore/releases.js +34 -14
- package/dist/playstore/reviews.js +14 -4
- package/dist/playstore/statistics.js +3 -1
- package/dist/prompts.js +160 -50
- package/dist/registers/admob.js +36 -11
- package/dist/registers/android.js +25 -9
- package/dist/registers/appstore/apps.js +22 -6
- package/dist/registers/appstore/customer-reviews.js +7 -1
- package/dist/registers/appstore/declarations.js +63 -19
- package/dist/registers/appstore/media.js +76 -24
- package/dist/registers/appstore/metadata.js +26 -8
- package/dist/registers/appstore/products.js +53 -19
- package/dist/registers/appstore/review-submission.js +31 -9
- package/dist/registers/appstore/testflight.js +82 -24
- package/dist/registers/appstore/versions.js +88 -30
- package/dist/registers/auth.js +343 -90
- package/dist/registers/bigquery.js +54 -14
- package/dist/registers/billing.js +18 -4
- package/dist/registers/checks.js +20 -5
- package/dist/registers/ci.js +60 -20
- package/dist/registers/drive.js +18 -7
- package/dist/registers/facebook.js +31 -9
- package/dist/registers/firebase.js +21 -7
- package/dist/registers/googleads.js +23 -6
- package/dist/registers/gsc.js +3 -1
- package/dist/registers/iam.js +44 -13
- package/dist/registers/instagram.js +19 -5
- package/dist/registers/jenkins.js +43 -14
- package/dist/registers/naver.js +13 -3
- package/dist/registers/playstore/financials.d.ts +6 -0
- package/dist/registers/playstore/financials.js +48 -0
- package/dist/registers/playstore/listing.d.ts +15 -0
- package/dist/registers/playstore/listing.js +138 -0
- package/dist/registers/playstore/media.d.ts +6 -0
- package/dist/registers/playstore/media.js +56 -0
- package/dist/registers/playstore/products.d.ts +21 -0
- package/dist/registers/playstore/products.js +238 -0
- package/dist/registers/playstore/recovery.d.ts +11 -0
- package/dist/registers/playstore/recovery.js +105 -0
- package/dist/registers/playstore/releases.d.ts +8 -0
- package/dist/registers/playstore/releases.js +157 -0
- package/dist/registers/playstore/reviews.d.ts +6 -0
- package/dist/registers/playstore/reviews.js +43 -0
- package/dist/registers/playstore/service-accounts.d.ts +13 -0
- package/dist/registers/playstore/service-accounts.js +127 -0
- package/dist/registers/playstore/shared.d.ts +12 -0
- package/dist/registers/playstore/shared.js +24 -0
- package/dist/registers/playstore.d.ts +8 -0
- package/dist/registers/playstore.js +28 -734
- package/dist/registers/threads.js +28 -8
- package/dist/registers/tiktok.js +4 -2
- package/dist/registers/video.js +3 -1
- package/dist/remote-sync.js +80 -28
- package/dist/resources.d.ts +0 -8
- package/dist/resources.js +73 -32
- package/dist/server.d.ts +2 -0
- package/dist/server.js +9 -1
- package/dist/social/profile-store.js +36 -12
- package/dist/social/setup-cli.js +1 -1
- package/dist/threads/api.js +23 -6
- package/dist/threads/setup.js +42 -14
- package/dist/tiktok-business/api.js +13 -3
- package/dist/tiktok-business/auth.js +10 -2
- package/dist/tiktok-business/config.js +8 -3
- package/dist/tiktok-business/posting.d.ts +6 -0
- package/dist/tiktok-business/posting.js +118 -36
- package/dist/tiktok-business/setup-cli.js +3 -1
- package/dist/tools-cli.js +4 -5
- package/dist/video/captions.js +3 -1
- package/dist/video/files.js +13 -3
- package/dist/video/project.js +65 -21
- package/dist/video/providers.js +52 -16
- package/dist/video/render.js +71 -22
- package/dist/video/research.js +10 -2
- package/dist/video/schemas.js +19 -5
- package/dist/video/youtube-publish.js +62 -32
- package/package.json +1 -1
package/dist/lib/cli-args.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { catalog } from '#core/lang.js';
|
|
2
|
+
const M = catalog({
|
|
3
|
+
valueMissing: (name) => `--${name} 에 값이 필요합니다 (값 없이 단독으로 쓰였습니다). 값이 '--'로 시작하면 --${name}=값 형태로 쓰세요.`,
|
|
4
|
+
required: (name) => `--${name} 가 필요합니다.`,
|
|
5
|
+
unknown: (cmd) => `❌ 알 수 없는 서브커맨드: ${cmd}\n\n`,
|
|
6
|
+
}, {
|
|
7
|
+
valueMissing: (name) => `--${name} needs a value (it was given alone, with no value). If the value starts with '--', write it as --${name}=value.`,
|
|
8
|
+
required: (name) => `--${name} is required.`,
|
|
9
|
+
unknown: (cmd) => `❌ Unknown subcommand: ${cmd}\n\n`,
|
|
10
|
+
});
|
|
5
11
|
/** process.argv.slice(2) 같은 토큰 배열을 파싱. */
|
|
6
12
|
export function parseArgs(argv) {
|
|
7
13
|
const flags = {};
|
|
@@ -42,9 +48,9 @@ export function requireFlag(p, name) {
|
|
|
42
48
|
const v = p.flags[name];
|
|
43
49
|
if (v === undefined || v === '') {
|
|
44
50
|
if (p.bools.has(name)) {
|
|
45
|
-
throw new CliUsageError(
|
|
51
|
+
throw new CliUsageError(M().valueMissing(name));
|
|
46
52
|
}
|
|
47
|
-
throw new CliUsageError(
|
|
53
|
+
throw new CliUsageError(M().required(name));
|
|
48
54
|
}
|
|
49
55
|
return v;
|
|
50
56
|
}
|
|
@@ -82,7 +88,7 @@ export async function runDomainCli(opts) {
|
|
|
82
88
|
}
|
|
83
89
|
const handler = opts.handlers[p.command];
|
|
84
90
|
if (!handler) {
|
|
85
|
-
process.stderr.write(
|
|
91
|
+
process.stderr.write(M().unknown(p.command) + opts.help + '\n');
|
|
86
92
|
process.exit(1);
|
|
87
93
|
}
|
|
88
94
|
try {
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
// Google API 에러 친절화 (Firebase / Cloud Resource Manager / 공용 OAuth).
|
|
2
2
|
// raw GaxiosError dump 대신 "무엇을 어떻게 고칠지"를 즉시 보여준다.
|
|
3
3
|
// 인식 못 한 에러는 원본을 그대로 보존한다.
|
|
4
|
-
|
|
4
|
+
import { catalog } from '#core/lang.js';
|
|
5
|
+
const M = catalog({
|
|
6
|
+
reauth: '터미널에서 재로그인:\n npx -y @yoonion/mimi-seed-mcp mimi-seed-auth',
|
|
7
|
+
authExpired: '❌ Google 인증이 만료됐거나 권한이 부족해요.',
|
|
8
|
+
apiDisabled: '❌ 필요한 Google API가 비활성화돼 있어요.',
|
|
9
|
+
activate: (url) => `→ 활성화: ${url}`,
|
|
10
|
+
activateInConsole: '→ Google Cloud Console에서 해당 API를 활성화한 뒤 다시 시도하세요.',
|
|
11
|
+
billingDisabled: '❌ 결제(billing)가 비활성화된 프로젝트예요.\n→ Google Cloud Console → 결제 에서 결제 계정을 연결하세요.',
|
|
12
|
+
alreadyExists: '❌ 이미 사용 중인 ID예요 (GCP 프로젝트 ID는 전역에서 유일해야 함).\n→ 다른 projectId로 다시 시도하거나, firebase_get_project 로 소유권을 확인하세요.',
|
|
13
|
+
notFound: '❌ 프로젝트/리소스를 찾을 수 없어요.\n→ firebase_list_projects 로 유효한 projectId를 확인하세요.',
|
|
14
|
+
forbidden: '❌ 권한 부족 — 이 Google 계정이 해당 프로젝트에 접근 권한이 있는지 확인하세요.',
|
|
15
|
+
}, {
|
|
16
|
+
reauth: 'Sign in again in a terminal:\n npx -y @yoonion/mimi-seed-mcp mimi-seed-auth',
|
|
17
|
+
authExpired: '❌ Google authentication has expired or lacks the required permissions.',
|
|
18
|
+
apiDisabled: '❌ A required Google API is disabled.',
|
|
19
|
+
activate: (url) => `→ Enable it: ${url}`,
|
|
20
|
+
activateInConsole: '→ Enable the API in Google Cloud Console, then try again.',
|
|
21
|
+
billingDisabled: '❌ Billing is disabled for this project.\n→ Link a billing account in Google Cloud Console → Billing.',
|
|
22
|
+
alreadyExists: '❌ This ID is already in use (GCP project IDs must be globally unique).\n→ Try again with a different projectId, or check ownership with firebase_get_project.',
|
|
23
|
+
notFound: '❌ Project/resource not found.\n→ Check for a valid projectId with firebase_list_projects.',
|
|
24
|
+
forbidden: '❌ Insufficient permissions — check that this Google account has access to the project.',
|
|
25
|
+
});
|
|
5
26
|
export function extractHttpStatus(e) {
|
|
6
27
|
if (e && typeof e === 'object') {
|
|
7
28
|
const any = e;
|
|
@@ -57,13 +78,14 @@ export function googleErrorDetail(e) {
|
|
|
57
78
|
/** invalid_grant / 만료 refresh_token / 부족 scope → 재로그인 안내 메시지. 아니면 null. */
|
|
58
79
|
export function authReauthMessage(text) {
|
|
59
80
|
if (/invalid_grant|invalid_rapt|rapt_required|unauthorized_client|ACCESS_TOKEN_SCOPE_INSUFFICIENT|insufficient.*scope/i.test(text)) {
|
|
60
|
-
return [
|
|
81
|
+
return [M().authExpired, '', M().reauth].join('\n');
|
|
61
82
|
}
|
|
62
83
|
return null;
|
|
63
84
|
}
|
|
64
85
|
function extractActivationUrl(text) {
|
|
65
86
|
const m = text.match(/https?:\/\/console\.(?:developers|cloud)\.google\.com\/\S+/);
|
|
66
|
-
|
|
87
|
+
// 따옴표를 \u0027/\u0022 로 쓴 이유: i18n 스캐너(#core/i18n-scan.js)는 정규식 리터럴 안의 ' " 를 문자열 시작으로 읽는다.
|
|
88
|
+
return m?.[0]?.replace(/[).,\u0027\u0022]+$/, '');
|
|
67
89
|
}
|
|
68
90
|
export function withCause(err, cause) {
|
|
69
91
|
err.cause = cause;
|
|
@@ -91,21 +113,21 @@ export function friendlyGoogleError(e) {
|
|
|
91
113
|
if (/SERVICE_DISABLED|has not been used in project|is disabled|accessNotConfigured/i.test(text)) {
|
|
92
114
|
const url = extractActivationUrl(text);
|
|
93
115
|
return withCause(new Error(withPartialNote(e, [
|
|
94
|
-
|
|
95
|
-
url ?
|
|
116
|
+
M().apiDisabled,
|
|
117
|
+
url ? M().activate(url) : M().activateInConsole,
|
|
96
118
|
].join('\n'))), e);
|
|
97
119
|
}
|
|
98
120
|
if (/BILLING_DISABLED|billing.*(disabled|not enabled|required)/i.test(text)) {
|
|
99
|
-
return withCause(new Error(withPartialNote(e,
|
|
121
|
+
return withCause(new Error(withPartialNote(e, M().billingDisabled)), e);
|
|
100
122
|
}
|
|
101
123
|
if (/ALREADY_EXISTS|already exists|already in use/i.test(text)) {
|
|
102
|
-
return withCause(new Error(withPartialNote(e,
|
|
124
|
+
return withCause(new Error(withPartialNote(e, M().alreadyExists)), e);
|
|
103
125
|
}
|
|
104
126
|
if (status === 404 || /NOT_FOUND|not found/i.test(text)) {
|
|
105
|
-
return withCause(new Error(withPartialNote(e,
|
|
127
|
+
return withCause(new Error(withPartialNote(e, M().notFound)), e);
|
|
106
128
|
}
|
|
107
129
|
if (status === 403 || /PERMISSION_DENIED|forbidden|permission/i.test(text)) {
|
|
108
|
-
return withCause(new Error(withPartialNote(e,
|
|
130
|
+
return withCause(new Error(withPartialNote(e, M().forbidden)), e);
|
|
109
131
|
}
|
|
110
132
|
const note = e?.partialFailureNote;
|
|
111
133
|
if (note)
|
package/dist/lib/http.js
CHANGED
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
// 규칙: 새 provider 클라이언트를 만들 때 raw `fetch` 를 쓰지 말고 이 래퍼를 쓸 것
|
|
13
13
|
// (`__tests__/http-timeout.test.ts` 가 강제한다).
|
|
14
14
|
import { endpointLabel as sharedEndpointLabel, isTimeoutAbort } from '#core/http-errors.js';
|
|
15
|
+
import { catalog } from '#core/lang.js';
|
|
16
|
+
const M = catalog({
|
|
17
|
+
externalServer: '외부 서버',
|
|
18
|
+
timeout: (label, sec) => `${label} 요청이 ${sec}초 안에 끝나지 않아 중단했습니다. ` + '네트워크 상태를 확인하고 다시 시도하세요.',
|
|
19
|
+
}, {
|
|
20
|
+
externalServer: 'external server',
|
|
21
|
+
timeout: (label, sec) => `The ${label} request did not finish within ${sec} seconds and was aborted. Check the network and try again.`,
|
|
22
|
+
});
|
|
15
23
|
/** JSON/메타데이터 API 의 기본 상한. 대부분의 Google·Apple·Meta·Jenkins 호출. */
|
|
16
24
|
export const HTTP_TIMEOUT_MS = 60_000;
|
|
17
25
|
/**
|
|
@@ -59,7 +67,7 @@ const TRANSIENT_STATUS = new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
|
59
67
|
/**
|
|
60
68
|
* 에러 메시지에 쓸 엔드포인트 라벨 — 쿼리스트링(토큰)을 버리는 규칙은 CLI 래퍼와 공유한다(#core/http-errors.js).
|
|
61
69
|
*/
|
|
62
|
-
const endpointLabel = (input) => sharedEndpointLabel(input,
|
|
70
|
+
const endpointLabel = (input) => sharedEndpointLabel(input, M().externalServer);
|
|
63
71
|
/**
|
|
64
72
|
* 본문을 다시 보낼 수 있는가.
|
|
65
73
|
*
|
|
@@ -151,8 +159,7 @@ export async function fetchWithTimeout(input, init = {}, options = {}) {
|
|
|
151
159
|
// 타임아웃은 재시도하지 않는다. 이미 예산을 통째로 쓴 실패이고, 같은 상한으로
|
|
152
160
|
// 두 번 더 기다려도 얻는 게 없다 — 총 소요 시간만 배로 늘린다.
|
|
153
161
|
if (isTimeoutAbort(error)) {
|
|
154
|
-
throw new Error(
|
|
155
|
-
'네트워크 상태를 확인하고 다시 시도하세요.', { cause: error });
|
|
162
|
+
throw new Error(M().timeout(endpointLabel(input), Math.round(attemptTimeout / 1000)), { cause: error });
|
|
156
163
|
}
|
|
157
164
|
// 응답 전 실패는 서버가 요청을 받았는지 알 수 없다 → idempotent 에서만 재시도.
|
|
158
165
|
if (!idempotent || !hasBudget(attempt + 1))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { readJsonFile, jsonFileProblem, type JsonFileRead } from '#core/json-file.js';
|
|
2
|
+
/**
|
|
3
|
+
* "설정이 없습니다" 안내 직전에 부른다 — 파일이 깨진 경우라면 그 사실을 대신 알린다.
|
|
4
|
+
* 다시 설정하면 파일을 통째로 새로 쓰므로 복구 명령은 원래 안내와 같다; 달라지는 건 원인을 밝히는 것뿐이다.
|
|
5
|
+
*/
|
|
6
|
+
export declare function assertCredentialFileReadable(file: string, fixHint: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* `~/.mimi-seed` 아래(최상위 + 한 단계 하위 폴더)의 *.json 중 읽거나 파싱할 수 없는 파일.
|
|
9
|
+
* 진단(mimi_seed_status)용 — 어떤 도구의 파일인지 몰라도 "깨진 파일이 있다"는 사실은 알려야 한다.
|
|
10
|
+
* 점으로 시작하는 폴더(.jobs 등 내부 작업 폴더)는 건너뛴다.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findInvalidJsonFiles(root: string): Array<{
|
|
13
|
+
file: string;
|
|
14
|
+
reason: string;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { catalog } from '#core/lang.js';
|
|
4
|
+
import { jsonFileProblem, readJsonFile } from '#core/json-file.js';
|
|
5
|
+
// 읽기(없음/정상/깨짐)와 원인 문구는 CLI 와 공유하는 core 에 있다. 여기는 MCP 전용 안내만 더한다.
|
|
6
|
+
export { readJsonFile, jsonFileProblem } from '#core/json-file.js';
|
|
7
|
+
const MSG = catalog({
|
|
8
|
+
corrupt: (file, reason, fix) => `❌ 설정 파일이 손상되어 읽을 수 없습니다: ${file}\n 원인: ${reason}\n → 파일을 고치거나 지운 뒤 다시 설정하세요: ${fix}`,
|
|
9
|
+
locked: (file, reason, fix) => `❌ 암호화된 설정 파일을 열 수 없습니다: ${file}\n 원인: ${reason}\n → 다시 설정하세요: ${fix}`,
|
|
10
|
+
}, {
|
|
11
|
+
corrupt: (file, reason, fix) => `❌ The settings file is damaged and cannot be read: ${file}\n Cause: ${reason}\n → Fix or delete the file, then set it up again: ${fix}`,
|
|
12
|
+
locked: (file, reason, fix) => `❌ The encrypted settings file cannot be opened: ${file}\n Cause: ${reason}\n → Set it up again: ${fix}`,
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* "설정이 없습니다" 안내 직전에 부른다 — 파일이 깨진 경우라면 그 사실을 대신 알린다.
|
|
16
|
+
* 다시 설정하면 파일을 통째로 새로 쓰므로 복구 명령은 원래 안내와 같다; 달라지는 건 원인을 밝히는 것뿐이다.
|
|
17
|
+
*/
|
|
18
|
+
export function assertCredentialFileReadable(file, fixHint) {
|
|
19
|
+
const read = readJsonFile(file);
|
|
20
|
+
// 잠김(암호화됐는데 이 컴퓨터에 키가 없음)은 '손상'이 아니다 — 고칠 게 없고 다시 설정하면 된다.
|
|
21
|
+
if (read.state === 'locked')
|
|
22
|
+
throw new Error(MSG().locked(file, read.reason, fixHint));
|
|
23
|
+
if (read.state === 'invalid')
|
|
24
|
+
throw new Error(MSG().corrupt(file, read.reason, fixHint));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* `~/.mimi-seed` 아래(최상위 + 한 단계 하위 폴더)의 *.json 중 읽거나 파싱할 수 없는 파일.
|
|
28
|
+
* 진단(mimi_seed_status)용 — 어떤 도구의 파일인지 몰라도 "깨진 파일이 있다"는 사실은 알려야 한다.
|
|
29
|
+
* 점으로 시작하는 폴더(.jobs 등 내부 작업 폴더)는 건너뛴다.
|
|
30
|
+
*/
|
|
31
|
+
export function findInvalidJsonFiles(root) {
|
|
32
|
+
const out = [];
|
|
33
|
+
const scan = (dir, depth) => {
|
|
34
|
+
let entries;
|
|
35
|
+
try {
|
|
36
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return; // 폴더가 없거나 못 읽음 — 진단은 있는 것만 본다.
|
|
40
|
+
}
|
|
41
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
42
|
+
const full = path.join(dir, entry.name);
|
|
43
|
+
if (entry.isDirectory()) {
|
|
44
|
+
if (depth > 0 && !entry.name.startsWith('.'))
|
|
45
|
+
scan(full, depth - 1);
|
|
46
|
+
}
|
|
47
|
+
else if (entry.name.endsWith('.json')) {
|
|
48
|
+
// 일반 파일만 읽는다 — *.json 이름의 FIFO·소켓을 readFileSync 하면 stdio 서버가 영원히 멈춘다.
|
|
49
|
+
// 심볼릭 링크는 따라가서 대상이 일반 파일일 때만.
|
|
50
|
+
let regular = false;
|
|
51
|
+
try {
|
|
52
|
+
regular = fs.statSync(full).isFile();
|
|
53
|
+
}
|
|
54
|
+
catch { /* 끊긴 링크 — 읽을 게 없다 */ }
|
|
55
|
+
if (!regular)
|
|
56
|
+
continue;
|
|
57
|
+
const problem = jsonFileProblem(full);
|
|
58
|
+
if (problem)
|
|
59
|
+
out.push({ file: full, reason: problem });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
scan(root, 1);
|
|
64
|
+
return out;
|
|
65
|
+
}
|
package/dist/lib/meta-auth.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export declare function metaTokenFreshness(expiresAt: string | undefined, now?:
|
|
|
8
8
|
export declare function metaExpiryMessage(expiresAt: string | undefined, fix: string): string;
|
|
9
9
|
/** Provider 원문은 유지하되 access token 모양은 절대 오류 메시지에 남기지 않는다. */
|
|
10
10
|
export declare function redactMetaSecrets(message: string): string;
|
|
11
|
-
/** Meta OAuth
|
|
11
|
+
/** Translates a Meta OAuth expiry/revocation into a command the user can run to recover right away. */
|
|
12
12
|
export declare function metaApiError(platform: MetaPlatform, status: number, message: string, code?: number): Error;
|
package/dist/lib/meta-auth.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
import { catalog } from '#core/lang.js';
|
|
2
|
+
const M = catalog({
|
|
3
|
+
expired: (fix) => `❌ 토큰 만료 — ${fix}`,
|
|
4
|
+
expiring: (days, fix) => `⚠️ 토큰 ${days}일 남음 — 지금 갱신 권장: ${fix}`,
|
|
5
|
+
fresh: (days) => `토큰: ${days}일 남음`,
|
|
6
|
+
unknown: (fix) => `⚠️ 토큰 만료일 미상 — 계정 조회로 검증하고 필요하면 ${fix}`,
|
|
7
|
+
revoked: (label) => `❌ ${label} 연결이 만료되었거나 취소되었습니다.`,
|
|
8
|
+
recovery: (fix) => `복구: ${fix}`,
|
|
9
|
+
metaResponse: (msg) => `Meta 응답: ${msg}`,
|
|
10
|
+
}, {
|
|
11
|
+
expired: (fix) => `❌ Token expired — ${fix}`,
|
|
12
|
+
expiring: (days, fix) => `⚠️ Token has ${days} day(s) left — refresh now: ${fix}`,
|
|
13
|
+
fresh: (days) => `Token: ${days} day(s) left`,
|
|
14
|
+
unknown: (fix) => `⚠️ Token expiry unknown — verify by fetching the account and, if needed, ${fix}`,
|
|
15
|
+
revoked: (label) => `❌ The ${label} connection has expired or was revoked.`,
|
|
16
|
+
recovery: (fix) => `Recovery: ${fix}`,
|
|
17
|
+
metaResponse: (msg) => `Meta response: ${msg}`,
|
|
18
|
+
});
|
|
1
19
|
const LABEL = {
|
|
2
20
|
facebook: 'Facebook',
|
|
3
21
|
instagram: 'Instagram',
|
|
@@ -27,13 +45,13 @@ export function metaTokenFreshness(expiresAt, now = Date.now()) {
|
|
|
27
45
|
export function metaExpiryMessage(expiresAt, fix) {
|
|
28
46
|
const freshness = metaTokenFreshness(expiresAt);
|
|
29
47
|
if (freshness.state === 'expired')
|
|
30
|
-
return
|
|
48
|
+
return M().expired(fix);
|
|
31
49
|
if (freshness.state === 'expiring') {
|
|
32
|
-
return
|
|
50
|
+
return M().expiring(freshness.daysRemaining ?? 0, fix);
|
|
33
51
|
}
|
|
34
52
|
if (freshness.state === 'fresh')
|
|
35
|
-
return
|
|
36
|
-
return
|
|
53
|
+
return M().fresh(freshness.daysRemaining ?? 0);
|
|
54
|
+
return M().unknown(fix);
|
|
37
55
|
}
|
|
38
56
|
/** Provider 원문은 유지하되 access token 모양은 절대 오류 메시지에 남기지 않는다. */
|
|
39
57
|
export function redactMetaSecrets(message) {
|
|
@@ -43,7 +61,7 @@ export function redactMetaSecrets(message) {
|
|
|
43
61
|
.replace(/\b(?:EAA|IGAA)[A-Za-z0-9_-]+\b/g, '[REDACTED]')
|
|
44
62
|
.replace(/\bTH[A-Za-z0-9_|-]{8,}\b/g, '[REDACTED]');
|
|
45
63
|
}
|
|
46
|
-
/** Meta OAuth
|
|
64
|
+
/** Translates a Meta OAuth expiry/revocation into a command the user can run to recover right away. */
|
|
47
65
|
export function metaApiError(platform, status, message, code) {
|
|
48
66
|
const safeMessage = redactMetaSecrets(message);
|
|
49
67
|
const needsReconnect = code === 190 ||
|
|
@@ -51,9 +69,9 @@ export function metaApiError(platform, status, message, code) {
|
|
|
51
69
|
/(?:session|access token|token).*(?:expired|invalid|revoked)|error validating access token/i.test(safeMessage);
|
|
52
70
|
if (needsReconnect) {
|
|
53
71
|
return new Error([
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
M().revoked(LABEL[platform]),
|
|
73
|
+
M().recovery(FIX[platform]),
|
|
74
|
+
M().metaResponse(safeMessage),
|
|
57
75
|
].join('\n'));
|
|
58
76
|
}
|
|
59
77
|
return new Error(`${LABEL[platform]} API ${status}: ${safeMessage}`);
|
package/dist/lib/package-name.js
CHANGED
|
@@ -9,6 +9,18 @@
|
|
|
9
9
|
// 스키마(모든 register 의 packageName 파라미터)와 파일 경계(playstore-auth.ts) 양쪽에서
|
|
10
10
|
// 같은 규칙을 쓴다 — 한쪽만 막으면 다음 호출 경로가 새로 생길 때 다시 뚫린다.
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
+
import { catalog } from '#core/lang.js';
|
|
13
|
+
const M = catalog({
|
|
14
|
+
invalidAndroid: (value) => `잘못된 Android 패키지명입니다: ${value} — `
|
|
15
|
+
+ 'com.example.app 처럼 점으로 구분된 영숫자/밑줄 세그먼트여야 합니다.',
|
|
16
|
+
androidFormat: 'Android 패키지명 형식이 아닙니다 (예: com.example.app)',
|
|
17
|
+
iosFormat: 'iOS 번들 ID 형식이 아닙니다 (예: com.example.app)',
|
|
18
|
+
}, {
|
|
19
|
+
invalidAndroid: (value) => `Invalid Android package name: ${value} — `
|
|
20
|
+
+ 'it must be dot-separated alphanumeric/underscore segments, like com.example.app.',
|
|
21
|
+
androidFormat: 'Not a valid Android package name (e.g. com.example.app)',
|
|
22
|
+
iosFormat: 'Not a valid iOS bundle ID (e.g. com.example.app)',
|
|
23
|
+
});
|
|
12
24
|
/**
|
|
13
25
|
* Android applicationId 모양: 점으로 구분된 두 개 이상의 세그먼트, 첫 세그먼트는 영문자로
|
|
14
26
|
* 시작, 문자는 [A-Za-z0-9_] 만. `/`, `\`, `..`, 빈 세그먼트는 구조적으로 불가능하다.
|
|
@@ -26,17 +38,16 @@ export function isValidAndroidPackageName(value) {
|
|
|
26
38
|
/** 파일 경계용 — 스키마를 우회한 호출(내부 호출·CLI)도 여기서 막힌다. */
|
|
27
39
|
export function assertAndroidPackageName(value) {
|
|
28
40
|
if (!isValidAndroidPackageName(value)) {
|
|
29
|
-
throw new Error(
|
|
30
|
-
+ 'com.example.app 처럼 점으로 구분된 영숫자/밑줄 세그먼트여야 합니다.');
|
|
41
|
+
throw new Error(M().invalidAndroid(JSON.stringify(String(value).slice(0, 80))));
|
|
31
42
|
}
|
|
32
43
|
}
|
|
33
44
|
/** register 의 zod 파라미터용. 호출부에서 `.describe(...)` / `.optional()` 을 붙인다. */
|
|
34
45
|
export const androidPackageName = z
|
|
35
46
|
.string()
|
|
36
47
|
.max(MAX_IDENTIFIER_LENGTH)
|
|
37
|
-
.regex(ANDROID_PACKAGE_NAME_RE,
|
|
48
|
+
.regex(ANDROID_PACKAGE_NAME_RE, { error: () => M().androidFormat });
|
|
38
49
|
/** iOS 번들 ID 용 zod 파라미터. 하이픈을 허용한다. */
|
|
39
50
|
export const iosBundleId = z
|
|
40
51
|
.string()
|
|
41
52
|
.max(MAX_IDENTIFIER_LENGTH)
|
|
42
|
-
.regex(IOS_BUNDLE_ID_RE,
|
|
53
|
+
.regex(IOS_BUNDLE_ID_RE, { error: () => M().iosFormat });
|
package/dist/lib/package-root.js
CHANGED
|
@@ -15,7 +15,7 @@ export function readToolManifest() {
|
|
|
15
15
|
if (typeof manifest?.total !== 'number' ||
|
|
16
16
|
typeof manifest?.domains !== 'object' ||
|
|
17
17
|
manifest.domains === null) {
|
|
18
|
-
throw new Error('tool-manifest.json
|
|
18
|
+
throw new Error('tool-manifest.json does not have the expected shape');
|
|
19
19
|
}
|
|
20
20
|
return manifest;
|
|
21
21
|
}
|
package/dist/lib/paginate.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { catalog } from '#core/lang.js';
|
|
2
|
+
const M = catalog({
|
|
3
|
+
repeated: '목록 API 가 같은 nextPageToken 을 반복해 페이지 순회를 중단했습니다.',
|
|
4
|
+
tooMany: (n) => `목록이 ${n}페이지를 넘어 순회를 중단했습니다 — 결과가 잘리지 않도록 범위를 좁혀 다시 조회하세요.`,
|
|
5
|
+
}, {
|
|
6
|
+
repeated: 'The list API repeated the same nextPageToken, so paging stopped.',
|
|
7
|
+
tooMany: (n) => `The list exceeded ${n} pages, so paging stopped — narrow the range and query again so the results are not truncated.`,
|
|
8
|
+
});
|
|
1
9
|
// nextPageToken 을 끝까지 따라가는 수집기.
|
|
2
10
|
//
|
|
3
11
|
// 왜 필요한가: IAM 서비스 계정·Service Usage·Play 상품/구독 목록은 첫 페이지만 읽고
|
|
@@ -22,7 +30,7 @@ export async function collectPagesUpTo(fetchPage, maxPages = MAX_PAGES) {
|
|
|
22
30
|
if (!next)
|
|
23
31
|
return { items, truncated: false };
|
|
24
32
|
if (seen.has(next))
|
|
25
|
-
throw new Error(
|
|
33
|
+
throw new Error(M().repeated);
|
|
26
34
|
seen.add(next);
|
|
27
35
|
token = next;
|
|
28
36
|
}
|
|
@@ -32,7 +40,7 @@ export async function collectPagesUpTo(fetchPage, maxPages = MAX_PAGES) {
|
|
|
32
40
|
export async function collectPages(fetchPage, maxPages = MAX_PAGES) {
|
|
33
41
|
const { items, truncated } = await collectPagesUpTo(fetchPage, maxPages);
|
|
34
42
|
if (truncated) {
|
|
35
|
-
throw new Error(
|
|
43
|
+
throw new Error(M().tooMany(maxPages));
|
|
36
44
|
}
|
|
37
45
|
return items;
|
|
38
46
|
}
|
|
@@ -7,9 +7,25 @@
|
|
|
7
7
|
// 양쪽 모두 realpath 로 비교한다.
|
|
8
8
|
import fs from 'node:fs';
|
|
9
9
|
import path from 'node:path';
|
|
10
|
+
import { catalog } from '#core/lang.js';
|
|
11
|
+
const M = catalog({
|
|
12
|
+
absolute: (label, c) => `${label} 경로는 절대경로여야 합니다: ${c}`,
|
|
13
|
+
noBase: (label, base) => `${label}: ${base} 가 없습니다 — 이 도구가 만든 파일만 사용할 수 있습니다.`,
|
|
14
|
+
missing: (label, c) => `${label} 파일이 없습니다: ${c}`,
|
|
15
|
+
outside: (label, base, c) => `${label} 파일은 ${base} 안에 있어야 합니다: ${c}`,
|
|
16
|
+
notFile: (label, c) => `${label} 경로가 파일이 아닙니다: ${c}`,
|
|
17
|
+
ext: (label, exts, c) => `${label} 파일 확장자는 ${exts} 중 하나여야 합니다: ${c}`,
|
|
18
|
+
}, {
|
|
19
|
+
absolute: (label, c) => `${label} path must be absolute: ${c}`,
|
|
20
|
+
noBase: (label, base) => `${label}: ${base} does not exist — only files created by this tool can be used.`,
|
|
21
|
+
missing: (label, c) => `${label} file does not exist: ${c}`,
|
|
22
|
+
outside: (label, base, c) => `${label} file must be inside ${base}: ${c}`,
|
|
23
|
+
notFile: (label, c) => `${label} path is not a file: ${c}`,
|
|
24
|
+
ext: (label, exts, c) => `${label} file extension must be one of ${exts}: ${c}`,
|
|
25
|
+
});
|
|
10
26
|
export function resolveInsideDir(baseDir, candidate, options) {
|
|
11
27
|
if (!path.isAbsolute(candidate)) {
|
|
12
|
-
throw new Error(
|
|
28
|
+
throw new Error(M().absolute(options.label, candidate));
|
|
13
29
|
}
|
|
14
30
|
let base;
|
|
15
31
|
let real;
|
|
@@ -17,23 +33,23 @@ export function resolveInsideDir(baseDir, candidate, options) {
|
|
|
17
33
|
base = fs.realpathSync(baseDir);
|
|
18
34
|
}
|
|
19
35
|
catch {
|
|
20
|
-
throw new Error(
|
|
36
|
+
throw new Error(M().noBase(options.label, baseDir));
|
|
21
37
|
}
|
|
22
38
|
try {
|
|
23
39
|
real = fs.realpathSync(candidate);
|
|
24
40
|
}
|
|
25
41
|
catch {
|
|
26
|
-
throw new Error(
|
|
42
|
+
throw new Error(M().missing(options.label, candidate));
|
|
27
43
|
}
|
|
28
44
|
const rel = path.relative(base, real);
|
|
29
45
|
if (!rel || rel.startsWith('..') || path.isAbsolute(rel)) {
|
|
30
|
-
throw new Error(
|
|
46
|
+
throw new Error(M().outside(options.label, baseDir, candidate));
|
|
31
47
|
}
|
|
32
48
|
if (!fs.statSync(real).isFile()) {
|
|
33
|
-
throw new Error(
|
|
49
|
+
throw new Error(M().notFile(options.label, candidate));
|
|
34
50
|
}
|
|
35
51
|
if (options.extensions && !options.extensions.includes(path.extname(real).toLowerCase())) {
|
|
36
|
-
throw new Error(
|
|
52
|
+
throw new Error(M().ext(options.label, options.extensions.join(', '), candidate));
|
|
37
53
|
}
|
|
38
54
|
return real;
|
|
39
55
|
}
|
package/dist/lib/resource-id.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { catalog } from '#core/lang.js';
|
|
2
|
+
const M = catalog({
|
|
3
|
+
invalid: (label, v) => `${label} 형식이 올바르지 않습니다: ${v} — ` + '영숫자와 - _ . : @ 만 쓸 수 있고 / 나 . / .. 단독 값은 허용하지 않습니다.',
|
|
4
|
+
unusable: (label, v) => `${label} 로 쓸 수 없는 값입니다: ${v}`,
|
|
5
|
+
}, {
|
|
6
|
+
invalid: (label, v) => `Invalid ${label} format: ${v} — only letters, digits, and - _ . : @ are allowed; / and a bare . or .. are not.`,
|
|
7
|
+
unusable: (label, v) => `Value cannot be used as ${label}: ${v}`,
|
|
8
|
+
});
|
|
1
9
|
// Google API 리소스 이름 검증 — `projects/${projectId}/androidApps/${appId}` 같은 문자열용.
|
|
2
10
|
//
|
|
3
11
|
// 왜 인코딩이 아니라 검증인가: googleapis 는 `name`/`parent`/`resource`/`projectId` 등을
|
|
@@ -22,8 +30,7 @@ export function resourceSegment(value, label = 'ID') {
|
|
|
22
30
|
|| value === '.'
|
|
23
31
|
|| value === '..'
|
|
24
32
|
|| !SEGMENT.test(value)) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
+ '영숫자와 - _ . : @ 만 쓸 수 있고 / 나 . / .. 단독 값은 허용하지 않습니다.');
|
|
33
|
+
throw new Error(M().invalid(label, JSON.stringify(String(value).slice(0, 80))));
|
|
27
34
|
}
|
|
28
35
|
return value;
|
|
29
36
|
}
|
|
@@ -33,7 +40,7 @@ export function resourceSegment(value, label = 'ID') {
|
|
|
33
40
|
*/
|
|
34
41
|
export function notDotSegment(value, label = 'ID') {
|
|
35
42
|
if (value === '' || value === '.' || value === '..') {
|
|
36
|
-
throw new Error(
|
|
43
|
+
throw new Error(M().unusable(label, JSON.stringify(value)));
|
|
37
44
|
}
|
|
38
45
|
return value;
|
|
39
46
|
}
|
|
@@ -1,20 +1,61 @@
|
|
|
1
1
|
import { textResult } from './mcp-response.js';
|
|
2
|
+
import { catalog } from '#core/lang.js';
|
|
3
|
+
/** Product-creation results — returned to the caller agent, so they follow the user's language. */
|
|
4
|
+
const C = catalog({
|
|
5
|
+
createFailed: (error) => `❌ 생성 실패: ${error}`,
|
|
6
|
+
unknownError: '알 수 없는 오류',
|
|
7
|
+
appleComplete: '✓ App Store 상품 생성·가격 설정 완료',
|
|
8
|
+
applePriceIncomplete: '⚠ App Store 상품 생성됨 — 가격 설정 미완료',
|
|
9
|
+
priceSet: '✓ 가격 설정됨',
|
|
10
|
+
priceError: (error) => `가격 오류: ${error}`,
|
|
11
|
+
priceNotSet: '요청 가격을 설정하지 못했습니다.',
|
|
12
|
+
nearestPrice: (json) => `가장 가까운 가격: ${json}`,
|
|
13
|
+
doNotRecreateApple: '상품은 이미 생성됐습니다. 생성 도구를 재실행하지 말고 이 상품의 가격·판매 지역을 수정하세요.',
|
|
14
|
+
extraRegions: (regions) => `✓ 추가 지역: ${regions}`,
|
|
15
|
+
localizationAdded: '✓ KRW 한국어 로컬라이제이션 추가됨',
|
|
16
|
+
checkBeforeSale: '판매 전 현지화·심사용 스크린샷·리뷰 노트·심사 상태를 확인하세요.',
|
|
17
|
+
subscriptionFailed: (error) => `❌ 구독 생성 실패: ${error}`,
|
|
18
|
+
playComplete: '✓ Play 구독 생성·활성화 완료',
|
|
19
|
+
playActivationPending: '⚠ Play 구독 생성됨 — 활성화 확인 필요',
|
|
20
|
+
activationError: (error) => `활성화 오류: ${error}`,
|
|
21
|
+
doNotRecreatePlay: '생성 도구를 재실행하지 말고 기존 기본 요금제 상태를 조회한 뒤 활성화하세요.',
|
|
22
|
+
skippedRegions: (regions) => `⚠ 적용하지 못한 지역 통화: ${regions}`,
|
|
23
|
+
}, {
|
|
24
|
+
createFailed: (error) => `❌ Creation failed: ${error}`,
|
|
25
|
+
unknownError: 'Unknown error',
|
|
26
|
+
appleComplete: '✓ App Store product created and price set',
|
|
27
|
+
applePriceIncomplete: '⚠ App Store product created — price setup incomplete',
|
|
28
|
+
priceSet: '✓ Price set',
|
|
29
|
+
priceError: (error) => `Price error: ${error}`,
|
|
30
|
+
priceNotSet: 'Could not set the requested price.',
|
|
31
|
+
nearestPrice: (json) => `Nearest prices: ${json}`,
|
|
32
|
+
doNotRecreateApple: 'The product has already been created. Do not run the create tool again; fix this product\'s price and sales regions instead.',
|
|
33
|
+
extraRegions: (regions) => `✓ Additional regions: ${regions}`,
|
|
34
|
+
localizationAdded: '✓ KRW Korean localization added',
|
|
35
|
+
checkBeforeSale: 'Before selling, check the localizations, review screenshot, review notes, and review status.',
|
|
36
|
+
subscriptionFailed: (error) => `❌ Subscription creation failed: ${error}`,
|
|
37
|
+
playComplete: '✓ Play subscription created and activated',
|
|
38
|
+
playActivationPending: '⚠ Play subscription created — activation needs checking',
|
|
39
|
+
activationError: (error) => `Activation error: ${error}`,
|
|
40
|
+
doNotRecreatePlay: 'Do not run the create tool again; look up the status of the existing base plan, then activate it.',
|
|
41
|
+
skippedRegions: (regions) => `⚠ Regional currencies not applied: ${regions}`,
|
|
42
|
+
});
|
|
2
43
|
/** Product creation is durable even when its price setup failed. Never advise recreating it. */
|
|
3
44
|
export function appleCreationResult(result, appId, subscription) {
|
|
4
45
|
if (!result.success)
|
|
5
|
-
return { ...textResult(
|
|
46
|
+
return { ...textResult(C().createFailed(result.error ?? C().unknownError)), isError: true };
|
|
6
47
|
const complete = result.priceSet === true;
|
|
7
48
|
return {
|
|
8
49
|
...textResult([
|
|
9
|
-
complete ?
|
|
50
|
+
complete ? C().appleComplete : C().applePriceIncomplete,
|
|
10
51
|
`productId: ${result.productId}`,
|
|
11
52
|
`internalId: ${result.internalId}`,
|
|
12
|
-
complete ?
|
|
13
|
-
!complete && result.priceNearest?.length ?
|
|
14
|
-
!complete ?
|
|
15
|
-
result.extraRegionsSet?.length ?
|
|
16
|
-
result.localizationAdded ?
|
|
17
|
-
|
|
53
|
+
complete ? C().priceSet : C().priceError(result.priceError ?? C().priceNotSet),
|
|
54
|
+
!complete && result.priceNearest?.length ? C().nearestPrice(JSON.stringify(result.priceNearest)) : '',
|
|
55
|
+
!complete ? C().doNotRecreateApple : '',
|
|
56
|
+
result.extraRegionsSet?.length ? C().extraRegions(result.extraRegionsSet.join(', ')) : '',
|
|
57
|
+
result.localizationAdded ? C().localizationAdded : '',
|
|
58
|
+
C().checkBeforeSale,
|
|
18
59
|
`https://appstoreconnect.apple.com/apps/${appId}/distribution/${subscription ? 'subscriptions' : 'iaps'}`,
|
|
19
60
|
].filter(Boolean)),
|
|
20
61
|
isError: !complete,
|
|
@@ -22,15 +63,15 @@ export function appleCreationResult(result, appId, subscription) {
|
|
|
22
63
|
}
|
|
23
64
|
export function googleSubscriptionCreationResult(result, args) {
|
|
24
65
|
if (!result.success)
|
|
25
|
-
return { ...textResult(
|
|
66
|
+
return { ...textResult(C().subscriptionFailed(result.error ?? C().unknownError)), isError: true };
|
|
26
67
|
return {
|
|
27
68
|
...textResult([
|
|
28
|
-
result.active === true ?
|
|
69
|
+
result.active === true ? C().playComplete : C().playActivationPending,
|
|
29
70
|
`productId: ${result.productId}`,
|
|
30
71
|
`price: ${args.price} ${args.currency} / ${args.period}`,
|
|
31
|
-
result.activationError ?
|
|
32
|
-
result.active !== true ?
|
|
33
|
-
result.skippedRegions?.length ?
|
|
72
|
+
result.activationError ? C().activationError(result.activationError) : '',
|
|
73
|
+
result.active !== true ? C().doNotRecreatePlay : '',
|
|
74
|
+
result.skippedRegions?.length ? C().skippedRegions(result.skippedRegions.join(', ')) : '',
|
|
34
75
|
`https://play.google.com/console/u/0/developers/-/app/-/subscriptions?package=${encodeURIComponent(args.packageName)}`,
|
|
35
76
|
].filter(Boolean)),
|
|
36
77
|
isError: result.active === false || !!result.activationError,
|