@yoonion/mimi-seed-mcp 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/admob/cli.js +34 -5
  2. package/dist/admob/errors.js +39 -14
  3. package/dist/ai/client.js +35 -14
  4. package/dist/ai/notes.js +14 -3
  5. package/dist/ai/review.js +17 -4
  6. package/dist/android/keystore-store.js +28 -8
  7. package/dist/android/keystore.d.ts +17 -2
  8. package/dist/android/keystore.js +110 -21
  9. package/dist/android/messages.d.ts +13 -11
  10. package/dist/android/messages.js +166 -72
  11. package/dist/android/playstore-sa.js +6 -3
  12. package/dist/appstore/analytics.js +46 -14
  13. package/dist/appstore/app-info-policy.js +7 -1
  14. package/dist/appstore/app-info.js +13 -3
  15. package/dist/appstore/apps.js +7 -1
  16. package/dist/appstore/asset-library-write.js +119 -37
  17. package/dist/appstore/asset-library.js +19 -5
  18. package/dist/appstore/auth.d.ts +2 -0
  19. package/dist/appstore/auth.js +31 -5
  20. package/dist/appstore/client.js +27 -6
  21. package/dist/appstore/declarations.js +22 -6
  22. package/dist/appstore/errors.d.ts +1 -1
  23. package/dist/appstore/errors.js +60 -34
  24. package/dist/appstore/http.d.ts +6 -0
  25. package/dist/appstore/http.js +22 -5
  26. package/dist/appstore/messages.js +86 -28
  27. package/dist/appstore/previews.js +22 -6
  28. package/dist/appstore/product-localization.js +10 -2
  29. package/dist/appstore/product-review.js +29 -10
  30. package/dist/appstore/products.js +20 -6
  31. package/dist/appstore/read-response.js +13 -3
  32. package/dist/appstore/release-target.js +13 -3
  33. package/dist/appstore/release.js +59 -22
  34. package/dist/appstore/review-preview.js +17 -6
  35. package/dist/appstore/review-submission.js +86 -35
  36. package/dist/appstore/sales.js +96 -44
  37. package/dist/appstore/screenshots.js +19 -5
  38. package/dist/appstore/testflight.js +41 -18
  39. package/dist/appstore/upload-parts.js +12 -3
  40. package/dist/appstore/versions.js +22 -10
  41. package/dist/auth/bigquery-auth.js +44 -15
  42. package/dist/auth/bigquery-setup-cli.js +1 -1
  43. package/dist/auth/cli.js +4 -2
  44. package/dist/auth/constants.js +13 -3
  45. package/dist/auth/drive-auth.d.ts +3 -2
  46. package/dist/auth/drive-auth.js +47 -17
  47. package/dist/auth/drive-setup-cli.js +1 -0
  48. package/dist/auth/errors.d.ts +75 -0
  49. package/dist/auth/errors.js +190 -86
  50. package/dist/auth/google-auth.d.ts +3 -1
  51. package/dist/auth/google-auth.js +39 -27
  52. package/dist/auth/playstore-auth.d.ts +1 -0
  53. package/dist/auth/playstore-auth.js +35 -15
  54. package/dist/auth/scopes.d.ts +11 -29
  55. package/dist/auth/scopes.js +38 -11
  56. package/dist/auth/youtube-channel.d.ts +8 -0
  57. package/dist/auth/youtube-channel.js +11 -3
  58. package/dist/bigquery/ids.js +19 -5
  59. package/dist/bigquery/tools.js +24 -8
  60. package/dist/billing/tools.js +22 -6
  61. package/dist/checks/appstore-submission.d.ts +1 -1
  62. package/dist/checks/appstore-submission.js +29 -8
  63. package/dist/checks/plan.js +169 -62
  64. package/dist/checks/release-status.js +10 -2
  65. package/dist/checks/risks.js +230 -63
  66. package/dist/checks/screenshots.d.ts +4 -4
  67. package/dist/checks/screenshots.js +63 -22
  68. package/dist/ci/config.js +8 -5
  69. package/dist/ci/gitlab.js +3 -1
  70. package/dist/core/atomic-write.d.ts +5 -2
  71. package/dist/core/atomic-write.js +8 -4
  72. package/dist/core/catch-scan.d.ts +17 -0
  73. package/dist/core/catch-scan.js +111 -0
  74. package/dist/core/checks/billing.d.ts +5 -0
  75. package/dist/core/checks/billing.js +36 -5
  76. package/dist/core/checks/lockfile.js +2 -0
  77. package/dist/core/checks/release-doctor/fcm.js +1 -0
  78. package/dist/core/checks/release-doctor/files.d.ts +3 -1
  79. package/dist/core/checks/release-doctor/files.js +12 -1
  80. package/dist/core/checks/release-doctor/gradle-apply.js +1 -0
  81. package/dist/core/checks/release-doctor/ios-xcode.js +22 -3
  82. package/dist/core/checks/release-doctor/target-sdk.js +1 -1
  83. package/dist/core/checks/release-doctor/util.d.ts +5 -0
  84. package/dist/core/checks/release-doctor/util.js +56 -0
  85. package/dist/core/checks/release-doctor.js +59 -16
  86. package/dist/core/credential-envelope.d.ts +25 -0
  87. package/dist/core/credential-envelope.js +66 -0
  88. package/dist/core/credential-keystore.d.ts +37 -0
  89. package/dist/core/credential-keystore.js +275 -0
  90. package/dist/core/credential-read.d.ts +33 -0
  91. package/dist/core/credential-read.js +112 -0
  92. package/dist/core/credential-store.d.ts +61 -0
  93. package/dist/core/credential-store.js +240 -0
  94. package/dist/core/http-errors.js +1 -0
  95. package/dist/core/i18n-scan.d.ts +10 -0
  96. package/dist/core/i18n-scan.js +79 -0
  97. package/dist/core/json-file.d.ts +30 -0
  98. package/dist/core/json-file.js +53 -0
  99. package/dist/core/lang.d.ts +14 -0
  100. package/dist/core/lang.js +22 -2
  101. package/dist/core/project-manifest.d.ts +24 -1
  102. package/dist/core/project-manifest.js +27 -16
  103. package/dist/drive/tools.js +86 -34
  104. package/dist/facebook/api.js +3 -1
  105. package/dist/facebook/config.js +11 -3
  106. package/dist/facebook/setup.d.ts +2 -0
  107. package/dist/facebook/setup.js +32 -9
  108. package/dist/firebase/cli.js +39 -5
  109. package/dist/firebase/tools.js +36 -10
  110. package/dist/ga4/cli.js +48 -4
  111. package/dist/ga4/tools.js +4 -2
  112. package/dist/googleads/config.js +24 -8
  113. package/dist/googleads/tools.js +3 -1
  114. package/dist/gsc/tools.js +10 -2
  115. package/dist/helpers.d.ts +4 -2
  116. package/dist/helpers.js +66 -32
  117. package/dist/i18n/manifest-en.d.ts +6 -0
  118. package/dist/i18n/manifest-en.js +53 -0
  119. package/dist/i18n/tools-en/admob.d.ts +25 -0
  120. package/dist/i18n/tools-en/admob.js +24 -0
  121. package/dist/i18n/tools-en/ai.d.ts +14 -0
  122. package/dist/i18n/tools-en/ai.js +13 -0
  123. package/dist/i18n/tools-en/android.d.ts +14 -0
  124. package/dist/i18n/tools-en/android.js +13 -0
  125. package/dist/i18n/tools-en/appstore.d.ts +240 -0
  126. package/dist/i18n/tools-en/appstore.js +239 -0
  127. package/dist/i18n/tools-en/auth.d.ts +16 -0
  128. package/dist/i18n/tools-en/auth.js +15 -0
  129. package/dist/i18n/tools-en/bigquery.d.ts +16 -0
  130. package/dist/i18n/tools-en/bigquery.js +15 -0
  131. package/dist/i18n/tools-en/billing.d.ts +17 -0
  132. package/dist/i18n/tools-en/billing.js +16 -0
  133. package/dist/i18n/tools-en/checks.d.ts +23 -0
  134. package/dist/i18n/tools-en/checks.js +22 -0
  135. package/dist/i18n/tools-en/ci.d.ts +21 -0
  136. package/dist/i18n/tools-en/ci.js +20 -0
  137. package/dist/i18n/tools-en/drive.d.ts +33 -0
  138. package/dist/i18n/tools-en/drive.js +32 -0
  139. package/dist/i18n/tools-en/facebook.d.ts +14 -0
  140. package/dist/i18n/tools-en/facebook.js +13 -0
  141. package/dist/i18n/tools-en/firebase.d.ts +42 -0
  142. package/dist/i18n/tools-en/firebase.js +41 -0
  143. package/dist/i18n/tools-en/ga4.d.ts +35 -0
  144. package/dist/i18n/tools-en/ga4.js +34 -0
  145. package/dist/i18n/tools-en/googleads.d.ts +15 -0
  146. package/dist/i18n/tools-en/googleads.js +14 -0
  147. package/dist/i18n/tools-en/gsc.d.ts +27 -0
  148. package/dist/i18n/tools-en/gsc.js +26 -0
  149. package/dist/i18n/tools-en/iam.d.ts +15 -0
  150. package/dist/i18n/tools-en/iam.js +14 -0
  151. package/dist/i18n/tools-en/index.d.ts +7 -0
  152. package/dist/i18n/tools-en/index.js +58 -0
  153. package/dist/i18n/tools-en/instagram.d.ts +16 -0
  154. package/dist/i18n/tools-en/instagram.js +15 -0
  155. package/dist/i18n/tools-en/jenkins.d.ts +41 -0
  156. package/dist/i18n/tools-en/jenkins.js +40 -0
  157. package/dist/i18n/tools-en/naver.d.ts +10 -0
  158. package/dist/i18n/tools-en/naver.js +9 -0
  159. package/dist/i18n/tools-en/playstore.d.ts +148 -0
  160. package/dist/i18n/tools-en/playstore.js +147 -0
  161. package/dist/i18n/tools-en/registrar.d.ts +6 -0
  162. package/dist/i18n/tools-en/registrar.js +6 -0
  163. package/dist/i18n/tools-en/threads.d.ts +21 -0
  164. package/dist/i18n/tools-en/threads.js +20 -0
  165. package/dist/i18n/tools-en/tiktok.d.ts +21 -0
  166. package/dist/i18n/tools-en/tiktok.js +20 -0
  167. package/dist/i18n/tools-en/video.d.ts +59 -0
  168. package/dist/i18n/tools-en/video.js +58 -0
  169. package/dist/i18n/tools-en/youtube.d.ts +44 -0
  170. package/dist/i18n/tools-en/youtube.js +43 -0
  171. package/dist/iam/key-files.js +13 -3
  172. package/dist/instagram/api.js +19 -5
  173. package/dist/instagram/config.js +11 -3
  174. package/dist/instagram/setup.js +37 -11
  175. package/dist/jenkins/builds.d.ts +2 -2
  176. package/dist/jenkins/builds.js +70 -30
  177. package/dist/jenkins/config.d.ts +5 -0
  178. package/dist/jenkins/config.js +25 -6
  179. package/dist/jenkins/credentials.js +33 -13
  180. package/dist/jenkins/http.js +6 -3
  181. package/dist/jenkins/jobs.js +19 -5
  182. package/dist/jenkins/messages.js +93 -36
  183. package/dist/lib/cli-args.js +13 -7
  184. package/dist/lib/google-errors.js +31 -9
  185. package/dist/lib/http.js +10 -3
  186. package/dist/lib/json-file.d.ts +15 -0
  187. package/dist/lib/json-file.js +65 -0
  188. package/dist/lib/meta-auth.d.ts +1 -1
  189. package/dist/lib/meta-auth.js +26 -8
  190. package/dist/lib/package-name.js +15 -4
  191. package/dist/lib/package-root.js +1 -1
  192. package/dist/lib/paginate.js +10 -2
  193. package/dist/lib/path-containment.js +22 -6
  194. package/dist/lib/resource-id.js +10 -3
  195. package/dist/lib/store-create-result.js +54 -13
  196. package/dist/lib/text-validators.js +20 -5
  197. package/dist/lib/tool-registrar.d.ts +9 -0
  198. package/dist/lib/tool-registrar.js +33 -14
  199. package/dist/lib/tool-text.d.ts +31 -0
  200. package/dist/lib/tool-text.js +52 -0
  201. package/dist/lib/toolsets.js +13 -3
  202. package/dist/lib/url-path.js +3 -1
  203. package/dist/naver/tools.js +138 -46
  204. package/dist/playstore/data-safety.js +16 -4
  205. package/dist/playstore/errors.js +33 -8
  206. package/dist/playstore/financials.js +83 -35
  207. package/dist/playstore/listing.js +7 -1
  208. package/dist/playstore/messages.js +179 -57
  209. package/dist/playstore/products.js +10 -2
  210. package/dist/playstore/recovery.js +10 -2
  211. package/dist/playstore/releases.js +34 -14
  212. package/dist/playstore/reviews.js +14 -4
  213. package/dist/playstore/statistics.js +3 -1
  214. package/dist/prompts.js +160 -50
  215. package/dist/registers/admob.js +36 -11
  216. package/dist/registers/android.js +25 -9
  217. package/dist/registers/appstore/apps.js +22 -6
  218. package/dist/registers/appstore/customer-reviews.js +7 -1
  219. package/dist/registers/appstore/declarations.js +63 -19
  220. package/dist/registers/appstore/media.js +76 -24
  221. package/dist/registers/appstore/metadata.js +26 -8
  222. package/dist/registers/appstore/products.js +53 -19
  223. package/dist/registers/appstore/review-submission.js +31 -9
  224. package/dist/registers/appstore/testflight.js +82 -24
  225. package/dist/registers/appstore/versions.js +88 -30
  226. package/dist/registers/auth.js +343 -90
  227. package/dist/registers/bigquery.js +54 -14
  228. package/dist/registers/billing.js +18 -4
  229. package/dist/registers/checks.js +20 -5
  230. package/dist/registers/ci.js +60 -20
  231. package/dist/registers/drive.js +18 -7
  232. package/dist/registers/facebook.js +31 -9
  233. package/dist/registers/firebase.js +21 -7
  234. package/dist/registers/googleads.js +23 -6
  235. package/dist/registers/gsc.js +3 -1
  236. package/dist/registers/iam.js +44 -13
  237. package/dist/registers/instagram.js +19 -5
  238. package/dist/registers/jenkins.js +43 -14
  239. package/dist/registers/naver.js +13 -3
  240. package/dist/registers/playstore/financials.d.ts +6 -0
  241. package/dist/registers/playstore/financials.js +48 -0
  242. package/dist/registers/playstore/listing.d.ts +15 -0
  243. package/dist/registers/playstore/listing.js +138 -0
  244. package/dist/registers/playstore/media.d.ts +6 -0
  245. package/dist/registers/playstore/media.js +56 -0
  246. package/dist/registers/playstore/products.d.ts +21 -0
  247. package/dist/registers/playstore/products.js +238 -0
  248. package/dist/registers/playstore/recovery.d.ts +11 -0
  249. package/dist/registers/playstore/recovery.js +105 -0
  250. package/dist/registers/playstore/releases.d.ts +8 -0
  251. package/dist/registers/playstore/releases.js +157 -0
  252. package/dist/registers/playstore/reviews.d.ts +6 -0
  253. package/dist/registers/playstore/reviews.js +43 -0
  254. package/dist/registers/playstore/service-accounts.d.ts +13 -0
  255. package/dist/registers/playstore/service-accounts.js +127 -0
  256. package/dist/registers/playstore/shared.d.ts +12 -0
  257. package/dist/registers/playstore/shared.js +24 -0
  258. package/dist/registers/playstore.d.ts +8 -0
  259. package/dist/registers/playstore.js +28 -734
  260. package/dist/registers/threads.js +28 -8
  261. package/dist/registers/tiktok.js +4 -2
  262. package/dist/registers/video.js +3 -1
  263. package/dist/remote-sync.js +80 -28
  264. package/dist/resources.d.ts +0 -8
  265. package/dist/resources.js +73 -32
  266. package/dist/server.d.ts +2 -0
  267. package/dist/server.js +9 -1
  268. package/dist/social/profile-store.js +36 -12
  269. package/dist/social/setup-cli.js +1 -1
  270. package/dist/threads/api.js +23 -6
  271. package/dist/threads/setup.js +42 -14
  272. package/dist/tiktok-business/api.js +13 -3
  273. package/dist/tiktok-business/auth.js +10 -2
  274. package/dist/tiktok-business/config.js +8 -3
  275. package/dist/tiktok-business/posting.d.ts +6 -0
  276. package/dist/tiktok-business/posting.js +118 -36
  277. package/dist/tiktok-business/setup-cli.js +3 -1
  278. package/dist/tools-cli.js +4 -5
  279. package/dist/video/captions.js +3 -1
  280. package/dist/video/files.js +13 -3
  281. package/dist/video/project.js +65 -21
  282. package/dist/video/providers.js +52 -16
  283. package/dist/video/render.js +71 -22
  284. package/dist/video/research.js +10 -2
  285. package/dist/video/schemas.js +19 -5
  286. package/dist/video/youtube-publish.js +62 -32
  287. package/package.json +1 -1
