@sudu-cli/fronted-preview-mcp 1.0.0-beta.4 → 1.0.0-beta.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 (49) hide show
  1. package/README.md +24 -0
  2. package/dist/handlers/autoFixLoop.d.ts +3 -10
  3. package/dist/handlers/autoFixLoop.js +10 -49
  4. package/dist/handlers/autoFixLoop.js.map +1 -1
  5. package/dist/handlers/click.d.ts +9 -0
  6. package/dist/handlers/click.js +93 -0
  7. package/dist/handlers/click.js.map +1 -0
  8. package/dist/handlers/fill.d.ts +10 -0
  9. package/dist/handlers/fill.js +129 -0
  10. package/dist/handlers/fill.js.map +1 -0
  11. package/dist/handlers/inspect.d.ts +11 -0
  12. package/dist/handlers/inspect.js +138 -0
  13. package/dist/handlers/inspect.js.map +1 -0
  14. package/dist/handlers/screenshot.d.ts +10 -0
  15. package/dist/handlers/screenshot.js +135 -0
  16. package/dist/handlers/screenshot.js.map +1 -0
  17. package/dist/handlers/typescriptDiagnostics.d.ts +9 -0
  18. package/dist/index.js +215 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/navigate.d.ts +9 -0
  21. package/dist/navigate.js +78 -0
  22. package/dist/navigate.js.map +1 -0
  23. package/dist/strategies/baseStrategy.d.ts +27 -0
  24. package/dist/strategies/baseStrategy.js +23 -0
  25. package/dist/strategies/baseStrategy.js.map +1 -0
  26. package/dist/strategies/index.d.ts +9 -0
  27. package/dist/strategies/index.js +22 -0
  28. package/dist/strategies/index.js.map +1 -0
  29. package/dist/strategies/missingImport.d.ts +16 -0
  30. package/dist/strategies/missingImport.js +156 -0
  31. package/dist/strategies/missingImport.js.map +1 -0
  32. package/dist/strategies/missingProperty.d.ts +13 -0
  33. package/dist/strategies/missingProperty.js +134 -0
  34. package/dist/strategies/missingProperty.js.map +1 -0
  35. package/dist/strategies/networkError.d.ts +10 -0
  36. package/dist/strategies/networkError.js +56 -0
  37. package/dist/strategies/networkError.js.map +1 -0
  38. package/dist/strategies/nullCheckInsertion.d.ts +14 -0
  39. package/dist/strategies/nullCheckInsertion.js +138 -0
  40. package/dist/strategies/nullCheckInsertion.js.map +1 -0
  41. package/dist/strategies/typeAssignment.d.ts +13 -0
  42. package/dist/strategies/typeAssignment.js +121 -0
  43. package/dist/strategies/typeAssignment.js.map +1 -0
  44. package/dist/strategies/unusedImportRemoval.d.ts +11 -0
  45. package/dist/strategies/unusedImportRemoval.js +138 -0
  46. package/dist/strategies/unusedImportRemoval.js.map +1 -0
  47. package/dist/types.d.ts +1 -1
  48. package/dist/types.js.map +1 -1
  49. package/package.json +2 -2
