@yoonion/mimi-seed-mcp 0.19.4 → 0.19.5

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.
@@ -31,6 +31,14 @@ export interface AppStoreKey {
31
31
  keyId: string;
32
32
  privateKey: string;
33
33
  }
34
+ /**
35
+ * 최상위 ASC API 키를 교체하되 같은 파일에 저장된 선택 설정은 보존한다.
36
+ *
37
+ * 재인증은 primary key 교체이지 appstore.json 전체 초기화가 아니다. 특히
38
+ * vendorNumber 와 reportsKey 는 별도 화면/키에서 얻는 값이라 다시 묻지 않고
39
+ * 지우면 매출·분석 기능이 조용히 망가진다.
40
+ */
41
+ export declare function mergeAppStoreCredentials(existing: AppStoreCredentials | null, primary: AppStoreKey, vendorNumber?: string): AppStoreCredentials;
34
42
  export declare function getAppStoreCredentials(): AppStoreCredentials | null;
35
43
  export declare function saveAppStoreCredentials(creds: AppStoreCredentials): void;
36
44
  export declare function generateToken(creds: AppStoreCredentials): Promise<string>;
@@ -10,6 +10,20 @@ import { writeCredentialJson } from '../lib/atomic-write.js';
10
10
  // force a re-setup.
11
11
  const CONFIG_PATH = path.join(os.homedir(), '.mimi-seed', 'appstore.json');
12
12
  const LEGACY_CONFIG_PATH = path.join(os.homedir(), '.preseed', 'appstore.json');
