pabal-web-mcp 0.1.1 → 0.1.3

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 CHANGED
@@ -2,12 +2,6 @@
2
2
 
3
3
  MCP (Model Context Protocol) server for ASO (App Store Optimization) data management with shared types and utilities.
4
4
 
5
- ## Installation
6
-
7
- ```bash
8
- npm install pabal-web-mcp
9
- ```
10
-
11
5
  ## 🛠️ MCP Client Installation
12
6
 
13
7
  ### Requirements
@@ -7,13 +7,15 @@ import {
7
7
  getPullDataDir,
8
8
  getPushDataDir,
9
9
  googlePlayToUnified,
10
+ isAppStoreLocale,
10
11
  isAppStoreMultilingual,
12
+ isGooglePlayLocale,
11
13
  isGooglePlayMultilingual,
12
14
  loadAsoFromConfig,
13
15
  saveAsoToAsoDir,
14
16
  unifiedToAppStore,
15
17
  unifiedToGooglePlay
16
- } from "../chunk-MWXNTV3M.js";
18
+ } from "../chunk-WNIH5KWA.js";
17
19
 
18
20
  // src/bin/mcp-server.ts
19
21
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -506,6 +508,7 @@ function convertToMultilingual(data, locale) {
506
508
  }
507
509
 
508
510
  // src/tools/public-to-aso.ts
511
+ import fs4 from "fs";
509
512
  var FIELD_LIMITS_DOC_PATH = "docs/aso/ASO_FIELD_LIMITS.md";
510
513
  var toJsonSchema2 = zodToJsonSchema2;