@@ -39,7 +39,7 @@ export declare function triggerBuild(cfg: JenkinsConfig, input: TriggerInput): P
39
39
  queue_id?: number | undefined;
40
40
  queue_url?: string | undefined;
41
41
  request_id: string;
42
- state: "pending" | "unknown" | "queued" | "rejected";
42
+ state: "pending" | "rejected" | "unknown" | "queued";
43
43
  replayed: boolean;
44
44
  } | {
45
45
  persisted: boolean;
@@ -48,7 +48,7 @@ export declare function triggerBuild(cfg: JenkinsConfig, input: TriggerInput): P
48
48
  queue_id?: number | undefined;
49
49
  queue_url?: string | undefined;
50
50
  request_id: string;
51
- state: "pending" | "unknown" | "queued" | "rejected";
51
+ state: "pending" | "rejected" | "unknown" | "queued";
52
52
  replayed: boolean;
53
53
  }>;
54
54
  export declare function getQueueItem(cfg: JenkinsConfig, queueId: number): Promise<{
@@ -15,16 +15,65 @@ import os from 'node:os';
15
15
  import path from 'node:path';
16
16
  import { z } from 'zod';
17
17
  import { CREDENTIAL_DIR_MODE, writeCredentialFile, writeCredentialJson } from '#core/atomic-write.js';
18
+ import { catalog } from '#core/lang.js';
18
19
  import { authHeaders, isStrictJobPath, jobUrl, requestCrumb } from './http.js';
19
20
  import { fetchWithTimeout } from '../lib/http.js';
20
21
  import { encodePathSegment } from '../lib/url-path.js';
22
+ const M = catalog({
23
+ badJobPath: '잡 경로에는 빈 세그먼트, . 또는 .., 백슬래시, 제어 문자를 쓸 수 없습니다.',
24
+ badRequestId: 'request_id 는 영숫자·_·- 만 쓸 수 있습니다 (최대 128자).',
25
+ badKeyFile: (name) => `Jenkins 빌드 요청 키 파일이 손상됐습니다 (${name}). 빌드를 요청하지 않았습니다.`,
26
+ needAuth: 'Jenkins 사용자와 API Token 설정이 필요합니다.',
27
+ badUrl: 'Jenkins URL은 인증정보·쿼리·fragment 없는 HTTP(S) 주소여야 합니다.',
28
+ pending: '같은 request_id 의 요청을 다른 호출이 방금 예약해 처리 중입니다. 잠시 뒤 같은 request_id 로 다시 호출해 결과를 확인하세요. '
29
+ + '새 request_id 로 재시도하지 마세요.',
30
+ unknown: '접수 여부 불명입니다. 자동 재전송하지 않습니다. Jenkins에서 접수 여부를 확인하세요. 같은 request_id 재호출도 POST하지 않습니다.',
31
+ rejected: 'Jenkins가 요청을 거절했습니다. 권한·잡·파라미터를 확인하세요. 수정 후 새 요청에만 새 request_id를 사용하세요.',
32
+ queuedNotPersisted: 'Jenkins 빌드는 큐에 들어갔습니다 — 다시 트리거하지 마세요. queue_id 를 jenkins_get_queue_item 으로 추적하세요. '
33
+ + '(로컬 결과 기록 저장 실패: 같은 request_id 재호출은 pending/unknown 으로 보이지만 재전송하지 않습니다.) '
34
+ + 'The build WAS queued — do not retrigger; track queue_id with jenkins_get_queue_item. '
35
+ + '(The local result record could not be saved; replays of this request_id report pending/unknown and never re-send.)',
36
+ notPersisted: ' 로컬 결과 기록을 저장하지 못했습니다 — 새 request_id 로 재시도하지 마세요. '
37
+ + 'The local result record could not be saved — do not retry with a new request_id.',
38
+ fingerprintMismatch: '같은 request_id에 다른 잡/파라미터를 사용할 수 없습니다. 새 요청이면 새 request_id를 쓰세요.',
39
+ crumbFailed: (status) => `Jenkins CSRF crumb 조회 실패${status} — 빌드를 요청하지 않았습니다. `
40
+ + '인증·서버 상태를 확인한 뒤 같은 request_id 로 다시 시도해도 됩니다.',
41
+ readConnect: 'Jenkins 조회 연결 실패/시간 초과. 연결 상태를 확인한 뒤 조회만 재시도하세요.',
42
+ readFailed: (status) => `Jenkins 조회 실패 (HTTP ${status}). 인증·권한·서버 상태를 확인하세요.`,
43
+ badJson: 'Jenkins JSON 응답을 읽을 수 없습니다.',
44
+ queueGone: '큐 항목이 만료됐거나 없습니다. 이미 기록한 빌드 번호로 조회하세요. 재트리거하거나 lastBuild로 추정하지 마세요.',
45
+ queueMismatch: 'Jenkins 큐 응답 형식 또는 ID가 일치하지 않습니다.',
46
+ buildMismatch: 'Jenkins 빌드 응답 형식 또는 번호가 일치하지 않습니다.',
47
+ }, {
48
+ badJobPath: 'A job path cannot contain empty segments, . or .., backslashes, or control characters.',
49
+ badRequestId: 'request_id may contain only letters, digits, _ and - (max 128 characters).',
50
+ badKeyFile: (name) => `The Jenkins build request key file is corrupted (${name}). No build was requested.`,
51
+ needAuth: 'A Jenkins user and API Token must be configured.',
52
+ badUrl: 'The Jenkins URL must be an HTTP(S) address with no credentials, query, or fragment.',
53
+ pending: 'Another call just reserved a request with the same request_id and is processing it. Call again with the same request_id shortly to check the result. '
54
+ + 'Do not retry with a new request_id.',
55
+ unknown: 'Whether Jenkins accepted the request is unknown. It is not re-sent automatically. Check in Jenkins whether it was accepted. Calling again with the same request_id does not POST either.',
56
+ rejected: 'Jenkins rejected the request. Check permissions, the job, and parameters. After fixing them, use a new request_id only for a new request.',
57
+ queuedNotPersisted: 'The build WAS queued — do not retrigger; track queue_id with jenkins_get_queue_item. '
58
+ + '(The local result record could not be saved; replays of this request_id report pending/unknown and never re-send.)',
59
+ notPersisted: ' The local result record could not be saved — do not retry with a new request_id.',
60
+ fingerprintMismatch: 'The same request_id cannot be used with a different job or parameters. Use a new request_id for a new request.',
61
+ crumbFailed: (status) => `Jenkins CSRF crumb request failed${status} — no build was requested. `
62
+ + 'After checking authentication and server status, you may retry with the same request_id.',
63
+ readConnect: 'Jenkins read failed to connect or timed out. Check the connection, then retry only the read.',
64
+ readFailed: (status) => `Jenkins read failed (HTTP ${status}). Check authentication, permissions, and server status.`,
65
+ badJson: 'Could not read the Jenkins JSON response.',
66
+ queueGone: 'The queue item expired or does not exist. Look up the build number you already recorded. Do not retrigger or guess from lastBuild.',
67
+ queueMismatch: 'The Jenkins queue response format or ID does not match.',
68
+ buildMismatch: 'The Jenkins build response format or number does not match.',
69
+ });
21
70
  export const buildJobSchema = z
22
71
  .string()
23
72
  .min(1)
24
73
  .max(1024)
25
- .refine(isStrictJobPath, '잡 경로에는 빈 세그먼트, . 또는 .., 백슬래시, 제어 문자를 쓸 수 없습니다.');
74
+ .refine(isStrictJobPath, { error: () => M().badJobPath });
26
75
  export const buildIdSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
27
- export const requestIdSchema = z.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/, 'request_id 는 영숫자·_·- 만 쓸 수 있습니다 (최대 128자).');
76
+ export const requestIdSchema = z.string().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/, { error: () => M().badRequestId });
28
77
  export const buildParametersSchema = z.record(z.string().min(1), z.string());
