@botim/botim-cli 0.1.6 → 0.1.7
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/dist/cli.js +3 -3
- package/dist/cli.mjs +2 -2
- package/package.json +2 -3
- package/dist/templates/templates/react/README.md +0 -48
- package/dist/templates/templates/react/docs/code-patterns.md +0 -139
- package/dist/templates/templates/react/docs/core-rules.md +0 -69
- package/dist/templates/templates/react/docs/figma-workflow.md +0 -81
- package/dist/templates/templates/react/docs/validation.md +0 -59
- package/dist/templates/templates/react/eslint.config.ts +0 -57
- package/dist/templates/templates/react/index.html +0 -12
- package/dist/templates/templates/react/package-lock.json +0 -12197
- package/dist/templates/templates/react/package.json +0 -102
- package/dist/templates/templates/react/scripts/setup.sh +0 -304
- package/dist/templates/templates/react/src/api/http-client.ts +0 -8
- package/dist/templates/templates/react/src/api/modules/example.ts +0 -12
- package/dist/templates/templates/react/src/app.tsx +0 -27
- package/dist/templates/templates/react/src/components/not-found-content/index.ts +0 -2
- package/dist/templates/templates/react/src/components/not-found-content/not-found-content.tsx +0 -24
- package/dist/templates/templates/react/src/components/welcome-card/index.ts +0 -1
- package/dist/templates/templates/react/src/components/welcome-card/welcome-card.tsx +0 -10
- package/dist/templates/templates/react/src/hooks/use-document-title.ts +0 -11
- package/dist/templates/templates/react/src/i18n/index.ts +0 -40
- package/dist/templates/templates/react/src/i18n/languages/en.json +0 -10
- package/dist/templates/templates/react/src/main.tsx +0 -27
- package/dist/templates/templates/react/src/modules/common/README.md +0 -7
- package/dist/templates/templates/react/src/modules/common/constants.ts +0 -3
- package/dist/templates/templates/react/src/modules/core/README.md +0 -7
- package/dist/templates/templates/react/src/modules/core/api/error.ts +0 -6
- package/dist/templates/templates/react/src/modules/core/app-providers.tsx +0 -18
- package/dist/templates/templates/react/src/modules/core/index.ts +0 -2
- package/dist/templates/templates/react/src/pages/home/index.tsx +0 -13
- package/dist/templates/templates/react/src/pages/not-found/index.tsx +0 -7
- package/dist/templates/templates/react/src/routes.tsx +0 -18
- package/dist/templates/templates/react/src/stores/home-store.ts +0 -11
- package/dist/templates/templates/react/src/styles/font.css +0 -1
- package/dist/templates/templates/react/src/styles/global-style.tsx +0 -27
- package/dist/templates/templates/react/src/styles/tailwind.css +0 -4
- package/dist/templates/templates/react/src/styles/utility-classes.ts +0 -13
- package/dist/templates/templates/react/src/theme/index.tsx +0 -24
- package/dist/templates/templates/react/src/theme/types.ts +0 -10
- package/dist/templates/templates/react/src/types/global.d.ts +0 -139
- package/dist/templates/templates/react/src/types/shims-global.d.ts +0 -97
- package/dist/templates/templates/react/src/utils/currency.ts +0 -6
- package/dist/templates/templates/react/src/utils/date.ts +0 -5
- package/dist/templates/templates/react/src/utils/guard.ts +0 -4
- package/dist/templates/templates/react/src/vite-env.d.ts +0 -1
- package/dist/templates/templates/react/tsconfig.json +0 -39
- package/dist/templates/templates/react/tsconfig.node.json +0 -11
- package/dist/templates/templates/react/types/global.d.ts +0 -131
- package/dist/templates/templates/react/vite.config.ts +0 -179
- package/dist/templates/templates/vue/README.md +0 -19
- package/dist/templates/templates/vue/eslint.config.ts +0 -44
- package/dist/templates/templates/vue/index.html +0 -12
- package/dist/templates/templates/vue/package-lock.json +0 -5774
- package/dist/templates/templates/vue/package.json +0 -39
- package/dist/templates/templates/vue/src/api/http-client.ts +0 -11
- package/dist/templates/templates/vue/src/api/modules/example.ts +0 -12
- package/dist/templates/templates/vue/src/app.vue +0 -23
- package/dist/templates/templates/vue/src/components/card/index.vue +0 -14
- package/dist/templates/templates/vue/src/components/layout/index.ts +0 -1
- package/dist/templates/templates/vue/src/components/layout/page-layout.vue +0 -43
- package/dist/templates/templates/vue/src/components/layout/styles.ts +0 -5
- package/dist/templates/templates/vue/src/components/typography/heading.vue +0 -21
- package/dist/templates/templates/vue/src/components/typography/index.ts +0 -1
- package/dist/templates/templates/vue/src/hooks/use-document-title.ts +0 -23
- package/dist/templates/templates/vue/src/i18n/index.ts +0 -31
- package/dist/templates/templates/vue/src/i18n/languages/en.json +0 -10
- package/dist/templates/templates/vue/src/main.ts +0 -12
- package/dist/templates/templates/vue/src/modules/common/README.md +0 -7
- package/dist/templates/templates/vue/src/modules/common/constants.ts +0 -3
- package/dist/templates/templates/vue/src/modules/core/README.md +0 -7
- package/dist/templates/templates/vue/src/modules/core/api/error.ts +0 -6
- package/dist/templates/templates/vue/src/modules/core/app-providers.ts +0 -17
- package/dist/templates/templates/vue/src/modules/core/index.ts +0 -2
- package/dist/templates/templates/vue/src/pages/home/index.vue +0 -28
- package/dist/templates/templates/vue/src/pages/not-found/index.vue +0 -13
- package/dist/templates/templates/vue/src/routes.ts +0 -19
- package/dist/templates/templates/vue/src/stores/home-store.ts +0 -12
- package/dist/templates/templates/vue/src/styles/font.css +0 -1
- package/dist/templates/templates/vue/src/styles/global-style.ts +0 -63
- package/dist/templates/templates/vue/src/styles/utility-classes.ts +0 -1
- package/dist/templates/templates/vue/src/theme/index.ts +0 -33
- package/dist/templates/templates/vue/src/theme/types.ts +0 -10
- package/dist/templates/templates/vue/src/types/global.d.ts +0 -9
- package/dist/templates/templates/vue/src/utils/currency.ts +0 -6
- package/dist/templates/templates/vue/src/utils/date.ts +0 -5
- package/dist/templates/templates/vue/src/utils/guard.ts +0 -4
- package/dist/templates/templates/vue/src/vite-env.d.ts +0 -1
- package/dist/templates/templates/vue/tsconfig.json +0 -36
- package/dist/templates/templates/vue/tsconfig.node.json +0 -9
- package/dist/templates/templates/vue/types/global.d.ts +0 -7
- package/dist/templates/templates/vue/vite.config.ts +0 -74
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botim/botim-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "A CLI tool that generates boilerplate code for React and Vue applications and manages Mini-Program apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"LICENSE"
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "tsup && npm run
|
|
17
|
-
"copy-templates": "cp -r templates dist/templates",
|
|
16
|
+
"build": "tsup && npm run build:bundle",
|
|
18
17
|
"build:bundle": "ncc build src/cli.ts -o dist-bundled -m -e @vercel/ncc && cp dist-bundled/index.js dist/cli.mjs && cp dist-bundled/sourcemap-register.cjs dist/ 2>/dev/null || true && rm -rf dist-bundled && npm run inject-version",
|
|
19
18
|
"inject-version": "node -e \"const fs=require('fs');const pkg=require('./package.json');const f='dist/cli.mjs';let c=fs.readFileSync(f,'utf8');c=c.replace(/process\\.env\\.BOTIM_CLI_VERSION\\|\\|\\\"1\\.0\\.0\\\"/g,'\\\"'+pkg.version+'\\\"');fs.writeFileSync(f,c);\"",
|
|
20
19
|
"build:tsup": "tsup",
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# React + Vite Mini Program Template
|
|
2
|
-
|
|
3
|
-
This template captures the reusable project structure, tooling, and architectural patterns from the original repository without including product-specific business logic. Use it as the starting point for new React + Vite micro-applications that rely on Emotion, Zustand, routing, and i18n.
|
|
4
|
-
|
|
5
|
-
## What's Included
|
|
6
|
-
|
|
7
|
-
- Vite + React + TypeScript baseline
|
|
8
|
-
- Emotion styling with global theme helpers
|
|
9
|
-
- React Router with centralized route definitions
|
|
10
|
-
- i18n setup with lazy-loaded namespaces
|
|
11
|
-
- Zustand-powered state management scaffold
|
|
12
|
-
- Modular folder structure for APIs, modules, pages, and shared UI components
|
|
13
|
-
- ESLint + TypeScript configs aligned with the original code style
|
|
14
|
-
|
|
15
|
-
## Getting Started
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install
|
|
19
|
-
npm run dev
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Project Structure
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
src/
|
|
26
|
-
api/ # API modules and service wrappers
|
|
27
|
-
components/ # Reusable UI components
|
|
28
|
-
hooks/ # Custom React hooks
|
|
29
|
-
i18n/ # Localization configuration
|
|
30
|
-
modules/ # Domain modules composed from core + common utilities
|
|
31
|
-
pages/ # Route-level views
|
|
32
|
-
stores/ # Zustand stores
|
|
33
|
-
styles/ # Global styles and utility classes
|
|
34
|
-
theme/ # Theme tokens and helpers
|
|
35
|
-
utils/ # General-purpose utilities
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Customization Checklist
|
|
39
|
-
|
|
40
|
-
1. Update `package.json` metadata (`name`, `version`, `description`).
|
|
41
|
-
2. Replace placeholder assets and translations in `src/assets` and `src/i18n/languages`.
|
|
42
|
-
3. Flesh out routes inside `src/routes.tsx`.
|
|
43
|
-
4. Extend stores, modules, and API clients as needed.
|
|
44
|
-
5. Adjust ESLint rules or tooling to match team conventions.
|
|
45
|
-
|
|
46
|
-
## Optional Integrations
|
|
47
|
-
|
|
48
|
-
The original project integrates several proprietary Botim packages (MP bridge, Buckit resolver, Sentry plugin, etc.). Add them back in `vite.config.ts` or `package.json` if the consuming project requires them.
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# Code Patterns
|
|
2
|
-
|
|
3
|
-
## Generation Order
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
Types → API → Hooks → Components → Page → Routes
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
src/
|
|
11
|
-
├── types/{feature}.types.ts
|
|
12
|
-
├── api/modules/{feature}.api.ts
|
|
13
|
-
├── hooks/use{Feature}.ts
|
|
14
|
-
├── pages/{feature}/
|
|
15
|
-
│ ├── index.tsx
|
|
16
|
-
│ └── components/
|
|
17
|
-
└── routes.tsx
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Hook Patterns
|
|
23
|
-
|
|
24
|
-
### Data Fetching
|
|
25
|
-
```typescript
|
|
26
|
-
export function useItems() {
|
|
27
|
-
const [items, setItems] = useState<Item[]>([]);
|
|
28
|
-
const [loading, setLoading] = useState(true);
|
|
29
|
-
const [error, setError] = useState<string | null>(null);
|
|
30
|
-
|
|
31
|
-
const fetchItems = useCallback(async () => {
|
|
32
|
-
try {
|
|
33
|
-
setLoading(true);
|
|
34
|
-
const data = await itemApi.getAll();
|
|
35
|
-
setItems(data);
|
|
36
|
-
} catch (err) {
|
|
37
|
-
setError(err.message);
|
|
38
|
-
} finally {
|
|
39
|
-
setLoading(false);
|
|
40
|
-
}
|
|
41
|
-
}, []);
|
|
42
|
-
|
|
43
|
-
useEffect(() => { fetchItems(); }, []);
|
|
44
|
-
return { items, loading, error, refetch: fetchItems };
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Form Hook
|
|
49
|
-
```typescript
|
|
50
|
-
export function useForm<T>(initial: T) {
|
|
51
|
-
const [data, setData] = useState(initial);
|
|
52
|
-
const [errors, setErrors] = useState({});
|
|
53
|
-
|
|
54
|
-
const handleChange = (field: keyof T, value: T[keyof T]) => {
|
|
55
|
-
setData(prev => ({ ...prev, [field]: value }));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const handleSubmit = async (submitFn: (data: T) => Promise<void>) => {
|
|
59
|
-
try {
|
|
60
|
-
await submitFn(data);
|
|
61
|
-
return true;
|
|
62
|
-
} catch (err) {
|
|
63
|
-
setErrors({ submit: err.message });
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return { data, errors, handleChange, handleSubmit };
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Bridge API Hook
|
|
73
|
-
```typescript
|
|
74
|
-
import { useBOT } from '@botim/framework';
|
|
75
|
-
|
|
76
|
-
export function useLocation() {
|
|
77
|
-
const BOT = useBOT();
|
|
78
|
-
const [location, setLocation] = useState(null);
|
|
79
|
-
const [loading, setLoading] = useState(false);
|
|
80
|
-
|
|
81
|
-
const getLocation = useCallback(() => {
|
|
82
|
-
setLoading(true);
|
|
83
|
-
BOT.getLocation({
|
|
84
|
-
success: (res) => setLocation(res),
|
|
85
|
-
fail: (err) => console.error(err),
|
|
86
|
-
complete: () => setLoading(false)
|
|
87
|
-
});
|
|
88
|
-
}, [BOT]);
|
|
89
|
-
|
|
90
|
-
return { location, loading, getLocation };
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Component Pattern
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
// ComponentName.tsx
|
|
100
|
-
import React from 'react';
|
|
101
|
-
import { Container } from './ComponentName.styles';
|
|
102
|
-
import type { ComponentNameProps } from './ComponentName.types';
|
|
103
|
-
|
|
104
|
-
export const ComponentName: React.FC<ComponentNameProps> = ({ title }) => {
|
|
105
|
-
return <Container>{title}</Container>;
|
|
106
|
-
};
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### List with States
|
|
110
|
-
```typescript
|
|
111
|
-
const ItemList = () => {
|
|
112
|
-
const { items, loading, error } = useItems();
|
|
113
|
-
if (loading) return <LoadingSpinner />;
|
|
114
|
-
if (error) return <ErrorMessage message={error} />;
|
|
115
|
-
return <List>{items.map(item => <ItemCard key={item.id} {...item} />)}</List>;
|
|
116
|
-
};
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Custom Component Structure
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
ComponentName/
|
|
125
|
-
├── index.ts
|
|
126
|
-
├── ComponentName.tsx
|
|
127
|
-
├── ComponentName.styles.ts
|
|
128
|
-
└── ComponentName.types.ts
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Validation Commands
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
npm run type-check
|
|
137
|
-
npm run build
|
|
138
|
-
npm run lint:fix
|
|
139
|
-
```
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Core Rules
|
|
2
|
-
|
|
3
|
-
## Rule 1: Code Connect Components
|
|
4
|
-
|
|
5
|
-
When Code Connect provides a mapping, use the component directly from code-connect components
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
// Check Code Connect first
|
|
9
|
-
const codeConnect = await mcp__botim-figma-mcp__get_code_connect_map({ fileKey, nodeId });
|
|
10
|
-
|
|
11
|
-
// Use library components directly
|
|
12
|
-
Use code connect components
|
|
13
|
-
|
|
14
|
-
// For spacing, use wrapper div
|
|
15
|
-
<div style={{ padding: 16 }}><Header /></div>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Rule 2: Mobile-First
|
|
21
|
-
|
|
22
|
-
- Viewport: 375-428px
|
|
23
|
-
- Touch targets: 44x44px minimum
|
|
24
|
-
- Base styles for mobile, media queries for larger screens
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
const Container = styled.div`
|
|
28
|
-
padding: 16px;
|
|
29
|
-
@media (min-width: 768px) { padding: 24px; }
|
|
30
|
-
`;
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Rule 3: Layer Separation
|
|
36
|
-
|
|
37
|
-
| Layer | Location | Purpose |
|
|
38
|
-
|-------|----------|---------|
|
|
39
|
-
| UI | `pages/`, `components/` | JSX only |
|
|
40
|
-
| Hooks | `hooks/` | Logic, data fetching |
|
|
41
|
-
| API | `api/modules/` | HTTP calls |
|
|
42
|
-
| Types | `*.types.ts` | Interfaces |
|
|
43
|
-
| Styles | `*.styles.ts` | Styled components |
|
|
44
|
-
|
|
45
|
-
**Components never call APIs directly** - use hooks.
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## Rule 4: File Limits
|
|
50
|
-
|
|
51
|
-
- Components: **100 lines max**
|
|
52
|
-
- Split into: `.tsx`, `.styles.ts`, `.types.ts`
|
|
53
|
-
- Use `@/` for cross-directory imports
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Rule 5: TypeScript
|
|
58
|
-
|
|
59
|
-
- No `any` types
|
|
60
|
-
- Type-only imports: `import type { T } from '@/types'`
|
|
61
|
-
- All hook returns must be typed
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Rule 6: Styling
|
|
66
|
-
|
|
67
|
-
- Emotion styled-components only
|
|
68
|
-
- No inline styles, no CSS files
|
|
69
|
-
- Transient props use `$` prefix
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# Figma Workflow
|
|
2
|
-
|
|
3
|
-
## MCP Servers
|
|
4
|
-
|
|
5
|
-
### botim-figma-mcp
|
|
6
|
-
- `get_design_context`: Layout, styles, structure
|
|
7
|
-
- `get_screenshot`: Visual reference
|
|
8
|
-
- `get_variable_defs`: Design tokens
|
|
9
|
-
- `get_code_connect_map`: Component mappings
|
|
10
|
-
|
|
11
|
-
### botim-mp-mcp
|
|
12
|
-
- `get_doc_content('botim-components')`: Component docs
|
|
13
|
-
- `get_icons_library()`: Icons catalog
|
|
14
|
-
- `get_all_sdk_methods()`: Native bridge APIs
|
|
15
|
-
- `search_docs()` / `list_docs()`: Backend API docs
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Implementation Workflow
|
|
20
|
-
|
|
21
|
-
### Step 1: Fetch Design
|
|
22
|
-
```typescript
|
|
23
|
-
const design = await mcp__botim-figma-mcp__get_design_context({ fileKey, nodeId });
|
|
24
|
-
const screenshot = await mcp__botim-figma-mcp__get_screenshot({ fileKey, nodeId });
|
|
25
|
-
const variables = await mcp__botim-figma-mcp__get_variable_defs({ fileKey, nodeId });
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Step 2: Check Code Connect (Required)
|
|
29
|
-
```typescript
|
|
30
|
-
const codeConnect = await mcp__botim-figma-mcp__get_code_connect_map({ fileKey, nodeId });
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Step 3: Get Component Details
|
|
34
|
-
```typescript
|
|
35
|
-
await mcp__botim-mp-mcp__get_doc_content('botim-components');
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Step 4: Apply Design Tokens
|
|
39
|
-
Extract exact values from Figma:
|
|
40
|
-
- Colors (hex values)
|
|
41
|
-
- Typography (font-size, weight, line-height)
|
|
42
|
-
- Spacing (padding, margin, gap)
|
|
43
|
-
- Border radius, shadows
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
const styles = {
|
|
47
|
-
background: '#F5F7FA',
|
|
48
|
-
padding: '16px 24px',
|
|
49
|
-
borderRadius: '12px',
|
|
50
|
-
};
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Component Priority
|
|
56
|
-
|
|
57
|
-
1. **Code Connect mapped** → Use those first
|
|
58
|
-
2. **Not available** → Create custom (rare)
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Import Pattern
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
|
|
66
|
-
// Bridge APIs
|
|
67
|
-
import { useBOT } from '@botim/framework';
|
|
68
|
-
const BOT = useBOT();
|
|
69
|
-
|
|
70
|
-
// Backend APIs
|
|
71
|
-
import { httpClient } from '@/api/http-client';
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Visual Match Target: 95%+
|
|
77
|
-
|
|
78
|
-
Validate against Figma:
|
|
79
|
-
- Colors, typography, spacing
|
|
80
|
-
- Layout, alignment, icons
|
|
81
|
-
- Shadows, borders
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Validation
|
|
2
|
-
|
|
3
|
-
## Quick Validation
|
|
4
|
-
|
|
5
|
-
### Step 1: Code Check
|
|
6
|
-
```bash
|
|
7
|
-
npm run type-check && npm run build && npm run lint:fix
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### Step 2: Visual Validation
|
|
11
|
-
```typescript
|
|
12
|
-
// Mobile viewport required
|
|
13
|
-
mcp__playwright__browser_resize({ width: 375, height: 667 })
|
|
14
|
-
|
|
15
|
-
// Navigate and screenshot
|
|
16
|
-
mcp__playwright__browser_navigate({ url: "http://localhost:5173/route" })
|
|
17
|
-
mcp__playwright__browser_wait_for({ time: 2 })
|
|
18
|
-
mcp__playwright__browser_take_screenshot({ fullPage: true })
|
|
19
|
-
|
|
20
|
-
// Compare with Figma
|
|
21
|
-
mcp__botim-figma-mcp__get_screenshot({ fileKey, nodeId })
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Step 3: Use Implementation Validator
|
|
25
|
-
```typescript
|
|
26
|
-
Task({
|
|
27
|
-
subagent_type: "implementation-validator",
|
|
28
|
-
prompt: "Validate PRD requirements, routes, visual match with Figma"
|
|
29
|
-
})
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Match Threshold
|
|
35
|
-
|
|
36
|
-
| Match % | Action |
|
|
37
|
-
|---------|--------|
|
|
38
|
-
| < 98% | Fix spacing/margins |
|
|
39
|
-
| 98%+ | Pass |
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Spacing Checklist
|
|
44
|
-
|
|
45
|
-
- Container padding
|
|
46
|
-
- Margin between elements
|
|
47
|
-
- Gap in flex/grid
|
|
48
|
-
- Text spacing from borders
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Common Fixes
|
|
53
|
-
|
|
54
|
-
| Error | Fix |
|
|
55
|
-
|-------|-----|
|
|
56
|
-
| `Cannot find module 'X'` | `npm install X` |
|
|
57
|
-
| `Property 'X' does not exist` | Check interface |
|
|
58
|
-
| `Type 'X' is not assignable` | Fix type |
|
|
59
|
-
| `'X' defined but never used` | Remove import |
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import eslintPluginReact from 'eslint-plugin-react';
|
|
3
|
-
import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
|
|
4
|
-
import eslintPluginImport from 'eslint-plugin-import';
|
|
5
|
-
// jsx-a11y plugin ships without TS types
|
|
6
|
-
import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';
|
|
7
|
-
import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
8
|
-
import tseslint from 'typescript-eslint';
|
|
9
|
-
|
|
10
|
-
export default tseslint.config(
|
|
11
|
-
{
|
|
12
|
-
ignores: [
|
|
13
|
-
'dist',
|
|
14
|
-
'coverage'
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
js.configs.recommended,
|
|
18
|
-
...tseslint.configs.recommended,
|
|
19
|
-
{
|
|
20
|
-
files: [ '**/*.ts', '**/*.tsx' ],
|
|
21
|
-
languageOptions: {
|
|
22
|
-
parserOptions: {
|
|
23
|
-
ecmaVersion: 'latest',
|
|
24
|
-
sourceType: 'module'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
plugins: {
|
|
28
|
-
react: eslintPluginReact,
|
|
29
|
-
'react-hooks': eslintPluginReactHooks,
|
|
30
|
-
import: eslintPluginImport,
|
|
31
|
-
'jsx-a11y': eslintPluginJsxA11y as unknown as import('eslint').ESLint.Plugin,
|
|
32
|
-
'simple-import-sort': eslintPluginSimpleImportSort
|
|
33
|
-
},
|
|
34
|
-
settings: {
|
|
35
|
-
react: {
|
|
36
|
-
version: 'detect'
|
|
37
|
-
},
|
|
38
|
-
'import/resolver': {
|
|
39
|
-
typescript: true,
|
|
40
|
-
node: {
|
|
41
|
-
extensions: [ '.js', '.jsx', '.ts', '.tsx' ]
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
rules: {
|
|
46
|
-
'react/react-in-jsx-scope': 'off',
|
|
47
|
-
'react/prop-types': 'off',
|
|
48
|
-
'react/jsx-uses-react': 'off',
|
|
49
|
-
'react/jsx-uses-vars': 'error',
|
|
50
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
51
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
52
|
-
'import/order': 'off',
|
|
53
|
-
'simple-import-sort/imports': 'error',
|
|
54
|
-
'simple-import-sort/exports': 'error'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>React Mini App</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<div id="root"></div>
|
|
10
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
-
</body>
|
|
12
|
-
</html>
|