511
514
  var publicToAsoInputSchema = z2.object({
@@ -520,12 +523,7 @@ var jsonSchema2 = toJsonSchema2(publicToAsoInputSchema, {
520
523
  var inputSchema2 = jsonSchema2.definitions?.PublicToAsoInput || jsonSchema2;
521
524
  async function downloadScreenshotsToAsoDir(slug, asoData, options) {
522
525
  const rootDir = options?.rootDir ?? getPushDataDir();
523
- const productStoreRoot = path4.join(
524
- rootDir,
525
- "products",
526
- slug,
527
- "store"
528
- );
526
+ const productStoreRoot = path4.join(rootDir, "products", slug, "store");
529
527
  if (asoData.googlePlay) {
530
528
  let googlePlayData = asoData.googlePlay;
531
529
  if (!isGooglePlayMultilingual(googlePlayData)) {
@@ -675,7 +673,85 @@ async function handlePublicToAso(input) {
675
673
  const { slug, dryRun } = input;
676
674
  const configData = loadAsoFromConfig(slug);
677
675
  if (!configData.googlePlay && !configData.appStore) {
678
- throw new Error(`No ASO data found in config.json + locales/ for ${slug}`);
676
+ const productsDir = getProductsDir();
677
+ const configPath = path4.join(productsDir, slug, "config.json");
678
+ const localesDir = path4.join(productsDir, slug, "locales");
679
+ const errors = [];
680
+ if (!fs4.existsSync(configPath)) {
681
+ errors.push(`- config.json not found at ${configPath}`);
682
+ } else {
683
+ try {
684
+ const config = JSON.parse(fs4.readFileSync(configPath, "utf-8"));
685
+ if (!config.packageName && !config.bundleId) {
686
+ errors.push(
687
+ `- config.json exists but missing both packageName and bundleId`
688
+ );
689
+ } else {
690
+ if (config.packageName) {
691
+ errors.push(`- packageName found: ${config.packageName}`);
692
+ }
693
+ if (config.bundleId) {
694
+ errors.push(`- bundleId found: ${config.bundleId}`);
695
+ }
696
+ }
697
+ } catch (e) {
698
+ errors.push(
699
+ `- Failed to parse config.json: ${e instanceof Error ? e.message : String(e)}`
700
+ );
701
+ }
702
+ }
703
+ if (!fs4.existsSync(localesDir)) {
704
+ errors.push(`- locales directory not found at ${localesDir}`);
705
+ } else {
706
+ try {
707
+ const localeFiles = fs4.readdirSync(localesDir).filter((f) => f.endsWith(".json"));
708
+ if (localeFiles.length === 0) {
709
+ errors.push(`- locales directory exists but no .json files found`);
710
+ } else {
711
+ errors.push(
712
+ `- Found ${localeFiles.length} locale file(s): ${localeFiles.join(
713
+ ", "
714
+ )}`
715
+ );
716
+ const validLocales = [];
717
+ const invalidLocales = [];
718
+ for (const file of localeFiles) {
719
+ const localeCode = file.replace(".json", "");
720
+ if (isGooglePlayLocale(localeCode) || isAppStoreLocale(localeCode)) {
721
+ validLocales.push(localeCode);
722
+ } else {
723
+ invalidLocales.push(localeCode);
724
+ }
725
+ }
726
+ if (validLocales.length > 0) {
727
+ errors.push(`- Valid locales: ${validLocales.join(", ")}`);
728
+ }
729
+ if (invalidLocales.length > 0) {
730
+ errors.push(
731
+ `- Invalid locales (not supported by Google Play or App Store): ${invalidLocales.join(
732
+ ", "
733
+ )}`
734
+ );
735
+ }
736
+ }
737
+ } catch (e) {
738
+ errors.push(
739
+ `- Failed to read locales directory: ${e instanceof Error ? e.message : String(e)}`
740
+ );
741
+ }
742
+ }
743
+ throw new Error(
744
+ `No ASO data found in config.json + locales/ for ${slug}
745
+
746
+ Diagnostics:
747
+ ${errors.join("\n")}
748
+
749
+ Possible causes:
750
+ 1. config.json is missing packageName (for Google Play) or bundleId (for App Store)
751
+ 2. locales/ directory is missing or empty
752
+ 3. Locale files exist but don't match supported Google Play/App Store locales
753
+ 4. Locale files don't contain valid ASO data`
754
+ );
679
755
  }
680
756
  const storeData = prepareAsoDataForPush(slug, configData);
681
757
  const pushDataRoot = getPushDataDir();
@@ -742,7 +818,7 @@ import { z as z3 } from "zod";
742
818
  import { zodToJsonSchema as zodToJsonSchema3 } from "zod-to-json-schema";
743
819
 
744
820
  // src/tools/utils/improve-public/load-product-locales.util.ts
745
- import fs4 from "fs";
821
+ import fs5 from "fs";
746
822
  import path5 from "path";
747
823
  function loadProductLocales(slug) {
748
824
  const productsDir = getProductsDir();
@@ -750,22 +826,22 @@ function loadProductLocales(slug) {
750
826
  const configPath = path5.join(productDir, "config.json");
751
827
  const localesDir = path5.join(productDir, "locales");
752
828
  let config = null;
753
- if (fs4.existsSync(configPath)) {
754
- const raw = fs4.readFileSync(configPath, "utf-8");
829
+ if (fs5.existsSync(configPath)) {
830
+ const raw = fs5.readFileSync(configPath, "utf-8");
755
831
  config = JSON.parse(raw);
756
832
  }
757
- if (!fs4.existsSync(localesDir)) {
833
+ if (!fs5.existsSync(localesDir)) {
758
834
  throw new Error(`No locales directory found for ${slug}`);
759
835
  }
760
836
  const locales = {};
761
- const localeFiles = fs4.readdirSync(localesDir).filter((file) => file.endsWith(".json"));
837
+ const localeFiles = fs5.readdirSync(localesDir).filter((file) => file.endsWith(".json"));
762
838
  if (localeFiles.length === 0) {
763
839
  throw new Error(`No locale files found for ${slug}`);
764
840
  }
765
841
  for (const file of localeFiles) {
766
842
  const localeCode = file.replace(".json", "");
767
843
  const localePath = path5.join(localesDir, file);
768
- const content = fs4.readFileSync(localePath, "utf-8");
844
+ const content = fs5.readFileSync(localePath, "utf-8");
769
845
  locales[localeCode] = JSON.parse(content);
770
846
  }
771
847
  return { config, locales };
@@ -1706,13 +1782,13 @@ async function handleImprovePublic(input) {
1706
1782
  }
1707
1783
 
1708
1784
  // src/tools/init-project.ts
1709
- import fs5 from "fs";
1785
+ import fs6 from "fs";
1710
1786
  import path6 from "path";
1711
1787
  import { z as z4 } from "zod";
1712
1788
  import { zodToJsonSchema as zodToJsonSchema4 } from "zod-to-json-schema";
1713
1789
  var listSlugDirs = (dir) => {
1714
- if (!fs5.existsSync(dir)) return [];
1715
- return fs5.readdirSync(dir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
1790
+ if (!fs6.existsSync(dir)) return [];
1791
+ return fs6.readdirSync(dir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
1716
1792
  };
1717
1793
  var initProjectInputSchema = z4.object({
1718
1794
  slug: z4.string().trim().optional().describe(