@roomi-fields/grillhouse 0.54.1 → 0.55.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.
Files changed (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +73 -0
  3. package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
  4. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
  5. package/cadre/templates/projet/CONTRIBUTING.md +0 -5
  6. package/cadre/templates/projet/README.md +0 -126
  7. package/cadre/templates/projet/_npmignore +1 -6
  8. package/cadre/templates/projet/package.json +5 -32
  9. package/cadre/templates/projet/tsconfig.json +4 -4
  10. package/cadre/templates/projet/vitest.config.cjs +3 -2
  11. package/charte/tests.md +14 -0
  12. package/dist/machine/part-par-sorte.d.ts +9 -9
  13. package/dist/machine/part-par-sorte.js +20 -24
  14. package/dist/machine/part-par-sorte.js.map +1 -1
  15. package/dist/machine/table-des-consommations.d.ts +65 -0
  16. package/dist/machine/table-des-consommations.js +94 -0
  17. package/dist/machine/table-des-consommations.js.map +1 -0
  18. package/dist/temporal/circuit/activites.d.ts +2 -0
  19. package/dist/temporal/circuit/activites.js +87 -3
  20. package/dist/temporal/circuit/activites.js.map +1 -1
  21. package/dist/temporal/circuit/client.js +9 -4
  22. package/dist/temporal/circuit/client.js.map +1 -1
  23. package/dist/temporal/circuit/contrat.d.ts +32 -4
  24. package/dist/temporal/circuit/deroule.js +54 -4
  25. package/dist/temporal/circuit/deroule.js.map +1 -1
  26. package/dist/temporal/circuit/versions.d.ts +12 -0
  27. package/dist/temporal/circuit/versions.js +22 -0
  28. package/dist/temporal/circuit/versions.js.map +1 -0
  29. package/dist/temporal/consommation/activites.d.ts +2 -0
  30. package/dist/temporal/consommation/activites.js +9 -0
  31. package/dist/temporal/consommation/activites.js.map +1 -0
  32. package/dist/temporal/consommation/actualisation.d.ts +2 -0
  33. package/dist/temporal/consommation/actualisation.js +71 -0
  34. package/dist/temporal/consommation/actualisation.js.map +1 -0
  35. package/dist/temporal/consommation/client.d.ts +12 -0
  36. package/dist/temporal/consommation/client.js +28 -0
  37. package/dist/temporal/consommation/client.js.map +1 -0
  38. package/dist/temporal/consommation/commande.d.ts +5 -0
  39. package/dist/temporal/consommation/commande.js +32 -0
  40. package/dist/temporal/consommation/commande.js.map +1 -0
  41. package/dist/temporal/consommation/contrat.d.ts +15 -0
  42. package/dist/temporal/consommation/contrat.js +13 -0
  43. package/dist/temporal/consommation/contrat.js.map +1 -0
  44. package/dist/temporal/consommation/deroule.d.ts +2 -0
  45. package/dist/temporal/consommation/deroule.js +14 -0
  46. package/dist/temporal/consommation/deroule.js.map +1 -0
  47. package/dist/temporal/deroules.d.ts +2 -1
  48. package/dist/temporal/deroules.js +3 -2
  49. package/dist/temporal/deroules.js.map +1 -1
  50. package/dist/temporal/file/contrat.d.ts +2 -0
  51. package/dist/temporal/file/deroule.js +14 -4
  52. package/dist/temporal/file/deroule.js.map +1 -1
  53. package/dist/temporal/installation.d.ts +6 -0
  54. package/dist/temporal/installation.js +15 -0
  55. package/dist/temporal/installation.js.map +1 -1
  56. package/dist/temporal/nuits/activites.d.ts +2 -1
  57. package/dist/temporal/nuits/activites.js +127 -3
  58. package/dist/temporal/nuits/activites.js.map +1 -1
  59. package/dist/temporal/nuits/client.d.ts +19 -5
  60. package/dist/temporal/nuits/client.js +33 -23
  61. package/dist/temporal/nuits/client.js.map +1 -1
  62. package/dist/temporal/nuits/commande.js +16 -11
  63. package/dist/temporal/nuits/commande.js.map +1 -1
  64. package/dist/temporal/nuits/contrat.d.ts +29 -0
  65. package/dist/temporal/nuits/contrat.js +10 -0
  66. package/dist/temporal/nuits/contrat.js.map +1 -1
  67. package/dist/temporal/nuits/deroule.d.ts +5 -0
  68. package/dist/temporal/nuits/deroule.js +18 -1
  69. package/dist/temporal/nuits/deroule.js.map +1 -1
  70. package/dist/temporal/nuits/pc2.d.ts +72 -0
  71. package/dist/temporal/nuits/pc2.js +206 -0
  72. package/dist/temporal/nuits/pc2.js.map +1 -0
  73. package/dist/temporal/places/activites.d.ts +23 -1
  74. package/dist/temporal/places/activites.js +38 -2
  75. package/dist/temporal/places/activites.js.map +1 -1
  76. package/dist/temporal/places/client.d.ts +18 -2
  77. package/dist/temporal/places/client.js +28 -3
  78. package/dist/temporal/places/client.js.map +1 -1
  79. package/dist/temporal/places/contrat.d.ts +79 -14
  80. package/dist/temporal/places/contrat.js +7 -0
  81. package/dist/temporal/places/contrat.js.map +1 -1
  82. package/dist/temporal/places/deroule.js +159 -23
  83. package/dist/temporal/places/deroule.js.map +1 -1
  84. package/dist/temporal/places/reservation.d.ts +54 -0
  85. package/dist/temporal/places/reservation.js +69 -0
  86. package/dist/temporal/places/reservation.js.map +1 -0
  87. package/dist/temporal/planification.d.ts +6 -0
  88. package/dist/temporal/planification.js +26 -0
  89. package/dist/temporal/planification.js.map +1 -0
  90. package/dist/temporal/tickets/activites.d.ts +0 -2
  91. package/dist/temporal/tickets/activites.js +2 -52
  92. package/dist/temporal/tickets/activites.js.map +1 -1
  93. package/dist/temporal/tickets/contrat.d.ts +7 -26
  94. package/dist/temporal/tickets/deroule.js +35 -23
  95. package/dist/temporal/tickets/deroule.js.map +1 -1
  96. package/dist/temporal/travailleur.js +2 -0
  97. package/dist/temporal/travailleur.js.map +1 -1
  98. package/docs/ARCHITECTURE.md +2 -2
  99. package/docs/CADRE.md +1 -1
  100. package/docs/INTERFACE.md +16 -11
  101. package/docs/architecture/circuit.md +62 -58
  102. package/docs/architecture/entree.md +87 -63
  103. package/docs/architecture/greffon.md +24 -21
  104. package/docs/architecture/installation.md +35 -30
  105. package/docs/architecture/machine.md +48 -40
  106. package/docs/architecture/tests.md +37 -33
  107. package/docs/lexique.md +4 -3
  108. package/package.json +1 -1
  109. package/scripts/activites.mjs +351 -180
  110. package/scripts/aiguillage.mjs +1 -0
  111. package/scripts/attente-de-la-machine.mjs +3 -22
  112. package/scripts/avancement.mjs +21 -30
  113. package/scripts/bilan.mjs +22 -2
  114. package/scripts/branche-de-nuit.mjs +1 -1
  115. package/scripts/circuit.mjs +75 -39
  116. package/scripts/codes-de-sortie.mjs +0 -6
  117. package/scripts/coeurs-dedies.mjs +19 -2
  118. package/scripts/consommation-des-passes.mjs +67 -35
  119. package/scripts/consommation.mjs +152 -24
  120. package/scripts/copies-finies.mjs +15 -35
  121. package/scripts/dernier-vert.mjs +4 -5
  122. package/scripts/dette.mjs +5 -3
  123. package/scripts/droits.mjs +2 -2
  124. package/scripts/echantillonneur-de-la-passe.mjs +7 -31
  125. package/scripts/engendres.mjs +5 -61
  126. package/scripts/enveloppe/enveloppe.mjs +30 -34
  127. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
  128. package/scripts/etapes.mjs +21 -7
  129. package/scripts/etat-du-depot.mjs +61 -0
  130. package/scripts/faits-du-circuit.mjs +7 -4
  131. package/scripts/fermeture-de-la-machine.d.mts +6 -4
  132. package/scripts/fermeture-de-la-machine.mjs +12 -16
  133. package/scripts/fichier-du-poste.d.mts +9 -0
  134. package/scripts/file-des-tickets.d.mts +0 -18
  135. package/scripts/file-des-tickets.mjs +0 -42
  136. package/scripts/fusion-du-changelog.mjs +1 -1
  137. package/scripts/grillhouse-maj.mjs +1 -1
  138. package/scripts/index-des-rouges.d.mts +40 -0
  139. package/scripts/index-des-rouges.mjs +104 -0
  140. package/scripts/integration/file.mjs +13 -63
  141. package/scripts/integration/integrer.mjs +157 -424
  142. package/scripts/integration/jugement.mjs +109 -0
  143. package/scripts/integration/rejeu.mjs +94 -71
  144. package/scripts/jointure.d.ts +34 -27
  145. package/scripts/journal-des-etats.d.mts +1 -1
  146. package/scripts/langages/c/commandes.mjs +27 -12
  147. package/scripts/langages/cargo/commandes.mjs +148 -94
  148. package/scripts/langages/cargo/index.mjs +2 -1
  149. package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
  150. package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
  151. package/scripts/langages/python/commandes.mjs +31 -15
  152. package/scripts/langages/python/index.mjs +2 -1
  153. package/scripts/langages/python/lectures-des-tests.mjs +148 -0
  154. package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
  155. package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
  156. package/scripts/langages/typescript/index.mjs +4 -0
  157. package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
  158. package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
  159. package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
  160. package/scripts/langages/typescript/tests.mjs +11 -37
  161. package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
  162. package/scripts/langages/typescript/verifier.mjs +74 -44
  163. package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
  164. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
  165. package/scripts/lectures-communes.mjs +234 -0
  166. package/scripts/machine.mjs +11 -18
  167. package/scripts/mesure/base-de-passe.mjs +1 -2
  168. package/scripts/mesure-de-la-machine.d.mts +43 -3
  169. package/scripts/mesure-de-la-machine.mjs +209 -11
  170. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
  171. package/scripts/migrations/nuit-yml-retire.mjs +25 -0
  172. package/scripts/migrations/part-retiree.mjs +31 -0
  173. package/scripts/migrations/table-des-consommations.mjs +36 -0
  174. package/scripts/migrations.mjs +6 -0
  175. package/scripts/montee.mjs +9 -0
  176. package/scripts/nuit-de-pc2.mjs +628 -0
  177. package/scripts/nuit.sh +8 -131
  178. package/scripts/paquets.mjs +1 -1
  179. package/scripts/passe-de-la-machine.mjs +365 -105
  180. package/scripts/place-du-circuit.d.mts +15 -0
  181. package/scripts/place-du-circuit.mjs +32 -0
  182. package/scripts/places-de-la-machine.mjs +148 -627
  183. package/scripts/places-du-serveur.mjs +43 -16
  184. package/scripts/plafond-de-la-machine.d.mts +8 -13
  185. package/scripts/plafond-de-la-machine.mjs +37 -69
  186. package/scripts/registre-des-entrees.mjs +57 -0
  187. package/scripts/regles-des-places.d.mts +84 -50
  188. package/scripts/regles-des-places.mjs +200 -156
  189. package/scripts/retirer-copie.sh +2 -2
  190. package/scripts/seances.mjs +181 -63
  191. package/scripts/secours.mjs +95 -0
  192. package/scripts/services-du-noyau.mjs +11 -19
  193. package/scripts/sous-commandes.mjs +1 -0
  194. package/scripts/sous-modules.sh +1 -1
  195. package/scripts/superviseur.mjs +16 -7
  196. package/scripts/table-des-consommations.d.mts +9 -0
  197. package/scripts/table-des-consommations.mjs +35 -0
  198. package/scripts/tableau.mjs +33 -19
  199. package/scripts/taches-du-graphe.mjs +124 -2
  200. package/scripts/transitions.d.mts +27 -5
  201. package/scripts/transitions.mjs +125 -104
  202. package/scripts/verdict-de-la-nuit.d.mts +13 -0
  203. package/scripts/verdict-de-la-nuit.mjs +34 -7
  204. package/scripts/verrou-de-fichier.mjs +1 -2
  205. package/scripts/workflows-du-cadre.mjs +2 -2
  206. package/skills/developpeur/SKILL.md +8 -2
  207. package/skills/direct/SKILL.md +5 -0
  208. package/skills/explorateur/SKILL.md +10 -1
  209. package/skills/grill/SKILL.md +2 -4
  210. package/skills/pitmaster/SKILL.md +7 -5
  211. package/skills/pitmaster/references/consigne-agent.md +1 -1
  212. package/skills/relecteur/SKILL.md +4 -1
  213. package/skills/testwriter/SKILL.md +15 -2
  214. package/cadre/templates/projet/.env.example +0 -57
  215. package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
  216. package/cadre/templates/projet/deployment/README.md +0 -98
  217. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
  218. package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
  219. package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
  220. package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
  221. package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
  222. package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
  223. package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
  224. package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
  225. package/cadre/templates/projet/ecosystem.config.cjs +0 -73
  226. package/cadre/templates/projet/src/config.ts +0 -68
  227. package/cadre/templates/projet/src/errors.ts +0 -102
  228. package/cadre/templates/projet/src/index.ts +0 -46
  229. package/cadre/templates/projet/src/services/.gitkeep +0 -8
  230. package/cadre/templates/projet/src/types/index.ts +0 -24
  231. package/cadre/templates/projet/src/utils/logger.ts +0 -106
  232. package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
  233. package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
  234. package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
  235. package/cadre/templates/projet/tsconfig.build.json +0 -14
  236. package/scripts/flux-de-la-nuit.mjs +0 -39
  237. package/scripts/garde-de-la-memoire.mjs +0 -231
  238. package/scripts/repli-de-la-nuit.mjs +0 -184
@@ -1,264 +0,0 @@
1
- # API Reference
2
-
3
- ## Overview
4
-
5
- Base URL: `http://localhost:3000`
6
-
7
- All endpoints return JSON responses.
8
-
9
- ## Authentication
10
-
11
- > Add authentication details here if applicable
12
-
13
- ## Endpoints
14
-
15
- ### Health Check
16
-
17
- Check if the server is running.
18
-
19
- **Request:**
20
- ```http
21
- GET /health
22
- ```
23
-
24
- **Response:**
25
- ```json
26
- {
27
- "status": "ok",
28
- "version": "1.0.0",
29
- "timestamp": "2024-01-01T00:00:00.000Z"
30
- }
31
- ```
32
-
33
- **cURL Example:**
34
- ```bash
35
- curl http://localhost:3000/health
36
- ```
37
-
38
- ---
39
-
40
- ### Example Resource
41
-
42
- #### List Resources
43
-
44
- **Request:**
45
- ```http
46
- GET /api/resources
47
- ```
48
-
49
- **Query Parameters:**
50
- | Parameter | Type | Description | Default |
51
- |-----------|------|-------------|---------|
52
- | `limit` | number | Max items to return | 10 |
53
- | `offset` | number | Items to skip | 0 |
54
-
55
- **Response:**
56
- ```json
57
- {
58
- "data": [
59
- {
60
- "id": "1",
61
- "name": "Resource 1"
62
- }
63
- ],
64
- "total": 100,
65
- "limit": 10,
66
- "offset": 0
67
- }
68
- ```
69
-
70
- **cURL Example:**
71
- ```bash
72
- curl "http://localhost:3000/api/resources?limit=10&offset=0"
73
- ```
74
-
75
- ---
76
-
77
- #### Get Resource by ID
78
-
79
- **Request:**
80
- ```http
81
- GET /api/resources/:id
82
- ```
83
-
84
- **Path Parameters:**
85
- | Parameter | Type | Description |
86
- |-----------|------|-------------|
87
- | `id` | string | Resource ID |
88
-
89
- **Response:**
90
- ```json
91
- {
92
- "id": "1",
93
- "name": "Resource 1",
94
- "createdAt": "2024-01-01T00:00:00.000Z"
95
- }
96
- ```
97
-
98
- **cURL Example:**
99
- ```bash
100
- curl http://localhost:3000/api/resources/1
101
- ```
102
-
103
- ---
104
-
105
- #### Create Resource
106
-
107
- **Request:**
108
- ```http
109
- POST /api/resources
110
- Content-Type: application/json
111
- ```
112
-
113
- **Body:**
114
- ```json
115
- {
116
- "name": "New Resource"
117
- }
118
- ```
119
-
120
- **Response:**
121
- ```json
122
- {
123
- "id": "2",
124
- "name": "New Resource",
125
- "createdAt": "2024-01-01T00:00:00.000Z"
126
- }
127
- ```
128
-
129
- **cURL Example:**
130
- ```bash
131
- curl -X POST http://localhost:3000/api/resources \
132
- -H "Content-Type: application/json" \
133
- -d '{"name": "New Resource"}'
134
- ```
135
-
136
- ---
137
-
138
- #### Update Resource
139
-
140
- **Request:**
141
- ```http
142
- PUT /api/resources/:id
143
- Content-Type: application/json
144
- ```
145
-
146
- **Body:**
147
- ```json
148
- {
149
- "name": "Updated Resource"
150
- }
151
- ```
152
-
153
- **Response:**
154
- ```json
155
- {
156
- "id": "1",
157
- "name": "Updated Resource",
158
- "updatedAt": "2024-01-01T00:00:00.000Z"
159
- }
160
- ```
161
-
162
- **cURL Example:**
163
- ```bash
164
- curl -X PUT http://localhost:3000/api/resources/1 \
165
- -H "Content-Type: application/json" \
166
- -d '{"name": "Updated Resource"}'
167
- ```
168
-
169
- ---
170
-
171
- #### Delete Resource
172
-
173
- **Request:**
174
- ```http
175
- DELETE /api/resources/:id
176
- ```
177
-
178
- **Response:**
179
- ```json
180
- {
181
- "success": true,
182
- "message": "Resource deleted"
183
- }
184
- ```
185
-
186
- **cURL Example:**
187
- ```bash
188
- curl -X DELETE http://localhost:3000/api/resources/1
189
- ```
190
-
191
- ---
192
-
193
- ## Error Responses
194
-
195
- All errors follow this format:
196
-
197
- ```json
198
- {
199
- "error": {
200
- "code": "ERROR_CODE",
201
- "message": "Human-readable error message"
202
- }
203
- }
204
- ```
205
-
206
- ### Error Codes
207
-
208
- | Code | HTTP Status | Description |
209
- |------|-------------|-------------|
210
- | `VALIDATION_ERROR` | 400 | Invalid request data |
211
- | `AUTHENTICATION_ERROR` | 401 | Not authenticated |
212
- | `AUTHORIZATION_ERROR` | 403 | Not authorized |
213
- | `NOT_FOUND` | 404 | Resource not found |
214
- | `CONFLICT_ERROR` | 409 | Resource conflict |
215
- | `RATE_LIMIT_ERROR` | 429 | Too many requests |
216
- | `INTERNAL_ERROR` | 500 | Server error |
217
-
218
- ### Error Examples
219
-
220
- **Validation Error:**
221
- ```json
222
- {
223
- "error": {
224
- "code": "VALIDATION_ERROR",
225
- "message": "Name is required"
226
- }
227
- }
228
- ```
229
-
230
- **Not Found:**
231
- ```json
232
- {
233
- "error": {
234
- "code": "NOT_FOUND",
235
- "message": "Resource not found"
236
- }
237
- }
238
- ```
239
-
240
- ## Rate Limiting
241
-
242
- > Add rate limiting details here if applicable
243
-
244
- ## Pagination
245
-
246
- List endpoints support pagination:
247
-
248
- ```http
249
- GET /api/resources?limit=10&offset=20
250
- ```
251
-
252
- Response includes pagination info:
253
- ```json
254
- {
255
- "data": [...],
256
- "total": 100,
257
- "limit": 10,
258
- "offset": 20
259
- }
260
- ```
261
-
262
- ## Next Steps
263
-
264
- - [Troubleshooting](04-TROUBLESHOOTING.md)
@@ -1,262 +0,0 @@
1
- # Troubleshooting Guide
2
-
3
- ## Common Issues
4
-
5
- ### Application Won't Start
6
-
7
- #### Symptom
8
- Application fails to start with configuration errors.
9
-
10
- #### Solution
11
- 1. Verify `.env` file exists
12
- 2. Check all required variables are set
13
- 3. Validate variable types
14
-
15
- ```bash
16
- # Check .env file
17
- cat .env
18
-
19
- # Verify Node version
20
- node --version
21
- ```
22
-
23
- ---
24
-
25
- ### Port Already in Use
26
-
27
- #### Symptom
28
- ```
29
- Error: listen EADDRINUSE: address already in use :::3000
30
- ```
31
-
32
- #### Solution
33
- 1. Find the process using the port:
34
- ```bash
35
- # Linux/macOS
36
- lsof -i :3000
37
-
38
- # Windows
39
- netstat -ano | findstr :3000
40
- ```
41
-
42
- 2. Kill the process or use a different port:
43
- ```bash
44
- # Change port in .env
45
- PORT=3001
46
- ```
47
-
48
- ---
49
-
50
- ### Build Errors
51
-
52
- #### Symptom
53
- TypeScript compilation fails.
54
-
55
- #### Solution
56
- 1. Clear build artifacts:
57
- ```bash
58
- rm -rf dist node_modules
59
- npm install
60
- npm run build
61
- ```
62
-
63
- 2. Check TypeScript version:
64
- ```bash
65
- npx tsc --version
66
- ```
67
-
68
- ---
69
-
70
- ### PM2 Issues
71
-
72
- #### Symptom
73
- PM2 daemon not starting or crashing.
74
-
75
- #### Solution
76
- 1. Check PM2 logs:
77
- ```bash
78
- npm run daemon:logs
79
- # or
80
- pm2 logs project-name
81
- ```
82
-
83
- 2. Check status:
84
- ```bash
85
- pm2 status
86
- ```
87
-
88
- 3. Restart PM2:
89
- ```bash
90
- pm2 delete all
91
- npm run daemon:start
92
- ```
93
-
94
- 4. Check memory usage:
95
- ```bash
96
- pm2 monit
97
- ```
98
-
99
- ---
100
-
101
- ### Connection Refused
102
-
103
- #### Symptom
104
- ```
105
- Error: connect ECONNREFUSED 127.0.0.1:3000
106
- ```
107
-
108
- #### Solution
109
- 1. Verify the application is running:
110
- ```bash
111
- pm2 status
112
- # or
113
- ps aux | grep node
114
- ```
115
-
116
- 2. Check the port configuration:
117
- ```bash
118
- echo $PORT
119
- ```
120
-
121
- 3. Test locally:
122
- ```bash
123
- curl http://localhost:3000/health
124
- ```
125
-
126
- ---
127
-
128
- ### Out of Memory
129
-
130
- #### Symptom
131
- Application crashes with memory errors.
132
-
133
- #### Solution
134
- 1. Increase Node memory limit:
135
- ```bash
136
- NODE_OPTIONS="--max-old-space-size=4096" npm start
137
- ```
138
-
139
- 2. Update PM2 memory limit in `ecosystem.config.cjs`:
140
- ```javascript
141
- max_memory_restart: '2G'
142
- ```
143
-
144
- ---
145
-
146
- ### Permission Errors
147
-
148
- #### Symptom
149
- ```
150
- Error: EACCES: permission denied
151
- ```
152
-
153
- #### Solution
154
- 1. Check file permissions:
155
- ```bash
156
- ls -la
157
- ```
158
-
159
- 2. Fix ownership:
160
- ```bash
161
- sudo chown -R $USER:$USER .
162
- ```
163
-
164
- 3. For npm global installs:
165
- ```bash
166
- npm config set prefix ~/.npm-global
167
- ```
168
-
169
- ---
170
-
171
- ## Debugging
172
-
173
- ### Enable Debug Logging
174
-
175
- ```bash
176
- LOG_LEVEL=debug npm start
177
- ```
178
-
179
- ### Check Application Logs
180
-
181
- ```bash
182
- # PM2 logs
183
- pm2 logs project-name --lines 100
184
-
185
- # Log files
186
- tail -f logs/pm2-out.log
187
- tail -f logs/pm2-error.log
188
- ```
189
-
190
- ### Test Endpoints
191
-
192
- ```bash
193
- # Health check
194
- curl -v http://localhost:3000/health
195
-
196
- # With headers
197
- curl -v -H "Content-Type: application/json" http://localhost:3000/api/endpoint
198
- ```
199
-
200
- ## Performance Issues
201
-
202
- ### Slow Response Times
203
-
204
- 1. Check resource usage:
205
- ```bash
206
- pm2 monit
207
- ```
208
-
209
- 2. Enable debug logging to identify bottlenecks
210
-
211
- 3. Profile the application:
212
- ```bash
213
- node --inspect dist/index.js
214
- ```
215
-
216
- ### High CPU Usage
217
-
218
- 1. Check for infinite loops in logs
219
- 2. Monitor with PM2:
220
- ```bash
221
- pm2 monit
222
- ```
223
-
224
- ## Getting Help
225
-
226
- If none of the above solutions work:
227
-
228
- 1. **Check GitHub Issues**: Search for similar problems
229
- 2. **Create an Issue**: Include:
230
- - Node.js version
231
- - OS and version
232
- - Error messages
233
- - Steps to reproduce
234
- 3. **Enable Debug Logging**: Attach relevant logs
235
-
236
- ## Useful Commands Reference
237
-
238
- ```bash
239
- # Check Node version
240
- node --version
241
-
242
- # Check npm version
243
- npm --version
244
-
245
- # View all environment variables
246
- printenv | grep -E "NODE|PORT|LOG"
247
-
248
- # Test connectivity
249
- curl -v http://localhost:3000/health
250
-
251
- # View PM2 status
252
- pm2 status
253
-
254
- # View PM2 logs
255
- pm2 logs --lines 50
256
-
257
- # Restart PM2 application
258
- pm2 restart project-name
259
-
260
- # Kill all PM2 processes
261
- pm2 kill
262
- ```
@@ -1,100 +0,0 @@
1
- <#
2
- .SYNOPSIS
3
- Installation script for the project.
4
-
5
- .DESCRIPTION
6
- Installs dependencies, builds the project, and sets up configuration.
7
-
8
- .EXAMPLE
9
- .\install.ps1
10
- #>
11
-
12
- $ErrorActionPreference = "Stop"
13
-
14
- function Write-Step {
15
- param([string]$Message)
16
- Write-Host "`n==> $Message" -ForegroundColor Cyan
17
- }
18
-
19
- function Write-Success {
20
- param([string]$Message)
21
- Write-Host "[OK] $Message" -ForegroundColor Green
22
- }
23
-
24
- function Write-Error {
25
- param([string]$Message)
26
- Write-Host "[ERROR] $Message" -ForegroundColor Red
27
- }
28
-
29
- Write-Host "Project Installation" -ForegroundColor Magenta
30
- Write-Host "====================" -ForegroundColor Magenta
31
-
32
- # Check Node.js
33
- Write-Step "Checking Node.js..."
34
- try {
35
- $nodeVersion = node --version
36
- Write-Success "Node.js $nodeVersion found"
37
- }
38
- catch {
39
- Write-Error "Node.js not found. Please install Node.js 18 or higher."
40
- exit 1
41
- }
42
-
43
- # Check npm
44
- Write-Step "Checking npm..."
45
- try {
46
- $npmVersion = npm --version
47
- Write-Success "npm $npmVersion found"
48
- }
49
- catch {
50
- Write-Error "npm not found."
51
- exit 1
52
- }
53
-
54
- # Install dependencies
55
- Write-Step "Installing dependencies..."
56
- npm install
57
- if ($LASTEXITCODE -ne 0) {
58
- Write-Error "Failed to install dependencies"
59
- exit 1
60
- }
61
- Write-Success "Dependencies installed"
62
-
63
- # Build project
64
- Write-Step "Building project..."
65
- npm run build
66
- if ($LASTEXITCODE -ne 0) {
67
- Write-Error "Build failed"
68
- exit 1
69
- }
70
- Write-Success "Build successful"
71
-
72
- # Create .env if not exists
73
- Write-Step "Checking configuration..."
74
- if (-not (Test-Path ".env")) {
75
- if (Test-Path ".env.example") {
76
- Copy-Item ".env.example" ".env"
77
- Write-Success "Created .env from .env.example"
78
- Write-Host "Please edit .env with your configuration." -ForegroundColor Yellow
79
- }
80
- else {
81
- Write-Host ".env.example not found, skipping .env creation" -ForegroundColor Yellow
82
- }
83
- }
84
- else {
85
- Write-Success ".env already exists"
86
- }
87
-
88
- # Create logs directory
89
- Write-Step "Creating logs directory..."
90
- if (-not (Test-Path "logs")) {
91
- New-Item -ItemType Directory -Path "logs" | Out-Null
92
- }
93
- Write-Success "Logs directory ready"
94
-
95
- Write-Host "`n" -NoNewline
96
- Write-Host "Installation complete!" -ForegroundColor Green
97
- Write-Host "`nNext steps:" -ForegroundColor Yellow
98
- Write-Host " 1. Edit .env with your configuration"
99
- Write-Host " 2. Run 'npm start' to start the application"
100
- Write-Host " 3. Or run 'npm run daemon:start' for background mode"
@@ -1,61 +0,0 @@
1
- <#
2
- .SYNOPSIS
3
- Start the application server.
4
-
5
- .DESCRIPTION
6
- Starts the application in foreground or daemon mode.
7
-
8
- .PARAMETER Daemon
9
- Run in daemon mode using PM2.
10
-
11
- .EXAMPLE
12
- .\start.ps1
13
- .\start.ps1 -Daemon
14
- #>
15
-
16
- param(
17
- [switch]$Daemon
18
- )
19
-
20
- $ErrorActionPreference = "Stop"
21
-
22
- function Write-Step {
23
- param([string]$Message)
24
- Write-Host "`n==> $Message" -ForegroundColor Cyan
25
- }
26
-
27
- function Write-Success {
28
- param([string]$Message)
29
- Write-Host "[OK] $Message" -ForegroundColor Green
30
- }
31
-
32
- # Navigate to project root
33
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
34
- $ProjectRoot = Resolve-Path (Join-Path $ScriptDir "..\..")
35
- Set-Location $ProjectRoot
36
-
37
- # Check if built
38
- if (-not (Test-Path "dist/index.js")) {
39
- Write-Step "Building project..."
40
- npm run build
41
- if ($LASTEXITCODE -ne 0) {
42
- Write-Host "[ERROR] Build failed" -ForegroundColor Red
43
- exit 1
44
- }
45
- }
46
-
47
- if ($Daemon) {
48
- Write-Step "Starting in daemon mode..."
49
- npm run daemon:start
50
- if ($LASTEXITCODE -eq 0) {
51
- Write-Success "Application started in daemon mode"
52
- Write-Host "`nUseful commands:" -ForegroundColor Yellow
53
- Write-Host " npm run daemon:status - Check status"
54
- Write-Host " npm run daemon:logs - View logs"
55
- Write-Host " npm run daemon:stop - Stop daemon"
56
- }
57
- }
58
- else {
59
- Write-Step "Starting application..."
60
- npm start
61
- }
@@ -1,37 +0,0 @@
1
- <#
2
- .SYNOPSIS
3
- Stop the application server.
4
-
5
- .DESCRIPTION
6
- Stops the application running in daemon mode.
7
-
8
- .EXAMPLE
9
- .\stop.ps1
10
- #>
11
-
12
- $ErrorActionPreference = "Stop"
13
-
14
- function Write-Step {
15
- param([string]$Message)
16
- Write-Host "`n==> $Message" -ForegroundColor Cyan
17
- }
18
-
19
- function Write-Success {
20
- param([string]$Message)
21
- Write-Host "[OK] $Message" -ForegroundColor Green
22
- }
23
-
24
- # Navigate to project root
25
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
26
- $ProjectRoot = Resolve-Path (Join-Path $ScriptDir "..\..")
27
- Set-Location $ProjectRoot
28
-
29
- Write-Step "Stopping application..."
30
- npm run daemon:stop
31
-
32
- if ($LASTEXITCODE -eq 0) {
33
- Write-Success "Application stopped"
34
- }
35
- else {
36
- Write-Host "[WARN] Application may not have been running" -ForegroundColor Yellow
37
- }