snow-ai 0.2.13 → 0.2.14

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.
@@ -471,31 +471,39 @@ export class FilesystemMCPService {
471
471
  let finalTotalLines = newTotalLines;
472
472
  let finalContextEnd = newContextEnd;
473
473
  let finalContextContent = newContextContent;
474
- try {
475
- execSync(`npx prettier --write "${fullPath}"`, {
476
- stdio: 'pipe',
477
- encoding: 'utf-8',
478
- });
479
- // Re-read the file after formatting to get the formatted content
480
- const formattedContent = await fs.readFile(fullPath, 'utf-8');
481
- finalLines = formattedContent.split('\n');
482
- finalTotalLines = finalLines.length;
483
- // Recalculate the context end line based on formatted content
484
- finalContextEnd = Math.min(finalTotalLines, contextStart + (newContextEnd - contextStart));
485
- // Extract formatted content for context with line numbers
486
- const formattedContextLines = finalLines.slice(contextStart - 1, finalContextEnd);
487
- finalContextContent = formattedContextLines
488
- .map((line, idx) => {
489
- const lineNum = contextStart + idx;
490
- const paddedNum = String(lineNum).padStart(String(finalContextEnd).length, ' ');
491
- return `${paddedNum}→${line}`;
492
- })
493
- .join('\n');
494
- }
495
- catch (formatError) {
496
- // If formatting fails, continue with the original content
497
- // This ensures editing is not blocked by formatting issues
498
- console.warn(`⚠️ Prettier formatting failed for ${filePath}, returning unformatted content:`, formatError instanceof Error ? formatError.message : 'Unknown error');
474
+ // Check if Prettier supports this file type
475
+ const prettierSupportedExtensions = [
476
+ '.js', '.jsx', '.ts', '.tsx', '.json', '.css', '.scss', '.less',
477
+ '.html', '.vue', '.yaml', '.yml', '.md', '.graphql', '.gql'
478
+ ];
479
+ const fileExtension = path.extname(fullPath).toLowerCase();
480
+ const shouldFormat = prettierSupportedExtensions.includes(fileExtension);
481
+ if (shouldFormat) {
482
+ try {
483
+ execSync(`npx prettier --write "${fullPath}"`, {
484
+ stdio: 'pipe',
485
+ encoding: 'utf-8',
486
+ });
487
+ // Re-read the file after formatting to get the formatted content
488
+ const formattedContent = await fs.readFile(fullPath, 'utf-8');
489
+ finalLines = formattedContent.split('\n');
490
+ finalTotalLines = finalLines.length;
491
+ // Recalculate the context end line based on formatted content
492
+ finalContextEnd = Math.min(finalTotalLines, contextStart + (newContextEnd - contextStart));
493
+ // Extract formatted content for context with line numbers
494
+ const formattedContextLines = finalLines.slice(contextStart - 1, finalContextEnd);
495
+ finalContextContent = formattedContextLines
496
+ .map((line, idx) => {
497
+ const lineNum = contextStart + idx;
498
+ const paddedNum = String(lineNum).padStart(String(finalContextEnd).length, ' ');
499
+ return `${paddedNum}→${line}`;
500
+ })
501
+ .join('\n');
502
+ }
503
+ catch (formatError) {
504
+ // If formatting fails, continue with the original content
505
+ // This ensures editing is not blocked by formatting issues
506
+ }
499
507
  }
500
508
  // Analyze code structure of the edited content (using formatted content if available)
501
509
  const editedContentLines = finalLines.slice(startLine - 1, startLine - 1 + newContentLines.length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-ai",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "Intelligent Command Line Assistant powered by AI",
5
5
  "license": "MIT",
6
6
  "bin": {