29
78
  export const triggerBuildSchema = z.object({
30
79
  job: buildJobSchema,
@@ -63,7 +112,7 @@ export function fingerprintKey() {
63
112
  const read = () => {
64
113
  const text = readFileSync(file, 'utf8').trim();
65
114
  if (!/^[0-9a-f]{64}$/.test(text)) {
66
- throw new Error(`Jenkins 빌드 요청 키 파일이 손상됐습니다 (${path.basename(file)}). 빌드를 요청하지 않았습니다.`);
115
+ throw new Error(M().badKeyFile(path.basename(file)));
67
116
  }
68
117
  return Buffer.from(text, 'hex');
69
118
  };
@@ -91,23 +140,19 @@ export function fingerprintKey() {
91
140
  }
92
141
  function root(cfg) {
93
142
  if (!cfg.username?.trim() || !cfg.token?.trim())
94
- throw new Error('Jenkins 사용자와 API Token 설정이 필요합니다.');
143
+ throw new Error(M().needAuth);
95
144
  const url = new URL(cfg.url);
96
145
  if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash) {
97
- throw new Error('Jenkins URL은 인증정보·쿼리·fragment 없는 HTTP(S) 주소여야 합니다.');
146
+ throw new Error(M().badUrl);
98
147
  }
99
148
  return url.href.replace(/\/+$/, '');
100
149
  }
101
150
  const queueUrlOf = (base, queueId) => `${base}/queue/item/${encodePathSegment(queueId)}/`;
102
- const MESSAGES = {
103
- pending: '같은 request_id 의 요청을 다른 호출이 방금 예약해 처리 중입니다. 잠시 뒤 같은 request_id 로 다시 호출해 결과를 확인하세요. '
104
- + '새 request_id 로 재시도하지 마세요.',
105
- unknown: '접수 여부 불명입니다. 자동 재전송하지 않습니다. Jenkins에서 접수 여부를 확인하세요. 같은 request_id 재호출도 POST하지 않습니다.',
106
- rejected: 'Jenkins가 요청을 거절했습니다. 권한·잡·파라미터를 확인하세요. 수정 후 새 요청에만 새 request_id를 사용하세요.',
107
- queued: undefined,
108
- };
151
+ function messageFor(state) {
152
+ return state === 'queued' ? undefined : M()[state];
153
+ }
109
154
  function result(receipt, base, requestId, replayed) {
110
- const message = MESSAGES[receipt.state];
155
+ const message = messageFor(receipt.state);
111
156
  return {
112
157
  request_id: requestId,
113
158
  state: receipt.state,
@@ -119,14 +164,9 @@ function result(receipt, base, requestId, replayed) {
119
164
  }
120
165
  /** 결과 기록을 저장하지 못했을 때 — 로컬 경로·원인 문자열은 싣지 않는다. */
121
166
  function notPersistedMessage(receipt) {
122
- if (receipt.state === 'queued') {
123
- return 'Jenkins 빌드는 큐에 들어갔습니다 — 다시 트리거하지 마세요. queue_id 를 jenkins_get_queue_item 으로 추적하세요. '
124
- + '(로컬 결과 기록 저장 실패: 같은 request_id 재호출은 pending/unknown 으로 보이지만 재전송하지 않습니다.) '
125
- + 'The build WAS queued — do not retrigger; track queue_id with jenkins_get_queue_item. '
126
- + '(The local result record could not be saved; replays of this request_id report pending/unknown and never re-send.)';
127
- }
128
- return `${MESSAGES[receipt.state] ?? ''} 로컬 결과 기록을 저장하지 못했습니다 — 새 request_id 로 재시도하지 마세요. `
129
- + 'The local result record could not be saved — do not retry with a new request_id.';
167
+ if (receipt.state === 'queued')
168
+ return M().queuedNotPersisted;
169
+ return `${messageFor(receipt.state) ?? ''}${M().notPersisted}`;
130
170
  }
131
171
  /** 이미 예약된 request_id 재호출 — 기록을 돌려주고 POST 하지 않는다. */
132
172
  function replay(dir, file, fingerprint, base, requestId) {
@@ -138,7 +178,7 @@ function replay(dir, file, fingerprint, base, requestId) {
138
178
  // 다른 호출이 아직 예약 중이거나, 도중에 죽어 기록이 없거나 잘렸다 — 아래에서 나이로 가른다.
139
179
  }
140
180
  if (receipt && receipt.fingerprint !== fingerprint) {
141
- throw new Error('같은 request_id에 다른 잡/파라미터를 사용할 수 없습니다. 새 요청이면 새 request_id를 쓰세요.');
181
+ throw new Error(M().fingerprintMismatch);
142
182
  }
143
183
  if (receipt && receipt.state !== 'pending')
144
184
  return result(receipt, base, requestId, true);
@@ -148,6 +188,7 @@ function replay(dir, file, fingerprint, base, requestId) {
148
188
  since = statSync(dir).mtimeMs;
149
189
  }
150
190
  catch {
191
+ // 예약 폴더 나이를 모르면 'unknown' 으로 답한다 — 어느 쪽이든 재전송은 하지 않는다
151
192
  since = undefined;
152
193
  }
153
194
  }
@@ -205,8 +246,7 @@ export async function triggerBuild(cfg, input) {
205
246
  // API 토큰 인증은 보통 crumb 이 면제지만, 켜 둔 서버도 있다. 인증 헤더를 단 채 리다이렉트를 따라가지 않는다.
206
247
  const crumbResult = await requestCrumb({ ...cfg, url: base }, { redirect: 'manual', maxAttempts: 1 });
207
248
  if (crumbResult.kind === 'failed') {
208
- throw new Error(`Jenkins CSRF crumb 조회 실패${crumbResult.status ? ` (HTTP ${crumbResult.status})` : ''} — 빌드를 요청하지 않았습니다. `
209
- + '인증·서버 상태를 확인한 뒤 같은 request_id 로 다시 시도해도 됩니다.');
249
+ throw new Error(M().crumbFailed(crumbResult.status ? ` (HTTP ${crumbResult.status})` : ''));
210
250
  }
211
251
  crumb = crumbResult.kind === 'ok' ? crumbResult.headers : {};
212
252
  }
@@ -255,17 +295,17 @@ async function readJson(cfg, url) {
255
295
  response = await fetchWithTimeout(url, { headers: authHeaders(cfg), redirect: 'manual' });
256
296
  }
257
297
  catch {
258
- throw new Error('Jenkins 조회 연결 실패/시간 초과. 연결 상태를 확인한 뒤 조회만 재시도하세요.');
298
+ throw new Error(M().readConnect);
259
299
  }
260
300
  if (response.status === 404)
261
301
  return { missing: true };
262
302
  if (!response.ok)
263
- throw new Error(`Jenkins 조회 실패 (HTTP ${response.status}). 인증·권한·서버 상태를 확인하세요.`);
303
+ throw new Error(M().readFailed(response.status));
264
304
  try {
265
305
  return { missing: false, data: await response.json() };
266
306
  }
267
307
  catch {
268
- throw new Error('Jenkins JSON 응답을 읽을 수 없습니다.');
308
+ throw new Error(M().badJson);
269
309
  }
270
310
  }
271
311
  const queueSchema = z.object({
@@ -285,12 +325,12 @@ export async function getQueueItem(cfg, queueId) {
285
325
  return {
286
326
  queue_id: queueId,
287
327
  state: 'unavailable',
288
- message: '큐 항목이 만료됐거나 없습니다. 이미 기록한 빌드 번호로 조회하세요. 재트리거하거나 lastBuild로 추정하지 마세요.',
328
+ message: M().queueGone,
289
329
  };
290
330
  }
291
331
  const data = queueSchema.safeParse(response.data);
292
332
  if (!data.success || data.data.id !== queueId)
293
- throw new Error('Jenkins 큐 응답 형식 또는 ID가 일치하지 않습니다.');
333
+ throw new Error(M().queueMismatch);
294
334
  const item = data.data;
295
335
  return {
296
336
  queue_id: queueId,
@@ -319,6 +359,6 @@ export async function getBuildStatus(cfg, job, buildNumber) {
319
359
  return { job, build_number: buildNumber, state: 'unavailable', build_url: buildUrl };
320
360
  const data = buildSchema.safeParse(response.data);
321
361
  if (!data.success || data.data.number !== buildNumber)
322
- throw new Error('Jenkins 빌드 응답 형식 또는 번호가 일치하지 않습니다.');
362
+ throw new Error(M().buildMismatch);
323
363
  return { job, build_number: buildNumber, build_url: buildUrl, ...data.data };
324
364
  }
@@ -15,4 +15,9 @@ export declare function saveJenkinsConfig(config: Partial<JenkinsConfig> & Pick<
15
15
  * 사내망(LAN/Tailscale) 컨트롤러는 http 가 흔하고 정당하므로 **막지 않고** 경고만 한다.
16
16
  */
17
17
  export declare function jenkinsUrlWarning(url: string): string | null;
18
+ /** jenkins.json 이 있는데 읽을 수 없으면 그 이유 (없음·정상이면 null). */
19
+ export declare function jenkinsConfigProblem(): {
20
+ file: string;
21
+ reason: string;
22
+ } | null;
18
23
  export declare function requireJenkinsConfig(): JenkinsConfig;
@@ -1,14 +1,28 @@
1
- import fs from 'node:fs';
2
1
  import path from 'node:path';
3
2
  import os from 'node:os';
4
3
  import { writeCredentialJson } from '#core/atomic-write.js';
4
+ import { catalog } from '#core/lang.js';
5
+ import { assertCredentialFileReadable, jsonFileProblem } from '../lib/json-file.js';
6
+ import { readCredentialFileSync } from '#core/credential-read.js';
5
7
  const CONFIG_DIR = path.join(os.homedir(), '.mimi-seed');
6
8
  const JENKINS_CONFIG_PATH = path.join(CONFIG_DIR, 'jenkins.json');
9
+ const M = catalog({
10
+ plainHttp: (host) => `⚠️ ${host} 는 사설망 주소가 아닌데 http 입니다 — API 토큰이 암호화 없이 전송됩니다. 가능하면 https URL 을 쓰세요.`,
11
+ notConfigured: 'Jenkins 설정이 없습니다.\n' +
12
+ 'jenkins_save_config 도구로 먼저 설정해주세요.\n' +
13
+ '예시:\n',
14
+ }, {
15
+ plainHttp: (host) => `⚠️ ${host} is not a private-network address but uses http — the API token is sent unencrypted. Use an https URL if possible.`,
16
+ notConfigured: 'Jenkins is not configured.\n' +
17
+ 'Configure it first with the jenkins_save_config tool.\n' +
18
+ 'Example:\n',
19
+ });
7
20
  export function loadJenkinsConfig() {
8
21
  try {
9
- return JSON.parse(fs.readFileSync(JENKINS_CONFIG_PATH, 'utf-8'));
22
+ return JSON.parse(readCredentialFileSync(JENKINS_CONFIG_PATH));
10
23
  }
11
24
  catch {
25
+ // 읽을 수 없으면 '미설정' — 깨진 파일은 requireJenkinsConfig · jenkinsConfigProblem 이 json-file 로 따로 진단한다
12
26
  return null;
13
27
  }
14
28
  }
@@ -62,18 +76,23 @@ export function jenkinsUrlWarning(url) {
62
76
  parsed = new URL(url);
63
77
  }
64
78
  catch {
79
+ // URL 형식은 저장 스키마(z.string().url())가 이미 거른다 — 여기선 경고 문구만 만들므로 파싱 실패는 '경고 없음'
65
80
  return null;
66
81
  }
67
82
  if (parsed.protocol !== 'http:' || isPrivateHost(parsed.hostname))
68
83
  return null;
69
- return `⚠️ ${parsed.host} 는 사설망 주소가 아닌데 http 입니다 — API 토큰이 암호화 없이 전송됩니다. 가능하면 https URL 을 쓰세요.`;
84
+ return M().plainHttp(parsed.host);
85
+ }
86
+ /** jenkins.json 이 있는데 읽을 수 없으면 그 이유 (없음·정상이면 null). */
87
+ export function jenkinsConfigProblem() {
88
+ const reason = jsonFileProblem(JENKINS_CONFIG_PATH);
89
+ return reason ? { file: JENKINS_CONFIG_PATH, reason } : null;
70
90
  }
71
91
  export function requireJenkinsConfig() {
72
92
  const cfg = loadJenkinsConfig();
73
93
  if (!cfg) {
74
- throw new Error('Jenkins 설정이 없습니다.\n' +
75
- 'jenkins_save_config 도구로 먼저 설정해주세요.\n' +
76
- '예시:\n' +
94
+ assertCredentialFileReadable(JENKINS_CONFIG_PATH, 'jenkins_save_config');
95
+ throw new Error(M().notConfigured +
77
96
  ' jenkins_save_config(url="https://jenkins.example.com", username="admin", token=<Jenkins API token>)');
78
97
  }
79
98
  return cfg;
@@ -1,5 +1,32 @@
1
1
  import { authHeaders, getCrumb } from './http.js';
2
+ import { catalog } from '#core/lang.js';
2
3
  import { fetchWithTimeout, HTTP_TRANSFER_TIMEOUT_MS } from '../lib/http.js';
4
+ const M = catalog({
5
+ differentKind: (id, shown, existing, requested) => [
6
+ `Jenkins credential "${id}" 가 이미 다른 종류로 존재합니다. / already exists as a different kind.`,
7
+ ` 기존 / existing: ${shown} (${existing})`,
8
+ ` 요청 / requested: ${requested}`,
9
+ '',
10
+ '덮어쓰면 기존 값이 사라집니다. 다른 id 를 쓰거나, 정말 교체하려면 먼저 삭제하세요.',
11
+ 'Replacing it would destroy the existing value — use a different id, or delete it first.',
12
+ 'jenkins_list_credentials 로 현재 목록을 확인할 수 있습니다.',
13
+ ],
14
+ listFailed: (status) => `Jenkins credentials 조회 실패 (${status})`,
15
+ writeFailed: (what, status) => `Jenkins ${what} 실패 (${status})`,
16
+ deleteFailed: (status) => `Jenkins credential 삭제 실패 (${status})`,
17
+ }, {
18
+ differentKind: (id, shown, existing, requested) => [
19
+ `Jenkins credential "${id}" already exists as a different kind.`,
20
+ ` existing: ${shown} (${existing})`,
21
+ ` requested: ${requested}`,
22
+ '',
23
+ 'Replacing it would destroy the existing value — use a different id, or delete it first.',
24
+ 'Check the current list with jenkins_list_credentials.',
25
+ ],
26
+ listFailed: (status) => `Jenkins credentials list failed (${status})`,
27
+ writeFailed: (what, status) => `Jenkins ${what} failed (${status})`,
28
+ deleteFailed: (status) => `Jenkins credential delete failed (${status})`,
29
+ });
3
30
  const FILE_CLASS = 'org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl';
4
31
  const TEXT_CLASS = 'org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl';
5
32
  // 도메인(_ = 전역) 레벨 — 목록 조회 / createCredentials 의 베이스
@@ -97,6 +124,7 @@ async function classFromConfigXml(cfg, id) {
97
124
  return cls && !cls.includes(WRAPPER_MARKER) ? cls : null;
98
125
  }
99
126
  catch {
127
+ // 권한·플러그인·네트워크 차이로 못 읽으면 판정 불가(null) — 호출자가 '클래스 미확인'으로 다룬다
100
128
  return null;
101
129
  }
102
130
  }
@@ -135,22 +163,14 @@ function assertSameKind(id, existing, kind, wanted) {
135
163
  if (kind === null || kind === wanted)
136
164
  return;
137
165
  const shown = existing.typeName || existing.className || kind;
138
- throw new Error([
139
- `Jenkins credential "${id}" 가 이미 다른 종류로 존재합니다. / already exists as a different kind.`,
140
- ` 기존 / existing: ${shown} (${kindLabel(kind)})`,
141
- ` 요청 / requested: ${kindLabel(wanted)}`,
142
- '',
143
- '덮어쓰면 기존 값이 사라집니다. 다른 id 를 쓰거나, 정말 교체하려면 먼저 삭제하세요.',
144
- 'Replacing it would destroy the existing value — use a different id, or delete it first.',
145
- 'jenkins_list_credentials 로 현재 목록을 확인할 수 있습니다.',
146
- ].join('\n'));
166
+ throw new Error(M().differentKind(id, shown, kindLabel(kind), kindLabel(wanted)).join('\n'));
147
167
  }
148
168
  export async function listCredentials(cfg) {
149
169
  const res = await fetchWithTimeout(`${storeBase(cfg.url)}/api/json?depth=1`, {
150
170
  headers: authHeaders(cfg),
151
171
  });
152
172
  if (!res.ok)
153
- throw new Error(`Jenkins credentials 조회 실패 (${res.status})`);
173
+ throw new Error(M().listFailed(res.status));
154
174
  const data = (await res.json());
155
175
  return (data.credentials ?? []).map((c) => ({
156
176
  id: c.id,
@@ -189,7 +209,7 @@ export async function upsertSecretText(cfg, id, secret, description = '', option
189
209
  body: new URLSearchParams({ json: JSON.stringify(payload) }).toString(),
190
210
  });
191
211
  if (!res.ok && res.status !== 302) {
192
- throw new Error(`Jenkins credential ${exists ? 'update' : 'create'} 실패 (${res.status})`);
212
+ throw new Error(M().writeFailed(`credential ${exists ? 'update' : 'create'}`, res.status));
193
213
  }
194
214
  return exists ? 'updated' : 'created';
195
215
  }
@@ -232,7 +252,7 @@ export async function upsertSecretFile(cfg, id, fileBase64, fileName, descriptio
232
252
  body: form,
233
253
  }, HTTP_TRANSFER_TIMEOUT_MS);
234
254
  if (!res.ok && res.status !== 302) {
235
- throw new Error(`Jenkins secret file credential ${exists ? 'update' : 'create'} 실패 (${res.status})`);
255
+ throw new Error(M().writeFailed(`secret file credential ${exists ? 'update' : 'create'}`, res.status));
236
256
  }
237
257
  return exists ? 'updated' : 'created';
238
258
  }
@@ -246,6 +266,6 @@ export async function deleteCredential(cfg, id) {
246
266
  },
247
267
  });
248
268
  if (!res.ok && res.status !== 302) {
249
- throw new Error(`Jenkins credential 삭제 실패 (${res.status})`);
269
+ throw new Error(M().deleteFailed(res.status));
250
270
  }
251
271
  }
@@ -1,5 +1,7 @@
1
1
  import { fetchWithTimeout } from '../lib/http.js';
2
2
  import { encodePathSegment } from '../lib/url-path.js';
3
+ import { catalog } from '#core/lang.js';
4
+ const M = catalog({ emptyJob: '잡 이름이 비어 있습니다.' }, { emptyJob: 'The job name is empty.' });
3
5
  export function basicAuth(username, token) {
4
6
  return 'Basic ' + Buffer.from(`${username}:${token}`).toString('base64');
5
7
  }
@@ -18,7 +20,8 @@ export async function getCrumb(cfg) {
18
20
  return result.kind === 'ok' ? result.headers : {};
19
21
  }
20
22
  /** 헤더 이름·값으로 안전한가 — 서버가 준 문자열을 그대로 헤더에 넣으면 fetch 가 요청 도중 던질 수 있다. */
21
- const CRUMB_FIELD = /^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/;
23
+ // \x27 = ' and \x60 = ` — written as escapes so string-literal scanners don't misread the regex.
24
+ const CRUMB_FIELD = /^[A-Za-z0-9!#$%&\x27*+.^_\x60|~-]{1,128}$/;
22
25
  const CRUMB_VALUE = /^[\x21-\x7e]{1,512}$/;
23
26
  /**
24
27
  * crumb 을 결과 종류와 함께 돌려준다. getCrumb 은 이것의 best-effort 판(실패 = 빈 객체)이다.
@@ -73,7 +76,7 @@ export function isStrictJobPath(jobPath) {
73
76
  export function jobUrl(cfg, jobPath) {
74
77
  const segments = jobPath.split('/').filter(Boolean);
75
78
  if (segments.length === 0)
76
- throw new Error('잡 이름이 비어 있습니다.');
79
+ throw new Error(M().emptyJob);
77
80
  const suffix = segments.map((s) => `job/${encodePathSegment(s)}`).join('/');
78
81
  return `${baseUrl(cfg)}/${suffix}`;
79
82
  }
@@ -84,7 +87,7 @@ export function jobUrl(cfg, jobPath) {
84
87
  export function createItemUrl(cfg, jobPath) {
85
88
  const segments = jobPath.split('/').filter(Boolean);
86
89
  if (segments.length === 0)
87
- throw new Error('잡 이름이 비어 있습니다.');
90
+ throw new Error(M().emptyJob);
88
91
  const leaf = segments.pop();
89
92
  const parent = segments.length ? jobUrl(cfg, segments.join('/')) : baseUrl(cfg);
90
93
  return `${parent}/createItem?name=${encodeURIComponent(leaf)}`;
@@ -1,5 +1,19 @@
1
1
  import { authHeaders, baseUrl, createItemUrl, getCrumb, jenkinsError, jobUrl } from './http.js';
2
2
  import { fetchWithTimeout } from '../lib/http.js';
3
+ import { catalog } from '#core/lang.js';
4
+ const M = catalog({
5
+ listFailed: 'Jenkins 잡 목록 조회 실패',
6
+ existsFailed: (job) => `Jenkins 잡 존재 확인 실패: ${job}`,
7
+ configFailed: (job) => `Jenkins 잡 config 조회 실패: ${job}`,
8
+ createFailed: (job) => `Jenkins 잡 생성 실패: ${job}`,
9
+ updateFailed: (job) => `Jenkins 잡 수정 실패: ${job}`,
10
+ }, {
11
+ listFailed: 'Jenkins job list failed',
12
+ existsFailed: (job) => `Jenkins job existence check failed: ${job}`,
13
+ configFailed: (job) => `Jenkins job config read failed: ${job}`,
14
+ createFailed: (job) => `Jenkins job create failed: ${job}`,
15
+ updateFailed: (job) => `Jenkins job update failed: ${job}`,
16
+ });
3
17
  /**
4
18
  * 잡 목록. folder 를 주면 그 폴더 안을, 없으면 루트를 조회한다.
5
19
  * 재귀하지 않는다 (한 단계만).
@@ -10,7 +24,7 @@ export async function listJobs(cfg, folder) {
10
24
  headers: authHeaders(cfg),
11
25
  });
12
26
  if (!res.ok)
13
- throw await jenkinsError('Jenkins 잡 목록 조회 실패', res);
27
+ throw await jenkinsError(M().listFailed, res);
14
28
  const data = (await res.json());
15
29
  return data.jobs ?? [];
16
30
  }
@@ -26,7 +40,7 @@ export async function jobExists(cfg, jobPath) {
26
40
  return true;
27
41
  if (res.status === 404)
28
42
  return false;
29
- throw await jenkinsError(`Jenkins 잡 존재 확인 실패: ${jobPath}`, res);
43
+ throw await jenkinsError(M().existsFailed(jobPath), res);
30
44
  }
31
45
  /** 잡의 config.xml 원문. 백업하거나 수정 전 현재 상태를 확인할 때 쓴다. */
32
46
  export async function getJobConfig(cfg, jobPath) {
@@ -34,7 +48,7 @@ export async function getJobConfig(cfg, jobPath) {
34
48
  headers: authHeaders(cfg),
35
49
  });
36
50
  if (!res.ok)
37
- throw await jenkinsError(`Jenkins 잡 config 조회 실패: ${jobPath}`, res);
51
+ throw await jenkinsError(M().configFailed(jobPath), res);
38
52
  return res.text();
39
53
  }
40
54
  /**
@@ -53,7 +67,7 @@ export async function createJob(cfg, jobPath, configXml) {
53
67
  body: configXml,
54
68
  });
55
69
  if (!res.ok)
56
- throw await jenkinsError(`Jenkins 잡 생성 실패: ${jobPath}`, res);
70
+ throw await jenkinsError(M().createFailed(jobPath), res);
57
71
  }
58
72
  /** 기존 잡의 config.xml 교체. 잡이 없으면 404. */
59
73
  export async function updateJob(cfg, jobPath, configXml) {
@@ -68,7 +82,7 @@ export async function updateJob(cfg, jobPath, configXml) {
68
82
  body: configXml,
69
83
  });
70
84
  if (!res.ok)
71
- throw await jenkinsError(`Jenkins 잡 수정 실패: ${jobPath}`, res);
85
+ throw await jenkinsError(M().updateFailed(jobPath), res);
72
86
  }
73
87
  /** 있으면 수정, 없으면 생성. Jenkinsfile/job-config.xml 을 레포에서 밀어넣을 때 쓴다. */
74
88
  export async function upsertJob(cfg, jobPath, configXml) {
@@ -1,6 +1,83 @@
1
1
  // Jenkins 도구의 사람용 응답 문구. jenkins register 와 android register(jenkins_upload_playstore_sa)가
2
2
  // 같은 credential 교체 dry-run 문구를 쓴다 — 도구마다 다르게 적히면 에이전트가 다르게 해석한다.
3
+ import { catalog } from '#core/lang.js';
3
4
  import { kindLabel } from './credentials.js';
5
+ const M = catalog({
6
+ exists: (id) => `🛑 dry-run — Jenkins credential \`${id}\` 가 이미 존재해 아직 바꾸지 않았다.`,
7
+ existingHeader: '기존 credential:',
8
+ kind: '종류: ',
9
+ name: '이름: ',
10
+ desc: '설명: ',
11
+ unknown: '(알 수 없음)',
12
+ none: '(없음)',
13
+ noMeta: ' (메타데이터를 읽지 못했다 — jenkins_list_credentials 로 확인)',
14
+ unverified: (shown, requested) => [
15
+ `⚠ 기존 크리덴셜 종류를 확인할 수 없음 — 기존: ${shown}, 요청: ${requested}. confirm 하면 이 종류로 교체됩니다.`,
16
+ `⚠ Existing credential kind could not be verified — existing: ${shown}, requested: ${requested}. ` +
17
+ 'confirm: true replaces it with the requested kind; check jenkins_list_credentials or the Jenkins UI first.',
18
+ ],
19
+ irreversible: '같은 종류의 기존 값(비밀값·keystore)은 교체되면 되돌릴 수 없다.',
20
+ confirmNext: '위 credential 이 이 앱의 것인지 사용자에게 확인받은 뒤 같은 인자에 confirm: true 를 추가해 다시 호출하거나, 다른 id 를 쓰세요.',
21
+ ambiguous: (id, prefix) => `⚠️ "${id}" 는 패키지명의 마지막 세그먼트("${prefix}")만으로 만든 기본 id 다 — com.foo.${prefix} 와 com.bar.${prefix} 처럼 ` +
22
+ '다른 앱도 같은 id 를 쓴다. 위 기존 credential 이 이 앱의 것이 아니면 교체하지 말고 고유한 id 를 명시하세요.',
23
+ notConfigured: [
24
+ '⚠️ Jenkins 설정이 없습니다.',
25
+ '',
26
+ '다음 정보를 사용자에게 확인한 뒤 jenkins_save_config를 호출해주세요:',
27
+ '',
28
+ '1. Jenkins URL (예: https://jenkins.company.com)',
29
+ '2. Jenkins 사용자 ID (예: admin)',
30
+ '3. Jenkins API Token',
31
+ ' 발급 방법: Jenkins 대시보드 → [사용자 이름] → 설정 → API Token → "Add new Token"',
32
+ '',
33
+ '로컬 Jenkins가 없어도 회사·원격 서버의 URL을 입력하면 됩니다.',
34
+ ],
35
+ configured: '✅ Jenkins 설정 있음',
36
+ user: '사용자: ',
37
+ configuredNext: [
38
+ 'jenkins_list_credentials 로 등록된 credential 목록을 확인하거나,',
39
+ 'jenkins_create_credential / jenkins_upload_keystore 로 credential을 추가하세요.',
40
+ '잡은 jenkins_list_jobs / jenkins_get_job_config / jenkins_create_job / jenkins_update_job 로 다룹니다.',
41
+ '빌드는 jenkins_trigger_build → jenkins_get_queue_item → jenkins_get_build_status 순서로 실행·추적합니다.',
42
+ ],
43
+ }, {
44
+ exists: (id) => `🛑 dry-run — Jenkins credential \`${id}\` already exists, so nothing has changed yet.`,
45
+ existingHeader: 'Existing credential:',
46
+ kind: 'kind: ',
47
+ name: 'name: ',
48
+ desc: 'desc: ',
49
+ unknown: '(unknown)',
50
+ none: '(none)',
51
+ noMeta: ' (could not read its metadata — check with jenkins_list_credentials)',
52
+ unverified: (shown, requested) => [
53
+ `⚠ Existing credential kind could not be verified — existing: ${shown}, requested: ${requested}. ` +
54
+ 'confirm: true replaces it with the requested kind; check jenkins_list_credentials or the Jenkins UI first.',
55
+ ],
56
+ irreversible: 'Once replaced, the existing value of the same kind (secret or keystore) cannot be restored.',
57
+ confirmNext: 'Confirm with the user that the credential above belongs to this app, then call again with the same arguments plus confirm: true, or use a different id.',
58
+ ambiguous: (id, prefix) => `⚠️ "${id}" is a default id built only from the last segment of the package name ("${prefix}") — other apps such as com.foo.${prefix} and com.bar.${prefix} ` +
59
+ 'use the same id. If the existing credential above is not this app\'s, do not replace it; specify a unique id.',
60
+ notConfigured: [
61
+ '⚠️ Jenkins is not configured.',
62
+ '',
63
+ 'Ask the user for the following, then call jenkins_save_config:',
64
+ '',
65
+ '1. Jenkins URL (e.g. https://jenkins.company.com)',
66
+ '2. Jenkins user ID (e.g. admin)',
67
+ '3. Jenkins API Token',
68
+ ' How to create one: Jenkins dashboard → [user name] → Configure → API Token → "Add new Token"',
69
+ '',
70
+ 'No local Jenkins is needed; a company or remote server URL works.',
71
+ ],
72
+ configured: '✅ Jenkins configured',
73
+ user: 'User: ',
74
+ configuredNext: [
75
+ 'Check the registered credentials with jenkins_list_credentials,',
76
+ 'or add credentials with jenkins_create_credential / jenkins_upload_keystore.',
77
+ 'Manage jobs with jenkins_list_jobs / jenkins_get_job_config / jenkins_create_job / jenkins_update_job.',
78
+ 'Run and track builds in order: jenkins_trigger_build → jenkins_get_queue_item → jenkins_get_build_status.',
79
+ ],
80
+ });
4
81
  /**
5
82
  * 같은 id 가 이미 있어 쓰지 않았을 때의 dry-run 응답 (confirm 없이 기존 credential 을 덮어쓰지 않는다).
6
83
  *
@@ -16,32 +93,26 @@ export function existingCredentialPreview(id, inspected, requested, notes = [])
16
93
  const replaced = existing?.description || existing?.displayName || id;
17
94
  const unverified = inspected !== null && inspected.kind === null;
18
95
  const shownKind = existing?.typeName || 'unknown';
96
+ const m = M();
19
97
  return [
20
- `🛑 dry-run — Jenkins credential \`${id}\` 가 이미 존재해 아직 바꾸지 않았다.`,
98
+ m.exists(id),
21
99
  '',
22
- '기존 credential:',
100
+ m.existingHeader,
23
101
  ...(existing
24
102
  ? [
25
103
  ` id: ${existing.id}`,
26
- ` 종류: ${existing.typeName || '(알 수 없음)'}`,
27
- ` 이름: ${existing.displayName || '(없음)'}`,
28
- ` 설명: ${existing.description || '(없음)'}`,
104
+ ` ${m.kind}${existing.typeName || m.unknown}`,
105
+ ` ${m.name}${existing.displayName || m.none}`,
106
+ ` ${m.desc}${existing.description || m.none}`,
29
107
  ]
30
- : [' (메타데이터를 읽지 못했다 — jenkins_list_credentials 로 확인)']),
108
+ : [m.noMeta]),
31
109
  '',
32
110
  `confirm: true will REPLACE this existing credential: ${replaced}`,
33
- ...(unverified
34
- ? [
35
- '',
36
- `⚠ 기존 크리덴셜 종류를 확인할 수 없음 — 기존: ${shownKind}, 요청: ${kindLabel(requested)}. confirm 하면 이 종류로 교체됩니다.`,
37
- `⚠ Existing credential kind could not be verified — existing: ${shownKind}, requested: ${kindLabel(requested)}. ` +
38
- 'confirm: true replaces it with the requested kind; check jenkins_list_credentials or the Jenkins UI first.',
39
- ]
40
- : []),
111
+ ...(unverified ? ['', ...m.unverified(shownKind, kindLabel(requested))] : []),
41
112
  ...(notes.length ? ['', ...notes] : []),
42
113
  '',
43
- '같은 종류의 기존 값(비밀값·keystore)은 교체되면 되돌릴 수 없다.',
44
- '위 credential 이 이 앱의 것인지 사용자에게 확인받은 뒤 같은 인자에 confirm: true 를 추가해 다시 호출하거나, 다른 id 를 쓰세요.',
114
+ m.irreversible,
115
+ m.confirmNext,
45
116
  ].join('\n');
46
117
  }
47
118
  /**
@@ -72,35 +143,21 @@ export function ambiguousDefaultIdNote(id) {
72
143
  const prefix = id.slice(0, -suffix.length);
73
144
  if (!isGenericCredentialPrefix(prefix))
74
145
  return null;
75
- return (`⚠️ "${id}" 는 패키지명의 마지막 세그먼트("${prefix}")만으로 만든 기본 id 다 — com.foo.${prefix} 와 com.bar.${prefix} 처럼 ` +
76
- '다른 앱도 같은 id 를 쓴다. 위 기존 credential 이 이 앱의 것이 아니면 교체하지 말고 고유한 id 를 명시하세요.');
146
+ return M().ambiguous(id, prefix);
77
147
  }
78
148
  /** jenkins_status — 설정이 없을 때 사용자에게 물어볼 항목. */
79
149
  export function jenkinsNotConfiguredLines() {
80
- return [
81
- '⚠️ Jenkins 설정이 없습니다.',
82
- '',
83
- '다음 정보를 사용자에게 확인한 뒤 jenkins_save_config를 호출해주세요:',
84
- '',
85
- '1. Jenkins URL (예: https://jenkins.company.com)',
86
- '2. Jenkins 사용자 ID (예: admin)',
87
- '3. Jenkins API Token',
88
- ' 발급 방법: Jenkins 대시보드 → [사용자 이름] → 설정 → API Token → "Add new Token"',
89
- '',
90
- '로컬 Jenkins가 없어도 회사·원격 서버의 URL을 입력하면 됩니다.',
91
- ];
150
+ return [...M().notConfigured];
92
151
  }
93
152
  /** jenkins_status — 설정이 있을 때의 요약 (토큰은 가린다) + 다음에 쓸 도구. */
94
153
  export function jenkinsConfiguredLines({ url, username }) {
154
+ const m = M();
95
155
  return [
96
- '✅ Jenkins 설정 있음',
156
+ m.configured,
97
157
  ` URL: ${url}`,
98
- ` 사용자: ${username}`,
158
+ ` ${m.user}${username}`,
99
159
  ` Token: ${'*'.repeat(8)}`,
100
160
  '',
101
- 'jenkins_list_credentials 로 등록된 credential 목록을 확인하거나,',
102
- 'jenkins_create_credential / jenkins_upload_keystore 로 credential을 추가하세요.',
103
- '잡은 jenkins_list_jobs / jenkins_get_job_config / jenkins_create_job / jenkins_update_job 로 다룹니다.',
104
- '빌드는 jenkins_trigger_build → jenkins_get_queue_item → jenkins_get_build_status 순서로 실행·추적합니다.',
161
+ ...m.configuredNext,
105
162
  ];
106
163
  }