@forvibe/cli 1.0.0 → 1.0.1

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 (2) hide show
  1. package/dist/index.js +29 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1576,7 +1576,8 @@ function generateProjectTree(rootDir, maxDepth = 5, maxEntries = 300) {
1576
1576
  // src/analyzers/asset-scanner.ts
1577
1577
  import { readFileSync as readFileSync3, existsSync as existsSync4, readdirSync as readdirSync6, statSync as statSync4 } from "fs";
1578
1578
  import { join as join7, extname as extname2, relative as relative3, basename } from "path";
1579
- var MAX_ASSET_SIZE = 5 * 1024 * 1024;
1579
+ var MAX_ASSET_SIZE = 1 * 1024 * 1024;
1580
+ var MAX_TOTAL_BASE64_SIZE = 3 * 1024 * 1024;
1580
1581
  var MAX_TOTAL_ASSETS = 10;
1581
1582
  var MAX_SCREENSHOTS = 5;
1582
1583
  var MIN_ASSET_SIZE = 500;
@@ -1780,6 +1781,9 @@ function getPromotionalPaths(rootDir, techStack) {
1780
1781
  }
1781
1782
  return paths;
1782
1783
  }
1784
+ function totalBase64Size(assets) {
1785
+ return assets.reduce((sum, a) => sum + a.base64_data.length, 0);
1786
+ }
1783
1787
  function scanAppAssets(rootDir, techStack) {
1784
1788
  const assets = [];
1785
1789
  const screenshotDirs = getScreenshotDirs(rootDir, techStack);
@@ -1818,7 +1822,17 @@ function scanAppAssets(rootDir, techStack) {
1818
1822
  break;
1819
1823
  }
1820
1824
  }
1821
- return assets.slice(0, MAX_TOTAL_ASSETS);
1825
+ const result = assets.slice(0, MAX_TOTAL_ASSETS);
1826
+ while (result.length > 0 && totalBase64Size(result) > MAX_TOTAL_BASE64_SIZE) {
1827
+ let largestIdx = 0;
1828
+ for (let i = 1; i < result.length; i++) {
1829
+ if (result[i].base64_data.length > result[largestIdx].base64_data.length) {
1830
+ largestIdx = i;
1831
+ }
1832
+ }
1833
+ result.splice(largestIdx, 1);
1834
+ }
1835
+ return result;
1822
1836
  }
1823
1837
 
1824
1838
  // src/api/forvibe-client.ts
@@ -1874,14 +1888,25 @@ var ForvibeClient = class {
1874
1888
  body: JSON.stringify({ report })
1875
1889
  });
1876
1890
  if (!response.ok) {
1877
- const error = await response.json().catch(() => ({ error: "Unknown error" }));
1891
+ const bodyText = await response.text().catch(() => "");
1892
+ let errorMessage;
1893
+ try {
1894
+ const errorJson = JSON.parse(bodyText);
1895
+ errorMessage = errorJson.error;
1896
+ } catch {
1897
+ }
1878
1898
  if (response.status === 401) {
1879
1899
  throw new Error("Session expired. Please generate a new connection code.");
1880
1900
  }
1881
1901
  if (response.status === 409) {
1882
1902
  throw new Error("Report has already been submitted for this session.");
1883
1903
  }
1884
- throw new Error(error.error || `Report submission failed (${response.status})`);
1904
+ if (response.status === 413) {
1905
+ throw new Error("Report too large. Try reducing the number of screenshots.");
1906
+ }
1907
+ throw new Error(
1908
+ errorMessage || `Report submission failed (HTTP ${response.status}: ${bodyText.substring(0, 200)})`
1909
+ );
1885
1910
  }
1886
1911
  return await response.json();
1887
1912
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forvibe/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Forvibe CLI - AI-powered project analyzer for App Store automation",
5
5
  "type": "module",
6
6
  "bin": {