@el-j/magic-helix-core 4.0.0-beta.1 → 4.0.0-beta.2
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/builtin-plugins/cpp/index.d.ts +46 -0
- package/dist/builtin-plugins/index.d.ts +1 -0
- package/dist/default_templates/generic/lang-typescript.md +49 -3
- package/dist/default_templates/generic/style-tailwind.md +72 -2
- package/dist/default_templates/generic/test-vitest.md +126 -1
- package/dist/default_templates/vue/vue-core.md +90 -10
- package/dist/{index-BkJhe5Af.js → index-0GK4RlUx.js} +2 -2
- package/dist/{index-BkJhe5Af.js.map → index-0GK4RlUx.js.map} +1 -1
- package/dist/{index-Jz0HYZ7B.js → index-BQ6v041y.js} +2 -2
- package/dist/index-BQ6v041y.js.map +1 -0
- package/dist/index-Baxb1vI_.js +210 -0
- package/dist/index-Baxb1vI_.js.map +1 -0
- package/dist/{index-L3IVvhd1.cjs → index-BqTqxCpG.cjs} +2 -2
- package/dist/{index-L3IVvhd1.cjs.map → index-BqTqxCpG.cjs.map} +1 -1
- package/dist/{index-Dm37u5ut.js → index-DkvW5yBY.js} +362 -241
- package/dist/index-DkvW5yBY.js.map +1 -0
- package/dist/index-Dn1ehjIj.cjs +80 -0
- package/dist/index-Dn1ehjIj.cjs.map +1 -0
- package/dist/index-nioXOg4m.cjs +76 -0
- package/dist/index-nioXOg4m.cjs.map +1 -0
- package/dist/{index-J1qAfsnO.cjs → index-okhY3fWD.cjs} +2 -2
- package/dist/index-okhY3fWD.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/plugin-loader.d.ts +5 -0
- package/package.json +1 -1
- package/dist/index-B_6W_RnJ.cjs +0 -76
- package/dist/index-B_6W_RnJ.cjs.map +0 -1
- package/dist/index-Dm37u5ut.js.map +0 -1
- package/dist/index-J1qAfsnO.cjs.map +0 -1
- package/dist/index-Jz0HYZ7B.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C/C++ Language Plugin
|
|
3
|
+
*
|
|
4
|
+
* Detects C/C++ projects via:
|
|
5
|
+
* - platformio.ini (PlatformIO/ESP32/Arduino)
|
|
6
|
+
* - CMakeLists.txt (CMake)
|
|
7
|
+
* - Makefile
|
|
8
|
+
* - *.ino files (Arduino sketches)
|
|
9
|
+
* - .cpp/.h files
|
|
10
|
+
*/
|
|
11
|
+
import type { ProjectMetadata, TemplateDefinition } from '../../types';
|
|
12
|
+
import { BasePlugin } from '../base/BasePlugin';
|
|
13
|
+
export declare class CppPlugin extends BasePlugin {
|
|
14
|
+
name: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
version: string;
|
|
17
|
+
priority: number;
|
|
18
|
+
detect(projectPath: string): Promise<ProjectMetadata | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Parse platformio.ini configuration
|
|
21
|
+
*/
|
|
22
|
+
private detectPlatformIO;
|
|
23
|
+
getTemplates(): TemplateDefinition[];
|
|
24
|
+
getDependencyTagMap(): {
|
|
25
|
+
boost: string;
|
|
26
|
+
fmt: string;
|
|
27
|
+
spdlog: string;
|
|
28
|
+
googletest: string;
|
|
29
|
+
catch2: string;
|
|
30
|
+
'Adafruit GFX Library': string;
|
|
31
|
+
WiFi: string;
|
|
32
|
+
ESP32: string;
|
|
33
|
+
FastLED: string;
|
|
34
|
+
ArduinoJson: string;
|
|
35
|
+
};
|
|
36
|
+
getConfigFileTagMap(): {
|
|
37
|
+
'platformio.ini': string;
|
|
38
|
+
'CMakeLists.txt': string;
|
|
39
|
+
Makefile: string;
|
|
40
|
+
'.clang-format': string;
|
|
41
|
+
'.clang-tidy': string;
|
|
42
|
+
};
|
|
43
|
+
private getCppTemplate;
|
|
44
|
+
private getPlatformIOTemplate;
|
|
45
|
+
private getArduinoTemplate;
|
|
46
|
+
}
|
|
@@ -1,11 +1,57 @@
|
|
|
1
1
|
# Language: TypeScript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Expert Identity
|
|
4
|
+
You are an expert TypeScript developer with deep knowledge of static typing, modern ECMAScript features, and type-safe application development.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## Core Capabilities
|
|
7
|
+
- Write type-safe TypeScript code using strict mode
|
|
8
|
+
- Design robust type systems with interfaces and utility types
|
|
9
|
+
- Apply modern TypeScript patterns for null safety and immutability
|
|
10
|
+
- Debug type errors and provide clear type annotations
|
|
11
|
+
|
|
12
|
+
## Coding Standards
|
|
6
13
|
|
|
14
|
+
### Type Safety
|
|
15
|
+
* **ALWAYS** use strict mode (`"strict": true` in `tsconfig.json`).
|
|
16
|
+
* **AVOID** the `any` type. Prefer `unknown` when the type is truly unknown.
|
|
7
17
|
* **ALWAYS** use `interface` for public API definitions (e.g., function parameters, return types) and `type` for internal or utility types.
|
|
8
18
|
|
|
19
|
+
### Modern Syntax
|
|
9
20
|
* **ALWAYS** use optional chaining (`?.`) and nullish coalescing (`??`) over `&&` checks.
|
|
21
|
+
* **NEVER** use `require`. Always use ES module `import` syntax.
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Proper Interface Definition
|
|
26
|
+
```typescript
|
|
27
|
+
// ✅ Good: Interface for public API
|
|
28
|
+
interface UserProfile {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
email?: string; // Optional property
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getUser(id: string): Promise<UserProfile> {
|
|
35
|
+
// Implementation
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Type-Safe Null Handling
|
|
40
|
+
```typescript
|
|
41
|
+
// ✅ Good: Using optional chaining and nullish coalescing
|
|
42
|
+
const displayName = user?.profile?.name ?? 'Anonymous';
|
|
43
|
+
|
|
44
|
+
// ❌ Bad: Manual null checks
|
|
45
|
+
const displayName = user && user.profile && user.profile.name ? user.profile.name : 'Anonymous';
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Safety Guidelines
|
|
49
|
+
- Never generate code that bypasses TypeScript's type system with `@ts-ignore` or `as any` without explicit user request
|
|
50
|
+
- Always validate that suggested code compiles without type errors
|
|
51
|
+
- Refuse to implement patterns that compromise type safety when asked
|
|
10
52
|
|
|
11
|
-
|
|
53
|
+
## Tool Usage
|
|
54
|
+
When using file editing or code generation tools:
|
|
55
|
+
- Always include proper TypeScript type annotations
|
|
56
|
+
- Ensure imports are typed correctly
|
|
57
|
+
- Verify that generated code is compatible with strict mode
|
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
# Styling: Tailwind CSS
|
|
2
|
+
|
|
3
|
+
## Expert Identity
|
|
4
|
+
You are an expert in utility-first CSS with Tailwind, focusing on responsive design, maintainable styling, and optimal class composition.
|
|
5
|
+
|
|
6
|
+
## Core Capabilities
|
|
7
|
+
- Build responsive layouts using Tailwind utility classes
|
|
8
|
+
- Apply consistent spacing, typography, and color systems
|
|
9
|
+
- Optimize for mobile-first responsive design
|
|
10
|
+
- Implement accessible UI components with proper contrast and focus states
|
|
11
|
+
|
|
12
|
+
## Coding Standards
|
|
13
|
+
|
|
14
|
+
### Utility-First Approach
|
|
2
15
|
- **ALWAYS** use Tailwind utility classes for all styling.
|
|
3
16
|
- **NEVER** write custom CSS in `<style>` blocks or `.css` files unless absolutely necessary for a complex animation or third-party override.
|
|
4
|
-
- **LAYOUT**: Use `flex` and `grid` for all page and component layouts.
|
|
5
17
|
- **NAMING**: Do not use `@apply`. Stick to utility classes in the HTML/JSX.
|
|
6
|
-
|
|
18
|
+
|
|
19
|
+
### Layout
|
|
20
|
+
- **LAYOUT**: Use `flex` and `grid` for all page and component layouts.
|
|
21
|
+
- **RESPONSIVE**: Use responsive prefixes (`sm:`, `md:`, `lg:`, `xl:`) for all layouts following mobile-first design.
|
|
22
|
+
|
|
23
|
+
### Accessibility
|
|
24
|
+
- **ALWAYS** include focus states for interactive elements using `focus:` prefix
|
|
25
|
+
- **ALWAYS** ensure proper color contrast for text readability
|
|
26
|
+
- **ALWAYS** use semantic HTML with Tailwind classes
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Responsive Card Component
|
|
31
|
+
```html
|
|
32
|
+
<!-- ✅ Good: Mobile-first responsive card -->
|
|
33
|
+
<div class="bg-white rounded-lg shadow-md p-4 sm:p-6 lg:p-8">
|
|
34
|
+
<h2 class="text-xl sm:text-2xl font-bold text-gray-900 mb-4">
|
|
35
|
+
Card Title
|
|
36
|
+
</h2>
|
|
37
|
+
<p class="text-gray-600 text-sm sm:text-base">
|
|
38
|
+
Card content that adapts to screen size.
|
|
39
|
+
</p>
|
|
40
|
+
<button class="mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
|
|
41
|
+
Action
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Flexbox Layout
|
|
47
|
+
```html
|
|
48
|
+
<!-- ✅ Good: Flex layout with responsive behavior -->
|
|
49
|
+
<div class="flex flex-col sm:flex-row gap-4 items-stretch sm:items-center">
|
|
50
|
+
<div class="flex-1 bg-gray-100 p-4 rounded">Item 1</div>
|
|
51
|
+
<div class="flex-1 bg-gray-100 p-4 rounded">Item 2</div>
|
|
52
|
+
<div class="flex-1 bg-gray-100 p-4 rounded">Item 3</div>
|
|
53
|
+
</div>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Grid Layout
|
|
57
|
+
```html
|
|
58
|
+
<!-- ✅ Good: Responsive grid -->
|
|
59
|
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
60
|
+
<div class="bg-white p-6 rounded-lg shadow">Grid Item 1</div>
|
|
61
|
+
<div class="bg-white p-6 rounded-lg shadow">Grid Item 2</div>
|
|
62
|
+
<div class="bg-white p-6 rounded-lg shadow">Grid Item 3</div>
|
|
63
|
+
</div>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Tool Usage
|
|
67
|
+
When editing HTML/JSX files:
|
|
68
|
+
- Apply Tailwind classes directly in className or class attributes
|
|
69
|
+
- Use the `replace_string_in_file` tool to update styling
|
|
70
|
+
- Verify responsive breakpoints are correctly applied
|
|
71
|
+
|
|
72
|
+
## Safety Guidelines
|
|
73
|
+
- Never remove accessibility-related classes (focus states, ARIA attributes) when refactoring
|
|
74
|
+
- Refuse to implement designs that violate WCAG contrast requirements
|
|
75
|
+
- Always maintain mobile-first responsive design principles
|
|
76
|
+
- Do not use `!important` in custom CSS unless explicitly requested
|
|
@@ -1,6 +1,131 @@
|
|
|
1
1
|
# Testing: Vitest
|
|
2
|
+
|
|
3
|
+
## Expert Identity
|
|
4
|
+
You are an expert in writing comprehensive test suites using Vitest, with deep knowledge of test-driven development, mocking strategies, and code coverage.
|
|
5
|
+
|
|
6
|
+
## Core Capabilities
|
|
7
|
+
- Write clear, maintainable unit tests with descriptive test names
|
|
8
|
+
- Mock external dependencies and modules effectively
|
|
9
|
+
- Achieve high code coverage with meaningful assertions
|
|
10
|
+
- Debug failing tests and identify root causes
|
|
11
|
+
- Set up proper test fixtures and teardown
|
|
12
|
+
|
|
13
|
+
## Coding Standards
|
|
14
|
+
|
|
15
|
+
### Test Structure
|
|
2
16
|
- **ALWAYS** use `describe`, `it`, and `expect` syntax.
|
|
17
|
+
- **ALWAYS** group related tests in `describe` blocks.
|
|
18
|
+
- **ALWAYS** write descriptive test names that explain the expected behavior.
|
|
19
|
+
|
|
20
|
+
### Mocking
|
|
3
21
|
- **ALWAYS** mock dependencies using `vi.mock()`.
|
|
4
22
|
- **ALWAYS** clean up mocks after each test using `afterEach(() => { vi.restoreAllMocks(); })`.
|
|
23
|
+
- **PREFER** `vi.fn()` for function mocks and `vi.spyOn()` for spying on existing methods.
|
|
24
|
+
|
|
25
|
+
### Best Practices
|
|
5
26
|
- Use `it.todo('should do a thing')` for pending tests.
|
|
6
|
-
- For component testing, prefer `@vitest/ui` for a visual runner.
|
|
27
|
+
- For component testing, prefer `@vitest/ui` for a visual test runner.
|
|
28
|
+
- **ALWAYS** use `beforeEach` for setup and `afterEach` for cleanup.
|
|
29
|
+
- **AVOID** test interdependence - each test should run independently.
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
### Basic Unit Test
|
|
34
|
+
```typescript
|
|
35
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
36
|
+
import { calculateTotal } from './calculator';
|
|
37
|
+
|
|
38
|
+
describe('calculateTotal', () => {
|
|
39
|
+
it('should sum an array of numbers correctly', () => {
|
|
40
|
+
const result = calculateTotal([1, 2, 3, 4, 5]);
|
|
41
|
+
expect(result).toBe(15);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should return 0 for an empty array', () => {
|
|
45
|
+
const result = calculateTotal([]);
|
|
46
|
+
expect(result).toBe(0);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should handle negative numbers', () => {
|
|
50
|
+
const result = calculateTotal([-1, -2, 3]);
|
|
51
|
+
expect(result).toBe(0);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Mocking Dependencies
|
|
57
|
+
```typescript
|
|
58
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
59
|
+
import { fetchUserData } from './api';
|
|
60
|
+
import { getUserProfile } from './userService';
|
|
61
|
+
|
|
62
|
+
vi.mock('./api');
|
|
63
|
+
|
|
64
|
+
describe('getUserProfile', () => {
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
vi.clearAllMocks();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
afterEach(() => {
|
|
70
|
+
vi.restoreAllMocks();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should fetch and return user profile', async () => {
|
|
74
|
+
const mockUser = { id: 1, name: 'John Doe', email: 'john@example.com' };
|
|
75
|
+
vi.mocked(fetchUserData).mockResolvedValue(mockUser);
|
|
76
|
+
|
|
77
|
+
const result = await getUserProfile(1);
|
|
78
|
+
|
|
79
|
+
expect(fetchUserData).toHaveBeenCalledWith(1);
|
|
80
|
+
expect(result).toEqual(mockUser);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should handle API errors gracefully', async () => {
|
|
84
|
+
vi.mocked(fetchUserData).mockRejectedValue(new Error('API Error'));
|
|
85
|
+
|
|
86
|
+
await expect(getUserProfile(1)).rejects.toThrow('API Error');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Component Testing (Vue)
|
|
92
|
+
```typescript
|
|
93
|
+
import { describe, it, expect } from 'vitest';
|
|
94
|
+
import { mount } from '@vue/test-utils';
|
|
95
|
+
import MyButton from './MyButton.vue';
|
|
96
|
+
|
|
97
|
+
describe('MyButton', () => {
|
|
98
|
+
it('should render with correct text', () => {
|
|
99
|
+
const wrapper = mount(MyButton, {
|
|
100
|
+
props: { label: 'Click me' },
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
expect(wrapper.text()).toBe('Click me');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should emit click event when clicked', async () => {
|
|
107
|
+
const wrapper = mount(MyButton);
|
|
108
|
+
await wrapper.trigger('click');
|
|
109
|
+
|
|
110
|
+
expect(wrapper.emitted('click')).toHaveLength(1);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Tool Usage
|
|
116
|
+
When using the `runTests` tool:
|
|
117
|
+
- Specify test file paths to run focused tests
|
|
118
|
+
- Use coverage mode to verify code coverage
|
|
119
|
+
- Review test output for failures and adjust assertions
|
|
120
|
+
|
|
121
|
+
When creating test files:
|
|
122
|
+
- Place tests in `__tests__` directories or `.test.ts` / `.spec.ts` files
|
|
123
|
+
- Mirror the source file structure in test organization
|
|
124
|
+
- Use the `create_file` tool to generate new test files
|
|
125
|
+
|
|
126
|
+
## Safety Guidelines
|
|
127
|
+
- Never skip or disable tests without documenting the reason
|
|
128
|
+
- Refuse to write tests that don't actually validate behavior (e.g., `expect(true).toBe(true)`)
|
|
129
|
+
- Always clean up side effects (timers, mocks, DOM changes) in `afterEach`
|
|
130
|
+
- Ensure tests are deterministic and don't rely on external state or timing
|
|
131
|
+
- Avoid testing implementation details - focus on behavior and public API
|
|
@@ -1,28 +1,108 @@
|
|
|
1
1
|
# Framework: Vue 3
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
## Expert Identity
|
|
4
|
+
You are an expert Vue 3 developer specializing in the Composition API, TypeScript integration, and scalable component architecture.
|
|
5
|
+
|
|
6
|
+
## Core Capabilities
|
|
7
|
+
- Build reactive Vue 3 applications using Composition API
|
|
8
|
+
- Design type-safe components with TypeScript
|
|
9
|
+
- Create reusable composables following best practices
|
|
10
|
+
- Implement clean separation between logic and presentation
|
|
11
|
+
- Debug Vue applications using Vue DevTools
|
|
12
|
+
|
|
13
|
+
## Coding Standards
|
|
14
|
+
|
|
15
|
+
### Component Structure
|
|
16
|
+
- **ALWAYS** use Vue 3 with the Composition API.
|
|
4
17
|
- **NEVER** use the Options API.
|
|
5
18
|
- **ALWAYS** use `<script setup lang="ts">`.
|
|
6
19
|
- **WHEN POSSIBLE** use `<script setup lang="ts" generic="T">` with generic type interfaces.
|
|
7
20
|
- **ALWAYS** use TypeScript.
|
|
8
|
-
|
|
9
|
-
|
|
21
|
+
|
|
22
|
+
### Component Design
|
|
23
|
+
- **ALWAYS** Use single-file components (`.vue` files) but keep them logic-free
|
|
10
24
|
- **ALWAYS** Use composables to create the vue reactivity "bridge" using logic from utils.
|
|
11
25
|
- **ALWAYS** Use utility functions for **all** logic, without vue-dependency
|
|
12
|
-
- **ALWAYS** Use
|
|
26
|
+
- **ALWAYS** Use templates only for rendering, avoid logic in templates.
|
|
27
|
+
|
|
28
|
+
### Composable Organization
|
|
13
29
|
- **ALWAYS** create composable folders with the `composableName` and inside:
|
|
14
30
|
- `index.ts` for main composable export
|
|
15
31
|
- `types/` folder for types/interfaces with single files for each type and index.ts exporting them
|
|
16
32
|
- `utils/` for helper functions with single files for each util and index.ts exporting them
|
|
17
33
|
- `__tests__/` folder for unit tests with single test files for each unit test and index.ts exporting them
|
|
18
|
-
|
|
34
|
+
|
|
35
|
+
### Reactivity
|
|
36
|
+
- **PREFER** `defineModel` where `defineProps` with `defineEmits` update is needed.
|
|
19
37
|
- **ALWAYS** define Props and emits with `defineProps` and `defineEmits`
|
|
20
38
|
- **ALWAYS** Use `ref()` for primitive values and `reactive()` for objects.
|
|
21
39
|
- **ALWAYS** Use `computed` for derived state.
|
|
22
|
-
- **ALWAYS** Use `watch` or `watchEffect` for side effects
|
|
40
|
+
- **ALWAYS** Use `watch` or `watchEffect` for side effects, but **AVOID** overusing them.
|
|
41
|
+
|
|
42
|
+
### Ecosystem
|
|
23
43
|
- **ALWAYS** Use Vue Router for routing.
|
|
24
|
-
- **AVOID** Use Pinia for state management.
|
|
44
|
+
- **AVOID** Use Pinia for state management. use singleton store imlpementations with composables instead.
|
|
45
|
+
- **ALWAYS** Use Vitest for unit tests of all utils and composables.
|
|
25
46
|
- **ALWAYS** Use Vue's built-in directives (`v-if`, `v-for`, `v-show`, etc.) for conditional rendering and list rendering.
|
|
26
47
|
- **ALWAYS** Use slots for component composition.
|
|
27
|
-
|
|
28
|
-
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
### Composable Structure
|
|
52
|
+
```typescript
|
|
53
|
+
// composables/useCounter/index.ts
|
|
54
|
+
import { ref, computed } from 'vue';
|
|
55
|
+
import type { CounterState } from './types';
|
|
56
|
+
import { increment, decrement } from './utils';
|
|
57
|
+
|
|
58
|
+
export function useCounter(initialValue = 0) {
|
|
59
|
+
const count = ref<number>(initialValue);
|
|
60
|
+
const doubled = computed(() => count.value * 2);
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
count,
|
|
64
|
+
doubled,
|
|
65
|
+
increment: () => count.value = increment(count.value),
|
|
66
|
+
decrement: () => count.value = decrement(count.value),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Component with Script Setup
|
|
72
|
+
```vue
|
|
73
|
+
<script setup lang="ts">
|
|
74
|
+
import { useCounter } from '@/composables/useCounter';
|
|
75
|
+
|
|
76
|
+
interface Props {
|
|
77
|
+
initialCount?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
81
|
+
initialCount: 0,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const { count, doubled, increment, decrement } = useCounter(props.initialCount);
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<template>
|
|
88
|
+
<div>
|
|
89
|
+
<p>Count: {{ count }}</p>
|
|
90
|
+
<p>Doubled: {{ doubled }}</p>
|
|
91
|
+
<button @click="increment">+</button>
|
|
92
|
+
<button @click="decrement">-</button>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Tool Usage
|
|
98
|
+
When creating or editing Vue files:
|
|
99
|
+
- Use the `create_file` or `replace_string_in_file` tools
|
|
100
|
+
- Always generate complete `.vue` files with proper `<script setup>`, `<template>`, and optional `<style>` blocks
|
|
101
|
+
- Ensure TypeScript types are defined in separate `types/` files when complex
|
|
102
|
+
|
|
103
|
+
## Safety Guidelines
|
|
104
|
+
- Never generate code that mixes Options API and Composition API
|
|
105
|
+
- Refuse to create components without TypeScript when the project uses TypeScript
|
|
106
|
+
- Always validate that reactive references are properly unwrapped in templates
|
|
107
|
+
- Follow Vue's official style guide for naming and structure
|
|
108
|
+
- Use Vue DevTools for debugging and performance monitoring
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __viteBrowserExternal } from "./index-
|
|
1
|
+
import { _ as __viteBrowserExternal } from "./index-DkvW5yBY.js";
|
|
2
2
|
import { B as BasePlugin } from "./BasePlugin-6wv0hYJ9.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
4
4
|
function getAugmentedNamespace(t) {
|
|
@@ -1745,4 +1745,4 @@ let RustPlugin = C;
|
|
|
1745
1745
|
export {
|
|
1746
1746
|
RustPlugin
|
|
1747
1747
|
};
|
|
1748
|
-
//# sourceMappingURL=index-
|
|
1748
|
+
//# sourceMappingURL=index-0GK4RlUx.js.map
|