@@ -0,0 +1,121 @@
1
+ import { SyntaxKind } from 'ts-morph';
2
+ import { getSourceFile, getRelativePath, saveChanges } from './baseStrategy.js';
3
+ export class TypeAssignmentStrategy {
4
+ errorType = 'typescript';
5
+ pattern = /Type '([^']+)' is not assignable to type '([^']+)'/i;
6
+ canFix(error) {
7
+ return this.pattern.test(error.message) && error.severity === 'error';
8
+ }
9
+ async fix(context, error) {
10
+ const changes = [];
11
+ if (!error.file || error.line === undefined) {
12
+ return { success: false, message: 'No file path or line number in error', changes };
13
+ }
14
+ const match = error.message.match(this.pattern);
15
+ if (!match) {
16
+ return { success: false, message: 'Could not parse type assignment error', changes };
17
+ }
18
+ const sourceType = match[1];
19
+ const targetType = match[2];
20
+ const sourceFile = getSourceFile(context, error.file);
21
+ if (!sourceFile) {
22
+ return { success: false, message: `Source file not found: ${error.file}`, changes };
23
+ }
24
+ const originalText = sourceFile.getFullText();
25
+ try {
26
+ // Find the expression at the error location
27
+ const expression = this.findExpressionAtLine(sourceFile, error.line);
28
+ if (!expression) {
29
+ return { success: false, message: `No expression found at line ${error.line}`, changes };
30
+ }
31
+ // Strategy: Add type assertion (as targetType) to the expression
32
+ const fixed = this.addTypeAssertion(expression, targetType);
33
+ if (!fixed) {
34
+ return { success: false, message: 'Could not add type assertion to expression', changes };
35
+ }
36
+ saveChanges(context);
37
+ const newText = sourceFile.getFullText();
38
+ const diff = this.generateDiff(originalText, newText, error.file);
39
+ changes.push({
40
+ file: getRelativePath(context, error.file),
41
+ description: `Added type assertion 'as ${targetType}' to fix assignment`,
42
+ diff,
43
+ });
44
+ return {
45
+ success: true,
46
+ message: `Fixed type assignment: added 'as ${targetType}' assertion`,
47
+ changes,
48
+ };
49
+ }
50
+ catch (err) {
51
+ const msg = err instanceof Error ? err.message : String(err);
52
+ return { success: false, message: `Fix failed: ${msg}`, changes };
53
+ }
54
+ }
55
+ findExpressionAtLine(sourceFile, line) {
56
+ // Get all expressions in the file and find one at the target line
57
+ const expressions = sourceFile.getDescendantsOfKind(SyntaxKind.Identifier);
58
+ for (const expr of expressions) {
59
+ const startLine = expr.getStartLineNumber();
60
+ const endLine = expr.getEndLineNumber();
61
+ if (startLine <= line && endLine >= line) {
62
+ // Prefer variable declarations, call expressions, property access
63
+ if (this.isFixableExpression(expr)) {
64
+ return expr;
65
+ }
66
+ }
67
+ }
68
+ return undefined;
69
+ }
70
+ isFixableExpression(expr) {
71
+ const kind = expr.getKind();
72
+ return (kind === SyntaxKind.VariableDeclaration ||
73
+ kind === SyntaxKind.CallExpression ||
74
+ kind === SyntaxKind.PropertyAccessExpression ||
75
+ kind === SyntaxKind.Identifier ||
76
+ kind === SyntaxKind.AsExpression);
77
+ }
78
+ addTypeAssertion(expr, targetType) {
79
+ // If it's already an AsExpression, update the type
80
+ if (expr.getKind() === SyntaxKind.AsExpression) {
81
+ const asExpr = expr;
82
+ asExpr.setType(targetType);
83
+ return true;
84
+ }
85
+ // For other expressions, wrap with AsExpression
86
+ // We need to replace the expression with an AsExpression
87
+ const parent = expr.getParent();
88
+ if (!parent)
89
+ return false;
90
+ try {
91
+ // Create the new as expression text
92
+ const exprText = expr.getText();
93
+ const newText = `(${exprText} as ${targetType})`;
94
+ // Replace the expression in the parent
95
+ expr.replaceWithText(newText);
96
+ return true;
97
+ }
98
+ catch {
99
+ return false;
100
+ }
101
+ }
102
+ generateDiff(oldText, newText, fileName) {
103
+ const oldLines = oldText.split('\n');
104
+ const newLines = newText.split('\n');
105
+ let diff = `--- ${fileName}\n+++ ${fileName}\n`;
106
+ const maxLen = Math.max(oldLines.length, newLines.length);
107
+ for (let i = 0; i < maxLen; i++) {
108
+ const oldLine = oldLines[i];
109
+ const newLine = newLines[i];
110
+ if (oldLine !== newLine) {
111
+ if (oldLine !== undefined)
112
+ diff += `-${oldLine}\n`;
113
+ if (newLine !== undefined)
114
+ diff += `+${newLine}\n`;
115
+ }
116
+ }
117
+ return diff;
118
+ }
119
+ }
120
+ export const typeAssignmentStrategy = new TypeAssignmentStrategy();
121
+ //# sourceMappingURL=typeAssignment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeAssignment.js","sourceRoot":"","sources":["../../src/strategies/typeAssignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,UAAU,EAA4C,MAAM,UAAU,CAAC;AAC7H,OAAO,EAAsC,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGpH,MAAM,OAAO,sBAAsB;IACjC,SAAS,GAAG,YAAqB,CAAC;IAClC,OAAO,GAAG,qDAAqD,CAAC;IAEhE,MAAM,CAAC,KAAqB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAAmB,EAAE,KAAqB;QAClD,MAAM,OAAO,GAAgE,EAAE,CAAC;QAEhF,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,sCAAsC,EAAE,OAAO,EAAE,CAAC;QACtF,CAAC;QAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAA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M,CAAC,CAAC;QAC1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;gBACxB,IAAI,OAAO,KAAK,SAAS;oBAAE,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC;gBACnD,IAAI,OAAO,KAAK,SAAS;oBAAE,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC;YACrD,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { FixStrategy, FixContext, FixResult } from './baseStrategy.js';
2
+ import { DiagnosticInfo } from '../handlers/typescriptDiagnostics.js';
3
+ export declare class UnusedImportRemovalStrategy implements FixStrategy {
4
+ errorType: "typescript";
5
+ pattern: RegExp;
6
+ canFix(error: DiagnosticInfo): boolean;
7
+ fix(context: FixContext, error: DiagnosticInfo): Promise<FixResult>;
8
+ private isSymbolUsedInFile;
9
+ private generateDiff;
10
+ }
11
+ export declare const unusedImportRemovalStrategy: UnusedImportRemovalStrategy;
@@ -0,0 +1,138 @@
1
+ import { SyntaxKind } from 'ts-morph';
2
+ import { saveChanges, getSourceFile, getRelativePath } from './baseStrategy.js';
3
+ export class UnusedImportRemovalStrategy {
4
+ errorType = 'typescript';
5
+ pattern = /(?:Unused variable|unused import|is declared but its value is never read|'([^']+)' is defined but never used)/i;
6
+ canFix(error) {
7
+ return this.pattern.test(error.message) && error.severity === 'error';
8
+ }
9
+ async fix(context, error) {
10
+ const changes = [];
11
+ let fixedCount = 0;
12
+ if (!error.file) {
13
+ return { success: false, message: 'No file path in error', changes };
14
+ }
15
+ const sourceFile = getSourceFile(context, error.file);
16
+ if (!sourceFile) {
17
+ return { success: false, message: `Source file not found: ${error.file}`, changes };
18
+ }
19
+ const originalText = sourceFile.getFullText();
20
+ try {
21
+ // Handle unused imports
22
+ const importDecls = sourceFile.getImportDeclarations();
23
+ for (const importDecl of importDecls) {
24
+ const namedImports = importDecl.getNamedImports();
25
+ const unusedSpecifiers = [];
26
+ for (const specifier of namedImports) {
27
+ const symbol = specifier.getSymbol();
28
+ if (symbol && !this.isSymbolUsedInFile(symbol, sourceFile)) {
29
+ unusedSpecifiers.push(specifier);
30
+ }
31
+ }
32
+ if (unusedSpecifiers.length > 0) {
33
+ if (unusedSpecifiers.length === namedImports.length) {
34
+ // All imports unused - remove entire declaration
35
+ const declText = importDecl.getText();
36
+ importDecl.remove();
37
+ changes.push({
38
+ file: getRelativePath(context, error.file),
39
+ description: `Removed unused import: ${declText.trim()}`,
40
+ });
41
+ }
42
+ else {
43
+ // Remove only unused specifiers
44
+ for (const spec of unusedSpecifiers) {
45
+ const specText = spec.getText();
46
+ spec.remove();
47
+ changes.push({
48
+ file: getRelativePath(context, error.file),
49
+ description: `Removed unused import specifier: ${specText}`,
50
+ });
51
+ }
52
+ // Fix formatting if needed
53
+ const syntaxList = importDecl.getFirstChildByKind(SyntaxKind.NamedImports)?.getFirstChildByKind(SyntaxKind.SyntaxList);
54
+ if (syntaxList) {
55
+ syntaxList.forEach?.(() => { });
56
+ }
57
+ }
58
+ fixedCount += unusedSpecifiers.length;
59
+ }
60
+ }
61
+ // Handle unused variables (const/let/var declarations)
62
+ const variableDecls = sourceFile.getVariableDeclarations();
63
+ for (const varDecl of variableDecls) {
64
+ const symbol = varDecl.getSymbol();
65
+ if (symbol && !this.isSymbolUsedInFile(symbol, sourceFile)) {
66
+ // Check if it's a simple unused variable (not part of destructuring used elsewhere)
67
+ const parent = varDecl.getParent();
68
+ if (parent && parent.getKind() === SyntaxKind.VariableDeclarationList) {
69
+ const declarations = parent.getDeclarations?.() || [];
70
+ if (declarations.length === 1) {
71
+ // Single declaration - remove entire statement
72
+ const statement = parent.getParent();
73
+ if (statement) {
74
+ const stmtText = statement.getText();
75
+ statement.remove();
76
+ changes.push({
77
+ file: getRelativePath(context, error.file),
78
+ description: `Removed unused variable declaration: ${stmtText.trim()}`,
79
+ });
80
+ fixedCount++;
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ if (fixedCount > 0) {
87
+ saveChanges(context);
88
+ const newText = sourceFile.getFullText();
89
+ const diff = this.generateDiff(originalText, newText, error.file);
90
+ if (changes.length > 0) {
91
+ changes[changes.length - 1].diff = diff;
92
+ }
93
+ return {
94
+ success: true,
95
+ message: `Removed ${fixedCount} unused import(s)/variable(s)`,
96
+ changes,
97
+ };
98
+ }
99
+ return { success: false, message: 'No unused imports/variables found to remove', changes };
100
+ }
101
+ catch (err) {
102
+ const msg = err instanceof Error ? err.message : String(err);
103
+ return { success: false, message: `Fix failed: ${msg}`, changes };
104
+ }
105
+ }
106
+ isSymbolUsedInFile(symbol, sourceFile) {
107
+ try {
108
+ const references = symbol.getReferences();
109
+ return references.some((ref) => {
110
+ const node = ref.getNode();
111
+ return node && node.getSourceFile() === sourceFile && node !== symbol.getDeclarations()[0];
112
+ });
113
+ }
114
+ catch {
115
+ return false;
116
+ }
117
+ }
118
+ generateDiff(oldText, newText, fileName) {
119
+ const oldLines = oldText.split('\n');
120
+ const newLines = newText.split('\n');
121
+ let diff = `--- ${fileName}\n+++ ${fileName}\n`;
122
+ // Simple line-by-line diff
123
+ const maxLen = Math.max(oldLines.length, newLines.length);
124
+ for (let i = 0; i < maxLen; i++) {
125
+ const oldLine = oldLines[i];
126
+ const newLine = newLines[i];
127
+ if (oldLine !== newLine) {
128
+ if (oldLine !== undefined)
129
+ diff += `-${oldLine}\n`;
130
+ if (newLine !== undefined)
131
+ diff += `+${newLine}\n`;
132
+ }
133
+ }
134
+ return diff;
135
+ }
136
+ }
137
+ export const unusedImportRemovalStrategy = new UnusedImportRemovalStrategy();
138
+ //# sourceMappingURL=unusedImportRemoval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unusedImportRemoval.js","sourceRoot":"","sources":["../../src/strategies/unusedImportRemoval.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8F,UAAU,EAAE,MAAM,UAAU,CAAC;AAClI,OAAO,EAAwD,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGtI,MAAM,OAAO,2BAA2B;IACtC,SAAS,GAAG,YAAqB,CAAC;IAClC,OAAO,GAAG,gHAAgH,CAAC;IAE3H,MAAM,CAAC,KAAqB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAAmB,EAAE,KAAqB;QAClD,MAAM,OAAO,GAAgE,EAAE,CAAC;QAChF,IAAI,UAAU,GAAG,CAAC,CAAC;QAEnB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,CAAC;QACvE,CAAC;QAED,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,0BAA0B,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC;QACtF,CAAC;QAED,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;QAE9C,IAAI,CAAC;YACH,wBAAwB;YACxB,MAAM,WAAW,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;YAEvD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;gBACrC,MAAM,YAA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E,CAAC,CAAC,CAAC,CAAC;YAC7F,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAEO,YAAY,CAAC,OAAe,EAAE,OAAe,EAAE,QAAgB;QACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,IAAI,GAAG,OAAO,QAAQ,SAAS,QAAQ,IAAI,CAAC;QAEhD,2BAA2B;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;gBACxB,IAAI,OAAO,KAAK,SAAS;oBAAE,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC;gBACnD,IAAI,OAAO,KAAK,SAAS;oBAAE,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC;YACrD,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,2BAA2B,EAAE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -28,7 +28,7 @@ export interface ToolContext {
28
28
  port?: number;
29
29
  cdpPort?: number;
30
30
  }
31
- export type MCPErrorCode = 'FRAMEWORK_NOT_DETECTED' | 'DEV_SERVER_START_FAILED' | 'CDP_CONNECTION_FAILED' | 'PAGE_NAVIGATION_FAILED' | 'TYPE_CHECK_FAILED' | 'CONFIG_NOT_FOUND' | 'INVALID_PROJECT_DIR' | 'PORT_IN_USE' | 'TIMEOUT' | 'UNKNOWN_ERROR';
31
+ export type MCPErrorCode = 'FRAMEWORK_NOT_DETECTED' | 'DEV_SERVER_START_FAILED' | 'CDP_CONNECTION_FAILED' | 'PAGE_NAVIGATION_FAILED' | 'TYPE_CHECK_FAILED' | 'CONFIG_NOT_FOUND' | 'INVALID_PROJECT_DIR' | 'PORT_IN_USE' | 'TIMEOUT' | 'UNKNOWN_ERROR' | 'ELEMENT_NOT_FOUND' | 'ELEMENT_NOT_CLICKABLE' | 'ELEMENT_NOT_INPUT' | 'CLICK_ERROR' | 'FILL_ERROR' | 'NAVIGATION_ERROR' | 'SCREENSHOT_ERROR' | 'INSPECTION_ERROR' | 'VALUE_SET_FAILED';
32
32
  export interface MCPError {
33
33
  code: MCPErrorCode;
34
34
  message: string;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAsDA,MAAM,UAAU,cAAc,CAC5B,IAAkB,EAClB,OAAe,EACf,OAAiB,EACjB,UAAmB;IAEnB,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;aACjF;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAC5C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;aACpC;SACF;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA+DA,MAAM,UAAU,cAAc,CAC5B,IAAkB,EAClB,OAAe,EACf,OAAiB,EACjB,UAAmB;IAEnB,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;aACjF;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAC5C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;aACpC;SACF;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sudu-cli/fronted-preview-mcp",
3
- "version": "1.0.0-beta.4",
4
- "description": "MCP server for frontend project detection, dev server management, and preview workflow. Pairs with chrome-devtools-mcp for automated frontend checking.",
3
+ "version": "1.0.0-beta.6",
4
+ "description": "MCP server for frontend project detection, dev server management, preview workflow, and browser automation. Includes click, fill, navigate, screenshot, and inspect tools for comprehensive frontend testing and automation.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {