snow-ai 0.4.27 → 0.4.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-ai",
3
- "version": "0.4.27",
3
+ "version": "0.4.29",
4
4
  "description": "Intelligent Command Line Assistant powered by AI",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -120,7 +120,8 @@
120
120
  }
121
121
  },
122
122
  "prettier": "@vdemedes/prettier-config",
123
- "dependencies": {
123
+ "dependencies": {},
124
+ "optionalDependencies": {
124
125
  "sharp": "^0.34.5"
125
126
  }
126
127
  }
@@ -79,6 +79,32 @@ function checkNodeVersion() {
79
79
  }
80
80
  }
81
81
 
82
+ /**
83
+ * Try to install sharp as optional dependency
84
+ */
85
+ function tryInstallSharp() {
86
+ try {
87
+ // Check if sharp is already installed
88
+ require.resolve('sharp');
89
+ console.log(`${colors.green}✓ sharp is already installed${colors.reset}`);
90
+ return true;
91
+ } catch {
92
+ console.log(`${colors.yellow}Installing optional dependency: sharp (for SVG to PNG conversion)${colors.reset}`);
93
+ try {
94
+ execSync('npm install --no-save --prefer-offline sharp', {
95
+ stdio: 'inherit',
96
+ cwd: process.cwd()
97
+ });
98
+ console.log(`${colors.green}✓ sharp installed successfully${colors.reset}`);
99
+ return true;
100
+ } catch (error) {
101
+ console.log(`${colors.yellow}⚠ sharp installation failed (this is OK - SVG will be returned as-is)${colors.reset}`);
102
+ console.log(`${colors.cyan} Reason: sharp requires native binaries that may not be compatible with your system${colors.reset}`);
103
+ return false;
104
+ }
105
+ }
106
+ }
107
+
82
108
  /**
83
109
  * Main function
84
110
  */
@@ -91,6 +117,9 @@ async function main() {
91
117
  return;
92
118
  }
93
119
 
120
+ // Try to install sharp (optional dependency)
121
+ tryInstallSharp();
122
+
94
123
  const currentRegistry = getCurrentRegistry();
95
124
  const isUsingMirror = currentRegistry.includes('npmmirror.com') ||
96
125
  currentRegistry.includes('taobao.org');