@atlashub/smartstack-cli 2.9.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.documentation/business-analyse.html +81 -17
- package/dist/mcp-entry.mjs +1302 -223
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/agents/efcore/db-deploy.md +1 -1
- package/templates/agents/efcore/migration.md +26 -10
- package/templates/agents/efcore/rebase-snapshot.md +24 -7
- package/templates/agents/efcore/squash.md +73 -57
- package/templates/agents/gitflow/commit.md +138 -18
- package/templates/agents/gitflow/exec.md +1 -1
- package/templates/agents/gitflow/finish.md +79 -62
- package/templates/agents/gitflow/init-clone.md +186 -0
- package/templates/agents/gitflow/init-detect.md +137 -0
- package/templates/agents/gitflow/init-validate.md +210 -0
- package/templates/agents/gitflow/init.md +231 -74
- package/templates/agents/gitflow/merge.md +65 -33
- package/templates/agents/gitflow/pr.md +93 -49
- package/templates/agents/gitflow/start.md +76 -33
- package/templates/agents/gitflow/status.md +41 -71
- package/templates/hooks/appsettings-guard.sh +76 -0
- package/templates/hooks/ef-migration-check.md +1 -1
- package/templates/hooks/hooks.json +9 -0
- package/templates/project/test-frontend/msw/handlers.ts +58 -0
- package/templates/project/test-frontend/msw/server.ts +25 -0
- package/templates/project/test-frontend/setup.ts +16 -0
- package/templates/project/test-frontend/test-utils.tsx +59 -0
- package/templates/project/test-frontend/vitest.config.ts +31 -0
- package/templates/skills/_resources/config-safety.md +61 -0
- package/templates/skills/_resources/formatting-guide.md +2 -2
- package/templates/skills/application/SKILL.md +12 -3
- package/templates/skills/application/steps/step-04-backend.md +21 -0
- package/templates/skills/application/steps/step-07-tests.md +259 -120
- package/templates/skills/business-analyse/SKILL.md +57 -28
- package/templates/skills/business-analyse/_shared.md +70 -39
- package/templates/skills/business-analyse/html/ba-interactive.html +2622 -0
- package/templates/skills/business-analyse/questionnaire/00-application.md +123 -131
- package/templates/skills/business-analyse/questionnaire/01-context.md +173 -24
- package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +170 -50
- package/templates/skills/business-analyse/questionnaire/03-scope.md +154 -48
- package/templates/skills/business-analyse/questionnaire/10-documentation.md +1 -1
- package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +135 -0
- package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +136 -0
- package/templates/skills/business-analyse/questionnaire.md +55 -46
- package/templates/skills/business-analyse/steps/step-00-init.md +24 -2
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +31 -20
- package/templates/skills/business-analyse/steps/step-03-specify.md +1 -0
- package/templates/skills/business-analyse/steps/step-05-handoff.md +103 -1
- package/templates/skills/business-analyse/steps/step-06-extract.md +518 -0
- package/templates/skills/check-version/SKILL.md +1 -1
- package/templates/skills/efcore/steps/db/step-deploy.md +22 -3
- package/templates/skills/efcore/steps/db/step-reset.md +27 -4
- package/templates/skills/efcore/steps/db/step-seed.md +46 -2
- package/templates/skills/efcore/steps/db/step-status.md +14 -0
- package/templates/skills/efcore/steps/migration/step-01-check.md +31 -5
- package/templates/skills/efcore/steps/migration/step-02-create.md +20 -4
- package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +60 -0
- package/templates/skills/efcore/steps/shared/step-00-init.md +47 -8
- package/templates/skills/efcore/steps/squash/step-03-create.md +27 -5
- package/templates/skills/gitflow/SKILL.md +91 -29
- package/templates/skills/gitflow/_shared.md +144 -2
- package/templates/skills/gitflow/phases/status.md +11 -1
- package/templates/skills/gitflow/steps/step-commit.md +1 -1
- package/templates/skills/gitflow/steps/step-init.md +202 -39
- package/templates/skills/gitflow/templates/config.json +10 -1
- package/templates/skills/ralph-loop/steps/step-03-commit.md +2 -2
- package/templates/skills/validate-feature/SKILL.md +83 -0
- package/templates/skills/validate-feature/steps/step-01-compile.md +38 -0
- package/templates/skills/validate-feature/steps/step-02-unit-tests.md +45 -0
- package/templates/skills/validate-feature/steps/step-03-integration-tests.md +53 -0
- package/templates/skills/validate-feature/steps/step-04-api-smoke.md +157 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { http, HttpResponse } from 'msw';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default MSW handlers for SmartStack API endpoints.
|
|
5
|
+
* These handlers mock common API calls used across the application.
|
|
6
|
+
*
|
|
7
|
+
* Override these in individual tests using server.use().
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // In a test file:
|
|
11
|
+
* server.use(
|
|
12
|
+
* http.get('/api/products', () =>
|
|
13
|
+
* HttpResponse.json({
|
|
14
|
+
* items: [{ id: '1', code: 'P-01', name: 'Test Product' }],
|
|
15
|
+
* totalCount: 1,
|
|
16
|
+
* pageNumber: 1,
|
|
17
|
+
* pageSize: 10,
|
|
18
|
+
* })
|
|
19
|
+
* )
|
|
20
|
+
* );
|
|
21
|
+
*/
|
|
22
|
+
export const handlers = [
|
|
23
|
+
// Auth endpoints
|
|
24
|
+
http.get('/api/auth/me', () =>
|
|
25
|
+
HttpResponse.json({
|
|
26
|
+
id: 'test-user-id',
|
|
27
|
+
email: 'test-admin@smartstack.io',
|
|
28
|
+
name: 'Test Admin',
|
|
29
|
+
role: 'Administrator',
|
|
30
|
+
permissions: ['*'],
|
|
31
|
+
})
|
|
32
|
+
),
|
|
33
|
+
|
|
34
|
+
http.post('/api/auth/login', () =>
|
|
35
|
+
HttpResponse.json({
|
|
36
|
+
token: 'test-jwt-token',
|
|
37
|
+
user: {
|
|
38
|
+
id: 'test-user-id',
|
|
39
|
+
email: 'test-admin@smartstack.io',
|
|
40
|
+
name: 'Test Admin',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
),
|
|
44
|
+
|
|
45
|
+
// Navigation endpoints
|
|
46
|
+
http.get('/api/navigation', () =>
|
|
47
|
+
HttpResponse.json([])
|
|
48
|
+
),
|
|
49
|
+
|
|
50
|
+
// User preferences
|
|
51
|
+
http.get('/api/users/preferences', () =>
|
|
52
|
+
HttpResponse.json({})
|
|
53
|
+
),
|
|
54
|
+
|
|
55
|
+
http.put('/api/users/preferences', () =>
|
|
56
|
+
HttpResponse.json({ success: true })
|
|
57
|
+
),
|
|
58
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { setupServer } from 'msw/node';
|
|
2
|
+
import { handlers } from './handlers';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* MSW (Mock Service Worker) server for intercepting API calls in tests.
|
|
6
|
+
* Configured with default handlers that mock common SmartStack API endpoints.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* - Default handlers are loaded from ./handlers.ts
|
|
10
|
+
* - Override handlers per-test using server.use()
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { server } from '@/test/msw/server';
|
|
14
|
+
* import { http, HttpResponse } from 'msw';
|
|
15
|
+
*
|
|
16
|
+
* test('custom handler', () => {
|
|
17
|
+
* server.use(
|
|
18
|
+
* http.get('/api/products', () =>
|
|
19
|
+
* HttpResponse.json({ items: [], totalCount: 0 })
|
|
20
|
+
* )
|
|
21
|
+
* );
|
|
22
|
+
* // ... test code
|
|
23
|
+
* });
|
|
24
|
+
*/
|
|
25
|
+
export const server = setupServer(...handlers);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
2
|
+
import { cleanup } from '@testing-library/react';
|
|
3
|
+
import { afterEach, beforeAll, afterAll } from 'vitest';
|
|
4
|
+
import { server } from './msw/server';
|
|
5
|
+
|
|
6
|
+
// Start MSW server before all tests
|
|
7
|
+
beforeAll(() => server.listen({ onUnhandledRequest: 'warn' }));
|
|
8
|
+
|
|
9
|
+
// Reset handlers after each test (to not leak state between tests)
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
cleanup();
|
|
12
|
+
server.resetHandlers();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Close MSW server after all tests
|
|
16
|
+
afterAll(() => server.close());
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { type ReactElement } from 'react';
|
|
2
|
+
import { render, type RenderOptions } from '@testing-library/react';
|
|
3
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
4
|
+
import { I18nextProvider } from 'react-i18next';
|
|
5
|
+
import i18n from '../i18n'; // Adjust path to your i18n config
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* AuthContext mock for tests.
|
|
9
|
+
* Provides a default authenticated user with admin permissions.
|
|
10
|
+
*/
|
|
11
|
+
const mockAuthContext = {
|
|
12
|
+
user: {
|
|
13
|
+
id: 'test-user-id',
|
|
14
|
+
email: 'test-admin@smartstack.io',
|
|
15
|
+
name: 'Test Admin',
|
|
16
|
+
role: 'Administrator',
|
|
17
|
+
},
|
|
18
|
+
isAuthenticated: true,
|
|
19
|
+
isLoading: false,
|
|
20
|
+
login: async () => {},
|
|
21
|
+
logout: async () => {},
|
|
22
|
+
hasPermission: () => true,
|
|
23
|
+
refreshPermissions: async () => {},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Wraps components with all necessary providers for testing.
|
|
28
|
+
* Includes: Router, i18n, Auth context.
|
|
29
|
+
*/
|
|
30
|
+
function AllProviders({ children }: { children: React.ReactNode }) {
|
|
31
|
+
return (
|
|
32
|
+
<BrowserRouter>
|
|
33
|
+
<I18nextProvider i18n={i18n}>
|
|
34
|
+
{children}
|
|
35
|
+
</I18nextProvider>
|
|
36
|
+
</BrowserRouter>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Custom render function that wraps components with test providers.
|
|
42
|
+
* Use this instead of @testing-library/react's render.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* import { renderWithProviders, screen } from '@/test/test-utils';
|
|
46
|
+
* renderWithProviders(<MyComponent />);
|
|
47
|
+
* expect(screen.getByText('Hello')).toBeInTheDocument();
|
|
48
|
+
*/
|
|
49
|
+
function renderWithProviders(
|
|
50
|
+
ui: ReactElement,
|
|
51
|
+
options?: Omit<RenderOptions, 'wrapper'>
|
|
52
|
+
) {
|
|
53
|
+
return render(ui, { wrapper: AllProviders, ...options });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Re-export everything from testing-library
|
|
57
|
+
export * from '@testing-library/react';
|
|
58
|
+
export { renderWithProviders };
|
|
59
|
+
export { mockAuthContext };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="vitest/config" />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react()],
|
|
8
|
+
test: {
|
|
9
|
+
globals: true,
|
|
10
|
+
environment: 'jsdom',
|
|
11
|
+
setupFiles: ['./src/test/setup.ts'],
|
|
12
|
+
css: false,
|
|
13
|
+
include: ['src/**/*.{test,spec}.{ts,tsx}'],
|
|
14
|
+
coverage: {
|
|
15
|
+
provider: 'v8',
|
|
16
|
+
reporter: ['text', 'json', 'html'],
|
|
17
|
+
include: ['src/**/*.{ts,tsx}'],
|
|
18
|
+
exclude: [
|
|
19
|
+
'src/test/**',
|
|
20
|
+
'src/**/*.d.ts',
|
|
21
|
+
'src/main.tsx',
|
|
22
|
+
'src/vite-env.d.ts',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
resolve: {
|
|
27
|
+
alias: {
|
|
28
|
+
'@': path.resolve(__dirname, './src'),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Configuration File Safety Rules
|
|
2
|
+
|
|
3
|
+
## appsettings*.json Protection
|
|
4
|
+
|
|
5
|
+
### MANDATORY Rules
|
|
6
|
+
|
|
7
|
+
1. **NEVER use Write tool on `appsettings*.json`** — ALWAYS use Edit for targeted changes
|
|
8
|
+
2. **NEVER remove existing top-level sections** — only add or modify values within existing structure
|
|
9
|
+
3. **NEVER delete configuration keys** — replace secret VALUES with `<CONFIGURE_HERE>` placeholder
|
|
10
|
+
4. **When adding a new section**, use Edit to insert at the correct location (before the closing `}`)
|
|
11
|
+
|
|
12
|
+
### WHY
|
|
13
|
+
|
|
14
|
+
Claude's Write tool replaces the entire file. If you read a 200-line appsettings.json but only reproduce 150 lines in the Write, 50 lines of configuration are permanently lost. This has caused production incidents where entire authentication, logging, or integration sections disappeared.
|
|
15
|
+
|
|
16
|
+
### Correct Patterns
|
|
17
|
+
|
|
18
|
+
| Action | Tool | Approach |
|
|
19
|
+
|--------|------|----------|
|
|
20
|
+
| Add new section | Edit | Find closing `}`, replace with new section + `}` |
|
|
21
|
+
| Modify a value | Edit | Target the specific key-value pair |
|
|
22
|
+
| Add a key to section | Edit | Find the section's closing `}`, add key before it |
|
|
23
|
+
| Replace secrets | Edit | Replace the VALUE only, keep the key |
|
|
24
|
+
|
|
25
|
+
### Example: Adding a New Section
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
// Use Edit tool with:
|
|
29
|
+
// old_string: "Serilog": { ... }\n}
|
|
30
|
+
// new_string: "Serilog": { ... },\n "NewSection": { "Key": "<CONFIGURE_HERE>" }\n}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Secret Value Handling
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
// WRONG - removing the key entirely
|
|
37
|
+
"Jwt": { }
|
|
38
|
+
|
|
39
|
+
// WRONG - deleting the section
|
|
40
|
+
// (section missing from file)
|
|
41
|
+
|
|
42
|
+
// CORRECT - placeholder value preserving structure
|
|
43
|
+
"Jwt": {
|
|
44
|
+
"SecretKey": "<CONFIGURE_HERE>",
|
|
45
|
+
"Issuer": "<CONFIGURE_HERE>",
|
|
46
|
+
"Audience": "<CONFIGURE_HERE>",
|
|
47
|
+
"ExpirationMinutes": 60
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Exception: New File Creation
|
|
52
|
+
|
|
53
|
+
Write is acceptable ONLY when creating a NEW `appsettings.*.json` file that does not yet exist on disk (e.g., `appsettings.Local.json` during `/gitflow start`). The PreToolUse hook automatically allows this case.
|
|
54
|
+
|
|
55
|
+
### Protection Layers
|
|
56
|
+
|
|
57
|
+
| Layer | Mechanism | When |
|
|
58
|
+
|-------|-----------|------|
|
|
59
|
+
| Hook `appsettings-guard.sh` | PreToolUse on Write | Blocks Write if top-level sections would be lost |
|
|
60
|
+
| Commit agent step 2b | During `/gitflow commit` | Detects section removal vs HEAD before staging |
|
|
61
|
+
| These instructions | During development | Prevents the issue from occurring |
|
|
@@ -46,7 +46,7 @@ Always in simple code block:
|
|
|
46
46
|
|
|
47
47
|
```markdown
|
|
48
48
|
```
|
|
49
|
-
/gitflow
|
|
49
|
+
/gitflow init --exec
|
|
50
50
|
```
|
|
51
51
|
```
|
|
52
52
|
|
|
@@ -77,7 +77,7 @@ npm test
|
|
|
77
77
|
|
|
78
78
|
```markdown
|
|
79
79
|
<!-- INCORRECT -->
|
|
80
|
-
Execute `/gitflow
|
|
80
|
+
Execute `/gitflow init`
|
|
81
81
|
Run the command `npm run build`
|
|
82
82
|
```
|
|
83
83
|
|
|
@@ -48,7 +48,10 @@ This skill uses progressive step loading. Each step calls MCP tools for generati
|
|
|
48
48
|
| `mcp__smartstack__scaffold_api_client` | TypeScript API client |
|
|
49
49
|
| `mcp__smartstack__scaffold_routes` | React Router configuration |
|
|
50
50
|
| `mcp__smartstack__suggest_migration` | Migration name suggestion |
|
|
51
|
-
| `mcp__smartstack__scaffold_tests` | Test suite generation |
|
|
51
|
+
| `mcp__smartstack__scaffold_tests` | Test suite generation (backend) |
|
|
52
|
+
| `mcp__smartstack__scaffold_frontend_tests` | Test suite generation (frontend React) |
|
|
53
|
+
| `mcp__smartstack__validate_conventions` | Post-generation convention check |
|
|
54
|
+
| `mcp__smartstack__review_code` | Code quality audit |
|
|
52
55
|
|
|
53
56
|
## WHEN THIS SKILL ACTIVATES
|
|
54
57
|
|
|
@@ -88,14 +91,17 @@ WEB (React) → API (.NET) → Application → Infrastructure → Database
|
|
|
88
91
|
3. ROLES (RolePermission mappings)
|
|
89
92
|
3b. CLIENT SEED PROVIDER (client projects only - IClientSeedDataProvider)
|
|
90
93
|
4. API (Controller + DTOs via /controller:create)
|
|
94
|
+
4b. VALIDATE (/validate - convention check on generated backend)
|
|
91
95
|
5. SERVICES (Interface + Implementation)
|
|
92
96
|
6. FRONTEND (Page + Components + Hooks)
|
|
93
97
|
7. I18N (fr, en, it, de)
|
|
94
98
|
8. ROUTES (nested routes mandatory)
|
|
95
99
|
9. PREFERENCES (Hook pattern)
|
|
96
100
|
10. MIGRATION (/efcore:migration)
|
|
97
|
-
11. TESTS (scaffold_tests -
|
|
98
|
-
12.
|
|
101
|
+
11. TESTS - Backend (scaffold_tests - 7 categories including real integration)
|
|
102
|
+
12. TESTS - Frontend (scaffold_frontend_tests - Vitest + Testing Library + MSW)
|
|
103
|
+
13. REVIEW (/review-code - security + architecture + quality audit)
|
|
104
|
+
14. DOCUMENTATION (in-app user doc via /documentation - if userDocRequired)
|
|
99
105
|
```
|
|
100
106
|
|
|
101
107
|
### 3b. Client Seed Provider (client projects only)
|
|
@@ -151,6 +157,9 @@ export function use{Module}Preferences() {
|
|
|
151
157
|
| `/workflow` | Automated emails | IWorkflowService.TriggerAsync |
|
|
152
158
|
| `/ai-prompt` | AI assistance | IAiCompletionService |
|
|
153
159
|
| `/feature-full` | Complete feature | Orchestration all skills |
|
|
160
|
+
| `/validate` | After step-04 (backend) | MCP `validate_conventions` on generated code |
|
|
161
|
+
| `/review-code` | After step-07 (tests) | Security (OWASP), architecture, SOLID, performance audit |
|
|
162
|
+
| `/validate-feature` | After step-07 (tests) | Compile + test + API smoke test |
|
|
154
163
|
| `/documentation` | In-app user doc | Documentation page via doc-data.ts + DocRenderer |
|
|
155
164
|
|
|
156
165
|
### Notification Integration Pattern
|
|
@@ -13,6 +13,8 @@ next_step: steps/step-05-frontend.md
|
|
|
13
13
|
- ALWAYS generate Entity + Service + Controller as a unit
|
|
14
14
|
- NEVER skip controller generation - API is required
|
|
15
15
|
- YOU ARE AN ORCHESTRATOR calling MCP, not a generator
|
|
16
|
+
- **NEVER use Write on appsettings*.json** - ALWAYS use Edit (see _resources/config-safety.md)
|
|
17
|
+
- **Replace secret VALUES with `<CONFIGURE_HERE>`** - NEVER delete keys or sections
|
|
16
18
|
|
|
17
19
|
## YOUR TASK
|
|
18
20
|
|
|
@@ -531,6 +533,25 @@ Scaffold the SQL objects infrastructure:
|
|
|
531
533
|
|
|
532
534
|
**If SqlObjectHelper already exists:** Skip this check.
|
|
533
535
|
|
|
536
|
+
### Check 6: Convention Validation (RECOMMENDED)
|
|
537
|
+
|
|
538
|
+
Run MCP convention validation on the generated backend code:
|
|
539
|
+
|
|
540
|
+
```
|
|
541
|
+
Tool: mcp__smartstack__validate_conventions
|
|
542
|
+
Args:
|
|
543
|
+
target: "backend"
|
|
544
|
+
scope: "{entity_name}"
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
This verifies:
|
|
548
|
+
- Naming conventions (PascalCase entities, correct prefixes)
|
|
549
|
+
- Architecture layers respected (no cross-layer violations)
|
|
550
|
+
- Required attributes present (NavRoute, RequirePermission)
|
|
551
|
+
- DTO patterns followed
|
|
552
|
+
|
|
553
|
+
IF violations found: Fix them before proceeding to step-05.
|
|
554
|
+
|
|
534
555
|
---
|
|
535
556
|
|
|
536
557
|
## SUCCESS METRICS
|