13
+ /**
14
+ * 최상위 ASC API 키를 교체하되 같은 파일에 저장된 선택 설정은 보존한다.
15
+ *
16
+ * 재인증은 primary key 교체이지 appstore.json 전체 초기화가 아니다. 특히
17
+ * vendorNumber 와 reportsKey 는 별도 화면/키에서 얻는 값이라 다시 묻지 않고
18
+ * 지우면 매출·분석 기능이 조용히 망가진다.
19
+ */
20
+ export function mergeAppStoreCredentials(existing, primary, vendorNumber) {
21
+ const merged = { ...(existing ?? {}), ...primary };
22
+ const normalizedVendorNumber = vendorNumber?.trim();
23
+ if (normalizedVendorNumber)
24
+ merged.vendorNumber = normalizedVendorNumber;
25
+ return merged;
26
+ }
13
27
  export function getAppStoreCredentials() {
14
28
  const pathToRead = fs.existsSync(CONFIG_PATH)
15
29
  ? CONFIG_PATH
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { saveAppStoreCredentials, getAppStoreCredentials } from './auth.js';
2
+ import { getAppStoreCredentials, mergeAppStoreCredentials } from './auth.js';
3
+ import { verifyAndSaveAppStoreCredentials } from './setup.js';
3
4
  import readline from 'node:readline';
4
5
  import fs from 'node:fs';
5
6
  import { resolveLang } from '../lib/lang.js';
6
7
  // ko 가 원본이고 en 은 `typeof ko` 를 만족해야 한다 — 키를 빠뜨리면 컴파일이 깨진다.
7
8
  const ko = {
8
9
  title: ' 🍎 Mimi Seed — App Store Connect 연결',
9
- already: (keyId) => ` ✅ 이미 연결됨 (Key ID: ${keyId})`,
10
- reconnect: ' 다시 설정할래? (y/N): ',
10
+ already: (keyId) => ` ✅ 설정 파일 있음 (Key ID: ${keyId}) — API 권한은 다시 검증합니다`,
11
+ reconnect: ' API Key도 다시 설정할래? (y/N): ',
11
12
  needTitle: ' App Store Connect에서 API Key를 만들어야 해:',
12
13
  step1: ' 1. "키 생성" 클릭',
13
14
  step2: ' 2. 이름: Mimi Seed, 역할: Admin',
@@ -15,16 +16,20 @@ const ko = {
15
16
  askIssuerId: ' Issuer ID: ',
16
17
  askKeyId: ' Key ID: ',
17
18
  askP8Path: ' .p8 파일 경로: ',
19
+ askVendorNumber: ' Vendor Number (선택, Enter로 기존 값 유지): ',
18
20
  noFile: (p) => ` ❌ 파일 없음: ${p}`,
19
- done: ' ✅ 연결 완료!',
21
+ verifying: ' Apple API로 자격증명을 검증하는 중...',
22
+ verifyFailed: (stage, message) => ` ❌ 검증 실패 (${stage}) — 저장하지 않았습니다.\n${message}`,
23
+ done: ' ✅ 연결 완료! (App Store API 검증 성공)',
24
+ vendorDone: ' ✅ Vendor Number 저장 완료! (기존 App Store API 키 검증 성공)',
20
25
  nextTitle: ' 이제 Claude Code 또는 Codex에서:',
21
26
  nextExample1: ' "내 앱스토어 앱 목록 보여줘"',
22
27
  nextExample2: ' "TestFlight 빌드 목록 보여줘"',
23
28
  };
24
29
  const en = {
25
30
  title: ' 🍎 Mimi Seed — Connect App Store Connect',
26
- already: (keyId) => ` ✅ Already connected (Key ID: ${keyId})`,
27
- reconnect: ' Set it up again? (y/N): ',
31
+ already: (keyId) => ` ✅ Configuration found (Key ID: ${keyId}) — API access will be verified again`,
32
+ reconnect: ' Replace the API Key too? (y/N): ',
28
33
  needTitle: ' You need to create an API Key in App Store Connect:',
29
34
  step1: ' 1. Click "Generate API Key"',
30
35
  step2: ' 2. Name: Mimi Seed, Access: Admin',
@@ -32,8 +37,12 @@ const en = {
32
37
  askIssuerId: ' Issuer ID: ',
33
38
  askKeyId: ' Key ID: ',
34
39
  askP8Path: ' Path to the .p8 file: ',
40
+ askVendorNumber: ' Vendor Number (optional, Enter keeps the saved value): ',
35
41
  noFile: (p) => ` ❌ File not found: ${p}`,
36
- done: ' ✅ Connected!',
42
+ verifying: ' Verifying the credentials with the Apple API...',
43
+ verifyFailed: (stage, message) => ` ❌ Verification failed (${stage}) — nothing was saved.\n${message}`,
44
+ done: ' ✅ Connected! (App Store API verification passed)',
45
+ vendorDone: ' ✅ Vendor Number saved! (existing App Store API key verification passed)',
37
46
  nextTitle: ' Now, in Claude Code or Codex:',
38
47
  nextExample1: ' "Show my App Store apps"',
39
48
  nextExample2: ' "List the TestFlight builds"',
@@ -41,15 +50,31 @@ const en = {
41
50
  const M = resolveLang() === 'en' ? en : ko;
42
51
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
43
52
  const ask = (q) => new Promise((r) => rl.question(q, r));
53
+ async function saveIfVerified(credentials) {
54
+ console.log(M.verifying);
55
+ const verification = await verifyAndSaveAppStoreCredentials(credentials);
56
+ if (verification.ok)
57
+ return true;
58
+ console.log(M.verifyFailed(verification.stage, verification.message));
59
+ process.exitCode = 1;
60
+ return false;
61
+ }
44
62
  async function main() {
45
63
  console.log('');
46
64
  console.log(M.title);
47
65
  console.log('');
48
66
  const existing = getAppStoreCredentials();
67
+ let vendorNumber = '';
49
68
  if (existing) {
50
69
  console.log(M.already(existing.keyId));
70
+ vendorNumber = await ask(M.askVendorNumber);
51
71
  const answer = await ask(M.reconnect);
52
72
  if (answer.toLowerCase() !== 'y') {
73
+ if (vendorNumber.trim()) {
74
+ const credentials = mergeAppStoreCredentials(existing, existing, vendorNumber);
75
+ if (await saveIfVerified(credentials))
76
+ console.log(M.vendorDone);
77
+ }
53
78
  rl.close();
54
79
  return;
55
80
  }
@@ -64,6 +89,8 @@ async function main() {
64
89
  const issuerId = await ask(M.askIssuerId);
65
90
  const keyId = await ask(M.askKeyId);
66
91
  const p8Path = await ask(M.askP8Path);
92
+ if (!existing)
93
+ vendorNumber = await ask(M.askVendorNumber);
67
94
  const trimmedPath = p8Path.trim().replace(/^["']|["']$/g, '');
68
95
  if (!fs.existsSync(trimmedPath)) {
69
96
  console.log(M.noFile(trimmedPath));
@@ -71,11 +98,11 @@ async function main() {
71
98
  process.exit(1);
72
99
  }
73
100
  const privateKey = fs.readFileSync(trimmedPath, 'utf-8');
74
- saveAppStoreCredentials({
75
- issuerId: issuerId.trim(),
76
- keyId: keyId.trim(),
77
- privateKey,
78
- });
101
+ const credentials = mergeAppStoreCredentials(existing, { issuerId: issuerId.trim(), keyId: keyId.trim(), privateKey }, vendorNumber);
102
+ if (!(await saveIfVerified(credentials))) {
103
+ rl.close();
104
+ return;
105
+ }
79
106
  console.log('');
80
107
  console.log(M.done);
81
108
  console.log('');
@@ -0,0 +1,9 @@
1
+ import { type AppStoreCredentials } from './auth.js';
2
+ import { type AppStoreVerifyResult } from './tools.js';
3
+ interface SetupDependencies {
4
+ verify: (credentials: AppStoreCredentials) => Promise<AppStoreVerifyResult>;
5
+ save: (credentials: AppStoreCredentials) => void;
6
+ }
7
+ /** Apple API에서 실제로 쓸 수 있는 키인지 확인한 뒤에만 디스크에 저장한다. */
8
+ export declare function verifyAndSaveAppStoreCredentials(credentials: AppStoreCredentials, dependencies?: SetupDependencies): Promise<AppStoreVerifyResult>;
9
+ export {};
@@ -0,0 +1,13 @@
1
+ import { saveAppStoreCredentials, } from './auth.js';
2
+ import { verifyAppStoreCredentials, } from './tools.js';
3
+ const defaultDependencies = {
4
+ verify: verifyAppStoreCredentials,
5
+ save: saveAppStoreCredentials,
6
+ };
7
+ /** Apple API에서 실제로 쓸 수 있는 키인지 확인한 뒤에만 디스크에 저장한다. */
8
+ export async function verifyAndSaveAppStoreCredentials(credentials, dependencies = defaultDependencies) {
9
+ const result = await dependencies.verify(credentials);
10
+ if (result.ok)
11
+ dependencies.save(credentials);
12
+ return result;
13
+ }
@@ -17,7 +17,7 @@ export interface AppStoreVerifyResult {
17
17
  * 파일 존재만 보는 requireAppStoreCreds 와 달리, 잘못된 .p8/keyId/issuerId 를
18
18
  * "첫 호출 401" 로 늦게 터지기 전에 setup 단계에서 잡아준다.
19
19
  */
20
- export declare function verifyAppStoreCredentials(): Promise<AppStoreVerifyResult>;
20
+ export declare function verifyAppStoreCredentials(creds?: import("./auth.js").AppStoreCredentials | null): Promise<AppStoreVerifyResult>;
21
21
  export declare function listApps(): Promise<any>;
22
22
  export declare function getApp(appId: string): Promise<any>;
23
23
  export declare function listVersions(appId: string): Promise<any>;
@@ -36,8 +36,7 @@ export async function apiGet(path, params) {
36
36
  * 파일 존재만 보는 requireAppStoreCreds 와 달리, 잘못된 .p8/keyId/issuerId 를
37
37
  * "첫 호출 401" 로 늦게 터지기 전에 setup 단계에서 잡아준다.
38
38
  */
39
- export async function verifyAppStoreCredentials() {
40
- const creds = getAppStoreCredentials();
39
+ export async function verifyAppStoreCredentials(creds = getAppStoreCredentials()) {
41
40
  if (!creds) {
42
41
  return {
43
42
  ok: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoonion/mimi-seed-mcp",
3
- "version": "0.19.4",
3
+ "version": "0.19.5",
4
4
  "description": "Mimi Seed MCP server \u2014 Firebase + AdMob + Google Play + App Store management for Claude Code / Codex / Cursor / any MCP client.",
5
5
  "type": "module",
6
6
  "bin": {