@el-j/magic-helix-plugins 4.0.0-beta.2 → 4.0.0-beta.3
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/architecture/codeowners.md +123 -0
- package/dist/architecture/monorepo.md +146 -0
- package/dist/architecture/nx.md +122 -0
- package/dist/architecture/turborepo.md +114 -0
- package/dist/ci/github-actions.md +268 -0
- package/dist/ci/gitlab-ci.md +330 -0
- package/dist/containers/docker-multistage.md +120 -0
- package/dist/containers/kubernetes-deploy.md +210 -0
- package/dist/cpp/index.cjs +79 -0
- package/dist/cpp/index.mjs +209 -0
- package/dist/csharp/index.cjs +2 -2
- package/dist/csharp/{index.js → index.mjs} +17 -11
- package/dist/csharp/templates/framework-aspnetcore.md +205 -0
- package/dist/csharp/templates/framework-blazor.md +271 -0
- package/dist/csharp/templates/lang-csharp.md +162 -0
- package/dist/devops/docker-compose.md +111 -0
- package/dist/devops/docker-dockerfile.md +94 -0
- package/dist/devops/github-actions.md +160 -0
- package/dist/devops/gitlab-ci.md +210 -0
- package/dist/generic/lang-typescript.md +57 -0
- package/dist/generic/state-redux.md +21 -0
- package/dist/generic/state-rxjs.md +6 -0
- package/dist/generic/style-mui.md +23 -0
- package/dist/generic/style-tailwind.md +76 -0
- package/dist/generic/test-cypress.md +21 -0
- package/dist/generic/test-jest.md +20 -0
- package/dist/generic/test-playwright.md +21 -0
- package/dist/generic/test-vitest.md +131 -0
- package/dist/go/index.cjs +3 -3
- package/dist/go/{index.js → index.mjs} +18 -15
- package/dist/go/templates/lang-go.md +571 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +24 -0
- package/dist/java/index.cjs +2 -2
- package/dist/java/{index.js → index.mjs} +25 -19
- package/dist/java/templates/build-gradle.md +102 -0
- package/dist/java/templates/build-maven.md +86 -0
- package/dist/java/templates/framework-spring-boot.md +179 -0
- package/dist/java/templates/lang-java.md +78 -0
- package/dist/java/templates/lang-kotlin.md +88 -0
- package/dist/meta/magic-helix-meta.md +213 -0
- package/dist/meta/meta-debug.md +459 -0
- package/dist/meta/meta-implement.md +450 -0
- package/dist/meta/meta-roadmap.md +265 -0
- package/dist/nodejs/templates/angular-core.md +19 -0
- package/dist/nodejs/templates/lang-typescript.md +57 -0
- package/dist/nodejs/templates/nestjs-core.md +7 -0
- package/dist/nodejs/templates/react-core.md +677 -0
- package/dist/nodejs/templates/react-zustand.md +7 -0
- package/dist/nodejs/templates/state-redux.md +21 -0
- package/dist/nodejs/templates/state-rxjs.md +6 -0
- package/dist/nodejs/templates/style-primevue.md +6 -0
- package/dist/nodejs/templates/style-quasar.md +22 -0
- package/dist/nodejs/templates/style-tailwind.md +76 -0
- package/dist/nodejs/templates/test-cypress.md +21 -0
- package/dist/nodejs/templates/test-jest.md +20 -0
- package/dist/nodejs/templates/test-playwright.md +21 -0
- package/dist/nodejs/templates/test-vitest.md +131 -0
- package/dist/nodejs/templates/vue-core.md +108 -0
- package/dist/nodejs/templates/vue-pinia.md +5 -0
- package/dist/patterns/architecture/clean-architecture.md +469 -0
- package/dist/patterns/architecture/dependency-injection.md +517 -0
- package/dist/patterns/architecture/domain-driven-design.md +621 -0
- package/dist/patterns/architecture/layered-architecture.md +382 -0
- package/dist/patterns/architecture/repository-pattern.md +408 -0
- package/dist/patterns/domain-expertise/nextjs-rules.md +115 -0
- package/dist/patterns/domain-expertise/react-patterns.md +181 -0
- package/dist/patterns/domain-expertise/server-components.md +212 -0
- package/dist/patterns/domain-expertise/shadcn-ui.md +52 -0
- package/dist/patterns/domain-expertise/tailwind-patterns.md +52 -0
- package/dist/patterns/environment/container-awareness.md +17 -0
- package/dist/patterns/environment/ide-features.md +17 -0
- package/dist/patterns/environment/os-commands.md +17 -0
- package/dist/patterns/organization/heading-hierarchy.md +103 -0
- package/dist/patterns/organization/sequential-workflows.md +102 -0
- package/dist/patterns/organization/xml-rule-groups.md +64 -0
- package/dist/patterns/reasoning/agent-loop.md +151 -0
- package/dist/patterns/reasoning/confirmation-gates.md +141 -0
- package/dist/patterns/reasoning/dependency-analysis.md +132 -0
- package/dist/patterns/reasoning/one-tool-per-iteration.md +152 -0
- package/dist/patterns/reasoning/preview-before-action.md +194 -0
- package/dist/patterns/reasoning/reflection-checkpoints.md +166 -0
- package/dist/patterns/reasoning/result-verification.md +157 -0
- package/dist/patterns/reasoning/subtask-breakdown.md +131 -0
- package/dist/patterns/reasoning/thinking-tags.md +100 -0
- package/dist/patterns/role-definition/capability-declarations.md +72 -0
- package/dist/patterns/role-definition/expert-identity.md +45 -0
- package/dist/patterns/role-definition/scope-boundaries.md +61 -0
- package/dist/patterns/safety/code-safety-rules.md +17 -0
- package/dist/patterns/safety/credential-handling.md +17 -0
- package/dist/patterns/safety/destructive-warnings.md +17 -0
- package/dist/patterns/safety/refusal-messages.md +17 -0
- package/dist/patterns/tone/adaptive-tone.md +17 -0
- package/dist/patterns/tone/concise-communication.md +17 -0
- package/dist/patterns/tone/forbidden-phrases.md +17 -0
- package/dist/patterns/tool-guidelines/function-schemas.md +143 -0
- package/dist/patterns/tool-guidelines/parameter-examples.md +137 -0
- package/dist/patterns/tool-guidelines/usage-policies.md +105 -0
- package/dist/php/index.cjs +2 -2
- package/dist/php/{index.js → index.mjs} +12 -6
- package/dist/php/templates/framework-laravel.md +112 -0
- package/dist/php/templates/lang-php.md +94 -0
- package/dist/python/index.cjs +4 -4
- package/dist/python/{index.js → index.mjs} +10 -7
- package/dist/python/templates/lang-python.md +508 -0
- package/dist/ruby/index.cjs +2 -2
- package/dist/ruby/{index.js → index.mjs} +16 -10
- package/dist/ruby/templates/framework-rails.md +309 -0
- package/dist/ruby/templates/framework-sinatra.md +227 -0
- package/dist/ruby/templates/lang-ruby.md +216 -0
- package/dist/rust/index.cjs +3 -3
- package/dist/rust/{index.js → index.mjs} +24 -18
- package/dist/rust/templates/lang-rust.md +89 -0
- package/dist/swift/index.cjs +32 -0
- package/dist/swift/index.mjs +112 -0
- package/dist/swift/templates/framework-vapor.md +352 -0
- package/dist/swift/templates/lang-swift.md +291 -0
- package/package.json +31 -21
- package/dist/index.js +0 -20
- /package/dist/nodejs/{index.js → index.mjs} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
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
|
|
15
|
+
- **ALWAYS** use Tailwind utility classes for all styling.
|
|
16
|
+
- **NEVER** write custom CSS in `<style>` blocks or `.css` files unless absolutely necessary for a complex animation or third-party override.
|
|
17
|
+
- **NAMING**: Do not use `@apply`. Stick to utility classes in the HTML/JSX.
|
|
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
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Testing: Cypress
|
|
2
|
+
- **ALWAYS** use `data-cy` attributes for element selection.
|
|
3
|
+
- **ALWAYS** avoid using CSS selectors - prefer `data-cy` attributes.
|
|
4
|
+
- **ALWAYS** use page object pattern for reusable selectors.
|
|
5
|
+
- **ALWAYS** use `cy.intercept()` for API mocking and spying.
|
|
6
|
+
- **ALWAYS** use `cy.wait()` sparingly - prefer assertions over arbitrary waits.
|
|
7
|
+
- **ALWAYS** use `should()` for assertions instead of `then()`.
|
|
8
|
+
- **ALWAYS** test user journeys, not implementation details.
|
|
9
|
+
- **ALWAYS** use `cy.session()` for authentication state management.
|
|
10
|
+
- **ALWAYS** organize tests in `cypress/e2e/` directory.
|
|
11
|
+
- **ALWAYS** use `describe()` and `it()` for test organization.
|
|
12
|
+
- **ALWAYS** use `beforeEach()` for test setup and navigation.
|
|
13
|
+
- **ALWAYS** test both happy path and error scenarios.
|
|
14
|
+
- **ALWAYS** use `cy.fixture()` for test data management.
|
|
15
|
+
- **ALWAYS** use `cy.viewport()` to test responsive design.
|
|
16
|
+
- **ALWAYS** use `cy.pause()` during development, remove for CI.
|
|
17
|
+
- **ALWAYS** use `cy.debug()` for debugging, remove for production.
|
|
18
|
+
- **ALWAYS** run tests in headless mode for CI/CD.
|
|
19
|
+
- **ALWAYS** use `cy.request()` for API testing when UI testing isn't needed.
|
|
20
|
+
- **ALWAYS** use custom commands for reusable actions.
|
|
21
|
+
- **ALWAYS** maintain test execution time under 2 minutes per spec.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Testing: Jest
|
|
2
|
+
- **ALWAYS** use descriptive test names that explain what is being tested.
|
|
3
|
+
- **ALWAYS** follow the "Arrange, Act, Assert" pattern in tests.
|
|
4
|
+
- **ALWAYS** use `describe` blocks to group related tests.
|
|
5
|
+
- **ALWAYS** use `beforeEach` and `afterEach` for test setup and teardown.
|
|
6
|
+
- **ALWAYS** mock external dependencies with `jest.mock()` or `jest.fn()`.
|
|
7
|
+
- **ALWAYS** use `expect.assertions()` to ensure assertions are called.
|
|
8
|
+
- **ALWAYS** test both success and error cases.
|
|
9
|
+
- **ALWAYS** use `test.each` for parameterized tests.
|
|
10
|
+
- **ALWAYS** avoid testing implementation details - test behavior.
|
|
11
|
+
- **ALWAYS** use `jest.clearAllMocks()` in `beforeEach` for clean tests.
|
|
12
|
+
- **ALWAYS** use meaningful assertion messages with `expect().toBe(expected, message)`.
|
|
13
|
+
- **ALWAYS** test async code with `async/await` and proper error handling.
|
|
14
|
+
- **ALWAYS** use `jest.spyOn()` for spying on object methods.
|
|
15
|
+
- **ALWAYS** group mocks in a `mocks` directory with descriptive names.
|
|
16
|
+
- **ALWAYS** use `jest.setTimeout()` for long-running async tests.
|
|
17
|
+
- **ALWAYS** test edge cases and boundary conditions.
|
|
18
|
+
- **ALWAYS** use `test.todo()` for planned tests.
|
|
19
|
+
- **ALWAYS** maintain test coverage above 80%.
|
|
20
|
+
- **ALWAYS** run tests in CI/CD pipelines with `--coverage` flag.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Testing: Playwright
|
|
2
|
+
- **ALWAYS** use semantic locators like `getByRole()`, `getByLabel()`, `getByText()`.
|
|
3
|
+
- **ALWAYS** use `data-testid` attributes as fallback for complex selectors.
|
|
4
|
+
- **ALWAYS** use page object model for reusable selectors and actions.
|
|
5
|
+
- **ALWAYS** use `page.route()` for API mocking and network interception.
|
|
6
|
+
- **ALWAYS** use `expect().toBeVisible()` and `expect().toBeHidden()` for visibility checks.
|
|
7
|
+
- **ALWAYS** use `page.waitForLoadState('networkidle')` for page load completion.
|
|
8
|
+
- **ALWAYS** test cross-browser compatibility with different browser contexts.
|
|
9
|
+
- **ALWAYS** use `test.describe()` for grouping related tests.
|
|
10
|
+
- **ALWAYS** use `test.beforeEach()` for test setup and navigation.
|
|
11
|
+
- **ALWAYS** use `page.context().storageState()` for authentication persistence.
|
|
12
|
+
- **ALWAYS** use `page.screenshot()` for visual regression testing.
|
|
13
|
+
- **ALWAYS** use `test.use()` for configuring test fixtures.
|
|
14
|
+
- **ALWAYS** use `page.pause()` during development for debugging.
|
|
15
|
+
- **ALWAYS** use `test.skip()` and `test.only()` for test management.
|
|
16
|
+
- **ALWAYS** use `expect().toMatchSnapshot()` for visual comparisons.
|
|
17
|
+
- **ALWAYS** use `page.keyboard` and `page.mouse` for complex interactions.
|
|
18
|
+
- **ALWAYS** use `page.waitForFunction()` for custom wait conditions.
|
|
19
|
+
- **ALWAYS** run tests in parallel with `workers` configuration.
|
|
20
|
+
- **ALWAYS** use `testInfo.attachments` for test artifacts.
|
|
21
|
+
- **ALWAYS** maintain test execution time under 30 seconds per test.
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
|
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
|
|
21
|
+
- **ALWAYS** mock dependencies using `vi.mock()`.
|
|
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
|
|
26
|
+
- Use `it.todo('should do a thing')` for pending tests.
|
|
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
|
package/dist/go/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../BasePlugin-odQJAKA-.cjs");class
|
|
2
|
-
`);let
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("node:path"),g=require("../BasePlugin-odQJAKA-.cjs");function m(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const u=m(c);class d extends g.BasePlugin{constructor(){super(...arguments),this.name="go",this.displayName="Go",this.version="3.0.0",this.priority=90}async detect(e){if(!this.fileExists(e,"go.mod"))return null;const t=this.readFile(e,"go.mod");if(!t)return{language:"Go",name:this.getProjectName(e),dependencies:{},manifestFile:"go.mod",projectPath:e};const s=t.match(/module\s+([^\s\n]+)/),r={},l=t.split(`
|
|
2
|
+
`);let a=!1;for(const i of l){if(i.trim().startsWith("require (")){a=!0;continue}if(a){if(i.trim()===")")break;const n=i.match(/^\s*([^\s]+)\s+v([^\s]+)/);n&&(r[n[1]]=n[2])}else if(i.trim().startsWith("require ")){const n=i.match(/require\s+([^\s]+)\s+v([^\s]+)/);n&&(r[n[1]]=n[2])}}return{language:"Go",name:s?.[1]||this.getProjectName(e),dependencies:r,manifestFile:"go.mod",projectPath:e}}getTemplates(){return[{name:"go-core",tags:["go"],content:()=>this.loadTemplateFromFile(u.join(__dirname,"templates/lang-go.md")).then(e=>e||this.getGoFallbackTemplate())}]}getDependencyTagMap(){return{"github.com/gin-gonic/gin":"gin","github.com/gofiber/fiber":"fiber","github.com/labstack/echo":"echo","gorm.io/gorm":"gorm"}}getGoFallbackTemplate(){return`# Go Development Guidelines
|
|
3
3
|
|
|
4
4
|
This project uses Go.
|
|
5
5
|
|
|
@@ -26,4 +26,4 @@ This project uses Go.
|
|
|
26
26
|
## Dependencies
|
|
27
27
|
- Use Go modules (\`go.mod\`)
|
|
28
28
|
- Keep dependencies minimal
|
|
29
|
-
- Review dependency licenses`}}exports.GoPlugin=
|
|
29
|
+
- Review dependency licenses`}}exports.GoPlugin=d;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import * as m from "node:path";
|
|
1
2
|
import { B as g } from "../BasePlugin-6wv0hYJ9.js";
|
|
2
|
-
class
|
|
3
|
+
class d extends g {
|
|
3
4
|
constructor() {
|
|
4
5
|
super(...arguments), this.name = "go", this.displayName = "Go", this.version = "3.0.0", this.priority = 90;
|
|
5
6
|
}
|
|
6
|
-
async detect(
|
|
7
|
-
if (!this.fileExists(
|
|
7
|
+
async detect(e) {
|
|
8
|
+
if (!this.fileExists(e, "go.mod"))
|
|
8
9
|
return null;
|
|
9
|
-
const i = this.readFile(
|
|
10
|
+
const i = this.readFile(e, "go.mod");
|
|
10
11
|
if (!i)
|
|
11
12
|
return {
|
|
12
13
|
language: "Go",
|
|
13
|
-
name: this.getProjectName(
|
|
14
|
+
name: this.getProjectName(e),
|
|
14
15
|
dependencies: {},
|
|
15
16
|
manifestFile: "go.mod",
|
|
16
|
-
projectPath:
|
|
17
|
+
projectPath: e
|
|
17
18
|
};
|
|
18
19
|
const r = i.match(/module\s+([^\s\n]+)/), n = {}, a = i.split(`
|
|
19
20
|
`);
|
|
@@ -25,19 +26,19 @@ class l extends g {
|
|
|
25
26
|
}
|
|
26
27
|
if (s) {
|
|
27
28
|
if (o.trim() === ")") break;
|
|
28
|
-
const
|
|
29
|
-
|
|
29
|
+
const t = o.match(/^\s*([^\s]+)\s+v([^\s]+)/);
|
|
30
|
+
t && (n[t[1]] = t[2]);
|
|
30
31
|
} else if (o.trim().startsWith("require ")) {
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
const t = o.match(/require\s+([^\s]+)\s+v([^\s]+)/);
|
|
33
|
+
t && (n[t[1]] = t[2]);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
return {
|
|
36
37
|
language: "Go",
|
|
37
|
-
name: r?.[1] || this.getProjectName(
|
|
38
|
+
name: r?.[1] || this.getProjectName(e),
|
|
38
39
|
dependencies: n,
|
|
39
40
|
manifestFile: "go.mod",
|
|
40
|
-
projectPath:
|
|
41
|
+
projectPath: e
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
getTemplates() {
|
|
@@ -45,7 +46,9 @@ class l extends g {
|
|
|
45
46
|
{
|
|
46
47
|
name: "go-core",
|
|
47
48
|
tags: ["go"],
|
|
48
|
-
content: this.
|
|
49
|
+
content: () => this.loadTemplateFromFile(
|
|
50
|
+
m.join(__dirname, "templates/lang-go.md")
|
|
51
|
+
).then((e) => e || this.getGoFallbackTemplate())
|
|
49
52
|
}
|
|
50
53
|
];
|
|
51
54
|
}
|
|
@@ -57,7 +60,7 @@ class l extends g {
|
|
|
57
60
|
"gorm.io/gorm": "gorm"
|
|
58
61
|
};
|
|
59
62
|
}
|
|
60
|
-
|
|
63
|
+
getGoFallbackTemplate() {
|
|
61
64
|
return `# Go Development Guidelines
|
|
62
65
|
|
|
63
66
|
This project uses Go.
|
|
@@ -89,5 +92,5 @@ This project uses Go.
|
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
export {
|
|
92
|
-
|
|
95
|
+
d as GoPlugin
|
|
93
96
|
};
|