@tac0de/flutter-mcp 0.1.0
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/LICENSE +21 -0
- package/README.md +132 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +226 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/dependencies.d.ts +27 -0
- package/dist/tools/dependencies.d.ts.map +1 -0
- package/dist/tools/dependencies.js +172 -0
- package/dist/tools/dependencies.js.map +1 -0
- package/dist/tools/validate.d.ts +33 -0
- package/dist/tools/validate.d.ts.map +1 -0
- package/dist/tools/validate.js +231 -0
- package/dist/tools/validate.js.map +1 -0
- package/dist/tools/widgets.d.ts +21 -0
- package/dist/tools/widgets.d.ts.map +1 -0
- package/dist/tools/widgets.js +164 -0
- package/dist/tools/widgets.js.map +1 -0
- package/dist/utils/flutter.d.ts +117 -0
- package/dist/utils/flutter.d.ts.map +1 -0
- package/dist/utils/flutter.js +316 -0
- package/dist/utils/flutter.js.map +1 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tac0de
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# flutter-mcp
|
|
2
|
+
|
|
3
|
+
> Repo-aware and Verify-first Flutter MCP Server for AI coding agents
|
|
4
|
+
|
|
5
|
+
An MCP (Model Context Protocol) server that helps AI coding agents better understand and work with Flutter projects. It provides project analysis, code validation, and dependency checking capabilities.
|
|
6
|
+
|
|
7
|
+
## 🎯 Expected Impact
|
|
8
|
+
|
|
9
|
+
### With Flutter MCP
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
User: "Add a list widget to the home screen"
|
|
13
|
+
|
|
14
|
+
AI Thought Process:
|
|
15
|
+
1. flutter_detect_project → Confirms Flutter project ✓
|
|
16
|
+
2. flutter_analyze_project → Understands project structure (lib/, android/, ios/)
|
|
17
|
+
3. flutter_list_widgets → Discovers 23 existing widgets, learns patterns
|
|
18
|
+
4. flutter_validate_code → Validates generated code before suggesting
|
|
19
|
+
5. → Adds code in correct location with proper patterns
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Without Flutter MCP (Typical AI Coding Agent)
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
User: "Add a list widget to the home screen"
|
|
26
|
+
|
|
27
|
+
AI Thought Process:
|
|
28
|
+
1. Not sure if it's a Flutter project → Proceeds with assumptions
|
|
29
|
+
2. Doesn't know file structure → Randomly searches files
|
|
30
|
+
3. Unaware of existing code style → Generates code based on guesses
|
|
31
|
+
4. Code may or may not work → Submits anyway
|
|
32
|
+
5. → Errors occur, retries needed
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 📊 Comparison
|
|
36
|
+
|
|
37
|
+
| Aspect | With Flutter MCP | Without MCP |
|
|
38
|
+
| ----------------- | ----------------------------------------- | -------------------------------- |
|
|
39
|
+
| Project Awareness | Accurately identifies via pubspec.yaml | Guesses from filenames |
|
|
40
|
+
| Code Validation | Validates syntax/imports before execution | Discovers errors after execution |
|
|
41
|
+
| Dependency Check | Detects version conflicts upfront | Errors occur during install |
|
|
42
|
+
| Code Consistency | Analyzes existing widget patterns first | Inconsistent style each time |
|
|
43
|
+
| Retry Rate | Low (pre-validated) | High (fix after execution) |
|
|
44
|
+
|
|
45
|
+
## ✨ Key Features
|
|
46
|
+
|
|
47
|
+
### Repo-aware Analysis
|
|
48
|
+
|
|
49
|
+
- **flutter_detect_project**: Detect if directory is a Flutter project and identify type (app/package/module)
|
|
50
|
+
- **flutter_analyze_project**: Analyze project structure including platforms and file organization
|
|
51
|
+
- **flutter_get_project_info**: Extract detailed project information from pubspec.yaml
|
|
52
|
+
- **flutter_list_widgets**: List all Flutter widgets (StatelessWidget, StatefulWidget) in the project
|
|
53
|
+
|
|
54
|
+
### Verify-first Validation
|
|
55
|
+
|
|
56
|
+
- **flutter_validate_code**: Validate Flutter/Dart code before execution with syntax checks, import validation, and common issue detection
|
|
57
|
+
- **flutter_check_dependencies**: Check dependencies for compatibility, version conflicts, and availability
|
|
58
|
+
|
|
59
|
+
## 🚀 Installation & Configuration
|
|
60
|
+
|
|
61
|
+
### MCP Server Setup
|
|
62
|
+
|
|
63
|
+
Add to your MCP client config:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"flutter": {
|
|
69
|
+
"command": "npx",
|
|
70
|
+
"args": ["-y", "@tac0de/flutter-mcp"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**For Claude Desktop**: Add the above to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows), then restart Claude.
|
|
77
|
+
|
|
78
|
+
**For other MCP clients**: Use the same configuration in your client's settings file.
|
|
79
|
+
|
|
80
|
+
After restart, the server will automatically analyze and validate Flutter projects.
|
|
81
|
+
|
|
82
|
+
## 🛠️ Available Tools
|
|
83
|
+
|
|
84
|
+
### flutter_detect_project
|
|
85
|
+
|
|
86
|
+
Detect if the current directory is a Flutter project.
|
|
87
|
+
|
|
88
|
+
### flutter_analyze_project
|
|
89
|
+
|
|
90
|
+
Analyze Flutter project structure.
|
|
91
|
+
|
|
92
|
+
### flutter_get_project_info
|
|
93
|
+
|
|
94
|
+
Get detailed Flutter project information from pubspec.yaml.
|
|
95
|
+
|
|
96
|
+
### flutter_validate_code
|
|
97
|
+
|
|
98
|
+
Validate Flutter/Dart code before execution.
|
|
99
|
+
|
|
100
|
+
### flutter_check_dependencies
|
|
101
|
+
|
|
102
|
+
Check Flutter project dependencies for compatibility and issues.
|
|
103
|
+
|
|
104
|
+
### flutter_list_widgets
|
|
105
|
+
|
|
106
|
+
List all Flutter widgets found in the project.
|
|
107
|
+
|
|
108
|
+
## 💻 Development
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Install dependencies
|
|
112
|
+
npm install
|
|
113
|
+
|
|
114
|
+
# Build
|
|
115
|
+
npm run build
|
|
116
|
+
|
|
117
|
+
# Watch mode
|
|
118
|
+
npm run dev
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 📋 Requirements
|
|
122
|
+
|
|
123
|
+
- Node.js >= 18
|
|
124
|
+
- npm >= 9
|
|
125
|
+
|
|
126
|
+
## 📄 License
|
|
127
|
+
|
|
128
|
+
MIT
|
|
129
|
+
|
|
130
|
+
## 🤝 Contributing
|
|
131
|
+
|
|
132
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, McpError, ErrorCode, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
// Flutter project utilities
|
|
6
|
+
import { detectFlutterProject, analyzeFlutterProject, getFlutterProjectInfo, } from "./utils/flutter.js";
|
|
7
|
+
// Error handler for uncaught exceptions
|
|
8
|
+
process.on("uncaughtException", (error) => {
|
|
9
|
+
console.error("Uncaught exception:", error);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
});
|
|
12
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
13
|
+
console.error("Unhandled rejection at:", promise, "reason:", reason);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
16
|
+
// Create server instance
|
|
17
|
+
const server = new Server({
|
|
18
|
+
name: "flutter-mcp",
|
|
19
|
+
version: "0.1.0",
|
|
20
|
+
}, {
|
|
21
|
+
capabilities: {
|
|
22
|
+
tools: {},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
// List available tools
|
|
26
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
27
|
+
return {
|
|
28
|
+
tools: [
|
|
29
|
+
{
|
|
30
|
+
name: "flutter_detect_project",
|
|
31
|
+
description: "Detect if the current directory is a Flutter project. Returns project type, Flutter version, and basic configuration.",
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
path: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Path to check (default: current working directory)",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "flutter_analyze_project",
|
|
44
|
+
description: "Analyze Flutter project structure including dependencies, project type (app/module/package), and file organization. Returns a comprehensive overview of the codebase architecture.",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
path: {
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "Path to Flutter project (default: current working directory)",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "flutter_get_project_info",
|
|
57
|
+
description: "Get detailed Flutter project information including package name, SDK versions, dependencies, material design version, and project configuration from pubspec.yaml.",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
path: {
|
|
62
|
+
type: "string",
|
|
63
|
+
description: "Path to Flutter project (default: current working directory)",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "flutter_validate_code",
|
|
70
|
+
description: "Validate Flutter/Dart code before execution. Checks for syntax errors, imports, and common issues. Returns validation results with specific error locations and suggestions.",
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
code: {
|
|
75
|
+
type: "string",
|
|
76
|
+
description: "Dart code to validate",
|
|
77
|
+
},
|
|
78
|
+
filePath: {
|
|
79
|
+
type: "string",
|
|
80
|
+
description: "Expected file path for better error reporting (optional)",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
required: ["code"],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "flutter_check_dependencies",
|
|
88
|
+
description: "Check Flutter project dependencies for compatibility, version conflicts, and availability. Analyzes pubspec.yaml and provides recommendations.",
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {
|
|
92
|
+
path: {
|
|
93
|
+
type: "string",
|
|
94
|
+
description: "Path to Flutter project (default: current working directory)",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "flutter_list_widgets",
|
|
101
|
+
description: "List all Flutter widgets (StatelessWidget, StatefulWidget) found in the project. Useful for understanding the UI component structure.",
|
|
102
|
+
inputSchema: {
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
path: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "Path to Flutter project (default: current working directory)",
|
|
108
|
+
},
|
|
109
|
+
includeFullPath: {
|
|
110
|
+
type: "boolean",
|
|
111
|
+
description: "Include full file paths in results (default: false)",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
// Handle tool calls
|
|
120
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
121
|
+
const { name, arguments: args } = request.params;
|
|
122
|
+
try {
|
|
123
|
+
switch (name) {
|
|
124
|
+
case "flutter_detect_project": {
|
|
125
|
+
const path = args?.path || process.cwd();
|
|
126
|
+
const result = await detectFlutterProject(path);
|
|
127
|
+
return {
|
|
128
|
+
content: [
|
|
129
|
+
{
|
|
130
|
+
type: "text",
|
|
131
|
+
text: JSON.stringify(result, null, 2),
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
case "flutter_analyze_project": {
|
|
137
|
+
const path = args?.path || process.cwd();
|
|
138
|
+
const result = await analyzeFlutterProject(path);
|
|
139
|
+
return {
|
|
140
|
+
content: [
|
|
141
|
+
{
|
|
142
|
+
type: "text",
|
|
143
|
+
text: JSON.stringify(result, null, 2),
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
case "flutter_get_project_info": {
|
|
149
|
+
const path = args?.path || process.cwd();
|
|
150
|
+
const result = await getFlutterProjectInfo(path);
|
|
151
|
+
return {
|
|
152
|
+
content: [
|
|
153
|
+
{
|
|
154
|
+
type: "text",
|
|
155
|
+
text: JSON.stringify(result, null, 2),
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
case "flutter_validate_code": {
|
|
161
|
+
const code = args?.code;
|
|
162
|
+
const filePath = args?.filePath;
|
|
163
|
+
if (!code) {
|
|
164
|
+
throw new McpError(ErrorCode.InvalidParams, "Code is required for validation");
|
|
165
|
+
}
|
|
166
|
+
const result = await validateDartCode(code, filePath);
|
|
167
|
+
return {
|
|
168
|
+
content: [
|
|
169
|
+
{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: JSON.stringify(result, null, 2),
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
case "flutter_check_dependencies": {
|
|
177
|
+
const path = args?.path || process.cwd();
|
|
178
|
+
const result = await checkDependencies(path);
|
|
179
|
+
return {
|
|
180
|
+
content: [
|
|
181
|
+
{
|
|
182
|
+
type: "text",
|
|
183
|
+
text: JSON.stringify(result, null, 2),
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
case "flutter_list_widgets": {
|
|
189
|
+
const path = args?.path || process.cwd();
|
|
190
|
+
const includeFullPath = args?.includeFullPath || false;
|
|
191
|
+
const result = await listWidgets(path, includeFullPath);
|
|
192
|
+
return {
|
|
193
|
+
content: [
|
|
194
|
+
{
|
|
195
|
+
type: "text",
|
|
196
|
+
text: JSON.stringify(result, null, 2),
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
default:
|
|
202
|
+
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
if (error instanceof McpError) {
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
// Import tool implementations
|
|
213
|
+
import { validateDartCode } from "./tools/validate.js";
|
|
214
|
+
import { checkDependencies } from "./tools/dependencies.js";
|
|
215
|
+
import { listWidgets } from "./tools/widgets.js";
|
|
216
|
+
// Start server
|
|
217
|
+
async function main() {
|
|
218
|
+
const transport = new StdioServerTransport();
|
|
219
|
+
await server.connect(transport);
|
|
220
|
+
console.error("Flutter MCP Server running on stdio");
|
|
221
|
+
}
|
|
222
|
+
main().catch((error) => {
|
|
223
|
+
console.error("Fatal error in main():", error);
|
|
224
|
+
process.exit(1);
|
|
225
|
+
});
|
|
226
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,QAAQ,EACR,SAAS,GACV,MAAM,oCAAoC,CAAC;AAG5C,4BAA4B;AAC5B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,wCAAwC;AACxC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,o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,0BAA0B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACnF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,8BAA8B;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,eAAe;AACf,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACvD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check Flutter project dependencies for compatibility and issues
|
|
3
|
+
*/
|
|
4
|
+
export declare function checkDependencies(projectPath: string): Promise<{
|
|
5
|
+
healthy: boolean;
|
|
6
|
+
dependencies: DependencyInfo[];
|
|
7
|
+
devDependencies: DependencyInfo[];
|
|
8
|
+
issues: DependencyIssue[];
|
|
9
|
+
recommendations: string[];
|
|
10
|
+
}>;
|
|
11
|
+
interface DependencyInfo {
|
|
12
|
+
name: string;
|
|
13
|
+
version: string;
|
|
14
|
+
type: "runtime" | "development";
|
|
15
|
+
isFlutterSdk?: boolean;
|
|
16
|
+
isGitDependency?: boolean;
|
|
17
|
+
isPathDependency?: boolean;
|
|
18
|
+
isHostedDependency?: boolean;
|
|
19
|
+
hasVersionConstraint: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface DependencyIssue {
|
|
22
|
+
type: "error" | "warning";
|
|
23
|
+
message: string;
|
|
24
|
+
dependency: string | null;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/tools/dependencies.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IACpE,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC,CA0KD;AAgCD,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,aAAa,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { readPubspecYaml } from "../utils/flutter.js";
|
|
4
|
+
/**
|
|
5
|
+
* Check Flutter project dependencies for compatibility and issues
|
|
6
|
+
*/
|
|
7
|
+
export async function checkDependencies(projectPath) {
|
|
8
|
+
const result = {
|
|
9
|
+
healthy: true,
|
|
10
|
+
dependencies: [],
|
|
11
|
+
devDependencies: [],
|
|
12
|
+
issues: [],
|
|
13
|
+
recommendations: [],
|
|
14
|
+
};
|
|
15
|
+
try {
|
|
16
|
+
const pubspec = await readPubspecYaml(projectPath);
|
|
17
|
+
if (!pubspec) {
|
|
18
|
+
result.issues.push({
|
|
19
|
+
type: "error",
|
|
20
|
+
message: "pubspec.yaml not found",
|
|
21
|
+
dependency: null,
|
|
22
|
+
});
|
|
23
|
+
result.healthy = false;
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
// Check if Flutter SDK is specified
|
|
27
|
+
if (!pubspec.environment?.sdk) {
|
|
28
|
+
result.issues.push({
|
|
29
|
+
type: "warning",
|
|
30
|
+
message: "Dart SDK version not specified in environment",
|
|
31
|
+
dependency: "sdk",
|
|
32
|
+
});
|
|
33
|
+
result.recommendations.push("Add SDK constraint to pubspec.yaml: environment: sdk: '>=3.0.0 <4.0.0'");
|
|
34
|
+
}
|
|
35
|
+
// Analyze dependencies
|
|
36
|
+
if (pubspec.dependencies) {
|
|
37
|
+
for (const [name, version] of Object.entries(pubspec.dependencies)) {
|
|
38
|
+
const depInfo = {
|
|
39
|
+
name,
|
|
40
|
+
version,
|
|
41
|
+
type: "runtime",
|
|
42
|
+
isFlutterSdk: name === "flutter",
|
|
43
|
+
hasVersionConstraint: version !== "any",
|
|
44
|
+
};
|
|
45
|
+
// Check for any version
|
|
46
|
+
if (version === "any") {
|
|
47
|
+
result.issues.push({
|
|
48
|
+
type: "warning",
|
|
49
|
+
message: `Dependency '${name}' uses 'any' version constraint`,
|
|
50
|
+
dependency: name,
|
|
51
|
+
});
|
|
52
|
+
result.recommendations.push(`Specify a version constraint for '${name}' instead of 'any'`);
|
|
53
|
+
depInfo.hasVersionConstraint = false;
|
|
54
|
+
}
|
|
55
|
+
// Check for git dependencies
|
|
56
|
+
if (typeof version === "string" && version.startsWith("git:")) {
|
|
57
|
+
depInfo.isGitDependency = true;
|
|
58
|
+
result.recommendations.push(`Consider using a published version of '${name}' instead of git dependency for stability`);
|
|
59
|
+
}
|
|
60
|
+
// Check for path dependencies
|
|
61
|
+
if (typeof version === "string" && version.startsWith("path:")) {
|
|
62
|
+
depInfo.isPathDependency = true;
|
|
63
|
+
const localPath = path.join(projectPath, version.replace("path:", ""));
|
|
64
|
+
if (!existsSync(localPath)) {
|
|
65
|
+
result.issues.push({
|
|
66
|
+
type: "error",
|
|
67
|
+
message: `Path dependency '${name}' points to non-existent path: ${localPath}`,
|
|
68
|
+
dependency: name,
|
|
69
|
+
});
|
|
70
|
+
result.healthy = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Check for hosted dependencies with version
|
|
74
|
+
if (typeof version === "string" && !version.startsWith("git:") &&
|
|
75
|
+
!version.startsWith("path:") && version !== "any") {
|
|
76
|
+
depInfo.isHostedDependency = true;
|
|
77
|
+
// Check version constraint format
|
|
78
|
+
if (!isValidVersionConstraint(version)) {
|
|
79
|
+
result.issues.push({
|
|
80
|
+
type: "warning",
|
|
81
|
+
message: `Invalid version constraint for '${name}': ${version}`,
|
|
82
|
+
dependency: name,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
result.dependencies.push(depInfo);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Analyze dev_dependencies
|
|
90
|
+
if (pubspec.dev_dependencies) {
|
|
91
|
+
for (const [name, version] of Object.entries(pubspec.dev_dependencies)) {
|
|
92
|
+
const depInfo = {
|
|
93
|
+
name,
|
|
94
|
+
version,
|
|
95
|
+
type: "development",
|
|
96
|
+
isFlutterSdk: name === "flutter_test",
|
|
97
|
+
hasVersionConstraint: version !== "any",
|
|
98
|
+
};
|
|
99
|
+
// Same checks as above
|
|
100
|
+
if (version === "any") {
|
|
101
|
+
result.issues.push({
|
|
102
|
+
type: "warning",
|
|
103
|
+
message: `Dev dependency '${name}' uses 'any' version constraint`,
|
|
104
|
+
dependency: name,
|
|
105
|
+
});
|
|
106
|
+
depInfo.hasVersionConstraint = false;
|
|
107
|
+
}
|
|
108
|
+
if (typeof version === "string" && version.startsWith("git:")) {
|
|
109
|
+
depInfo.isGitDependency = true;
|
|
110
|
+
}
|
|
111
|
+
if (typeof version === "string" && version.startsWith("path:")) {
|
|
112
|
+
depInfo.isPathDependency = true;
|
|
113
|
+
}
|
|
114
|
+
result.devDependencies.push(depInfo);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Check for common testing dependencies
|
|
118
|
+
const hasTestDependencies = pubspec.dev_dependencies?.flutter_test ||
|
|
119
|
+
pubspec.dev_dependencies?.build_runner ||
|
|
120
|
+
pubspec.dev_dependencies?.mockito;
|
|
121
|
+
if (!hasTestDependencies && result.devDependencies.length > 0) {
|
|
122
|
+
result.recommendations.push("Consider adding testing dependencies like flutter_test for better test coverage");
|
|
123
|
+
}
|
|
124
|
+
// Check for flutter_lints
|
|
125
|
+
if (!pubspec.dev_dependencies?.flutter_lints) {
|
|
126
|
+
result.recommendations.push("Add flutter_lints package for better code quality checks: dev_dependencies: flutter_lints: ^3.0.0");
|
|
127
|
+
}
|
|
128
|
+
// Count dependencies
|
|
129
|
+
const totalDeps = result.dependencies.length + result.devDependencies.length;
|
|
130
|
+
if (totalDeps > 50) {
|
|
131
|
+
result.issues.push({
|
|
132
|
+
type: "warning",
|
|
133
|
+
message: `Project has ${totalDeps} dependencies. Consider reducing dependencies for better maintainability.`,
|
|
134
|
+
dependency: null,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
result.issues.push({
|
|
140
|
+
type: "error",
|
|
141
|
+
message: `Failed to analyze dependencies: ${error instanceof Error ? error.message : String(error)}`,
|
|
142
|
+
dependency: null,
|
|
143
|
+
});
|
|
144
|
+
result.healthy = false;
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Check if version constraint is valid
|
|
150
|
+
*/
|
|
151
|
+
function isValidVersionConstraint(constraint) {
|
|
152
|
+
// Basic version constraint validation
|
|
153
|
+
// Supports: ^1.0.0, >=1.0.0, <2.0.0, 1.0.0, etc.
|
|
154
|
+
// Check for caret
|
|
155
|
+
if (constraint.startsWith("^")) {
|
|
156
|
+
return /^\^\d+\.\d+\.\d+$/.test(constraint);
|
|
157
|
+
}
|
|
158
|
+
// Check for comparison operators
|
|
159
|
+
if (/^[<>]=?\s*\d+\.\d+\.\d+/.test(constraint)) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
// Check for exact version
|
|
163
|
+
if (/^\d+\.\d+\.\d+$/.test(constraint)) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
// Check for range
|
|
167
|
+
if (/^\d+\.\d+\.\d+\s*<=\s*version\s*<\s*\d+\.\d+\.\d+/.test(constraint)) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/tools/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,WAAmB;IAOzD,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,EAAsB;QACpC,eAAe,EAAE,EAAsB;QACvC,MAAM,EAAE,EAAuB;QAC/B,eAAe,EAAE,EAAc;KAChC,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,W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C;QAC/B,OAAO,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED,iCAAiC;IACjC,IAAI,yBAAyB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kBAAkB;IAClB,IAAI,mDAAmD,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate Dart/Flutter code before execution
|
|
3
|
+
* Performs syntax checks, import validation, and common issue detection
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateDartCode(code: string, filePath?: string): Promise<{
|
|
6
|
+
valid: boolean;
|
|
7
|
+
errors: ValidationError[];
|
|
8
|
+
warnings: ValidationWarning[];
|
|
9
|
+
suggestions: string[];
|
|
10
|
+
metadata: {
|
|
11
|
+
lineCount: number;
|
|
12
|
+
hasImports: boolean;
|
|
13
|
+
hasMainFunction: boolean;
|
|
14
|
+
hasWidgetClass: boolean;
|
|
15
|
+
estimatedComplexity: "low" | "medium" | "high";
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
interface ValidationError {
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
message: string;
|
|
22
|
+
severity: "error";
|
|
23
|
+
code: string;
|
|
24
|
+
}
|
|
25
|
+
interface ValidationWarning {
|
|
26
|
+
line: number;
|
|
27
|
+
column: number;
|
|
28
|
+
message: string;
|
|
29
|
+
severity: "warning" | "info";
|
|
30
|
+
code: string;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/tools/validate.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC;IACT,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;QACzB,cAAc,EAAE,OAAO,CAAC;QACxB,mBAAmB,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;KAChD,CAAC;CACH,CAAC,CAiND;AA6CD,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd"}
|