@yoonion/mimi-seed-mcp 0.29.1 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/assets/agent-guide.md +39 -12
- package/dist/checks/appstore-submission.d.ts +4 -4
- package/dist/checks/plan.d.ts +2 -2
- package/dist/checks/release-readiness.d.ts +3 -3
- package/dist/checks/risks.d.ts +1 -1
- package/dist/gsc/tools.d.ts +3 -3
- package/dist/i18n/manifest-en.js +3 -0
- package/dist/i18n/tools-en/auth.d.ts +7 -1
- package/dist/i18n/tools-en/auth.js +7 -1
- package/dist/i18n/tools-en/index.js +2 -0
- package/dist/i18n/tools-en/playstore.d.ts +17 -0
- package/dist/i18n/tools-en/playstore.js +17 -0
- package/dist/i18n/tools-en/social.d.ts +5 -0
- package/dist/i18n/tools-en/social.js +4 -0
- package/dist/index.js +2 -0
- package/dist/jenkins/builds.d.ts +2 -2
- package/dist/lib/audit-log.d.ts +73 -0
- package/dist/lib/audit-log.js +135 -0
- package/dist/lib/package-root.d.ts +15 -0
- package/dist/lib/package-root.js +30 -0
- package/dist/lib/tool-menu.d.ts +9 -2
- package/dist/lib/tool-menu.js +19 -3
- package/dist/lib/tool-registrar.d.ts +4 -0
- package/dist/lib/tool-registrar.js +60 -3
- package/dist/playstore/releases.d.ts +2 -2
- package/dist/playstore/statistics.d.ts +39 -0
- package/dist/playstore/statistics.js +126 -1
- package/dist/prompts.js +2 -2
- package/dist/registers/android.js +2 -0
- package/dist/registers/appstore/declarations.js +2 -0
- package/dist/registers/appstore/media.js +2 -0
- package/dist/registers/appstore/reports.js +2 -0
- package/dist/registers/appstore/review-submission.js +2 -0
- package/dist/registers/appstore/testflight.js +5 -0
- package/dist/registers/appstore/versions.js +3 -0
- package/dist/registers/auth.js +23 -87
- package/dist/registers/crosspost.js +2 -0
- package/dist/registers/ga4.js +2 -0
- package/dist/registers/jenkins.js +3 -0
- package/dist/registers/playstore/listing.d.ts +3 -0
- package/dist/registers/playstore/listing.js +42 -0
- package/dist/registers/playstore/recovery.js +4 -0
- package/dist/registers/social-status.d.ts +2 -0
- package/dist/registers/social-status.js +143 -0
- package/dist/registers/video.js +4 -0
- package/dist/registers/youtube.js +5 -0
- package/dist/resources.js +4 -3
- package/dist/server.js +5 -14
- package/dist/social/profile-store.js +1 -1
- package/dist/social-index.d.ts +2 -0
- package/dist/social-index.js +31 -0
- package/dist/social-server.d.ts +11 -0
- package/dist/social-server.js +49 -0
- package/dist/tiktok-business/config.js +1 -1
- package/dist/tools-cli.js +13 -5
- package/dist/video/research.d.ts +1 -1
- package/dist/video/schemas.d.ts +3 -3
- package/npm-shrinkwrap.json +3 -2
- package/package.json +2 -1
- package/tool-manifest.json +34 -13
|
@@ -5,6 +5,7 @@ import { listProductPageMedia } from '../../appstore/asset-library.js';
|
|
|
5
5
|
import { reorderMediaPlacements, uploadAndPlaceMedia } from '../../appstore/asset-library-write.js';
|
|
6
6
|
import { jsonResult, textResult } from '../../lib/mcp-response.js';
|
|
7
7
|
import { catalog } from '#core/lang.js';
|
|
8
|
+
import { previewWhen, unconfirmed } from '../../lib/audit-log.js';
|
|
8
9
|
const M = catalog({
|
|
9
10
|
groupOrDisplay: 'placementGroup과 displayType 중 하나만 지정하세요.',
|
|
10
11
|
needDisplayAndFile: '기존 세트 업로드에는 displayType과 filePath가 필요합니다.',
|
|
@@ -185,6 +186,7 @@ export function registerPreviewTools(server) {
|
|
|
185
186
|
M().encodingNote,
|
|
186
187
|
]);
|
|
187
188
|
});
|
|
189
|
+
previewWhen('appstore_delete_preview', unconfirmed);
|
|
188
190
|
server.tool('appstore_delete_preview', [
|
|
189
191
|
'기존 미리보기 동영상 또는 세트를 삭제한다 — DELETE /v1/appPreviews/{id} 또는 /appPreviewSets/{id}.',
|
|
190
192
|
'⚠️ 되돌릴 수 없다. 세트를 지우면 그 안의 동영상이 모두 사라진다. confirm 필요.',
|
|
@@ -2,8 +2,10 @@ import { z } from 'zod';
|
|
|
2
2
|
import * as appstoreSales from '../../appstore/sales.js';
|
|
3
3
|
import { getWeeklyInsight } from '../../appstore/analytics.js';
|
|
4
4
|
import { jsonResult } from '../../lib/mcp-response.js';
|
|
5
|
+
import { previewWhen } from '../../lib/audit-log.js';
|
|
5
6
|
/** appstore_get_weekly_insight */
|
|
6
7
|
export function registerWeeklyInsightTool(server) {
|
|
8
|
+
previewWhen('appstore_get_weekly_insight', (a) => a.createIfMissing !== true || a.confirmCreate !== true);
|
|
7
9
|
server.tool('appstore_get_weekly_insight', [
|
|
8
10
|
'App Store Connect Analytics의 표준 주간 Engagement·Downloads·Purchases 리포트를 내려받아 지난 두 기간을 비교합니다.',
|
|
9
11
|
'제품 페이지·획득·수익화 중 가장 크게 악화된 한 영역과 근거 지표, 실행할 개선안 하나를 반환합니다.',
|
|
@@ -5,6 +5,7 @@ import { appStoreRiskPolicyShape, releaseReadinessResult, releaseReadinessShape
|
|
|
5
5
|
import { textResult } from '../../lib/mcp-response.js';
|
|
6
6
|
import { reviewSubmissionsText, submitForReviewDryRunText } from '../../appstore/messages.js';
|
|
7
7
|
import { catalog } from '#core/lang.js';
|
|
8
|
+
import { previewWhen, unconfirmed } from '../../lib/audit-log.js';
|
|
8
9
|
const M = catalog({
|
|
9
10
|
itemRemoved: '✓ 묶음에서 항목 제거됨',
|
|
10
11
|
canReattach: '항목이 버전이었다면 이제 다른 묶음에 붙일 수 있다 (appstore_submit_for_review).',
|
|
@@ -97,6 +98,7 @@ export function registerSubmitForReviewTools(server) {
|
|
|
97
98
|
});
|
|
98
99
|
return releaseReadinessResult(text, readiness);
|
|
99
100
|
}, releaseReadinessShape);
|
|
101
|
+
previewWhen('appstore_submit_for_review', unconfirmed);
|
|
100
102
|
server.tool('appstore_submit_for_review', [
|
|
101
103
|
'App Store 버전을 심사에 제출 — 새 reviewSubmissions API 사용 (옛 /appStoreVersionSubmissions는 2024-01 deprecated).',
|
|
102
104
|
'내부 흐름: POST /reviewSubmissions(또는 CREATED 상태 재사용) → POST /reviewSubmissionItems(version attach) → PATCH submitted=true.',
|
|
@@ -4,6 +4,7 @@ import * as testflight from '../../appstore/testflight.js';
|
|
|
4
4
|
import { jsonResult, textResult } from '../../lib/mcp-response.js';
|
|
5
5
|
import { betaStatusText } from '../../appstore/messages.js';
|
|
6
6
|
import { catalog } from '#core/lang.js';
|
|
7
|
+
import { previewWhen, unconfirmed } from '../../lib/audit-log.js';
|
|
7
8
|
const M = catalog({
|
|
8
9
|
reviewDetailUpdated: (id) => `✅ 베타 심사 정보 갱신 (${id})`,
|
|
9
10
|
passwordSet: ' demoAccountPassword: (설정됨)',
|
|
@@ -141,6 +142,7 @@ export function registerBetaTestingTools(server) {
|
|
|
141
142
|
const r = await testflight.upsertWhatsToTest({ buildId, locale, whatsNew });
|
|
142
143
|
return textResult(M().whatToTestSaved(r.created, r.locale, r.id));
|
|
143
144
|
});
|
|
145
|
+
previewWhen('appstore_submit_beta_review', unconfirmed);
|
|
144
146
|
server.tool('appstore_submit_beta_review', [
|
|
145
147
|
'빌드를 TestFlight 베타 심사에 제출한다 — POST /v1/betaAppReviewSubmissions.',
|
|
146
148
|
'외부 테스터에게 배포하려면 이 심사를 통과해야 한다 (내부 테스터는 불필요).',
|
|
@@ -179,6 +181,7 @@ export function registerBetaTestingTools(server) {
|
|
|
179
181
|
M().checkProgress,
|
|
180
182
|
]);
|
|
181
183
|
});
|
|
184
|
+
previewWhen('appstore_set_beta_group_build', unconfirmed);
|
|
182
185
|
server.tool('appstore_set_beta_group_build', [
|
|
183
186
|
'베타 그룹에 빌드를 붙이거나 뗀다 — POST/DELETE /v1/betaGroups/{id}/relationships/builds.',
|
|
184
187
|
'⚠️ 외부 그룹에 붙이는 것은 **실제 배포**다 (심사 통과 후에만 가능). 떼면 테스터가 더 이상 받지 못한다.',
|
|
@@ -203,6 +206,7 @@ export function registerBetaTestingTools(server) {
|
|
|
203
206
|
const r = await testflight.setBetaGroupBuild({ groupId, buildId, action });
|
|
204
207
|
return textResult(M().groupDone(r.groupId, r.action === 'add', r.buildId));
|
|
205
208
|
});
|
|
209
|
+
previewWhen('appstore_add_beta_testers', unconfirmed);
|
|
206
210
|
server.tool('appstore_add_beta_testers', [
|
|
207
211
|
'베타 그룹에 테스터를 초대한다 — POST /v1/betaTesters.',
|
|
208
212
|
'이메일별로 개별 호출하며, 이미 등록된 주소는 실패로 표시하고 나머지는 계속 진행한다.',
|
|
@@ -234,6 +238,7 @@ export function registerBetaTestingTools(server) {
|
|
|
234
238
|
...results.filter((r) => !r.ok).map((r) => ` ✗ ${r.email}: ${r.error}`),
|
|
235
239
|
]);
|
|
236
240
|
});
|
|
241
|
+
previewWhen('appstore_notify_beta_testers', unconfirmed);
|
|
237
242
|
server.tool('appstore_notify_beta_testers', [
|
|
238
243
|
'이미 배포된 빌드에 대해 테스터에게 알림을 다시 보낸다 — POST /v1/buildBetaNotifications.',
|
|
239
244
|
'자동 알림(autoNotifyEnabled)이 꺼져 있거나, 배포 후 다시 알리고 싶을 때.',
|
|
@@ -4,6 +4,7 @@ import * as appstoreRelease from '../../appstore/release.js';
|
|
|
4
4
|
import { jsonResult, textResult, errorResult } from '../../lib/mcp-response.js';
|
|
5
5
|
import { releaseStatusText } from '../../appstore/messages.js';
|
|
6
6
|
import { catalog } from '#core/lang.js';
|
|
7
|
+
import { previewWhen, unconfirmed } from '../../lib/audit-log.js';
|
|
7
8
|
const M = catalog({
|
|
8
9
|
created: (v, platform, build, json) => `✅ 버전 ${v} (${platform}) 생성됨${build ? ` + 빌드 ${build} 연결됨` : ''}.\n\n${json}`,
|
|
9
10
|
minBuildNeedsAuto: '❌ minBuildNumber 는 buildId 생략(최신 VALID 빌드 자동 선택) 시에만 쓸 수 있다 — API 호출 안 함.',
|
|
@@ -168,6 +169,7 @@ export function registerReleaseTools(server) {
|
|
|
168
169
|
const { version, phased, note } = await appstoreRelease.getReleaseStatus(versionId);
|
|
169
170
|
return textResult(releaseStatusText({ version, phased, note }));
|
|
170
171
|
});
|
|
172
|
+
previewWhen('appstore_release_version', unconfirmed);
|
|
171
173
|
server.tool('appstore_release_version', [
|
|
172
174
|
'심사를 통과해 개발자 출시 대기(PENDING_DEVELOPER_RELEASE) 중인 버전을 지금 출시한다 — POST /v1/appStoreVersionReleaseRequests.',
|
|
173
175
|
'콘솔의 "이 버전 출시" 버튼과 같은 동작.',
|
|
@@ -225,6 +227,7 @@ export function registerReleaseTools(server) {
|
|
|
225
227
|
M().state(after.state ?? M().unknown),
|
|
226
228
|
].filter(Boolean));
|
|
227
229
|
});
|
|
230
|
+
previewWhen('appstore_phased_release', (a) => a.action === 'status' || ((a.action === 'complete' || a.action === 'disable') && a.confirm !== true));
|
|
228
231
|
server.tool('appstore_phased_release', [
|
|
229
232
|
'iOS 단계적 출시(7일 램프)를 제어한다 — appStoreVersionPhasedReleases.',
|
|
230
233
|
'action: status(조회) / enable(켜기·PAUSED면 재개) / pause(일시중지) / resume(재개) / complete(즉시 전체 공개) / disable(단계적 출시 제거).',
|
package/dist/registers/auth.js
CHANGED
|
@@ -14,18 +14,12 @@ import { getAppStoreCredentials } from '../appstore/auth.js';
|
|
|
14
14
|
import { loadJenkinsConfig } from '../jenkins/config.js';
|
|
15
15
|
import { loadCiConfig } from '../ci/config.js';
|
|
16
16
|
import { loadConfig as loadGoogleAdsConfig } from '../googleads/config.js';
|
|
17
|
-
import { loadFacebookConfig } from '../facebook/config.js';
|
|
18
|
-
import { loadInstagramConfig } from '../instagram/config.js';
|
|
19
|
-
import { loadThreadsConfig } from '../threads/config.js';
|
|
20
|
-
import { loadTikTokBusinessConfig } from '../tiktok-business/config.js';
|
|
21
|
-
import { tokenFreshness as tiktokTokenFreshness } from '../tiktok-business/auth.js';
|
|
22
|
-
import { metaTokenFreshness } from '../lib/meta-auth.js';
|
|
23
17
|
import { readPackageRootText } from '../lib/package-root.js';
|
|
24
18
|
import { resolveBigQueryAuth } from '../auth/bigquery-auth.js';
|
|
25
19
|
import { syncRemoteCredentials } from '../remote-sync.js';
|
|
26
|
-
import { resolveSocialConfigTarget } from '../social/profile-store.js';
|
|
27
20
|
import { lookupProjectManifest, manifestServiceEntries, } from '#core/project-manifest.js';
|
|
28
|
-
import { textResult } from '../lib/mcp-response.js';
|
|
21
|
+
import { jsonResult, textResult } from '../lib/mcp-response.js';
|
|
22
|
+
import { previewWhen, readAudit, unconfirmed } from '../lib/audit-log.js';
|
|
29
23
|
import { describeToolsets } from '../lib/toolsets.js';
|
|
30
24
|
import { describeApproval } from '../lib/human-approval.js';
|
|
31
25
|
import { findInvalidJsonFiles } from '../lib/json-file.js';
|
|
@@ -33,7 +27,7 @@ import { credentialStoreReport } from '#core/credential-store.js';
|
|
|
33
27
|
import { catalog } from '#core/lang.js';
|
|
34
28
|
/** 출력 문구 — 도구별로 묶었다. 호출 시점에 언어를 읽는다 (`A()`). */
|
|
35
29
|
const A = catalog({
|
|
36
|
-
// ── 공통: tokens.json 갱신 시각 ·
|
|
30
|
+
// ── 공통: tokens.json 갱신 시각 · 매니페스트 줄 ──
|
|
37
31
|
refresh: {
|
|
38
32
|
mtimeFailed: '(파일 mtime 조회 실패)',
|
|
39
33
|
daysAgo: (days, hours) => `${days}d ${hours}h 전 갱신`,
|
|
@@ -41,13 +35,6 @@ const A = catalog({
|
|
|
41
35
|
over14: `⚠️ 14일 이상 미사용 — Google 정책상 refresh_token revoke 위험. 안전을 위해 'mimi_seed_auth_start' 로 재인증 권장.`,
|
|
42
36
|
over7: `ℹ️ 7일 이상 미사용 — 한 번 더 갱신하지 않으면 곧 revoke 가능. 다음 도구 호출이 자동 갱신해주지만, 장기 미사용 예정이면 미리 인증 갱신 권장.`,
|
|
43
37
|
},
|
|
44
|
-
meta: {
|
|
45
|
-
missing: (padded, fix) => `❌ ${padded} — 미설정 → ${fix} (선택)`,
|
|
46
|
-
expired: (padded, fix) => `❌ ${padded} — 토큰 만료 → ${fix}`,
|
|
47
|
-
expiring: (padded, days, detail, fix) => `⚠️ ${padded} — ${days}일 후 만료 (${detail}) → ${fix}`,
|
|
48
|
-
unknown: (padded, detail) => `⚠️ ${padded} — 설정됨, 만료일 미상 (${detail}) → 계정 조회 도구로 검증`,
|
|
49
|
-
ok: (padded, detail, days) => `✅ ${padded} — 연결됨 (${detail}, ${days}일 남음)`,
|
|
50
|
-
},
|
|
51
38
|
manifestFix: {
|
|
52
39
|
oauth: () => 'mimi_seed_auth_start (Google 로그인 — Firebase/AdMob/Play/GSC/GA4)',
|
|
53
40
|
bigquery: () => 'npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (서비스 계정 권장)',
|
|
@@ -88,11 +75,8 @@ const A = catalog({
|
|
|
88
75
|
ciMissing: '❌ CI — 미설정 → ci_save_config (선택)',
|
|
89
76
|
gadsOk: (customerId) => `⚠️ Google Ads — 설정됨 (customerId: ${customerId})`,
|
|
90
77
|
gadsMissing: '❌ Google Ads — 미설정 → googleads_save_config (선택)',
|
|
91
|
-
tiktokMissing: '❌ TikTok Business — 미설정 → mimi-seed auth tiktok (선택)',
|
|
92
|
-
tiktokRefreshExpired: (openId) => `❌ TikTok Business — refresh token 만료 (${openId}) → mimi-seed auth tiktok`,
|
|
93
|
-
tiktokAccessExpired: (openId) => `⚠️ TikTok Business — 연결됨, 다음 호출에서 access token 자동 갱신 (${openId})`,
|
|
94
|
-
tiktokOk: (openId) => `✅ TikTok Business — Organic API 연결됨 (${openId})`,
|
|
95
78
|
bqSa: (email) => `✅ BigQuery — 서비스 계정 연결됨 (${email})`,
|
|
79
|
+
socialServer: '📣 소셜 게시(Facebook · Instagram · Threads · TikTok · 통합 게시)는 별도 서버다 — 등록: npx -y @yoonion/mimi-seed-mcp mimi-seed-social-mcp, 연결 확인: social_status',
|
|
96
80
|
bqOauth: '⚠️ BigQuery — OAuth fallback (Workspace 재인증 정책 시 끊길 수 있음 → 서비스 계정 권장: mimi-seed-bigquery-auth)',
|
|
97
81
|
bqMissing: '❌ BigQuery — 미설정 → npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (선택)',
|
|
98
82
|
invalidHeader: '── ⚠️ 읽을 수 없는 설정 파일 ─────────────────────',
|
|
@@ -147,13 +131,6 @@ const A = catalog({
|
|
|
147
131
|
over14: `⚠️ Unused for 14+ days — under Google policy the refresh_token may be revoked. To be safe, re-authenticate with 'mimi_seed_auth_start'.`,
|
|
148
132
|
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.`,
|
|
149
133
|
},
|
|
150
|
-
meta: {
|
|
151
|
-
missing: (padded, fix) => `❌ ${padded} — not set up → ${fix} (optional)`,
|
|
152
|
-
expired: (padded, fix) => `❌ ${padded} — token expired → ${fix}`,
|
|
153
|
-
expiring: (padded, days, detail, fix) => `⚠️ ${padded} — expires in ${days} day(s) (${detail}) → ${fix}`,
|
|
154
|
-
unknown: (padded, detail) => `⚠️ ${padded} — set up, expiry unknown (${detail}) → verify with the account lookup tool`,
|
|
155
|
-
ok: (padded, detail, days) => `✅ ${padded} — connected (${detail}, ${days} day(s) left)`,
|
|
156
|
-
},
|
|
157
134
|
manifestFix: {
|
|
158
135
|
oauth: () => 'mimi_seed_auth_start (Google login — Firebase/AdMob/Play/GSC/GA4)',
|
|
159
136
|
bigquery: () => 'npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (service account recommended)',
|
|
@@ -193,11 +170,8 @@ const A = catalog({
|
|
|
193
170
|
ciMissing: '❌ CI — not set up → ci_save_config (optional)',
|
|
194
171
|
gadsOk: (customerId) => `⚠️ Google Ads — set up (customerId: ${customerId})`,
|
|
195
172
|
gadsMissing: '❌ Google Ads — not set up → googleads_save_config (optional)',
|
|
196
|
-
tiktokMissing: '❌ TikTok Business — not set up → mimi-seed auth tiktok (optional)',
|
|
197
|
-
tiktokRefreshExpired: (openId) => `❌ TikTok Business — refresh token expired (${openId}) → mimi-seed auth tiktok`,
|
|
198
|
-
tiktokAccessExpired: (openId) => `⚠️ TikTok Business — connected; the access token refreshes automatically on the next call (${openId})`,
|
|
199
|
-
tiktokOk: (openId) => `✅ TikTok Business — Organic API connected (${openId})`,
|
|
200
173
|
bqSa: (email) => `✅ BigQuery — service account connected (${email})`,
|
|
174
|
+
socialServer: '📣 Social posting (Facebook · Instagram · Threads · TikTok · cross-post) is a separate server — register: npx -y @yoonion/mimi-seed-mcp mimi-seed-social-mcp, check it with social_status',
|
|
201
175
|
bqOauth: '⚠️ BigQuery — OAuth fallback (may disconnect under a Workspace re-auth policy → service account recommended: mimi-seed-bigquery-auth)',
|
|
202
176
|
bqMissing: '❌ BigQuery — not set up → npx -y @yoonion/mimi-seed-mcp mimi-seed-bigquery-auth (optional)',
|
|
203
177
|
invalidHeader: '── ⚠️ Unreadable config files ─────────────────────',
|
|
@@ -270,22 +244,6 @@ function formatLastRefreshHint(lastMs) {
|
|
|
270
244
|
}
|
|
271
245
|
return { label };
|
|
272
246
|
}
|
|
273
|
-
function renderMetaConnection(label, config, detail, fix) {
|
|
274
|
-
const padded = label.padEnd(18);
|
|
275
|
-
const m = A().meta;
|
|
276
|
-
if (!config)
|
|
277
|
-
return m.missing(padded, fix);
|
|
278
|
-
const freshness = metaTokenFreshness(config.expiresAt);
|
|
279
|
-
if (freshness.state === 'expired')
|
|
280
|
-
return m.expired(padded, fix);
|
|
281
|
-
if (freshness.state === 'expiring') {
|
|
282
|
-
return m.expiring(padded, freshness.daysRemaining, detail, fix);
|
|
283
|
-
}
|
|
284
|
-
if (freshness.state === 'unknown') {
|
|
285
|
-
return m.unknown(padded, detail);
|
|
286
|
-
}
|
|
287
|
-
return m.ok(padded, detail, freshness.daysRemaining);
|
|
288
|
-
}
|
|
289
247
|
// 두 MCP 가 모두 'mimi-seed' 로 등록되는 환경에서 에이전트가 프로그램적으로
|
|
290
248
|
// 어느 서버인지 판별할 수 있도록 status 첫 줄에 자기소개를 넣는다.
|
|
291
249
|
const { version: PKG_VERSION } = JSON.parse(readPackageRootText('package.json'));
|
|
@@ -345,7 +303,7 @@ export function registerAuthTools(server) {
|
|
|
345
303
|
// ── 전체 연결 상태 진단 ────────────────────────────────────────────────────
|
|
346
304
|
server.tool('mimi_seed_status', [
|
|
347
305
|
'초기 설정, 전체 연결 확인 또는 인증 문제 진단에 사용합니다.',
|
|
348
|
-
'
|
|
306
|
+
'앱 운영 서비스(Google OAuth / Play SA / App Store / Jenkins / CI / Google Ads / BigQuery)',
|
|
349
307
|
'설정 상태를 한 번에 스캔해 ✅ / ❌ 트래픽 라이트 리포트와 번호 매긴 다음 단계를 반환합니다.',
|
|
350
308
|
'미설정 서비스마다 어떤 도구를 호출하면 되는지 구체적으로 알려줍니다.',
|
|
351
309
|
].join(' '), {}, async () => {
|
|
@@ -452,45 +410,6 @@ export function registerAuthTools(server) {
|
|
|
452
410
|
else {
|
|
453
411
|
lines.push(m.gadsMissing);
|
|
454
412
|
}
|
|
455
|
-
// 7–9. Meta 소셜 — 프로필 결정이 throw 하면(깨진 .mimi-seed.json · 잘못된 socialProfiles) 상태 리포트 전체를
|
|
456
|
-
// 죽이지 않고 그 줄에 원인을 보인다. 게시 도구는 같은 경우에 실패한다(기본 계정으로 폴백하지 않는다).
|
|
457
|
-
const socialLine = (label, render) => {
|
|
458
|
-
try {
|
|
459
|
-
lines.push(render());
|
|
460
|
-
}
|
|
461
|
-
catch (error) {
|
|
462
|
-
lines.push(`❌ ${label.padEnd(17)} — ${error instanceof Error ? error.message : String(error)}`);
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
socialLine('Facebook', () => {
|
|
466
|
-
const fb = loadFacebookConfig();
|
|
467
|
-
return renderMetaConnection('Facebook', fb, `pageId: ${fb?.pageId ?? ''}`, 'mimi-seed auth facebook');
|
|
468
|
-
});
|
|
469
|
-
socialLine('Instagram', () => {
|
|
470
|
-
const igTarget = resolveSocialConfigTarget('instagram');
|
|
471
|
-
const ig = loadInstagramConfig();
|
|
472
|
-
return renderMetaConnection('Instagram', ig, `${igTarget.profile ? `profile: ${igTarget.profile}, ` : ''}userId: ${ig?.userId ?? ''}`, `mimi-seed auth instagram${igTarget.profile ? ` --profile ${igTarget.profile}` : ''}`);
|
|
473
|
-
});
|
|
474
|
-
socialLine('Threads', () => {
|
|
475
|
-
const threadsTarget = resolveSocialConfigTarget('threads');
|
|
476
|
-
const threads = loadThreadsConfig();
|
|
477
|
-
return renderMetaConnection('Threads', threads, `${threadsTarget.profile ? `profile: ${threadsTarget.profile}, ` : ''}userId: ${threads?.userId ?? ''}`, `mimi-seed auth threads${threadsTarget.profile ? ` --profile ${threadsTarget.profile}` : ''}`);
|
|
478
|
-
});
|
|
479
|
-
// 10. TikTok Business — 네트워크 없이 refresh token 만료 상태까지 판정.
|
|
480
|
-
const tiktok = loadTikTokBusinessConfig();
|
|
481
|
-
const tiktokFreshness = tiktokTokenFreshness(tiktok);
|
|
482
|
-
if (!tiktok) {
|
|
483
|
-
lines.push(m.tiktokMissing);
|
|
484
|
-
}
|
|
485
|
-
else if (tiktokFreshness.state === 'refresh_expired') {
|
|
486
|
-
lines.push(m.tiktokRefreshExpired(tiktok.openId));
|
|
487
|
-
}
|
|
488
|
-
else if (tiktokFreshness.state === 'access_expired') {
|
|
489
|
-
lines.push(m.tiktokAccessExpired(tiktok.openId));
|
|
490
|
-
}
|
|
491
|
-
else {
|
|
492
|
-
lines.push(m.tiktokOk(tiktok.openId));
|
|
493
|
-
}
|
|
494
413
|
// 11. BigQuery — resolveBigQueryAuth 기준(서비스 계정 우선, OAuth fallback).
|
|
495
414
|
// 이전엔 SA 파일만 검사해 OAuth fallback 이 살아있어도 ❌ 로 오표기했다.
|
|
496
415
|
let bqAuth = null;
|
|
@@ -513,6 +432,7 @@ export function registerAuthTools(server) {
|
|
|
513
432
|
else {
|
|
514
433
|
lines.push(m.bqMissing);
|
|
515
434
|
}
|
|
435
|
+
lines.push('', m.socialServer);
|
|
516
436
|
// 12. 깨진 설정 파일 — 로더는 "없음"과 "깨짐"을 둘 다 null 로 돌려주므로 위 줄들은 ❌ 미설정으로만 보인다.
|
|
517
437
|
// 어느 파일이 왜 못 읽히는지는 여기서 따로 밝힌다 (잘린 쓰기 · 손으로 고친 문법 오류 · 권한).
|
|
518
438
|
const invalidFiles = findInvalidJsonFiles(path.join(os.homedir(), '.mimi-seed'));
|
|
@@ -695,6 +615,7 @@ export function registerAuthTools(server) {
|
|
|
695
615
|
: ''));
|
|
696
616
|
}
|
|
697
617
|
});
|
|
618
|
+
previewWhen('mimi_seed_remote_sync_credentials', unconfirmed);
|
|
698
619
|
server.tool('mimi_seed_remote_sync_credentials', [
|
|
699
620
|
'로컬 ~/.mimi-seed의 App Store Connect 키와 패키지별 Google Play 서비스 계정을',
|
|
700
621
|
'Mimi Seed 원격 MCP에 검증 후 암호화 동기화합니다.',
|
|
@@ -711,4 +632,19 @@ export function registerAuthTools(server) {
|
|
|
711
632
|
includePlayStore: include_playstore,
|
|
712
633
|
packageNames: package_names,
|
|
713
634
|
})));
|
|
635
|
+
// ── 실행 기록 (lib/audit-log.ts) ─────────────────────────────────────────────
|
|
636
|
+
server.tool('mimi_seed_audit_log', [
|
|
637
|
+
'쓰기·파괴적 도구의 실행 기록을 최신 것부터 읽는다 — 언제, 어느 서버(main/social)에서, 어떤 도구를, 어떤 인자로',
|
|
638
|
+
'불렀고 결과가 무엇이었나(preview=dry-run만 · refused=승인 거절 · ok · error · threw). 인자의 비밀은 가려져 있고 결과 본문은 없다.',
|
|
639
|
+
'에이전트가 무엇을 바꿨는지 사람이 확인할 때 쓴다. 기록은 ~/.mimi-seed/audit (MIMI_SEED_AUDIT_DIR, 끄기: MIMI_SEED_AUDIT=off).',
|
|
640
|
+
].join(' '), {
|
|
641
|
+
days: z.number().int().min(1).max(366).default(7).describe('최근 며칠 (기본 7)'),
|
|
642
|
+
tool: z.string().optional().describe('도구 이름. _ 로 끝나면 접두어 (예: playstore_)'),
|
|
643
|
+
outcomes: z.array(z.enum(['preview', 'refused', 'ok', 'error', 'threw'])).optional().describe('이 결과만. preview·refused 는 아무것도 바뀌지 않은 호출, ok 는 도구가 성공을 돌려준 호출'),
|
|
644
|
+
server: z.enum(['main', 'social']).optional().describe('이 서버의 기록만'),
|
|
645
|
+
limit: z.number().int().min(1).max(500).default(50).describe('최대 개수 (기본 50)'),
|
|
646
|
+
}, async ({ days, tool, outcomes, server: serverId, limit }) => {
|
|
647
|
+
const since = new Date(Date.now() - days * 86_400_000);
|
|
648
|
+
return jsonResult(readAudit({ since, tool, outcomes, server: serverId, limit }));
|
|
649
|
+
});
|
|
714
650
|
}
|
|
@@ -5,6 +5,7 @@ import { YOUTUBE_CHANNEL_ID } from '../auth/youtube-channel.js';
|
|
|
5
5
|
import { executePublish, planPublish, recordMarksOnly, SOCIAL_TARGETS } from '../crosspost/tools.js';
|
|
6
6
|
import { jsonResult } from '../lib/mcp-response.js';
|
|
7
7
|
import { catalog } from '#core/lang.js';
|
|
8
|
+
import { previewWhen, unconfirmed } from '../lib/audit-log.js';
|
|
8
9
|
const M = catalog({
|
|
9
10
|
httpsOnly: 'HTTPS URL만 허용합니다.',
|
|
10
11
|
absoluteOnly: '절대경로만 허용합니다.',
|
|
@@ -36,6 +37,7 @@ const approval = z.object({
|
|
|
36
37
|
at: z.string().min(1).max(64).describe('계획에 표시된 그 기록의 at (승인 대상 기록을 정확히 지목). 이 호출의 그 플랫폼 게시물과 계정 기준이므로, 내용을 바꾸면 다시 미리보기한 계획의 at 을 쓰세요.'),
|
|
37
38
|
});
|
|
38
39
|
export function registerCrosspostTools(server) {
|
|
40
|
+
previewWhen('social_publish', unconfirmed);
|
|
39
41
|
server.tool('social_publish', [
|
|
40
42
|
'하나의 게시물을 여러 소셜 플랫폼(facebook, instagram, threads, youtube, tiktok)에 한 번에 게시합니다.',
|
|
41
43
|
'confirm 없이 부르면 dry-run 계획만 돌려줍니다: 플랫폼별 동작·본문·미디어와 게시를 막는 문제. 네트워크 호출은 하지 않습니다.',
|
package/dist/registers/ga4.js
CHANGED
|
@@ -6,6 +6,7 @@ import { requireAuth } from '../helpers.js';
|
|
|
6
6
|
import { friendlyGoogleError } from '../lib/google-errors.js';
|
|
7
7
|
import { wrapDomain } from '../lib/wrap-domain.js';
|
|
8
8
|
import { jsonResult } from '../lib/mcp-response.js';
|
|
9
|
+
import { previewWhen, unconfirmed } from '../lib/audit-log.js';
|
|
9
10
|
const ga4 = wrapDomain(ga4Raw, (err) => friendlyGoogleError(err));
|
|
10
11
|
const PROPERTY_DESC = "GA4 property ID — '123456789' 또는 'properties/123456789'";
|
|
11
12
|
const profile = z.string().regex(GOOGLE_PROFILE_ID).optional().describe('Google 로그인 프로필. 생략하면 기본 계정을 사용.');
|
|
@@ -70,6 +71,7 @@ export function registerGa4Tools(server) {
|
|
|
70
71
|
const plan = await ga4.planBigQueryLink(auth, propertyId, opts);
|
|
71
72
|
return jsonResult(plan);
|
|
72
73
|
});
|
|
74
|
+
previewWhen('ga4_create_bigquery_link', unconfirmed);
|
|
73
75
|
server.tool('ga4_create_bigquery_link', 'GA4 → BigQuery export 링크 생성. confirm 생략/false 시 읽기 전용 계획만 반환하고, confirm: true 일 때만 계획을 재검사한 뒤 생성한다. 기존 링크가 있으면 no-op.', {
|
|
74
76
|
...bigQueryLinkSchema,
|
|
75
77
|
confirm: z.boolean().optional().describe('true 명시 시에만 원격 링크 생성. 생략/false 면 계획만 반환'),
|
|
@@ -7,6 +7,7 @@ import { jsonResult, textResult } from '../lib/mcp-response.js';
|
|
|
7
7
|
import { SIGNING_SECRET_FIELDS, resolveKeystoreInput, resolveSecretInput } from '../android/keystore-store.js';
|
|
8
8
|
import { ambiguousDefaultIdNote, existingCredentialPreview, jenkinsConfiguredLines, jenkinsNotConfiguredLines, newCredentialPreview, } from '../jenkins/messages.js';
|
|
9
9
|
import { catalog } from '#core/lang.js';
|
|
10
|
+
import { previewWhen, unconfirmed } from '../lib/audit-log.js';
|
|
10
11
|
const M = catalog({
|
|
11
12
|
corrupt: (file, reason) => `❌ ${file} 이 손상되어 읽을 수 없습니다 (${reason}). 다시 저장하면 새로 씁니다.`,
|
|
12
13
|
saved: '✅ Jenkins 설정 저장 완료',
|
|
@@ -97,6 +98,7 @@ export function registerJenkinsTools(server) {
|
|
|
97
98
|
return textResult(M().credentials(list.length, lines.join('\n')));
|
|
98
99
|
});
|
|
99
100
|
// ── 3. Secret Text ─────────────────────────────────────────────────────────
|
|
101
|
+
previewWhen('jenkins_create_credential', unconfirmed);
|
|
100
102
|
server.tool('jenkins_create_credential', [
|
|
101
103
|
'Jenkins에 Secret Text credential을 생성하거나 업데이트합니다.',
|
|
102
104
|
'비밀번호, API 키, 앱 시크릿 등 문자열 값에 사용하세요.',
|
|
@@ -130,6 +132,7 @@ export function registerJenkinsTools(server) {
|
|
|
130
132
|
return textResult(`✅ Jenkins credential ${result}: \`${id}\``);
|
|
131
133
|
});
|
|
132
134
|
// ── 4. Secret File (keystore) ──────────────────────────────────────────────
|
|
135
|
+
previewWhen('jenkins_upload_keystore', unconfirmed);
|
|
133
136
|
server.tool('jenkins_upload_keystore', [
|
|
134
137
|
'Jenkins에 Android keystore 파일을 Secret File credential로 업로드합니다.',
|
|
135
138
|
'keystore_base64에 .jks/.p12 파일을 base64로 인코딩한 값을 전달하세요.',
|
|
@@ -9,6 +9,9 @@ import type { ToolRegistrar } from '../../lib/tool-registrar.js';
|
|
|
9
9
|
* playstore_update_listing
|
|
10
10
|
* playstore_list_tracks
|
|
11
11
|
* playstore_get_statistics
|
|
12
|
+
* playstore_list_vitals_issues
|
|
13
|
+
* playstore_list_vitals_reports
|
|
14
|
+
* playstore_list_vitals_anomalies
|
|
12
15
|
*/
|
|
13
16
|
export declare function registerListingTools(server: ToolRegistrar): void;
|
|
14
17
|
/** playstore_upload_data_safety */
|
|
@@ -7,6 +7,7 @@ import { readDataSafetyCsv } from '../../playstore/data-safety.js';
|
|
|
7
7
|
import { dataSafetyDryRunLines, dataSafetyUploadedLines } from '../../playstore/messages.js';
|
|
8
8
|
import { playstore } from './shared.js';
|
|
9
9
|
import { catalog } from '#core/lang.js';
|
|
10
|
+
import { previewWhen, unconfirmed } from '../../lib/audit-log.js';
|
|
10
11
|
const M = catalog({
|
|
11
12
|
updated: (json) => `수정 완료:\n${json}`,
|
|
12
13
|
}, {
|
|
@@ -19,6 +20,9 @@ const M = catalog({
|
|
|
19
20
|
* playstore_update_listing
|
|
20
21
|
* playstore_list_tracks
|
|
21
22
|
* playstore_get_statistics
|
|
23
|
+
* playstore_list_vitals_issues
|
|
24
|
+
* playstore_list_vitals_reports
|
|
25
|
+
* playstore_list_vitals_anomalies
|
|
22
26
|
*/
|
|
23
27
|
export function registerListingTools(server) {
|
|
24
28
|
server.tool('playstore_get_app', 'Google Play 앱 세부정보 조회 — 개발자 연락처(이메일·전화·웹사이트)·기본 언어 등 (edits.details). 수정은 playstore_update_details.', { packageName: androidPackageName.describe('패키지명 (예: com.example.app)') }, async ({ packageName }) => {
|
|
@@ -109,9 +113,47 @@ export function registerListingTools(server) {
|
|
|
109
113
|
const result = await playstore.getStatistics(auth, args.packageName, args);
|
|
110
114
|
return jsonResult(result);
|
|
111
115
|
});
|
|
116
|
+
const vitalsRange = {
|
|
117
|
+
startDate: z.string().optional().describe('시작일 YYYY-MM-DD (00:00 UTC부터). endDate와 함께 지정, 둘 다 생략하면 최근 24시간'),
|
|
118
|
+
endDate: z.string().optional().describe('종료일 YYYY-MM-DD (이날 00:00 UTC 전까지, 미포함)'),
|
|
119
|
+
types: z.array(z.enum(['CRASH', 'ANR', 'NON_FATAL'])).optional().describe('오류 종류. 생략하면 전부'),
|
|
120
|
+
versionCode: z.number().int().positive().optional().describe('이 versionCode 만'),
|
|
121
|
+
filter: z.string().optional().describe('추가 AIP-160 조건 (위 조건과 AND). 예: deviceBrand = "samsung" · apiLevel = 34 · appProcessState = FOREGROUND · isUserPerceived'),
|
|
122
|
+
pageToken: z.string().optional().describe('다음 페이지 토큰 (다른 인자는 직전 호출과 같아야 함)'),
|
|
123
|
+
};
|
|
124
|
+
server.tool('playstore_list_vitals_issues', 'Android vitals 오류 이슈 — 크래시·ANR을 원인별로 묶은 목록(원인 예외·위치·보고서 수·영향 사용자·첫/마지막 버전·Play Console 링크). 비율 추이는 playstore_get_statistics, 스택 트레이스는 playstore_list_vitals_reports.', {
|
|
125
|
+
packageName: androidPackageName.describe('패키지명 (예: com.example.app)'),
|
|
126
|
+
...vitalsRange,
|
|
127
|
+
orderBy: z.enum(['errorReportCount desc', 'distinctUsers desc']).default('errorReportCount desc').describe('정렬. 기본: 보고서 수 많은 순'),
|
|
128
|
+
includeSampleReport: z.boolean().optional().describe('이슈마다 샘플 보고서 이름 1개 포함 (그 이슈의 보고서는 playstore_list_vitals_reports의 issueId로 열람)'),
|
|
129
|
+
pageSize: z.number().int().min(1).max(1000).optional().describe('최대 이슈 수 (기본 20, 최대 1000)'),
|
|
130
|
+
}, async ({ packageName, ...query }) => {
|
|
131
|
+
const auth = await requirePlayStoreAuth(packageName, PLAY_DEVELOPER_REPORTING_SCOPE);
|
|
132
|
+
return jsonResult(await playstore.searchErrorIssues(auth, packageName, query));
|
|
133
|
+
});
|
|
134
|
+
server.tool('playstore_list_vitals_reports', 'Android vitals 오류 보고서 — 개별 크래시·ANR 보고서(스택 트레이스 reportText, 기기·OS·앱 버전, 발생 시각). issueId로 한 이슈의 보고서만 볼 수 있다.', {
|
|
135
|
+
packageName: androidPackageName.describe('패키지명 (예: com.example.app)'),
|
|
136
|
+
issueId: z.string().optional().describe('오류 이슈 — playstore_list_vitals_issues가 준 name 또는 그 마지막 조각'),
|
|
137
|
+
...vitalsRange,
|
|
138
|
+
pageSize: z.number().int().min(1).max(100).optional().describe('최대 보고서 수 (기본 5, 최대 100 — 보고서마다 스택 트레이스가 길다)'),
|
|
139
|
+
}, async ({ packageName, ...query }) => {
|
|
140
|
+
const auth = await requirePlayStoreAuth(packageName, PLAY_DEVELOPER_REPORTING_SCOPE);
|
|
141
|
+
return jsonResult(await playstore.searchErrorReports(auth, packageName, query));
|
|
142
|
+
});
|
|
143
|
+
server.tool('playstore_list_vitals_anomalies', 'Android vitals 이상 징후 — Play가 "평소보다 나빠졌다"고 감지한 지표 구간(지표·차원·기간). 출시 후 회귀 감시용.', {
|
|
144
|
+
packageName: androidPackageName.describe('패키지명 (예: com.example.app)'),
|
|
145
|
+
startDate: z.string().optional().describe('이날 00:00 UTC 이후 활성인 것. 생략하면 처음부터'),
|
|
146
|
+
endDate: z.string().optional().describe('이날 00:00 UTC 전까지 활성인 것. 생략하면 지금까지'),
|
|
147
|
+
pageSize: z.number().int().min(1).max(100).optional().describe('최대 개수 (기본 20, 최대 100)'),
|
|
148
|
+
pageToken: z.string().optional().describe('다음 페이지 토큰'),
|
|
149
|
+
}, async ({ packageName, ...query }) => {
|
|
150
|
+
const auth = await requirePlayStoreAuth(packageName, PLAY_DEVELOPER_REPORTING_SCOPE);
|
|
151
|
+
return jsonResult(await playstore.listAnomalies(auth, packageName, query));
|
|
152
|
+
});
|
|
112
153
|
}
|
|
113
154
|
/** playstore_upload_data_safety */
|
|
114
155
|
export function registerDataSafetyTool(server) {
|
|
156
|
+
previewWhen('playstore_upload_data_safety', unconfirmed);
|
|
115
157
|
server.tool('playstore_upload_data_safety', [
|
|
116
158
|
'Play 데이터 안전(Safety Labels) 선언을 업로드한다 — POST applications/{packageName}/dataSafety.',
|
|
117
159
|
'오래 Console 전용으로 알려졌던 항목이지만 API 가 있다.',
|
|
@@ -5,6 +5,7 @@ import { textResult } from '../../lib/mcp-response.js';
|
|
|
5
5
|
import { recoveryActionsText, recoveryCreateDryRunLines, recoveryCreatedLines, } from '../../playstore/messages.js';
|
|
6
6
|
import { playstore } from './shared.js';
|
|
7
7
|
import { catalog } from '#core/lang.js';
|
|
8
|
+
import { previewWhen, unconfirmed } from '../../lib/audit-log.js';
|
|
8
9
|
const M = catalog({
|
|
9
10
|
none: '복구 액션 없음.',
|
|
10
11
|
deployDryRun: (id) => `🛑 dry-run — 복구 액션 ${id} 를 배포할 참이다. 대상 사용자에게 원격 업데이트가 나간다. confirm: true 로 다시 호출.`,
|
|
@@ -39,6 +40,7 @@ export function registerRecoveryTools(server) {
|
|
|
39
40
|
return textResult(M().none);
|
|
40
41
|
return textResult(recoveryActionsText(rows));
|
|
41
42
|
});
|
|
43
|
+
previewWhen('playstore_create_recovery_action', unconfirmed);
|
|
42
44
|
server.tool('playstore_create_recovery_action', [
|
|
43
45
|
'앱 복구 액션을 DRAFT 상태로 만든다 — apprecovery.create.',
|
|
44
46
|
'만들기만 하고 배포하지 않는다 (배포는 playstore_deploy_recovery_action).',
|
|
@@ -70,6 +72,7 @@ export function registerRecoveryTools(server) {
|
|
|
70
72
|
const r = await playstore.createRecoveryAction(auth, packageName, targeting);
|
|
71
73
|
return textResult(recoveryCreatedLines(r));
|
|
72
74
|
});
|
|
75
|
+
previewWhen('playstore_deploy_recovery_action', unconfirmed);
|
|
73
76
|
server.tool('playstore_deploy_recovery_action', [
|
|
74
77
|
'DRAFT 복구 액션을 실제로 배포한다 — apprecovery.deploy.',
|
|
75
78
|
'⚠️ 대상 사용자 기기에 원격 인앱 업데이트가 나간다. 되돌리려면 취소해야 하고, 이미 적용된 기기는 되돌아가지 않는다.',
|
|
@@ -86,6 +89,7 @@ export function registerRecoveryTools(server) {
|
|
|
86
89
|
const r = await playstore.deployRecoveryAction(auth, packageName, appRecoveryId);
|
|
87
90
|
return textResult(M().deployed(r.appRecoveryId));
|
|
88
91
|
});
|
|
92
|
+
previewWhen('playstore_cancel_recovery_action', unconfirmed);
|
|
89
93
|
server.tool('playstore_cancel_recovery_action', [
|
|
90
94
|
'진행 중인 복구 액션을 취소한다 — apprecovery.cancel.',
|
|
91
95
|
'아직 받지 않은 기기에는 더 이상 나가지 않는다. 이미 적용된 기기는 되돌아가지 않는다.',
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { ensureFreshAccessToken, getStoredTokens, youtubeUploadProfiles } from '../auth/google-auth.js';
|
|
2
|
+
import { summarizeGrantedDomains } from '../auth/scopes.js';
|
|
3
|
+
import { loadFacebookConfig } from '../facebook/config.js';
|
|
4
|
+
import { loadInstagramConfig } from '../instagram/config.js';
|
|
5
|
+
import { loadThreadsConfig } from '../threads/config.js';
|
|
6
|
+
import { loadTikTokBusinessConfig } from '../tiktok-business/config.js';
|
|
7
|
+
import { tokenFreshness as tiktokTokenFreshness } from '../tiktok-business/auth.js';
|
|
8
|
+
import { metaTokenFreshness } from '../lib/meta-auth.js';
|
|
9
|
+
import { resolveSocialConfigTarget } from '../social/profile-store.js';
|
|
10
|
+
import { readPackageRootText } from '../lib/package-root.js';
|
|
11
|
+
import { textResult } from '../lib/mcp-response.js';
|
|
12
|
+
import { describeToolsets } from '../lib/toolsets.js';
|
|
13
|
+
import { describeApproval } from '../lib/human-approval.js';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import os from 'node:os';
|
|
16
|
+
import { findInvalidJsonFiles } from '../lib/json-file.js';
|
|
17
|
+
import { catalog } from '#core/lang.js';
|
|
18
|
+
/** 소셜 서버의 연결 진단 — 앱 운영 서버의 mimi_seed_status 에서 소셜 줄을 떼어 왔다. */
|
|
19
|
+
const S = catalog({
|
|
20
|
+
header: (version) => `📣 Mimi Seed Social 연결 상태 — local-stdio (@yoonion/mimi-seed-mcp v${version}, 소셜 서버)`,
|
|
21
|
+
metaMissing: (padded, fix) => `❌ ${padded} — 미설정 → ${fix} (선택)`,
|
|
22
|
+
metaExpired: (padded, fix) => `❌ ${padded} — 토큰 만료 → ${fix}`,
|
|
23
|
+
metaExpiring: (padded, days, detail, fix) => `⚠️ ${padded} — ${days}일 후 만료 (${detail}) → ${fix}`,
|
|
24
|
+
metaUnknown: (padded, detail) => `⚠️ ${padded} — 설정됨, 만료일 미상 (${detail}) → 계정 조회 도구로 검증`,
|
|
25
|
+
metaOk: (padded, detail, days) => `✅ ${padded} — 연결됨 (${detail}, ${days}일 남음)`,
|
|
26
|
+
tiktokMissing: '❌ TikTok Business — 미설정 → mimi-seed auth tiktok (선택)',
|
|
27
|
+
tiktokRefreshExpired: (openId) => `❌ TikTok Business — refresh token 만료 (${openId}) → mimi-seed auth tiktok`,
|
|
28
|
+
tiktokAccessExpired: (openId) => `⚠️ TikTok Business — 연결됨, 다음 호출에서 access token 자동 갱신 (${openId})`,
|
|
29
|
+
tiktokOk: (openId) => `✅ TikTok Business — Organic API 연결됨 (${openId})`,
|
|
30
|
+
youtubeUpload: '✅ YouTube — 업로드 권한 연결됨 (social_publish 의 youtube 대상)',
|
|
31
|
+
youtubeProfiles: (list) => `✅ YouTube — 업로드 권한 연결됨 (프로필 ${list})`,
|
|
32
|
+
youtubeMissing: '❌ YouTube — 업로드 권한 없음 → 메인 Mimi Seed 서버의 mimi_seed_auth_start(profile="youtube", domains=["youtube"]) (선택)',
|
|
33
|
+
invalidHeader: '── ⚠️ 읽을 수 없는 설정 파일 ─────────────────────',
|
|
34
|
+
invalidReason: (reason) => ` 원인: ${reason}`,
|
|
35
|
+
invalidFix: ' → 해당 연결을 다시 설정하면 파일을 새로 씁니다. 고치기 전 내용을 보존하려면 먼저 백업하세요.',
|
|
36
|
+
footer: '앱 스토어 · 클라우드 · CI · 영상 제작 연결은 메인 Mimi Seed 서버의 mimi_seed_status 로 확인한다.',
|
|
37
|
+
}, {
|
|
38
|
+
header: (version) => `📣 Mimi Seed Social connection status — local-stdio (@yoonion/mimi-seed-mcp v${version}, social server)`,
|
|
39
|
+
metaMissing: (padded, fix) => `❌ ${padded} — not set up → ${fix} (optional)`,
|
|
40
|
+
metaExpired: (padded, fix) => `❌ ${padded} — token expired → ${fix}`,
|
|
41
|
+
metaExpiring: (padded, days, detail, fix) => `⚠️ ${padded} — expires in ${days} day(s) (${detail}) → ${fix}`,
|
|
42
|
+
metaUnknown: (padded, detail) => `⚠️ ${padded} — set up, expiry unknown (${detail}) → verify with the account lookup tool`,
|
|
43
|
+
metaOk: (padded, detail, days) => `✅ ${padded} — connected (${detail}, ${days} day(s) left)`,
|
|
44
|
+
tiktokMissing: '❌ TikTok Business — not set up → mimi-seed auth tiktok (optional)',
|
|
45
|
+
tiktokRefreshExpired: (openId) => `❌ TikTok Business — refresh token expired (${openId}) → mimi-seed auth tiktok`,
|
|
46
|
+
tiktokAccessExpired: (openId) => `⚠️ TikTok Business — connected; the access token refreshes automatically on the next call (${openId})`,
|
|
47
|
+
tiktokOk: (openId) => `✅ TikTok Business — Organic API connected (${openId})`,
|
|
48
|
+
youtubeUpload: '✅ YouTube — upload permission connected (social_publish youtube target)',
|
|
49
|
+
youtubeProfiles: (list) => `✅ YouTube — upload permission connected (profile ${list})`,
|
|
50
|
+
youtubeMissing: '❌ YouTube — no upload permission → mimi_seed_auth_start(profile="youtube", domains=["youtube"]) on the main Mimi Seed server (optional)',
|
|
51
|
+
invalidHeader: '── ⚠️ Unreadable config files ─────────────────────',
|
|
52
|
+
invalidReason: (reason) => ` Cause: ${reason}`,
|
|
53
|
+
invalidFix: ' → Setting up that connection again rewrites the file. To keep its current contents, back it up first.',
|
|
54
|
+
footer: 'App store, cloud, CI, and video-production connections are checked with mimi_seed_status on the main Mimi Seed server.',
|
|
55
|
+
});
|
|
56
|
+
const { version: PKG_VERSION } = JSON.parse(readPackageRootText('package.json'));
|
|
57
|
+
function renderMetaConnection(label, config, detail, fix) {
|
|
58
|
+
const padded = label.padEnd(18);
|
|
59
|
+
const m = S();
|
|
60
|
+
if (!config)
|
|
61
|
+
return m.metaMissing(padded, fix);
|
|
62
|
+
const freshness = metaTokenFreshness(config.expiresAt);
|
|
63
|
+
if (freshness.state === 'expired')
|
|
64
|
+
return m.metaExpired(padded, fix);
|
|
65
|
+
if (freshness.state === 'expiring')
|
|
66
|
+
return m.metaExpiring(padded, freshness.daysRemaining, detail, fix);
|
|
67
|
+
if (freshness.state === 'unknown')
|
|
68
|
+
return m.metaUnknown(padded, detail);
|
|
69
|
+
return m.metaOk(padded, detail, freshness.daysRemaining);
|
|
70
|
+
}
|
|
71
|
+
export function registerSocialStatusTools(server) {
|
|
72
|
+
server.tool('social_status', [
|
|
73
|
+
'소셜 게시 초기 설정, 연결 확인 또는 인증 문제 진단에 사용합니다.',
|
|
74
|
+
'Facebook / Instagram / Threads / TikTok Business / YouTube(통합 게시 대상) 연결 상태를 한 번에 스캔해',
|
|
75
|
+
'✅ / ❌ 리포트와 미설정 서비스마다 실행할 명령을 반환합니다.',
|
|
76
|
+
].join(' '), {}, async () => {
|
|
77
|
+
const m = S();
|
|
78
|
+
const lines = [
|
|
79
|
+
m.header(PKG_VERSION),
|
|
80
|
+
`🧰 Toolsets: ${describeToolsets(server.toolsets, server.manifest)}`,
|
|
81
|
+
`🛡️ Approval: ${describeApproval(server.approvalStatus())}`,
|
|
82
|
+
'',
|
|
83
|
+
];
|
|
84
|
+
// Meta 소셜 — 프로필 결정이 throw 하면(깨진 .mimi-seed.json · 잘못된 socialProfiles) 리포트 전체를
|
|
85
|
+
// 죽이지 않고 그 줄에 원인을 보인다. 게시 도구는 같은 경우에 실패한다(기본 계정으로 폴백하지 않는다).
|
|
86
|
+
const socialLine = (label, render) => {
|
|
87
|
+
try {
|
|
88
|
+
lines.push(render());
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
lines.push(`❌ ${label.padEnd(17)} — ${error instanceof Error ? error.message : String(error)}`);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
socialLine('Facebook', () => {
|
|
95
|
+
const fb = loadFacebookConfig();
|
|
96
|
+
return renderMetaConnection('Facebook', fb, `pageId: ${fb?.pageId ?? ''}`, 'mimi-seed auth facebook');
|
|
97
|
+
});
|
|
98
|
+
socialLine('Instagram', () => {
|
|
99
|
+
const igTarget = resolveSocialConfigTarget('instagram');
|
|
100
|
+
const ig = loadInstagramConfig();
|
|
101
|
+
return renderMetaConnection('Instagram', ig, `${igTarget.profile ? `profile: ${igTarget.profile}, ` : ''}userId: ${ig?.userId ?? ''}`, `mimi-seed auth instagram${igTarget.profile ? ` --profile ${igTarget.profile}` : ''}`);
|
|
102
|
+
});
|
|
103
|
+
socialLine('Threads', () => {
|
|
104
|
+
const threadsTarget = resolveSocialConfigTarget('threads');
|
|
105
|
+
const threads = loadThreadsConfig();
|
|
106
|
+
return renderMetaConnection('Threads', threads, `${threadsTarget.profile ? `profile: ${threadsTarget.profile}, ` : ''}userId: ${threads?.userId ?? ''}`, `mimi-seed auth threads${threadsTarget.profile ? ` --profile ${threadsTarget.profile}` : ''}`);
|
|
107
|
+
});
|
|
108
|
+
// TikTok Business — 네트워크 없이 refresh token 만료 상태까지 판정.
|
|
109
|
+
const tiktok = loadTikTokBusinessConfig();
|
|
110
|
+
const tiktokFreshness = tiktokTokenFreshness(tiktok);
|
|
111
|
+
if (!tiktok)
|
|
112
|
+
lines.push(m.tiktokMissing);
|
|
113
|
+
else if (tiktokFreshness.state === 'refresh_expired')
|
|
114
|
+
lines.push(m.tiktokRefreshExpired(tiktok.openId));
|
|
115
|
+
else if (tiktokFreshness.state === 'access_expired')
|
|
116
|
+
lines.push(m.tiktokAccessExpired(tiktok.openId));
|
|
117
|
+
else
|
|
118
|
+
lines.push(m.tiktokOk(tiktok.openId));
|
|
119
|
+
// YouTube — social_publish 의 youtube 대상은 Google 로그인을 쓴다. 로그인 자체는 메인 서버가 한다.
|
|
120
|
+
const oauth = await ensureFreshAccessToken();
|
|
121
|
+
const oauthOk = oauth.status === 'fresh' || oauth.status === 'refreshed';
|
|
122
|
+
const profiles = youtubeUploadProfiles();
|
|
123
|
+
if (oauthOk && summarizeGrantedDomains(getStoredTokens()?.scope).granted.includes('youtube')) {
|
|
124
|
+
lines.push(m.youtubeUpload);
|
|
125
|
+
}
|
|
126
|
+
else if (profiles.length > 0) {
|
|
127
|
+
lines.push(m.youtubeProfiles(profiles.map((p) => (p.channelTitle ? `${p.profile}: ${p.channelTitle}` : p.profile)).join(', ')));
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
lines.push(m.youtubeMissing);
|
|
131
|
+
}
|
|
132
|
+
// 로더는 "없음"과 "깨짐"을 둘 다 null 로 돌려주므로 위 줄들은 ❌ 미설정으로만 보인다 — 깨진 파일은 따로 밝힌다.
|
|
133
|
+
const invalidFiles = findInvalidJsonFiles(path.join(os.homedir(), '.mimi-seed'));
|
|
134
|
+
if (invalidFiles.length > 0) {
|
|
135
|
+
lines.push('', m.invalidHeader);
|
|
136
|
+
for (const { file, reason } of invalidFiles)
|
|
137
|
+
lines.push(`❌ ${file}`, m.invalidReason(reason));
|
|
138
|
+
lines.push(m.invalidFix);
|
|
139
|
+
}
|
|
140
|
+
lines.push('', m.footer);
|
|
141
|
+
return textResult(lines.join('\n'));
|
|
142
|
+
});
|
|
143
|
+
}
|