@atlashub/smartstack-cli 1.13.2 → 1.14.1

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.
Files changed (214) hide show
  1. package/.documentation/agents.html +1 -1
  2. package/.documentation/apex.html +1 -1
  3. package/.documentation/business-analyse.html +1 -1
  4. package/.documentation/cli-commands.html +3 -3
  5. package/.documentation/commands.html +1 -1
  6. package/.documentation/efcore.html +1 -1
  7. package/.documentation/gitflow.html +231 -236
  8. package/.documentation/hooks.html +1 -1
  9. package/.documentation/index.html +1 -1
  10. package/.documentation/init.html +3 -3
  11. package/.documentation/installation.html +1075 -351
  12. package/.documentation/ralph-loop.html +1 -1
  13. package/.documentation/test-web.html +1 -1
  14. package/README.md +88 -20
  15. package/config/default-config.json +10 -1
  16. package/dist/index.js +276 -85
  17. package/dist/index.js.map +1 -1
  18. package/package.json +1 -1
  19. package/templates/agents/code-reviewer.md +163 -0
  20. package/templates/agents/efcore/db-deploy.md +25 -7
  21. package/templates/agents/efcore/db-reset.md +31 -10
  22. package/templates/agents/efcore/db-status.md +22 -5
  23. package/templates/agents/efcore/migration.md +70 -20
  24. package/templates/agents/gitflow/cleanup.md +8 -1
  25. package/templates/agents/gitflow/commit.md +7 -5
  26. package/templates/agents/gitflow/finish.md +6 -4
  27. package/templates/agents/gitflow/pr.md +8 -1
  28. package/templates/agents/gitflow/start.md +1 -1
  29. package/templates/commands/check-version.md +267 -0
  30. package/templates/commands/efcore/_shared.md +31 -2
  31. package/templates/commands/efcore/db-reset.md +18 -6
  32. package/templates/commands/efcore/migration.md +1 -1
  33. package/templates/commands/efcore/rebase-snapshot.md +1 -1
  34. package/templates/commands/efcore/squash.md +1 -0
  35. package/templates/commands/refactor.md +164 -0
  36. package/templates/project/DependencyInjection.Application.cs.template +25 -0
  37. package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
  38. package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
  39. package/templates/project/ExampleEntity.cs.template +116 -0
  40. package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
  41. package/templates/project/ExampleService.cs.template +146 -0
  42. package/templates/project/ExtensionsDbContext.cs.template +41 -0
  43. package/templates/project/IExtensionsDbContext.cs.template +22 -0
  44. package/templates/project/Program.cs.template +47 -0
  45. package/templates/project/README.md +79 -0
  46. package/templates/ralph/README.md +10 -8
  47. package/templates/ralph/ralph.config.yaml +2 -2
  48. package/templates/skills/_shared.md +44 -44
  49. package/templates/skills/ai-prompt/SKILL.md +55 -55
  50. package/templates/skills/apex/SKILL.md +235 -0
  51. package/templates/skills/apex/steps/step-00-init.md +203 -0
  52. package/templates/skills/apex/steps/step-01-analyze.md +210 -0
  53. package/templates/skills/apex/steps/step-02-plan.md +217 -0
  54. package/templates/skills/apex/steps/step-03-execute.md +178 -0
  55. package/templates/skills/apex/steps/step-04-validate.md +217 -0
  56. package/templates/skills/apex/steps/step-05-examine.md +207 -0
  57. package/templates/skills/apex/steps/step-06-resolve.md +181 -0
  58. package/templates/skills/apex/steps/step-07-tests.md +206 -0
  59. package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
  60. package/templates/skills/apex/templates/00-context.md +46 -0
  61. package/templates/skills/apex/templates/01-analyze.md +63 -0
  62. package/templates/skills/apex/templates/02-plan.md +63 -0
  63. package/templates/skills/apex/templates/03-execute.md +34 -0
  64. package/templates/skills/apex/templates/04-validate.md +61 -0
  65. package/templates/skills/apex/templates/05-examine.md +58 -0
  66. package/templates/skills/apex/templates/06-resolve.md +39 -0
  67. package/templates/skills/apex/templates/07-tests.md +56 -0
  68. package/templates/skills/apex/templates/08-run-tests.md +41 -0
  69. package/templates/skills/apex/templates/README.md +69 -0
  70. package/templates/skills/application/SKILL.md +50 -50
  71. package/templates/skills/application/templates-backend.md +25 -25
  72. package/templates/skills/application/templates-frontend.md +43 -43
  73. package/templates/skills/application/templates-i18n.md +29 -29
  74. package/templates/skills/application/templates-seed.md +77 -77
  75. package/templates/skills/business-analyse/SKILL.md +223 -0
  76. package/templates/skills/business-analyse/_shared.md +258 -0
  77. package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
  78. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
  79. package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
  80. package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
  81. package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
  82. package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
  83. package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
  84. package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
  85. package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
  86. package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
  87. package/templates/skills/business-analyse/questionnaire.md +177 -177
  88. package/templates/skills/business-analyse/react/components.md +340 -0
  89. package/templates/skills/business-analyse/react/i18n-template.md +245 -0
  90. package/templates/skills/business-analyse/react/schema.md +151 -0
  91. package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
  92. package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
  93. package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
  94. package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
  95. package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
  96. package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
  97. package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
  98. package/templates/skills/business-analyse/templates/00-context.md +105 -0
  99. package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
  100. package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
  101. package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
  102. package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
  103. package/templates/skills/business-analyse/templates-frd.md +217 -217
  104. package/templates/skills/business-analyse/templates-react.md +26 -26
  105. package/templates/skills/controller/SKILL.md +141 -92
  106. package/templates/skills/controller/postman-templates.md +15 -15
  107. package/templates/skills/controller/steps/step-00-init.md +191 -0
  108. package/templates/skills/controller/steps/step-01-analyze.md +146 -0
  109. package/templates/skills/controller/steps/step-02-plan.md +176 -0
  110. package/templates/skills/controller/steps/step-03-generate.md +219 -0
  111. package/templates/skills/controller/steps/step-04-perms.md +219 -0
  112. package/templates/skills/controller/steps/step-05-validate.md +107 -0
  113. package/templates/skills/controller/templates.md +77 -77
  114. package/templates/skills/documentation/SKILL.md +79 -79
  115. package/templates/skills/feature-full/SKILL.md +38 -38
  116. package/templates/skills/gitflow/SKILL.md +277 -0
  117. package/templates/{commands → skills}/gitflow/_shared.md +20 -20
  118. package/templates/skills/gitflow/phases/abort.md +173 -0
  119. package/templates/skills/gitflow/phases/cleanup.md +226 -0
  120. package/templates/skills/gitflow/phases/status.md +178 -0
  121. package/templates/skills/gitflow/steps/step-commit.md +255 -0
  122. package/templates/skills/gitflow/steps/step-finish.md +255 -0
  123. package/templates/skills/gitflow/steps/step-init.md +209 -0
  124. package/templates/skills/gitflow/steps/step-merge.md +225 -0
  125. package/templates/skills/gitflow/steps/step-plan.md +208 -0
  126. package/templates/skills/gitflow/steps/step-pr.md +235 -0
  127. package/templates/skills/gitflow/steps/step-start.md +334 -0
  128. package/templates/skills/gitflow/steps/step-sync.md +200 -0
  129. package/templates/skills/gitflow/templates/config.json +53 -0
  130. package/templates/skills/notification/SKILL.md +51 -51
  131. package/templates/skills/ralph-loop/SKILL.md +228 -0
  132. package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
  133. package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
  134. package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
  135. package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
  136. package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
  137. package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
  138. package/templates/skills/review-code/SKILL.md +219 -0
  139. package/templates/skills/review-code/references/clean-code-principles.md +140 -0
  140. package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
  141. package/templates/skills/review-code/references/feedback-patterns.md +149 -0
  142. package/templates/skills/review-code/references/security-checklist.md +127 -0
  143. package/templates/skills/ui-components/SKILL.md +54 -54
  144. package/templates/skills/workflow/SKILL.md +46 -46
  145. package/templates/commands/ai-prompt.md +0 -315
  146. package/templates/commands/apex/1-analyze.md +0 -100
  147. package/templates/commands/apex/2-plan.md +0 -145
  148. package/templates/commands/apex/3-execute.md +0 -171
  149. package/templates/commands/apex/4-examine.md +0 -116
  150. package/templates/commands/apex/5-tasks.md +0 -209
  151. package/templates/commands/apex.md +0 -76
  152. package/templates/commands/application/create.md +0 -362
  153. package/templates/commands/application/templates-backend.md +0 -463
  154. package/templates/commands/application/templates-frontend.md +0 -517
  155. package/templates/commands/application/templates-i18n.md +0 -478
  156. package/templates/commands/application/templates-seed.md +0 -362
  157. package/templates/commands/application.md +0 -303
  158. package/templates/commands/business-analyse/0-orchestrate.md +0 -156
  159. package/templates/commands/business-analyse/1-init.md +0 -99
  160. package/templates/commands/business-analyse/2-discover.md +0 -143
  161. package/templates/commands/business-analyse/3-analyse.md +0 -106
  162. package/templates/commands/business-analyse/4-specify.md +0 -133
  163. package/templates/commands/business-analyse/5-validate.md +0 -132
  164. package/templates/commands/business-analyse/6-handoff.md +0 -157
  165. package/templates/commands/business-analyse/7-doc-html.md +0 -103
  166. package/templates/commands/business-analyse/_shared.md +0 -176
  167. package/templates/commands/business-analyse/bug.md +0 -118
  168. package/templates/commands/business-analyse/change-request.md +0 -144
  169. package/templates/commands/business-analyse/hotfix.md +0 -116
  170. package/templates/commands/business-analyse.md +0 -121
  171. package/templates/commands/controller/create.md +0 -216
  172. package/templates/commands/controller/postman-templates.md +0 -528
  173. package/templates/commands/controller/templates.md +0 -600
  174. package/templates/commands/controller.md +0 -337
  175. package/templates/commands/create/agent.md +0 -138
  176. package/templates/commands/create/command.md +0 -166
  177. package/templates/commands/create/hook.md +0 -234
  178. package/templates/commands/create/plugin.md +0 -329
  179. package/templates/commands/create/project.md +0 -508
  180. package/templates/commands/create/skill.md +0 -199
  181. package/templates/commands/create.md +0 -220
  182. package/templates/commands/documentation/module.md +0 -202
  183. package/templates/commands/documentation/templates.md +0 -432
  184. package/templates/commands/documentation.md +0 -190
  185. package/templates/commands/epct.md +0 -69
  186. package/templates/commands/explain.md +0 -186
  187. package/templates/commands/feature-full.md +0 -267
  188. package/templates/commands/gitflow/1-init.md +0 -188
  189. package/templates/commands/gitflow/10-start.md +0 -190
  190. package/templates/commands/gitflow/11-finish.md +0 -382
  191. package/templates/commands/gitflow/12-cleanup.md +0 -103
  192. package/templates/commands/gitflow/13-sync.md +0 -216
  193. package/templates/commands/gitflow/14-rebase.md +0 -251
  194. package/templates/commands/gitflow/2-status.md +0 -122
  195. package/templates/commands/gitflow/3-commit.md +0 -209
  196. package/templates/commands/gitflow/4-plan.md +0 -174
  197. package/templates/commands/gitflow/5-exec.md +0 -202
  198. package/templates/commands/gitflow/6-abort.md +0 -121
  199. package/templates/commands/gitflow/7-pull-request.md +0 -176
  200. package/templates/commands/gitflow/8-review.md +0 -113
  201. package/templates/commands/gitflow/9-merge.md +0 -157
  202. package/templates/commands/gitflow.md +0 -128
  203. package/templates/commands/implement.md +0 -663
  204. package/templates/commands/init.md +0 -567
  205. package/templates/commands/mcp-integration.md +0 -330
  206. package/templates/commands/notification.md +0 -129
  207. package/templates/commands/oneshot.md +0 -57
  208. package/templates/commands/quickstart.md +0 -154
  209. package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
  210. package/templates/commands/ralph-loop/help.md +0 -126
  211. package/templates/commands/ralph-loop/ralph-loop.md +0 -120
  212. package/templates/commands/review.md +0 -106
  213. package/templates/commands/workflow.md +0 -193
  214. package/templates/gitflow/config.json +0 -138
