@yoonion/mimi-seed-mcp 0.21.4 → 0.21.6

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 (34) hide show
  1. package/dist/appstore/auth.d.ts +3 -1
  2. package/dist/appstore/auth.js +29 -4
  3. package/dist/appstore/client.d.ts +1 -0
  4. package/dist/appstore/client.js +10 -59
  5. package/dist/appstore/http.d.ts +5 -0
  6. package/dist/appstore/products.js +3 -15
  7. package/dist/appstore/sales.js +35 -10
  8. package/dist/auth/google-auth.d.ts +0 -13
  9. package/dist/auth/google-auth.js +13 -1
  10. package/dist/core/checks/release-doctor/fcm.d.ts +3 -0
  11. package/dist/core/checks/release-doctor/fcm.js +270 -0
  12. package/dist/core/checks/release-doctor/files.d.ts +16 -0
  13. package/dist/core/checks/release-doctor/files.js +312 -0
  14. package/dist/core/checks/release-doctor/gradle-apply.d.ts +18 -0
  15. package/dist/core/checks/release-doctor/gradle-apply.js +423 -0
  16. package/dist/core/checks/release-doctor/ios-xcode.d.ts +2 -0
  17. package/dist/core/checks/release-doctor/ios-xcode.js +299 -0
  18. package/dist/core/checks/release-doctor/project.d.ts +101 -0
  19. package/dist/core/checks/release-doctor/project.js +828 -0
  20. package/dist/core/checks/release-doctor/target-sdk.d.ts +102 -0
  21. package/dist/core/checks/release-doctor/target-sdk.js +868 -0
  22. package/dist/core/checks/release-doctor/types.d.ts +60 -0
  23. package/dist/core/checks/release-doctor/types.js +3 -0
  24. package/dist/core/checks/release-doctor/util.d.ts +26 -0
  25. package/dist/core/checks/release-doctor/util.js +95 -0
  26. package/dist/core/checks/release-doctor.d.ts +3 -75
  27. package/dist/core/checks/release-doctor.js +9 -3057
  28. package/dist/helpers.d.ts +1 -1
  29. package/dist/helpers.js +19 -12
  30. package/dist/playstore/financials.js +1 -1
  31. package/dist/registers/android.js +1 -1
  32. package/dist/registers/checks.js +1 -1
  33. package/dist/registers/playstore.js +26 -26
  34. package/package.json +2 -2
