ntc-dev-kit 1.0.0__py3-none-any.whl
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.
- ntc/__init__.py +5 -0
- ntc/app_creator.py +296 -0
- ntc/cli.py +4 -0
- ntc/cli_enhanced.py +820 -0
- ntc/composer/__init__.py +0 -0
- ntc/composer/main.py +443 -0
- ntc/deployment/__init__.py +0 -0
- ntc/templates/__init__.py +2 -0
- ntc/templates/auth_app/__init__.py +0 -0
- ntc/templates/auth_app/admin.py +24 -0
- ntc/templates/auth_app/apps.py +6 -0
- ntc/templates/auth_app/models.py +30 -0
- ntc/templates/auth_app/serializers.py +101 -0
- ntc/templates/auth_app/urls.py +19 -0
- ntc/templates/auth_app/views.py +175 -0
- ntc/templates/drf_structure/__init__.py +1 -0
- ntc/templates/drf_structure/drf_structure.md +83 -0
- ntc/templates/drf_structure/main.py +389 -0
- ntc/templates/drf_structure/structure.json +126 -0
- ntc/templates/drf_structure/templates/.entry/start_core_backend.sh +37 -0
- ntc/templates/drf_structure/templates/.entry/start_tasks_backend.sh +30 -0
- ntc/templates/drf_structure/templates/CLAUDE.md +194 -0
- ntc/templates/drf_structure/templates/README.md +117 -0
- ntc/templates/drf_structure/templates/apps/app_admin.py +3 -0
- ntc/templates/drf_structure/templates/apps/app_apps.py +6 -0
- ntc/templates/drf_structure/templates/apps/app_models.py +4 -0
- ntc/templates/drf_structure/templates/apps/app_urls.py +8 -0
- ntc/templates/drf_structure/templates/apps/app_views.py +6 -0
- ntc/templates/drf_structure/templates/apps/common_apps.py +6 -0
- ntc/templates/drf_structure/templates/apps/common_models.py +8 -0
- ntc/templates/drf_structure/templates/config/gunicorn_config.py +9 -0
- ntc/templates/drf_structure/templates/config/http.conf +33 -0
- ntc/templates/drf_structure/templates/core/base_model.py +9 -0
- ntc/templates/drf_structure/templates/core/formatter.py +5 -0
- ntc/templates/drf_structure/templates/core/logger.py +8 -0
- ntc/templates/drf_structure/templates/core/pagination.py +6 -0
- ntc/templates/drf_structure/templates/core/response_wrapper.py +7 -0
- ntc/templates/drf_structure/templates/core/services/azure/email/backend.py +108 -0
- ntc/templates/drf_structure/templates/core/services/azure/email/client.py +296 -0
- ntc/templates/drf_structure/templates/core/services/azure/email/notifier.py +102 -0
- ntc/templates/drf_structure/templates/core/services/object_storage.py +285 -0
- ntc/templates/drf_structure/templates/django_project/asgi.py +5 -0
- ntc/templates/drf_structure/templates/django_project/celery.py +8 -0
- ntc/templates/drf_structure/templates/django_project/dev_settings.py +2 -0
- ntc/templates/drf_structure/templates/django_project/django_settings.txt +322 -0
- ntc/templates/drf_structure/templates/django_project/management_command.py +114 -0
- ntc/templates/drf_structure/templates/django_project/prod_settings.py +3 -0
- ntc/templates/drf_structure/templates/django_project/schema.py +7 -0
- ntc/templates/drf_structure/templates/django_project/urls.py +6 -0
- ntc/templates/drf_structure/templates/django_project/wsgi.py +5 -0
- ntc/templates/drf_structure/templates/docker/docker-compose.yml +11 -0
- ntc/templates/drf_structure/templates/knowledge/knowledge_description.md +201 -0
- ntc/templates/drf_structure/templates/knowledge/knowledge_design_pattern.md +722 -0
- ntc/templates/drf_structure/templates/knowledge/knowledge_structure.md +151 -0
- ntc/templates/drf_structure/templates/root/README.md +307 -0
- ntc/templates/drf_structure/templates/root/django_env.txt +98 -0
- ntc/templates/drf_structure/templates/root/django_requirements.txt +24 -0
- ntc/templates/drf_structure/templates/root/gitignore.txt +6 -0
- ntc/templates/drf_structure/templates/root/manage.py +11 -0
- ntc/templates/flutter/.gitignore +44 -0
- ntc/templates/flutter/.knowledge/knowledge_description.md +215 -0
- ntc/templates/flutter/.knowledge/knowledge_design_pattern.md +310 -0
- ntc/templates/flutter/.knowledge/knowledge_structure.md +83 -0
- ntc/templates/flutter/CLAUDE.md +190 -0
- ntc/templates/flutter/__init__.py +0 -0
- ntc/templates/flutter/analysis_options.yaml +9 -0
- ntc/templates/flutter/main.py +187 -0
- ntc/templates/flutter/pubspec.yaml +65 -0
- ntc/templates/flutter/structure.json +51 -0
- ntc/templates/nextjs/.env.example +10 -0
- ntc/templates/nextjs/.gitignore +36 -0
- ntc/templates/nextjs/CLAUDE.md +181 -0
- ntc/templates/nextjs/README.md +94 -0
- ntc/templates/nextjs/__init__.py +0 -0
- ntc/templates/nextjs/knowledge/knowledge_description.md +208 -0
- ntc/templates/nextjs/knowledge/knowledge_design_pattern.md +460 -0
- ntc/templates/nextjs/knowledge/knowledge_structure.md +75 -0
- ntc/templates/nextjs/main.py +224 -0
- ntc/templates/nextjs/package.json +25 -0
- ntc/templates/nextjs/src/app/globals.css +26 -0
- ntc/templates/nextjs/src/app/layout.tsx +59 -0
- ntc/templates/nextjs/src/app/page.tsx +21 -0
- ntc/templates/nextjs/src/components/Header.tsx +16 -0
- ntc/templates/nextjs/src/services/api.ts +81 -0
- ntc/templates/nextjs/src/utils/constants.ts +1 -0
- ntc/templates/nextjs/structure.json +32 -0
- ntc/templates/nextjs/tsconfig.json +27 -0
- ntc/templates/react_admin/.env.example +1 -0
- ntc/templates/react_admin/.gitignore +10 -0
- ntc/templates/react_admin/CLAUDE.md +210 -0
- ntc/templates/react_admin/README.md +72 -0
- ntc/templates/react_admin/__init__.py +0 -0
- ntc/templates/react_admin/index.html +13 -0
- ntc/templates/react_admin/knowledge/knowledge_description.md +202 -0
- ntc/templates/react_admin/knowledge/knowledge_design_pattern.md +448 -0
- ntc/templates/react_admin/knowledge/knowledge_structure.md +97 -0
- ntc/templates/react_admin/main.py +208 -0
- ntc/templates/react_admin/package.json +35 -0
- ntc/templates/react_admin/src/App.tsx +60 -0
- ntc/templates/react_admin/src/components/ProtectedRoute.tsx +16 -0
- ntc/templates/react_admin/src/components/Sidebar.tsx +90 -0
- ntc/templates/react_admin/src/components/TopNav.tsx +44 -0
- ntc/templates/react_admin/src/context/AuthContext.tsx +107 -0
- ntc/templates/react_admin/src/context/ThemeContext.tsx +34 -0
- ntc/templates/react_admin/src/context/WorkspaceContext.tsx +28 -0
- ntc/templates/react_admin/src/hooks/useApi.ts +39 -0
- ntc/templates/react_admin/src/index.css +34 -0
- ntc/templates/react_admin/src/layouts/AuthLayout.tsx +23 -0
- ntc/templates/react_admin/src/layouts/DashboardLayout.tsx +24 -0
- ntc/templates/react_admin/src/main.tsx +5 -0
- ntc/templates/react_admin/src/pages/DashboardPage.tsx +10 -0
- ntc/templates/react_admin/src/pages/auth/LoginPage.tsx +79 -0
- ntc/templates/react_admin/src/pages/auth/RegisterPage.tsx +93 -0
- ntc/templates/react_admin/src/services/api.service.ts +44 -0
- ntc/templates/react_admin/src/services/base.service.ts +193 -0
- ntc/templates/react_admin/structure.json +52 -0
- ntc/templates/react_admin/tsconfig.app.json +25 -0
- ntc/templates/react_admin/tsconfig.json +7 -0
- ntc/templates/react_admin/tsconfig.node.json +19 -0
- ntc/templates/react_admin/vite.config.ts +13 -0
- ntc/templates/react_structure/CLAUDE.md +176 -0
- ntc/templates/react_structure/__init__.py +1 -0
- ntc/templates/react_structure/index.css +21 -0
- ntc/templates/react_structure/index.html +13 -0
- ntc/templates/react_structure/knowledge/knowledge_description.md +170 -0
- ntc/templates/react_structure/knowledge/knowledge_design_pattern.md +411 -0
- ntc/templates/react_structure/knowledge/knowledge_structure.md +74 -0
- ntc/templates/react_structure/main.py +217 -0
- ntc/templates/react_structure/package.json +32 -0
- ntc/templates/react_structure/src/App.tsx +63 -0
- ntc/templates/react_structure/src/components/Header.tsx +51 -0
- ntc/templates/react_structure/src/main.tsx +5 -0
- ntc/templates/react_structure/src/services/api.ts +90 -0
- ntc/templates/react_structure/src/utils/constants.ts +1 -0
- ntc/templates/react_structure/structure.json +65 -0
- ntc/templates/react_structure/tsconfig.app.json +25 -0
- ntc/templates/react_structure/tsconfig.json +7 -0
- ntc/templates/react_structure/tsconfig.node.json +19 -0
- ntc/templates/react_structure/vite.config.ts +12 -0
- ntc/utils/__init__.py +1 -0
- ntc/utils/environment.py +67 -0
- ntc/utils/output.py +41 -0
- ntc_dev_kit-1.0.0.dist-info/METADATA +188 -0
- ntc_dev_kit-1.0.0.dist-info/RECORD +148 -0
- ntc_dev_kit-1.0.0.dist-info/WHEEL +5 -0
- ntc_dev_kit-1.0.0.dist-info/entry_points.txt +2 -0
- ntc_dev_kit-1.0.0.dist-info/licenses/LICENSE +21 -0
- ntc_dev_kit-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# AI Agent Instructions for NTC-Generated Flutter Projects
|
|
2
|
+
|
|
3
|
+
This document provides specific instructions for AI agents (Claude, GPT, etc.) working with NTC-generated Flutter projects.
|
|
4
|
+
|
|
5
|
+
## 📖 Knowledge Base Reading Order
|
|
6
|
+
|
|
7
|
+
When first approaching this codebase, AI agents should read the knowledge files in this order:
|
|
8
|
+
|
|
9
|
+
1. **CLAUDE.md** (this file) - AI agent specific instructions
|
|
10
|
+
2. **.knowledge/knowledge_structure.md** - Project structure and organization
|
|
11
|
+
3. **.knowledge/knowledge_description.md** - Architecture overview and technical stack
|
|
12
|
+
4. **.knowledge/knowledge_design_pattern.md** - Design patterns and coding conventions
|
|
13
|
+
|
|
14
|
+
## 🤖 AI Agent Guidelines
|
|
15
|
+
|
|
16
|
+
### Before Making Changes
|
|
17
|
+
|
|
18
|
+
1. **Read the Knowledge Base**: Always read the knowledge files before making any changes to understand the project structure and conventions.
|
|
19
|
+
|
|
20
|
+
2. **Understand the NTC Structure**: This project follows the NTC (Nexent Toolkit Console) structure with Flutter, Riverpod, and modern Flutter patterns.
|
|
21
|
+
|
|
22
|
+
3. **Check Existing Implementations**: Before adding new features, check if similar implementations already exist in `lib/core/`, `lib/features/`, or `lib/services/`.
|
|
23
|
+
|
|
24
|
+
### Code Modification Rules
|
|
25
|
+
|
|
26
|
+
1. **Use Dart Type Safety**: All code must use Dart with strong type safety. Avoid `dynamic` types whenever possible.
|
|
27
|
+
|
|
28
|
+
2. **Follow Widget Patterns**:
|
|
29
|
+
- Use functional widgets with Riverpod
|
|
30
|
+
- Keep widgets small and focused
|
|
31
|
+
- Use const constructors where possible
|
|
32
|
+
- Separate UI from business logic
|
|
33
|
+
|
|
34
|
+
3. **State Management**:
|
|
35
|
+
- Use Riverpod for state management
|
|
36
|
+
- Use StateNotifier for stateful logic
|
|
37
|
+
- Keep state as close to where it's used as possible
|
|
38
|
+
- Use ProviderScope at the root
|
|
39
|
+
|
|
40
|
+
4. **API Integration**:
|
|
41
|
+
- Use the `ApiService` from `lib/services/api_service.dart` for all API calls
|
|
42
|
+
- Use the `DioClient` from `lib/core/network/dio_client.dart` for HTTP operations
|
|
43
|
+
- Handle loading and error states properly
|
|
44
|
+
- Use async/await for asynchronous operations
|
|
45
|
+
|
|
46
|
+
5. **Environment Variables**:
|
|
47
|
+
- Use `String.fromEnvironment()` for environment variables
|
|
48
|
+
- All configuration should use environment variables, never hardcode values
|
|
49
|
+
- Define environment variables in `--dart-define` during build
|
|
50
|
+
|
|
51
|
+
6. **Follow Naming Conventions**:
|
|
52
|
+
- Widgets: `PascalCase` (e.g., `UserProfile`)
|
|
53
|
+
- Files: `snake_case.dart` (e.g., `user_profile.dart`)
|
|
54
|
+
- Variables: `camelCase` (e.g., `userName`)
|
|
55
|
+
- Constants: `UPPER_SNAKE_CASE`
|
|
56
|
+
- Private members: `_camelCase`
|
|
57
|
+
|
|
58
|
+
### Flutter Best Practices
|
|
59
|
+
|
|
60
|
+
1. **Widget Structure**:
|
|
61
|
+
- Prefer const constructors
|
|
62
|
+
- Use ConsumerWidget for widgets that need providers
|
|
63
|
+
- Use ConsumerStatefulWidget for complex state
|
|
64
|
+
- Extract widgets into separate files
|
|
65
|
+
|
|
66
|
+
2. **Performance**:
|
|
67
|
+
- Use const widgets where possible
|
|
68
|
+
- Avoid rebuilding unnecessarily
|
|
69
|
+
- Use `const` for static values
|
|
70
|
+
- Use `ListView.builder` for long lists
|
|
71
|
+
|
|
72
|
+
3. **Accessibility**:
|
|
73
|
+
- Use semantic labels
|
|
74
|
+
- Ensure proper contrast
|
|
75
|
+
- Support screen readers
|
|
76
|
+
- Use proper touch targets
|
|
77
|
+
|
|
78
|
+
### External Service Integration
|
|
79
|
+
|
|
80
|
+
1. **API Communication**:
|
|
81
|
+
- Use the configured Dio instance in `DioClient`
|
|
82
|
+
- Handle authentication with JWT tokens via interceptors
|
|
83
|
+
- Implement proper error handling and user feedback
|
|
84
|
+
- Use loading states for async operations
|
|
85
|
+
|
|
86
|
+
2. **State Management**:
|
|
87
|
+
- Use Riverpod providers for state
|
|
88
|
+
- Use StateNotifier for complex state logic
|
|
89
|
+
- Keep state local when possible
|
|
90
|
+
- Use family modifiers for parameterized providers
|
|
91
|
+
|
|
92
|
+
### Development Workflow
|
|
93
|
+
|
|
94
|
+
1. **Running the Project**:
|
|
95
|
+
- Install dependencies: `flutter pub get`
|
|
96
|
+
- Run development server: `flutter run`
|
|
97
|
+
- Build for production: `flutter build apk` or `flutter build ios`
|
|
98
|
+
- Run tests: `flutter test`
|
|
99
|
+
|
|
100
|
+
2. **Adding New Features**:
|
|
101
|
+
- Place in `lib/features/` for feature-based organization
|
|
102
|
+
- Follow the feature pattern: data, domain, presentation layers
|
|
103
|
+
- Include proper Riverpod providers
|
|
104
|
+
- Add necessary API services
|
|
105
|
+
|
|
106
|
+
3. **Adding API Services**:
|
|
107
|
+
- Add endpoint methods to `lib/services/api_service.dart`
|
|
108
|
+
- Use the existing `DioClient` with interceptors
|
|
109
|
+
- Follow the existing service patterns
|
|
110
|
+
- Include proper Dart types
|
|
111
|
+
|
|
112
|
+
### Testing
|
|
113
|
+
|
|
114
|
+
1. **Test Structure**: Each widget and service should have corresponding test files in the `test/` directory.
|
|
115
|
+
|
|
116
|
+
2. **Run Tests**: Use `flutter test` to run the test suite.
|
|
117
|
+
|
|
118
|
+
### Security Considerations
|
|
119
|
+
|
|
120
|
+
1. **Never Commit Secrets**: Environment variables should never be committed to the repository.
|
|
121
|
+
|
|
122
|
+
2. **Use HTTPS in Production**: All API calls should use HTTPS in production.
|
|
123
|
+
|
|
124
|
+
3. **Validate Inputs**: Always validate user inputs both on client and server side.
|
|
125
|
+
|
|
126
|
+
4. **Secure Storage**: Use `flutter_secure_storage` for sensitive data.
|
|
127
|
+
|
|
128
|
+
### When to Ask for Clarification
|
|
129
|
+
|
|
130
|
+
1. If you're unsure about the NTC structure or conventions
|
|
131
|
+
2. If you need to add a new external service integration
|
|
132
|
+
3. If you're modifying the build configuration
|
|
133
|
+
4. If you're changing the Riverpod state management
|
|
134
|
+
5. If you're modifying the authentication flow
|
|
135
|
+
|
|
136
|
+
## 🎯 Quick Reference
|
|
137
|
+
|
|
138
|
+
### Import Patterns
|
|
139
|
+
```dart
|
|
140
|
+
// API service
|
|
141
|
+
import '../services/api_service.dart';
|
|
142
|
+
|
|
143
|
+
// Core config
|
|
144
|
+
import '../core/config/app_config.dart';
|
|
145
|
+
import '../core/config/environment.dart';
|
|
146
|
+
|
|
147
|
+
// Riverpod
|
|
148
|
+
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
149
|
+
|
|
150
|
+
// Flutter
|
|
151
|
+
import 'package:flutter/material.dart';
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Common Patterns
|
|
155
|
+
```dart
|
|
156
|
+
// API call with loading and error states
|
|
157
|
+
final isLoading = ref.watch(isLoadingProvider);
|
|
158
|
+
final error = ref.watch(errorProvider);
|
|
159
|
+
|
|
160
|
+
final fetchData = ref.read(fetchDataProvider.notifier).fetchData();
|
|
161
|
+
|
|
162
|
+
// Environment variable
|
|
163
|
+
final apiUrl = String.fromEnvironment('API_BASE_URL', defaultValue: 'http://localhost:8000');
|
|
164
|
+
|
|
165
|
+
// Riverpod provider
|
|
166
|
+
final myProvider = Provider<int>((ref) {
|
|
167
|
+
return 42;
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// ConsumerWidget
|
|
171
|
+
class MyWidget extends ConsumerWidget {
|
|
172
|
+
@override
|
|
173
|
+
Widget build(BuildContext context, WidgetRef ref) {
|
|
174
|
+
final value = ref.watch(myProvider);
|
|
175
|
+
return Text('$value');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## 📝 Additional Resources
|
|
181
|
+
|
|
182
|
+
- Flutter Documentation: https://flutter.dev/docs
|
|
183
|
+
- Riverpod Documentation: https://riverpod.dev/
|
|
184
|
+
- Dart Documentation: https://dart.dev/guides
|
|
185
|
+
- Dio Documentation: https://pub.dev/packages/dio
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
**Last Updated**: 2026-05-09
|
|
190
|
+
**Template Version**: Flutter 3.19+ + Riverpod 2.4+
|
|
File without changes
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import subprocess
|
|
3
|
+
import sys
|
|
4
|
+
import json
|
|
5
|
+
import shutil
|
|
6
|
+
from ntc.utils.output import print_success, print_error, print_warning, print_info, print_progress
|
|
7
|
+
|
|
8
|
+
def replace_variables(content, variables):
|
|
9
|
+
"""Replace placeholders with actual variables."""
|
|
10
|
+
for key, value in variables.items():
|
|
11
|
+
content = content.replace(f"{{{key}}}", value)
|
|
12
|
+
return content
|
|
13
|
+
|
|
14
|
+
def get_template_content(template_name, variables):
|
|
15
|
+
"""Load template content and replace variables."""
|
|
16
|
+
# Remove 'flutter/' prefix if present since we're already in that directory
|
|
17
|
+
if template_name.startswith("flutter/"):
|
|
18
|
+
template_name = template_name[len("flutter/"):]
|
|
19
|
+
|
|
20
|
+
template_path = os.path.join(os.path.dirname(__file__), template_name)
|
|
21
|
+
if not os.path.exists(template_path):
|
|
22
|
+
return ""
|
|
23
|
+
with open(template_path, "r", encoding="utf-8") as f:
|
|
24
|
+
content = f.read()
|
|
25
|
+
return replace_variables(content, variables)
|
|
26
|
+
|
|
27
|
+
def create_from_json(base_path, structure, variables):
|
|
28
|
+
"""Recursively create directories and files from JSON."""
|
|
29
|
+
for name, content in structure.items():
|
|
30
|
+
name = replace_variables(name, variables)
|
|
31
|
+
full_path = os.path.join(base_path, name)
|
|
32
|
+
|
|
33
|
+
if isinstance(content, dict):
|
|
34
|
+
if "template" in content:
|
|
35
|
+
os.makedirs(os.path.dirname(full_path), exist_ok=True)
|
|
36
|
+
with open(full_path, "w", encoding="utf-8") as f:
|
|
37
|
+
f.write(get_template_content(content["template"], variables))
|
|
38
|
+
else:
|
|
39
|
+
os.makedirs(full_path, exist_ok=True)
|
|
40
|
+
create_from_json(full_path, content, variables)
|
|
41
|
+
else:
|
|
42
|
+
os.makedirs(os.path.dirname(full_path), exist_ok=True)
|
|
43
|
+
with open(full_path, "w", encoding="utf-8") as f:
|
|
44
|
+
f.write(replace_variables(content or "", variables))
|
|
45
|
+
|
|
46
|
+
def install_flutter_dependencies(project_root):
|
|
47
|
+
"""Install Flutter dependencies for the project."""
|
|
48
|
+
print_info("Installing Flutter dependencies...")
|
|
49
|
+
|
|
50
|
+
# Check if flutter is available
|
|
51
|
+
if not shutil.which("flutter"):
|
|
52
|
+
print_error("Flutter not found. Please install Flutter SDK first.")
|
|
53
|
+
print_info("Visit https://flutter.dev/docs/get-started/install to download Flutter")
|
|
54
|
+
return False
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
# Change to project directory and install dependencies
|
|
58
|
+
result = subprocess.run(
|
|
59
|
+
["flutter", "pub", "get"],
|
|
60
|
+
cwd=project_root,
|
|
61
|
+
check=True,
|
|
62
|
+
capture_output=True,
|
|
63
|
+
text=True
|
|
64
|
+
)
|
|
65
|
+
print_success("Flutter dependencies installed successfully!")
|
|
66
|
+
return True
|
|
67
|
+
except subprocess.CalledProcessError as e:
|
|
68
|
+
print_error(f"Failed to install Flutter dependencies: {e}")
|
|
69
|
+
print_info("You can manually run 'flutter pub get' in the project directory later.")
|
|
70
|
+
return False
|
|
71
|
+
|
|
72
|
+
def convert_to_camel_case(name):
|
|
73
|
+
"""Convert snake_case to CamelCase."""
|
|
74
|
+
return ''.join(word.capitalize() for word in name.split('_'))
|
|
75
|
+
|
|
76
|
+
def init_flutter_project(base_path, project_name):
|
|
77
|
+
"""Initialize Flutter project structure and setup environment."""
|
|
78
|
+
structure_file = os.path.join(os.path.dirname(__file__), "structure.json")
|
|
79
|
+
|
|
80
|
+
if not os.path.exists(structure_file):
|
|
81
|
+
print_error(f"Structure file not found: {structure_file}")
|
|
82
|
+
return
|
|
83
|
+
|
|
84
|
+
with open(structure_file, "r", encoding="utf-8") as f:
|
|
85
|
+
structure = json.load(f)
|
|
86
|
+
|
|
87
|
+
project_root = os.path.join(base_path, project_name)
|
|
88
|
+
os.makedirs(project_root, exist_ok=True)
|
|
89
|
+
|
|
90
|
+
variables = {
|
|
91
|
+
"project_name": project_name,
|
|
92
|
+
"project_camel": convert_to_camel_case(project_name),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
create_from_json(project_root, structure["{project_name}"], variables)
|
|
96
|
+
print_success(f"Flutter project '{project_name}' initialized at: {project_root}")
|
|
97
|
+
|
|
98
|
+
# Ask user for dependency installation
|
|
99
|
+
print(f"\n📦 FLUTTER DEPENDENCY SETUP")
|
|
100
|
+
print("─" * 40)
|
|
101
|
+
print("[1] Install dependencies now (flutter pub get)")
|
|
102
|
+
print("[2] Skip dependency installation")
|
|
103
|
+
|
|
104
|
+
deps_choice = input("❓ Select dependency option (1-2): ").strip()
|
|
105
|
+
|
|
106
|
+
# Clear screen after selection
|
|
107
|
+
os.system('cls' if os.name == 'nt' else 'clear')
|
|
108
|
+
|
|
109
|
+
if deps_choice == "1":
|
|
110
|
+
install_flutter_dependencies(project_root)
|
|
111
|
+
else:
|
|
112
|
+
print_info("Skipping dependency installation.")
|
|
113
|
+
print_info("Remember to run 'flutter pub get' before starting development.")
|
|
114
|
+
|
|
115
|
+
# Show next steps
|
|
116
|
+
print(f"\n🎉 PROJECT READY!")
|
|
117
|
+
print("─" * 30)
|
|
118
|
+
print_info("Next steps:")
|
|
119
|
+
print(" 1. cd " + project_name)
|
|
120
|
+
if deps_choice != "1":
|
|
121
|
+
print(" 2. flutter pub get")
|
|
122
|
+
print(" 3. flutter run")
|
|
123
|
+
else:
|
|
124
|
+
print(" 2. flutter run")
|
|
125
|
+
print_info("Your Flutter app will be available on your connected device/emulator")
|
|
126
|
+
print_info("Make sure your backend API is running on http://localhost:8000")
|
|
127
|
+
|
|
128
|
+
def init_flutter_project_in_current_dir(project_name):
|
|
129
|
+
"""Initialize Flutter project structure in the current directory."""
|
|
130
|
+
structure_file = os.path.join(os.path.dirname(__file__), "structure.json")
|
|
131
|
+
|
|
132
|
+
if not os.path.exists(structure_file):
|
|
133
|
+
print_error(f"Structure file not found: {structure_file}")
|
|
134
|
+
return
|
|
135
|
+
|
|
136
|
+
with open(structure_file, "r", encoding="utf-8") as f:
|
|
137
|
+
structure = json.load(f)
|
|
138
|
+
|
|
139
|
+
project_root = os.getcwd() # Use current directory
|
|
140
|
+
|
|
141
|
+
variables = {
|
|
142
|
+
"project_name": project_name,
|
|
143
|
+
"project_camel": convert_to_camel_case(project_name),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
# Check if current directory is empty or ask for confirmation
|
|
147
|
+
existing_files = [f for f in os.listdir(project_root) if not f.startswith('.')]
|
|
148
|
+
if existing_files:
|
|
149
|
+
print_warning(f"Current directory is not empty. Found {len(existing_files)} files/folders.")
|
|
150
|
+
print_info("Existing items: " + ", ".join(existing_files[:5]) + ("..." if len(existing_files) > 5 else ""))
|
|
151
|
+
|
|
152
|
+
confirm = input("❓ Continue anyway? (y/N): ").strip().lower()
|
|
153
|
+
if confirm != 'y':
|
|
154
|
+
print_info("Project initialization cancelled.")
|
|
155
|
+
return
|
|
156
|
+
|
|
157
|
+
create_from_json(project_root, structure["{project_name}"], variables)
|
|
158
|
+
print_success(f"Flutter project '{project_name}' initialized in current directory: {project_root}")
|
|
159
|
+
|
|
160
|
+
# Ask user for dependency installation
|
|
161
|
+
print(f"\n📦 FLUTTER DEPENDENCY SETUP")
|
|
162
|
+
print("─" * 40)
|
|
163
|
+
print("[1] Install dependencies now (flutter pub get)")
|
|
164
|
+
print("[2] Skip dependency installation")
|
|
165
|
+
|
|
166
|
+
deps_choice = input("❓ Select dependency option (1-2): ").strip()
|
|
167
|
+
|
|
168
|
+
# Clear screen after selection
|
|
169
|
+
os.system('cls' if os.name == 'nt' else 'clear')
|
|
170
|
+
|
|
171
|
+
if deps_choice == "1":
|
|
172
|
+
install_flutter_dependencies(project_root)
|
|
173
|
+
else:
|
|
174
|
+
print_info("Skipping dependency installation.")
|
|
175
|
+
print_info("Remember to run 'flutter pub get' before starting development.")
|
|
176
|
+
|
|
177
|
+
# Show next steps
|
|
178
|
+
print(f"\n🎉 PROJECT READY!")
|
|
179
|
+
print("─" * 30)
|
|
180
|
+
print_info("Next steps:")
|
|
181
|
+
if deps_choice != "1":
|
|
182
|
+
print(" 1. flutter pub get")
|
|
183
|
+
print(" 2. flutter run")
|
|
184
|
+
else:
|
|
185
|
+
print(" 1. flutter run")
|
|
186
|
+
print_info("Your Flutter app will be available on your connected device/emulator")
|
|
187
|
+
print_info("Make sure your backend API is running on http://localhost:8000")
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: {project_name}
|
|
2
|
+
description: A modern Flutter application with state management and API integration
|
|
3
|
+
publish_to: 'none'
|
|
4
|
+
|
|
5
|
+
version: 1.0.0+1
|
|
6
|
+
|
|
7
|
+
environment:
|
|
8
|
+
sdk: ^3.9.0
|
|
9
|
+
|
|
10
|
+
dependencies:
|
|
11
|
+
flutter:
|
|
12
|
+
sdk: flutter
|
|
13
|
+
flutter_localizations:
|
|
14
|
+
sdk: flutter
|
|
15
|
+
|
|
16
|
+
# State Management
|
|
17
|
+
flutter_riverpod: ^2.4.9
|
|
18
|
+
|
|
19
|
+
# HTTP Client & Networking
|
|
20
|
+
dio: ^5.4.0
|
|
21
|
+
connectivity_plus: ^5.0.2
|
|
22
|
+
|
|
23
|
+
# Secure Storage
|
|
24
|
+
flutter_secure_storage: ^9.0.0
|
|
25
|
+
|
|
26
|
+
# Local Storage & Caching
|
|
27
|
+
hive: ^2.2.3
|
|
28
|
+
hive_flutter: ^1.1.0
|
|
29
|
+
shared_preferences: ^2.5.4
|
|
30
|
+
|
|
31
|
+
# JSON & Models
|
|
32
|
+
freezed_annotation: ^2.4.1
|
|
33
|
+
json_annotation: ^4.8.1
|
|
34
|
+
|
|
35
|
+
# Utils
|
|
36
|
+
cached_network_image: ^3.3.0
|
|
37
|
+
intl: ^0.20.2
|
|
38
|
+
|
|
39
|
+
# Fonts
|
|
40
|
+
google_fonts: ^6.1.0
|
|
41
|
+
|
|
42
|
+
# Device Info
|
|
43
|
+
device_info_plus: ^10.1.0
|
|
44
|
+
|
|
45
|
+
# Path Provider
|
|
46
|
+
path_provider: ^2.1.2
|
|
47
|
+
|
|
48
|
+
# URL Launcher
|
|
49
|
+
url_launcher: ^6.3.0
|
|
50
|
+
|
|
51
|
+
# Cupertino Icons
|
|
52
|
+
cupertino_icons: ^1.0.8
|
|
53
|
+
|
|
54
|
+
dev_dependencies:
|
|
55
|
+
flutter_test:
|
|
56
|
+
sdk: flutter
|
|
57
|
+
|
|
58
|
+
flutter_lints: ^5.0.0
|
|
59
|
+
|
|
60
|
+
flutter:
|
|
61
|
+
uses-material-design: true
|
|
62
|
+
generate: true
|
|
63
|
+
|
|
64
|
+
assets:
|
|
65
|
+
- assets/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"{project_name}": {
|
|
3
|
+
"pubspec.yaml": { "template": "flutter/pubspec.yaml" },
|
|
4
|
+
".gitignore": { "template": "flutter/.gitignore" },
|
|
5
|
+
"analysis_options.yaml": { "template": "flutter/analysis_options.yaml" },
|
|
6
|
+
"README.md": "# {project_name}\n\nA modern Flutter application with state management and API integration, initialized by `ntc init`.\n\n## Tech Stack\n\n- Flutter 3.19+\n- Dart 3.9+\n- Riverpod 2.4+ (State Management)\n- Dio 5.4+ (HTTP Client)\n- Flutter Secure Storage\n- Hive (Local Storage)\n\n## Getting Started\n\n```bash\nflutter pub get\nflutter run\n```\n\n## Available Commands\n\n- `flutter pub get` - Install dependencies\n- `flutter run` - Run the app in development mode\n- `flutter build apk` - Build Android APK\n- `flutter build ios` - Build iOS app\n- `flutter test` - Run tests\n- `flutter analyze` - Analyze code\n",
|
|
7
|
+
"CLAUDE.md": { "template": "flutter/CLAUDE.md" },
|
|
8
|
+
".knowledge": {
|
|
9
|
+
"knowledge_structure.md": { "template": "flutter/.knowledge/knowledge_structure.md" },
|
|
10
|
+
"knowledge_description.md": { "template": "flutter/.knowledge/knowledge_description.md" },
|
|
11
|
+
"knowledge_design_pattern.md": { "template": "flutter/.knowledge/knowledge_design_pattern.md" }
|
|
12
|
+
},
|
|
13
|
+
"lib": {
|
|
14
|
+
"main.dart": { "template": "flutter/lib/main.dart" },
|
|
15
|
+
"core": {
|
|
16
|
+
"config": {
|
|
17
|
+
"app_config.dart": { "template": "flutter/lib/core/config/app_config.dart" },
|
|
18
|
+
"environment.dart": { "template": "flutter/lib/core/config/environment.dart" }
|
|
19
|
+
},
|
|
20
|
+
"constants": {
|
|
21
|
+
"app_constants.dart": { "template": "flutter/lib/core/constants/app_constants.dart" }
|
|
22
|
+
},
|
|
23
|
+
"network": {
|
|
24
|
+
"dio_client.dart": { "template": "flutter/lib/core/network/dio_client.dart" }
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"services": {
|
|
28
|
+
"api_service.dart": { "template": "flutter/lib/services/api_service.dart" }
|
|
29
|
+
},
|
|
30
|
+
"shared": {
|
|
31
|
+
"theme": {
|
|
32
|
+
"app_theme.dart": { "template": "flutter/lib/shared/theme/app_theme.dart" },
|
|
33
|
+
"theme_provider.dart": { "template": "flutter/lib/shared/theme/theme_provider.dart" }
|
|
34
|
+
},
|
|
35
|
+
"localization": {
|
|
36
|
+
"locale_provider.dart": { "template": "flutter/lib/shared/localization/locale_provider.dart" }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"features": {
|
|
40
|
+
"home": {
|
|
41
|
+
"presentation": {
|
|
42
|
+
"home_screen.dart": { "template": "flutter/lib/features/home/presentation/home_screen.dart" }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"l10n": {
|
|
47
|
+
"app_localizations.dart": { "template": "flutter/lib/l10n/app_localizations.dart" }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# API Configuration
|
|
2
|
+
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
|
|
3
|
+
|
|
4
|
+
# Site Configuration
|
|
5
|
+
NEXT_PUBLIC_SITE_NAME={project_name}
|
|
6
|
+
NEXT_PUBLIC_SITE_URL=http://localhost:3000
|
|
7
|
+
|
|
8
|
+
# SEO Configuration
|
|
9
|
+
NEXT_PUBLIC_SITE_DESCRIPTION=A modern website built with Next.js
|
|
10
|
+
NEXT_PUBLIC_SITE_KEYWORDS=nextjs,react,typescript
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# dependencies
|
|
4
|
+
/node_modules
|
|
5
|
+
/.pnp
|
|
6
|
+
.pnp.js
|
|
7
|
+
|
|
8
|
+
# testing
|
|
9
|
+
/coverage
|
|
10
|
+
|
|
11
|
+
# next.js
|
|
12
|
+
/.next/
|
|
13
|
+
/out/
|
|
14
|
+
|
|
15
|
+
# production
|
|
16
|
+
/build
|
|
17
|
+
|
|
18
|
+
# misc
|
|
19
|
+
.DS_Store
|
|
20
|
+
*.pem
|
|
21
|
+
|
|
22
|
+
# debug
|
|
23
|
+
npm-debug.log*
|
|
24
|
+
yarn-debug.log*
|
|
25
|
+
yarn-error.log*
|
|
26
|
+
|
|
27
|
+
# local env files
|
|
28
|
+
.env*.local
|
|
29
|
+
.env
|
|
30
|
+
|
|
31
|
+
# vercel
|
|
32
|
+
.vercel
|
|
33
|
+
|
|
34
|
+
# typescript
|
|
35
|
+
*.tsbuildinfo
|
|
36
|
+
next-env.d.ts
|