@@ -1,517 +0,0 @@
1
- # Templates Frontend - Application Skill
2
-
3
- > Ces templates génèrent le code React/TypeScript pour les nouvelles applications/modules.
4
- > **RAPPEL:** Toutes les pages client sont sous `/business/...`
5
-
6
- ---
7
-
8
- ## ARCHITECTURE FRONTEND
9
-
10
- ```
11
- web/smartstack-web/src/
12
- ├── pages/business/$APP/$MODULE/
13
- │ ├── $MODULE_PASCALPage.tsx # Page principale (liste)
14
- │ ├── $MODULE_PASCALDetailPage.tsx # Page détail
15
- │ └── Create$MODULE_PASCALPage.tsx # Page création
16
- ├── components/$MODULE/
17
- │ ├── $MODULE_PASCALListView.tsx # Composant liste réutilisable
18
- │ ├── $MODULE_PASCALForm.tsx # Formulaire CRUD
19
- │ └── $MODULE_PASCALFilters.tsx # Filtres
20
- ├── components/common/
21
- │ └── (composants partagés)
22
- ├── hooks/
23
- │ ├── use$MODULE_PASCALPreferences.ts # Hook préférences
24
- │ └── use$MODULE_PASCAL.ts # Hook API
25
- ├── services/api/
26
- │ └── $moduleApi.ts # Service API
27
- └── i18n/locales/
28
- ├── fr/$module.json
29
- ├── en/$module.json
30
- ├── it/$module.json
31
- └── de/$module.json
32
- ```
33
-
34
- ---
35
-
36
- ## TEMPLATE: PAGE PRINCIPALE
37
-
38
- ```tsx
39
- // pages/business/$APP/$MODULE/$MODULE_PASCALPage.tsx
40
-
41
- import { useTranslation } from 'react-i18next';
42
- import { $MODULE_PASCALListView } from '@/components/$MODULE/$MODULE_PASCALListView';
43
-
44
- export function $MODULE_PASCALPage() {
45
- const { t } = useTranslation(['$module', 'common']);
46
-
47
- return (
48
- <$MODULE_PASCALListView
49
- title={t('$module:title')}
50
- subtitle={t('$module:subtitle')}
51
- basePath="/business/$APP/$MODULE"
52
- createPath="/business/$APP/$MODULE/new"
53
- />
54
- );
55
- }
56
- ```
57
-
58
- ---
59
-
60
- ## TEMPLATE: LISTE VIEW (Composant réutilisable)
61
-
62
- ```tsx
63
- // components/$MODULE/$MODULE_PASCALListView.tsx
64
-
65
- import { useState, useEffect } from 'react';
66
- import { useNavigate } from 'react-router-dom';
67
- import { useTranslation } from 'react-i18next';
68
- import { Plus, Search, MoreVertical, Pencil, Trash2 } from 'lucide-react';
69
- import { api } from '@/services/api/apiClient';
70
- import { use$MODULE_PASCALPreferences } from '@/hooks/use$MODULE_PASCALPreferences';
71
- import { Pagination } from '@/components/common/Pagination';
72
- import { ColumnSelector } from '@/components/common/ColumnSelector';
73
- import { ViewModeToggle } from '@/components/common/ViewModeToggle';
74
-
75
- interface $ENTITY_PASCALDto {
76
- id: string;
77
- name: string;
78
- description: string | null;
79
- isActive: boolean;
80
- createdAt: string;
81
- updatedAt: string | null;
82
- }
83
-
84
- interface PagedResult {
85
- items: $ENTITY_PASCALDto[];
86
- totalCount: number;
87
- page: number;
88
- pageSize: number;
89
- }
90
-
91
- interface $MODULE_PASCALListViewProps {
92
- title: string;
93
- subtitle?: string;
94
- basePath: string;
95
- createPath?: string;
96
- }
97
-
98
- const DEFAULT_COLUMNS = ['name', 'description', 'isActive', 'createdAt'];
99
-
100
- export function $MODULE_PASCALListView({
101
- title,
102
- subtitle,
103
- basePath,
104
- createPath,
105
- }: $MODULE_PASCALListViewProps) {
106
- const { t } = useTranslation(['$module', 'common']);
107
- const navigate = useNavigate();
108
- const {
109
- pageSize,
110
- sortColumn,
111
- sortDirection,
112
- visibleColumns,
113
- viewMode,
114
- setPageSize,
115
- setSortColumn,
116
- setSortDirection,
117
- setVisibleColumns,
118
- setViewMode,
119
- } = use$MODULE_PASCALPreferences();
120
-
121
- const [data, setData] = useState<PagedResult | null>(null);
122
- const [loading, setLoading] = useState(true);
123
- const [error, setError] = useState<string | null>(null);
124
- const [page, setPage] = useState(1);
125
- const [searchTerm, setSearchTerm] = useState('');
126
-
127
- useEffect(() => {
128
- loadData();
129
- }, [page, pageSize, sortColumn, sortDirection, searchTerm]);
130
-
131
- const loadData = async () => {
132
- try {
133
- setLoading(true);
134
- setError(null);
135
- const params = new URLSearchParams({
136
- page: page.toString(),
137
- pageSize: pageSize.toString(),
138
- sortColumn,
139
- sortDirection,
140
- ...(searchTerm && { searchTerm }),
141
- });
142
- const result = await api.get<PagedResult>(`/api/business/$MODULE?${params}`);
143
- setData(result);
144
- } catch (err) {
145
- setError(t('common:errors.loadFailed'));
146
- console.error('Failed to load $module:', err);
147
- } finally {
148
- setLoading(false);
149
- }
150
- };
151
-
152
- const handleSort = (column: string) => {
153
- if (sortColumn === column) {
154
- setSortDirection(sortDirection === 'asc' ? 'desc' : 'asc');
155
- } else {
156
- setSortColumn(column);
157
- setSortDirection('asc');
158
- }
159
- };
160
-
161
- const handleDelete = async (id: string) => {
162
- if (!confirm(t('common:confirmDelete'))) return;
163
-
164
- try {
165
- await api.delete(`/api/business/$MODULE/${id}`);
166
- loadData();
167
- } catch (err) {
168
- console.error('Failed to delete:', err);
169
- }
170
- };
171
-
172
- const columns = [
173
- { key: 'name', label: t('$module:columns.name'), sortable: true },
174
- { key: 'description', label: t('$module:columns.description'), sortable: false },
175
- { key: 'isActive', label: t('$module:columns.status'), sortable: true },
176
- { key: 'createdAt', label: t('$module:columns.createdAt'), sortable: true },
177
- ];
178
-
179
- return (
180
- <div className="space-y-6">
181
- {/* Header */}
182
- <div className="flex items-center justify-between">
183
- <div>
184
- <h1 className="text-2xl font-bold text-[var(--text-primary)]">{title}</h1>
185
- {subtitle && (
186
- <p className="text-[var(--text-secondary)] mt-1">{subtitle}</p>
187
- )}
188
- </div>
189
- {createPath && (
190
- <button
191
- onClick={() => navigate(createPath)}
192
- className="flex items-center gap-2 px-4 py-2 bg-[var(--color-accent-500)] hover:bg-[var(--color-accent-600)] text-white font-medium transition-colors"
193
- style={{ borderRadius: 'var(--radius-button)' }}
194
- >
195
- <Plus className="w-4 h-4" />
196
- {t('common:actions.create')}
197
- </button>
198
- )}
199
- </div>
200
-
201
- {/* Toolbar */}
202
- <div className="flex items-center justify-between gap-4">
203
- <div className="relative flex-1 max-w-md">
204
- <Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-muted)]" />
205
- <input
206
- type="text"
207
- placeholder={t('common:search.placeholder')}
208
- value={searchTerm}
209
- onChange={(e) => setSearchTerm(e.target.value)}
210
- className="w-full pl-10 pr-4 py-2 bg-[var(--bg-primary)] border border-[var(--border-color)] text-sm focus:outline-none focus:border-[var(--color-accent-500)]"
211
- style={{ borderRadius: 'var(--radius-input)' }}
212
- />
213
- </div>
214
- <div className="flex items-center gap-2">
215
- <ColumnSelector
216
- columns={columns}
217
- visibleColumns={visibleColumns}
218
- onChange={setVisibleColumns}
219
- />
220
- <ViewModeToggle value={viewMode} onChange={setViewMode} />
221
- </div>
222
- </div>
223
-
224
- {/* Content */}
225
- {loading ? (
226
- <div className="flex items-center justify-center py-12">
227
- <div className="animate-spin h-8 w-8 border-4 border-[var(--color-accent-500)] border-t-transparent rounded-full" />
228
- </div>
229
- ) : error ? (
230
- <div className="p-4 bg-[var(--error-bg)] border border-[var(--error-border)] text-[var(--error-text)]" style={{ borderRadius: 'var(--radius-card)' }}>
231
- {error}
232
- </div>
233
- ) : viewMode === 'list' ? (
234
- <div className="bg-[var(--bg-card)] border border-[var(--item-color-border)] overflow-hidden" style={{ borderRadius: 'var(--radius-card)' }}>
235
- <table className="w-full">
236
- <thead>
237
- <tr className="border-b border-[var(--item-color-border)]">
238
- {columns.filter(col => visibleColumns.includes(col.key)).map((col) => (
239
- <th
240
- key={col.key}
241
- className={`px-4 py-3 text-left text-sm font-medium text-[var(--text-secondary)] ${
242
- col.sortable ? 'cursor-pointer hover:text-[var(--text-primary)]' : ''
243
- }`}
244
- onClick={() => col.sortable && handleSort(col.key)}
245
- >
246
- {col.label}
247
- {sortColumn === col.key && (
248
- <span className="ml-1">{sortDirection === 'asc' ? '↑' : '↓'}</span>
249
- )}
250
- </th>
251
- ))}
252
- <th className="px-4 py-3 text-right text-sm font-medium text-[var(--text-secondary)]">
253
- {t('common:actions.title')}
254
- </th>
255
- </tr>
256
- </thead>
257
- <tbody>
258
- {data?.items.map((item) => (
259
- <tr
260
- key={item.id}
261
- className="border-b border-[var(--item-color-border)] hover:bg-[var(--bg-hover)] cursor-pointer"
262
- onClick={() => navigate(`${basePath}/${item.id}`)}
263
- >
264
- {visibleColumns.includes('name') && (
265
- <td className="px-4 py-3 text-sm text-[var(--text-primary)] font-medium">
266
- {item.name}
267
- </td>
268
- )}
269
- {visibleColumns.includes('description') && (
270
- <td className="px-4 py-3 text-sm text-[var(--text-secondary)]">
271
- {item.description || '-'}
272
- </td>
273
- )}
274
- {visibleColumns.includes('isActive') && (
275
- <td className="px-4 py-3">
276
- <span
277
- className={`inline-flex items-center px-2 py-1 text-xs font-medium ${
278
- item.isActive
279
- ? 'bg-green-100 text-green-800'
280
- : 'bg-gray-100 text-gray-800'
281
- }`}
282
- style={{ borderRadius: 'var(--radius-badge)' }}
283
- >
284
- {item.isActive ? t('common:status.active') : t('common:status.inactive')}
285
- </span>
286
- </td>
287
- )}
288
- {visibleColumns.includes('createdAt') && (
289
- <td className="px-4 py-3 text-sm text-[var(--text-secondary)]">
290
- {new Date(item.createdAt).toLocaleDateString()}
291
- </td>
292
- )}
293
- <td className="px-4 py-3 text-right">
294
- <div className="flex items-center justify-end gap-2">
295
- <button
296
- onClick={(e) => {
297
- e.stopPropagation();
298
- navigate(`${basePath}/${item.id}/edit`);
299
- }}
300
- className="p-1 hover:bg-[var(--bg-tertiary)]"
301
- style={{ borderRadius: 'var(--radius-button)' }}
302
- >
303
- <Pencil className="w-4 h-4 text-[var(--text-secondary)]" />
304
- </button>
305
- <button
306
- onClick={(e) => {
307
- e.stopPropagation();
308
- handleDelete(item.id);
309
- }}
310
- className="p-1 hover:bg-[var(--error-bg)]"
311
- style={{ borderRadius: 'var(--radius-button)' }}
312
- >
313
- <Trash2 className="w-4 h-4 text-[var(--error-text)]" />
314
- </button>
315
- </div>
316
- </td>
317
- </tr>
318
- ))}
319
- </tbody>
320
- </table>
321
- </div>
322
- ) : (
323
- /* Grid view */
324
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
325
- {data?.items.map((item) => (
326
- <div
327
- key={item.id}
328
- className="bg-[var(--bg-card)] border border-[var(--item-color-border)] p-4 hover:border-[var(--color-accent-500)] cursor-pointer transition-colors"
329
- style={{ borderRadius: 'var(--radius-card)' }}
330
- onClick={() => navigate(`${basePath}/${item.id}`)}
331
- >
332
- <h3 className="font-medium text-[var(--text-primary)]">{item.name}</h3>
333
- <p className="text-sm text-[var(--text-secondary)] mt-1 line-clamp-2">
334
- {item.description || '-'}
335
- </p>
336
- <div className="flex items-center justify-between mt-3">
337
- <span
338
- className={`inline-flex items-center px-2 py-1 text-xs font-medium ${
339
- item.isActive
340
- ? 'bg-green-100 text-green-800'
341
- : 'bg-gray-100 text-gray-800'
342
- }`}
343
- style={{ borderRadius: 'var(--radius-badge)' }}
344
- >
345
- {item.isActive ? t('common:status.active') : t('common:status.inactive')}
346
- </span>
347
- <span className="text-xs text-[var(--text-muted)]">
348
- {new Date(item.createdAt).toLocaleDateString()}
349
- </span>
350
- </div>
351
- </div>
352
- ))}
353
- </div>
354
- )}
355
-
356
- {/* Pagination */}
357
- {data && (
358
- <Pagination
359
- page={data.page}
360
- pageSize={data.pageSize}
361
- totalCount={data.totalCount}
362
- onPageChange={setPage}
363
- onPageSizeChange={setPageSize}
364
- />
365
- )}
366
- </div>
367
- );
368
- }
369
- ```
370
-
371
- ---
372
-
373
- ## TEMPLATE: HOOK PRÉFÉRENCES
374
-
375
- ```tsx
376
- // hooks/use$MODULE_PASCALPreferences.ts
377
-
378
- import { useUserPreferences } from '@/contexts/UserPreferencesContext';
379
-
380
- const DEFAULT_COLUMNS = ['name', 'description', 'isActive', 'createdAt'];
381
-
382
- export function use$MODULE_PASCALPreferences() {
383
- const { preferences, updatePreference } = useUserPreferences();
384
- const modulePrefs = preferences.$module || {};
385
-
386
- return {
387
- // Getters with defaults
388
- pageSize: modulePrefs.pageSize ?? 10,
389
- sortColumn: modulePrefs.sortColumn ?? 'createdAt',
390
- sortDirection: modulePrefs.sortDirection ?? 'desc',
391
- filters: modulePrefs.filters ?? {},
392
- visibleColumns: modulePrefs.visibleColumns ?? DEFAULT_COLUMNS,
393
- viewMode: modulePrefs.viewMode ?? 'list',
394
-
395
- // Setters
396
- setPageSize: (size: number) =>
397
- updatePreference('$module.pageSize', size),
398
- setSortColumn: (col: string) =>
399
- updatePreference('$module.sortColumn', col),
400
- setSortDirection: (dir: 'asc' | 'desc') =>
401
- updatePreference('$module.sortDirection', dir),
402
- setFilters: (filters: Record<string, unknown>) =>
403
- updatePreference('$module.filters', filters),
404
- setVisibleColumns: (cols: string[]) =>
405
- updatePreference('$module.visibleColumns', cols),
406
- setViewMode: (mode: 'list' | 'grid') =>
407
- updatePreference('$module.viewMode', mode),
408
- };
409
- }
410
- ```
411
-
412
- ---
413
-
414
- ## TEMPLATE: SERVICE API
415
-
416
- ```tsx
417
- // services/api/$moduleApi.ts
418
-
419
- import { api } from './apiClient';
420
-
421
- export interface $ENTITY_PASCALDto {
422
- id: string;
423
- name: string;
424
- description: string | null;
425
- isActive: boolean;
426
- createdAt: string;
427
- updatedAt: string | null;
428
- }
429
-
430
- export interface Create$ENTITY_PASCALRequest {
431
- name: string;
432
- description?: string;
433
- }
434
-
435
- export interface Update$ENTITY_PASCALRequest {
436
- name: string;
437
- description?: string;
438
- }
439
-
440
- export interface PagedResult<T> {
441
- items: T[];
442
- totalCount: number;
443
- page: number;
444
- pageSize: number;
445
- }
446
-
447
- export interface QueryParameters {
448
- page?: number;
449
- pageSize?: number;
450
- searchTerm?: string;
451
- sortColumn?: string;
452
- sortDirection?: 'asc' | 'desc';
453
- }
454
-
455
- export const $moduleApi = {
456
- getAll: async (params: QueryParameters = {}): Promise<PagedResult<$ENTITY_PASCALDto>> => {
457
- const queryParams = new URLSearchParams();
458
- if (params.page) queryParams.set('page', params.page.toString());
459
- if (params.pageSize) queryParams.set('pageSize', params.pageSize.toString());
460
- if (params.searchTerm) queryParams.set('searchTerm', params.searchTerm);
461
- if (params.sortColumn) queryParams.set('sortColumn', params.sortColumn);
462
- if (params.sortDirection) queryParams.set('sortDirection', params.sortDirection);
463
-
464
- return api.get(`/api/business/$MODULE?${queryParams}`);
465
- },
466
-
467
- getById: async (id: string): Promise<$ENTITY_PASCALDto> => {
468
- return api.get(`/api/business/$MODULE/${id}`);
469
- },
470
-
471
- create: async (data: Create$ENTITY_PASCALRequest): Promise<$ENTITY_PASCALDto> => {
472
- return api.post('/api/business/$MODULE', data);
473
- },
474
-
475
- update: async (id: string, data: Update$ENTITY_PASCALRequest): Promise<$ENTITY_PASCALDto> => {
476
- return api.put(`/api/business/$MODULE/${id}`, data);
477
- },
478
-
479
- delete: async (id: string): Promise<void> => {
480
- return api.delete(`/api/business/$MODULE/${id}`);
481
- },
482
- };
483
- ```
484
-
485
- ---
486
-
487
- ## TEMPLATE: ROUTES (App.tsx)
488
-
489
- ```tsx
490
- // Ajouter dans App.tsx
491
-
492
- import { $MODULE_PASCALPage } from '@/pages/business/$APP/$MODULE/$MODULE_PASCALPage';
493
- import { $MODULE_PASCALDetailPage } from '@/pages/business/$APP/$MODULE/$MODULE_PASCALDetailPage';
494
- import { Create$MODULE_PASCALPage } from '@/pages/business/$APP/$MODULE/Create$MODULE_PASCALPage';
495
-
496
- // Dans les routes - TOUJOURS sous /business/
497
- <Route path="/business/$APP/$MODULE" element={<$MODULE_PASCALPage />} />
498
- <Route path="/business/$APP/$MODULE/new" element={<Create$MODULE_PASCALPage />} />
499
- <Route path="/business/$APP/$MODULE/:id" element={<$MODULE_PASCALDetailPage />} />
500
- <Route path="/business/$APP/$MODULE/:id/edit" element={<Create$MODULE_PASCALPage />} />
501
- ```
502
-
503
- ---
504
-
505
- ## CHECKLIST FRONTEND
506
-
507
- | Vérification | Status |
508
- |--------------|--------|
509
- | ☐ Page principale créée (sous /business/) | |
510
- | ☐ Composant ListView créé | |
511
- | ☐ Hook préférences créé | |
512
- | ☐ Service API créé (endpoint /api/business/) | |
513
- | ☐ Routes ajoutées dans App.tsx (sous /business/) | |
514
- | ☐ Utilise apiClient (pas d'appel direct) | |
515
- | ☐ Pas d'import Infrastructure | |
516
- | ☐ npm run build réussi | |
517
- | ☐ npm run lint réussi | |