@@ -0,0 +1,312 @@
1
+ // Release Doctor project walk: which files are read, bounded source scanning, and Gradle convention builds.
2
+ // Internal to Release Doctor — import the public API (scanReleaseDoctor, report types) from ../release-doctor.js.
3
+ import fs from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ import { closingBrace, stripGradleComments } from '../gradle-text.js';
6
+ import { FCM_HINT } from './fcm.js';
7
+ import { GRADLE_PLUGIN_BUILD, appliesAndroidAppPlugin } from './project.js';
8
+ import { isWithin, isXcodePinFile, stripComments } from './util.js';
9
+ const SKIP_DIRS = new Set([
10
+ '.git',
11
+ '.gradle',
12
+ '.idea',
13
+ '.next',
14
+ '.expo',
15
+ 'build',
16
+ 'dist',
17
+ 'node_modules',
18
+ 'Pods',
19
+ 'DerivedData',
20
+ // Agent / git worktrees are full copies of the repository (often of other branches); scanning them doubles
21
+ // every finding and floods the bounded source scan.
22
+ '.worktrees',
23
+ '.claude',
24
+ ]);
25
+ // Bounded source scan for the FCM markers (FCM_HINT in ./fcm.ts; see readFcmSources).
26
+ const SOURCE_EXTENSIONS = new Set([
27
+ '.js', '.cjs', '.mjs', '.jsx', '.ts', '.cts', '.mts', '.tsx',
28
+ '.py', '.go', '.java', '.kt', '.php', '.rb', '.cs', '.dart', '.swift', '.sh',
29
+ ]);
30
+ const HASH_COMMENT_EXTENSIONS = new Set(['.py', '.rb', '.sh']);
31
+ const MAX_SOURCE_BYTES = 512 * 1024;
32
+ export const MAX_SOURCE_FILES = 4000;
33
+ const SOURCE_READ_CONCURRENCY = 32;
34
+ // Test, fixture, generated, or vendored trees say nothing about the shipped build or push code. Source files and
35
+ // Xcode pin files inside them are ignored (manifest files are still read, as before).
36
+ export const EXCLUDED_EVIDENCE_DIRS = new Set([
37
+ '.cache', '.turbo', '.venv', '.vercel', '__pycache__', '__tests__', '__mocks__', '__fixtures__', 'coverage',
38
+ 'e2e', 'fixtures', 'Library', 'mocks', 'obj', 'out', 'spec', 'Temp', 'target', 'test', 'tests', 'vendor', 'venv',
39
+ // Documentation and sample projects show pins and endpoints without building or running them. (An example app's
40
+ // manifests are still read, so a library repo's xample/ app is detected as before.)
41
+ 'doc', 'docs', 'example', 'examples', 'sample', 'samples',
42
+ // Third-party checkouts that carry their own CI and Xcode pins.
43
+ 'Carthage', '.build', '.symlinks', '.dart_tool', '.swiftpm',
44
+ // Android instrumentation-test and test-fixture source sets.
45
+ 'androidTest', 'testFixtures',
46
+ ]);
47
+ // Demo apps are often the real product of a small repository, so demo/ is only a *sample* tree: its app evidence,
48
+ // Xcode pins, and FCM sources count when no app exists outside sample trees (see `preferShipped`).
49
+ export const SAMPLE_ONLY_DIRS = new Set(['demo', 'demos']);
50
+ // Xcode test-target folders (UnitTests, UITests, WikipediaUITests, ...). Case-sensitive, so `contests` is not one.
51
+ export const TEST_TARGET_DIR = /Tests$/;
52
+ const TEST_SOURCE_FILE = /(?:\.(?:spec|test)\.[^.]+$|_test\.(?:go|py|dart)$|^test_[^/]+\.py$)/;
53
+ /** Codes whose check could not decide; see `coverage.unresolved`. */
54
+ export const UNRESOLVED_CODES = new Set([
55
+ 'TARGET_SDK_UNRESOLVED',
56
+ 'TARGET_SDK_POLICY_REFRESH_REQUIRED',
57
+ 'TARGET_SDK_SPECIALIZED_APP_REVIEW',
58
+ 'BILLING_UNRESOLVED',
59
+ 'IOS_XCODE_UNRESOLVED',
60
+ 'IOS_XCODE_MIXED_PINS',
61
+ 'IOS_SDK_POLICY_REFRESH_REQUIRED',
62
+ ]);
63
+ /**
64
+ * Every Gradle script and plugin source of the convention builds in the scan: buildSrc/ and build-logic/ folders at
65
+ * any depth (also nested, as in `gradle/build-logic/`) and every `includeBuild("…")` root a settings script declares
66
+ * inside the scanned tree, read with no depth limit of the project walk. Package folders inside them (`com/example/…`,
67
+ * `test/`) never mark a file as a sample; a root several builds include is a sample only when every including build
68
+ * is. Kotlin / Java / Groovy sources are read from every root except inside its Android application modules (the
69
+ * app's own code, never a Gradle plugin). Plugin roots are read first, each within its own budget; a root the walk could not read completely is returned in
70
+ * `truncated`, and the Target API check then cannot be OK. Included builds under node_modules/ are third-party
71
+ * plugins, like binary plugins, and are not read.
72
+ */
73
+ async function conventionFiles(root, files, found) {
74
+ const declared = found.map((owner) => ({ ...owner, plugin: true }));
75
+ for (const settings of files.filter((file) => /(?:^|\/)settings\.gradle(?:\.kts)?$/.test(file.relative))) {
76
+ const dir = path.dirname(settings.absolute);
77
+ const code = stripGradleComments(settings.text);
78
+ const pluginManagement = /\bpluginManagement\s*\{/.exec(code);
79
+ const pluginRange = pluginManagement
80
+ ? [pluginManagement.index, closingBrace(code, pluginManagement.index + pluginManagement[0].length - 1)]
81
+ : undefined;
82
+ for (const match of code.matchAll(/\bincludeBuild\s*\(?\s*["']([^"'$]+)["']/g)) {
83
+ const target = path.resolve(dir, match[1]);
84
+ if (!isWithin(root, target) || isWithin(target, dir))
85
+ continue;
86
+ if (path.relative(root, target).split(path.sep).some((segment) => SKIP_DIRS.has(segment)))
87
+ continue;
88
+ const plugin = Boolean(pluginRange && match.index > pluginRange[0] && (pluginRange[1] < 0 || match.index < pluginRange[1]));
89
+ declared.push({ dir: target, sample: Boolean(settings.sample), demo: Boolean(settings.demo), plugin });
90
+ }
91
+ }
92
+ // One entry per directory: a sample only when every build that includes it is one.
93
+ const byDir = new Map();
94
+ for (const owner of declared) {
95
+ const existing = byDir.get(owner.dir);
96
+ byDir.set(owner.dir, existing
97
+ ? { dir: owner.dir, sample: existing.sample && owner.sample, demo: existing.demo && owner.demo, plugin: existing.plugin || owner.plugin }
98
+ : owner);
99
+ }
100
+ // Plugin builds first, then non-sample ones, then outer before inner: a directory is read once, by the first root
101
+ // that reaches it, so a nested non-sample plugin root never takes an outer sample root's flags.
102
+ const roots = [...byDir.values()].sort((left, right) => Number(right.plugin) - Number(left.plugin)
103
+ || Number(left.sample) - Number(right.sample) || left.dir.length - right.dir.length);
104
+ const result = [];
105
+ const truncated = [];
106
+ const seen = new Set();
107
+ for (const owner of roots) {
108
+ const scripts = [];
109
+ const sources = [];
110
+ let incomplete = false;
111
+ const visit = async (dir, depth) => {
112
+ if (seen.has(dir))
113
+ return;
114
+ if (depth > MAX_CONVENTION_DEPTH || scripts.length + sources.length >= MAX_CONVENTION_PATHS) {
115
+ incomplete = true;
116
+ return;
117
+ }
118
+ seen.add(dir);
119
+ let entries;
120
+ try {
121
+ entries = await fs.readdir(dir, { withFileTypes: true });
122
+ }
123
+ catch {
124
+ return;
125
+ }
126
+ for (const entry of entries) {
127
+ const absolute = path.join(dir, entry.name);
128
+ if (entry.isDirectory()) {
129
+ if (!SKIP_DIRS.has(entry.name))
130
+ await visit(absolute, depth + 1);
131
+ continue;
132
+ }
133
+ if (!entry.isFile())
134
+ continue;
135
+ const relative = path.relative(root, absolute).replace(/\\/g, '/');
136
+ if (isRelevantFile(entry.name, relative))
137
+ scripts.push(absolute);
138
+ else if (CONVENTION_SOURCE_FILE.test(entry.name))
139
+ sources.push(absolute);
140
+ }
141
+ };
142
+ await visit(owner.dir, 0);
143
+ const read = async (absolute) => {
144
+ try {
145
+ if ((await fs.stat(absolute)).size > MAX_SOURCE_BYTES)
146
+ return undefined;
147
+ const relative = path.relative(root, absolute).replace(/\\/g, '/');
148
+ return { absolute, relative, text: await fs.readFile(absolute, 'utf8'), sample: owner.sample, demo: owner.demo, convention: true };
149
+ }
150
+ catch {
151
+ return undefined;
152
+ }
153
+ };
154
+ const scriptFiles = (await Promise.all(scripts.map(read))).filter((file) => Boolean(file));
155
+ result.push(...scriptFiles);
156
+ // Plugin sources are read from every included build; only an Android application module's own sources (its
157
+ // app code, never a Gradle plugin) are skipped — and never in a plugin root (buildSrc, build-logic, a
158
+ // `pluginManagement { includeBuild }` root), whose every source is read.
159
+ // A source belongs to the nearest project folder above it, so a plugin project nested in an app's folder is read.
160
+ const projects = scriptFiles
161
+ .filter((file) => /(?:^|\/)build\.gradle(?:\.kts)?$/.test(file.relative))
162
+ .map((file) => ({ dir: path.dirname(file.absolute), app: !owner.plugin && appliesAndroidAppPlugin(file.text) && !GRADLE_PLUGIN_BUILD.test(stripGradleComments(file.text)) }))
163
+ .sort((left, right) => right.dir.length - left.dir.length);
164
+ const pluginSources = sources.filter((source) => !projects.find((project) => isWithin(project.dir, source))?.app);
165
+ if (pluginSources.length > MAX_CONVENTION_FILES)
166
+ incomplete = true;
167
+ result.push(...(await Promise.all(pluginSources.slice(0, MAX_CONVENTION_FILES).map(read))).filter((file) => Boolean(file)));
168
+ if (incomplete)
169
+ truncated.push(path.relative(root, owner.dir).replace(/\\/g, '/') || '.');
170
+ }
171
+ return { files: result, truncated };
172
+ }
173
+ export async function walk(root, maxSourceFiles = MAX_SOURCE_FILES, maxDepth = 7) {
174
+ const files = [];
175
+ const conventionRoots = [];
176
+ const sourceCandidates = [];
177
+ // `excluded`: inside a test/fixture/vendored tree or a nested repository (a directory with its own `.git`).
178
+ // Manifest files there are still read exactly as before; Xcode pins and FCM source evidence are not.
179
+ // `sample` additionally covers app projects inside a nested Swift package (a component library's demo app).
180
+ async function visit(dir, depth, excluded, sample, demo) {
181
+ if (depth > maxDepth)
182
+ return;
183
+ let entries;
184
+ try {
185
+ entries = await fs.readdir(dir, { withFileTypes: true });
186
+ }
187
+ catch {
188
+ return;
189
+ }
190
+ const nestedRepository = depth > 0 && entries.some((entry) => entry.name === '.git');
191
+ const excludedHere = excluded || nestedRepository;
192
+ const sampleHere = sample || excludedHere || (depth > 0 && entries.some((entry) => entry.name === 'Package.swift'));
193
+ for (const entry of entries) {
194
+ const absolute = path.join(dir, entry.name);
195
+ if (entry.isDirectory()) {
196
+ // A convention build is read whole by `conventionFiles` (no depth limit, no sample flags from inside it).
197
+ if (CONVENTION_DIRS.has(entry.name)) {
198
+ conventionRoots.push({ dir: absolute, sample: sampleHere, demo, plugin: true });
199
+ continue;
200
+ }
201
+ if (!SKIP_DIRS.has(entry.name)) {
202
+ const excludedChild = excludedHere
203
+ || EXCLUDED_EVIDENCE_DIRS.has(entry.name)
204
+ || TEST_TARGET_DIR.test(entry.name)
205
+ || entry.name.startsWith('.next');
206
+ const demoChild = demo || SAMPLE_ONLY_DIRS.has(entry.name);
207
+ await visit(absolute, depth + 1, excludedChild, sampleHere || excludedChild || demoChild, demoChild);
208
+ }
209
+ continue;
210
+ }
211
+ if (!entry.isFile())
212
+ continue;
213
+ const relative = path.relative(root, absolute).replace(/\\/g, '/');
214
+ if (isRelevantFile(entry.name, relative)) {
215
+ if (excludedHere && isXcodePinFile(entry.name, relative))
216
+ continue;
217
+ try {
218
+ files.push({ absolute, relative, text: await fs.readFile(absolute, 'utf8'), sample: sampleHere, demo });
219
+ }
220
+ catch {
221
+ // Unreadable files are ignored; other evidence can still produce a useful partial report.
222
+ }
223
+ continue;
224
+ }
225
+ if (excludedHere || !SOURCE_EXTENSIONS.has(path.extname(entry.name)) || TEST_SOURCE_FILE.test(entry.name))
226
+ continue;
227
+ sourceCandidates.push({ absolute, relative, depth, sample: sampleHere, demo });
228
+ }
229
+ }
230
+ await visit(root, 0, false, false, false);
231
+ // Files the project walk already read keep its flags (an included build can be a whole app, with its own samples),
232
+ // except plugin sources under `src/main/{kotlin,java,groovy}/`, whose package folders (`com/example/…`) never make
233
+ // them samples. The convention walk adds what that walk does not read (deep, or Kotlin/Java/Groovy plugin sources).
234
+ const merged = new Map(files.map((file) => [file.absolute, file]));
235
+ const convention = await conventionFiles(root, files, conventionRoots);
236
+ for (const file of convention.files) {
237
+ const pluginSource = /(?:^|\/)src\/main\/(?:kotlin|java|groovy)\//.test(file.relative)
238
+ && !/(?:^|\/)(?:build|settings)\.gradle(?:\.kts)?$/.test(file.relative);
239
+ if (!merged.has(file.absolute) || pluginSource)
240
+ merged.set(file.absolute, file);
241
+ }
242
+ files.splice(0, files.length, ...merged.values());
243
+ // Shallow files first, so a deep generated tree cannot crowd the project's own sources out of the cap.
244
+ const prioritized = sourceCandidates
245
+ .map((candidate, order) => ({ ...candidate, order }))
246
+ .sort((left, right) => left.depth - right.depth || left.order - right.order);
247
+ return {
248
+ files,
249
+ fcmSources: await readFcmSources(prioritized.slice(0, maxSourceFiles)),
250
+ sourceScanTruncated: prioritized.length > maxSourceFiles,
251
+ conventionTruncated: convention.truncated,
252
+ };
253
+ }
254
+ // Source files are read only for the FCM markers; the text is kept only when a marker matches.
255
+ async function readFcmSources(candidates) {
256
+ const matches = [];
257
+ let next = 0;
258
+ async function worker() {
259
+ while (next < candidates.length) {
260
+ const candidate = candidates[next++];
261
+ try {
262
+ // Oversized files are almost always generated bundles; skip them without reading megabytes.
263
+ if ((await fs.stat(candidate.absolute)).size > MAX_SOURCE_BYTES)
264
+ continue;
265
+ const raw = await fs.readFile(candidate.absolute, 'utf8');
266
+ if (!FCM_HINT.test(raw))
267
+ continue;
268
+ const hash = HASH_COMMENT_EXTENSIONS.has(path.extname(candidate.absolute));
269
+ const text = stripComments(raw, { slash: !hash, hash });
270
+ if (FCM_HINT.test(text))
271
+ matches.push({ absolute: candidate.absolute, relative: candidate.relative, text, sample: candidate.sample, demo: candidate.demo });
272
+ }
273
+ catch {
274
+ // Source files only add optional FCM evidence.
275
+ }
276
+ }
277
+ }
278
+ await Promise.all(Array.from({ length: SOURCE_READ_CONCURRENCY }, () => worker()));
279
+ return matches.sort((left, right) => left.relative.localeCompare(right.relative));
280
+ }
281
+ function isRelevantFile(name, relative) {
282
+ return isXcodePinFile(name, relative)
283
+ || name.endsWith('.xcconfig')
284
+ || name === 'project.yml'
285
+ || name === 'app.json'
286
+ || name === 'app.config.json'
287
+ || /^app\.config\.(?:js|cjs|mjs|ts)$/.test(name)
288
+ // Every Gradle script (build, settings, applied scripts): the Target API net inventories each targetSdk setting
289
+ // in them. Convention builds (buildSrc/, build-logic/, `includeBuild(…)` roots) are read by `conventionFiles`.
290
+ || name.endsWith('.gradle')
291
+ || name.endsWith('.gradle.kts')
292
+ || name.endsWith('.versions.toml')
293
+ || name === 'settings.gradle'
294
+ || name === 'settings.gradle.kts'
295
+ || name === 'gradle.properties'
296
+ || name === 'AndroidManifest.xml'
297
+ || name === 'Info.plist'
298
+ || name === 'project.pbxproj'
299
+ || name === 'ProjectSettings.asset'
300
+ || name === 'package.json';
301
+ }
302
+ /** Directories holding a Gradle convention build, where a shared targetSdk is often set. */
303
+ const CONVENTION_DIRS = new Set(['buildSrc', 'build-logic', 'build_logic', 'buildLogic']);
304
+ /** Convention-build sources the Target API net reads: scripts and plugin sources in every JVM build language. */
305
+ export const CONVENTION_SOURCE_FILE = /\.(?:gradle|gradle\.kts|kts|kt|java|groovy)$/;
306
+ /**
307
+ * Bounds for each root of the convention walk (it has no depth limit of its own, unlike the project walk): a root that
308
+ * exceeds them is reported as not fully read, so the Target API check cannot pass on a partial read.
309
+ */
310
+ const MAX_CONVENTION_DEPTH = 40;
311
+ const MAX_CONVENTION_PATHS = 20000;
312
+ const MAX_CONVENTION_FILES = 5000;
@@ -0,0 +1,18 @@
1
+ import type { ProjectFile } from './types.js';
2
+ /**
3
+ * Scripts the given Gradle files pull in with `apply from:`, followed transitively (a script applied by an applied
4
+ * script runs in the same project), whatever their extension (`.gradle`, `.gradle.kts`, `.groovy`). Values set in a
5
+ * shared `common.gradle` count for every module that applies it. A repository reference that cannot be followed — a
6
+ * URL, a computed path, a missing file, a file outside the repository — is added to `missed`; a third-party package
7
+ * script that cannot be read (like a binary plugin, which is never read either) is added to `notes` with the reason.
8
+ */
9
+ export declare function appliedGradleScripts(gradleFiles: ProjectFile[], root: string, limit: string, known: ProjectFile[], missed?: string[], notes?: Array<{
10
+ reference: string;
11
+ reason: string;
12
+ installHint: boolean;
13
+ }>): Promise<ProjectFile[]>;
14
+ /**
15
+ * When `--path` points inside a repository, CI and the root Gradle version catalog usually live at the repository
16
+ * root. Read those few files from there (marked `outside`) so a narrowed scan keeps its Xcode pins and catalog values.
17
+ */
18
+ export declare function repositoryRootFiles(root: string, repo: string): Promise<ProjectFile[]>;