@roomi-fields/grillhouse 0.54.0 → 0.55.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.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +75 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
- package/cadre/templates/projet/CONTRIBUTING.md +0 -5
- package/cadre/templates/projet/README.md +0 -126
- package/cadre/templates/projet/_npmignore +1 -6
- package/cadre/templates/projet/package.json +5 -32
- package/cadre/templates/projet/tsconfig.json +4 -4
- package/cadre/templates/projet/vitest.config.cjs +3 -2
- package/charte/tests.md +14 -0
- package/dist/machine/part-par-sorte.d.ts +9 -9
- package/dist/machine/part-par-sorte.js +20 -24
- package/dist/machine/part-par-sorte.js.map +1 -1
- package/dist/machine/table-des-consommations.d.ts +65 -0
- package/dist/machine/table-des-consommations.js +94 -0
- package/dist/machine/table-des-consommations.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +2 -0
- package/dist/temporal/circuit/activites.js +87 -3
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/client.js +9 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +32 -4
- package/dist/temporal/circuit/deroule.js +54 -4
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/circuit/versions.d.ts +12 -0
- package/dist/temporal/circuit/versions.js +22 -0
- package/dist/temporal/circuit/versions.js.map +1 -0
- package/dist/temporal/consommation/activites.d.ts +2 -0
- package/dist/temporal/consommation/activites.js +9 -0
- package/dist/temporal/consommation/activites.js.map +1 -0
- package/dist/temporal/consommation/actualisation.d.ts +2 -0
- package/dist/temporal/consommation/actualisation.js +71 -0
- package/dist/temporal/consommation/actualisation.js.map +1 -0
- package/dist/temporal/consommation/client.d.ts +12 -0
- package/dist/temporal/consommation/client.js +28 -0
- package/dist/temporal/consommation/client.js.map +1 -0
- package/dist/temporal/consommation/commande.d.ts +5 -0
- package/dist/temporal/consommation/commande.js +32 -0
- package/dist/temporal/consommation/commande.js.map +1 -0
- package/dist/temporal/consommation/contrat.d.ts +15 -0
- package/dist/temporal/consommation/contrat.js +13 -0
- package/dist/temporal/consommation/contrat.js.map +1 -0
- package/dist/temporal/consommation/deroule.d.ts +2 -0
- package/dist/temporal/consommation/deroule.js +14 -0
- package/dist/temporal/consommation/deroule.js.map +1 -0
- package/dist/temporal/deroules.d.ts +2 -1
- package/dist/temporal/deroules.js +3 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +2 -0
- package/dist/temporal/file/deroule.js +14 -4
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +6 -0
- package/dist/temporal/installation.js +15 -0
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +2 -1
- package/dist/temporal/nuits/activites.js +127 -3
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/client.d.ts +19 -5
- package/dist/temporal/nuits/client.js +33 -23
- package/dist/temporal/nuits/client.js.map +1 -1
- package/dist/temporal/nuits/commande.js +16 -11
- package/dist/temporal/nuits/commande.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +29 -0
- package/dist/temporal/nuits/contrat.js +10 -0
- package/dist/temporal/nuits/contrat.js.map +1 -1
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +18 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/nuits/pc2.d.ts +72 -0
- package/dist/temporal/nuits/pc2.js +206 -0
- package/dist/temporal/nuits/pc2.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +23 -1
- package/dist/temporal/places/activites.js +38 -2
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +16 -0
- package/dist/temporal/places/client.js +25 -1
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +79 -14
- package/dist/temporal/places/contrat.js +7 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +159 -23
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/places/reservation.d.ts +54 -0
- package/dist/temporal/places/reservation.js +69 -0
- package/dist/temporal/places/reservation.js.map +1 -0
- package/dist/temporal/planification.d.ts +6 -0
- package/dist/temporal/planification.js +26 -0
- package/dist/temporal/planification.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +0 -2
- package/dist/temporal/tickets/activites.js +2 -52
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +7 -26
- package/dist/temporal/tickets/deroule.js +35 -23
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.js +2 -0
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/CADRE.md +1 -1
- package/docs/INTERFACE.md +16 -11
- package/docs/architecture/circuit.md +62 -58
- package/docs/architecture/entree.md +87 -63
- package/docs/architecture/greffon.md +32 -27
- package/docs/architecture/installation.md +43 -32
- package/docs/architecture/machine.md +48 -40
- package/docs/architecture/tests.md +37 -33
- package/docs/lexique.md +4 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +351 -180
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-de-la-machine.mjs +3 -22
- package/scripts/avancement.mjs +21 -30
- package/scripts/bilan.mjs +22 -2
- package/scripts/branche-de-nuit.mjs +1 -1
- package/scripts/circuit.mjs +75 -39
- package/scripts/codes-de-sortie.mjs +0 -6
- package/scripts/consommation-des-passes.mjs +67 -31
- package/scripts/consommation.mjs +152 -24
- package/scripts/copies-finies.mjs +15 -35
- package/scripts/dernier-vert.mjs +4 -5
- package/scripts/dette.mjs +5 -3
- package/scripts/droits.mjs +2 -2
- package/scripts/echantillonneur-de-la-passe.mjs +7 -31
- package/scripts/engendres.mjs +5 -61
- package/scripts/enveloppe/enveloppe.mjs +30 -34
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
- package/scripts/etapes.mjs +21 -7
- package/scripts/etat-du-depot.mjs +61 -0
- package/scripts/faits-du-circuit.mjs +7 -4
- package/scripts/fermeture-de-la-machine.d.mts +6 -4
- package/scripts/fermeture-de-la-machine.mjs +12 -16
- package/scripts/fichier-du-poste.d.mts +9 -0
- package/scripts/file-des-tickets.d.mts +0 -18
- package/scripts/file-des-tickets.mjs +0 -42
- package/scripts/fusion-du-changelog.mjs +1 -1
- package/scripts/greffons.mjs +282 -17
- package/scripts/grillhouse-maj.mjs +1 -1
- package/scripts/index-des-rouges.d.mts +40 -0
- package/scripts/index-des-rouges.mjs +104 -0
- package/scripts/integration/file.mjs +13 -63
- package/scripts/integration/integrer.mjs +157 -424
- package/scripts/integration/jugement.mjs +109 -0
- package/scripts/integration/rejeu.mjs +94 -71
- package/scripts/jointure.d.ts +34 -27
- package/scripts/journal-des-etats.d.mts +1 -1
- package/scripts/langages/c/commandes.mjs +27 -12
- package/scripts/langages/cargo/commandes.mjs +148 -94
- package/scripts/langages/cargo/index.mjs +2 -1
- package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
- package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/python/commandes.mjs +31 -15
- package/scripts/langages/python/index.mjs +2 -1
- package/scripts/langages/python/lectures-des-tests.mjs +148 -0
- package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
- package/scripts/langages/typescript/index.mjs +4 -0
- package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
- package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
- package/scripts/langages/typescript/tests.mjs +11 -37
- package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
- package/scripts/langages/typescript/verifier.mjs +74 -44
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
- package/scripts/lectures-communes.mjs +234 -0
- package/scripts/machine.mjs +11 -18
- package/scripts/mesure/base-de-passe.mjs +1 -2
- package/scripts/mesure-de-la-machine.d.mts +40 -3
- package/scripts/mesure-de-la-machine.mjs +201 -11
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
- package/scripts/migrations/nuit-yml-retire.mjs +25 -0
- package/scripts/migrations/part-retiree.mjs +31 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/montee.mjs +22 -1
- package/scripts/nuit-de-pc2.mjs +628 -0
- package/scripts/nuit.sh +8 -131
- package/scripts/paquets.mjs +1 -1
- package/scripts/passe-de-la-machine.mjs +340 -103
- package/scripts/place-du-circuit.d.mts +15 -0
- package/scripts/place-du-circuit.mjs +32 -0
- package/scripts/places-de-la-machine.mjs +148 -626
- package/scripts/places-du-serveur.mjs +26 -13
- package/scripts/plafond-de-la-machine.d.mts +8 -13
- package/scripts/plafond-de-la-machine.mjs +26 -56
- package/scripts/registre-des-entrees.mjs +57 -0
- package/scripts/regles-des-places.d.mts +82 -50
- package/scripts/regles-des-places.mjs +192 -156
- package/scripts/retirer-copie.sh +9 -2
- package/scripts/seances.mjs +181 -63
- package/scripts/secours.mjs +95 -0
- package/scripts/services-du-noyau.mjs +11 -19
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/sous-modules.sh +1 -1
- package/scripts/superviseur.mjs +98 -20
- package/scripts/table-des-consommations.d.mts +9 -0
- package/scripts/table-des-consommations.mjs +35 -0
- package/scripts/tableau.mjs +33 -19
- package/scripts/taches-du-graphe.mjs +124 -2
- package/scripts/transitions.d.mts +27 -5
- package/scripts/transitions.mjs +122 -104
- package/scripts/verdict-de-la-nuit.d.mts +13 -0
- package/scripts/verdict-de-la-nuit.mjs +34 -7
- package/scripts/verrou-de-fichier.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +2 -2
- package/skills/developpeur/SKILL.md +8 -2
- package/skills/direct/SKILL.md +5 -0
- package/skills/explorateur/SKILL.md +10 -1
- package/skills/grill/SKILL.md +2 -4
- package/skills/pitmaster/SKILL.md +14 -7
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/relecteur/SKILL.md +4 -1
- package/skills/testwriter/SKILL.md +15 -2
- package/cadre/templates/projet/.env.example +0 -57
- package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
- package/cadre/templates/projet/deployment/README.md +0 -98
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
- package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
- package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
- package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
- package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
- package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
- package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
- package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
- package/cadre/templates/projet/ecosystem.config.cjs +0 -73
- package/cadre/templates/projet/src/config.ts +0 -68
- package/cadre/templates/projet/src/errors.ts +0 -102
- package/cadre/templates/projet/src/index.ts +0 -46
- package/cadre/templates/projet/src/services/.gitkeep +0 -8
- package/cadre/templates/projet/src/types/index.ts +0 -24
- package/cadre/templates/projet/src/utils/logger.ts +0 -106
- package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
- package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
- package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
- package/cadre/templates/projet/tsconfig.build.json +0 -14
- package/scripts/flux-de-la-nuit.mjs +0 -39
- package/scripts/garde-de-la-memoire.mjs +0 -231
- package/scripts/repli-de-la-nuit.mjs +0 -184
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
# Configuration Guide
|
|
2
|
-
|
|
3
|
-
## Environment Variables
|
|
4
|
-
|
|
5
|
-
All configuration is done through environment variables. Create a `.env` file in the project root.
|
|
6
|
-
|
|
7
|
-
### Required Variables
|
|
8
|
-
|
|
9
|
-
| Variable | Description | Example |
|
|
10
|
-
|----------|-------------|---------|
|
|
11
|
-
| `NODE_ENV` | Environment mode | `production` |
|
|
12
|
-
|
|
13
|
-
### Optional Variables
|
|
14
|
-
|
|
15
|
-
| Variable | Description | Default |
|
|
16
|
-
|----------|-------------|---------|
|
|
17
|
-
| `PORT` | Server port | `3000` |
|
|
18
|
-
| `LOG_LEVEL` | Logging verbosity | `info` |
|
|
19
|
-
|
|
20
|
-
## Configuration File
|
|
21
|
-
|
|
22
|
-
### .env Template
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
# Environment
|
|
26
|
-
NODE_ENV=production
|
|
27
|
-
|
|
28
|
-
# Server
|
|
29
|
-
PORT=3000
|
|
30
|
-
|
|
31
|
-
# Logging
|
|
32
|
-
LOG_LEVEL=info
|
|
33
|
-
|
|
34
|
-
# Add your configuration here
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Environment-Specific Configuration
|
|
38
|
-
|
|
39
|
-
### Development
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
NODE_ENV=development
|
|
43
|
-
LOG_LEVEL=debug
|
|
44
|
-
PORT=3000
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Production
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
NODE_ENV=production
|
|
51
|
-
LOG_LEVEL=warn
|
|
52
|
-
PORT=8080
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Test
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
NODE_ENV=test
|
|
59
|
-
LOG_LEVEL=error
|
|
60
|
-
PORT=3001
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Advanced Configuration
|
|
64
|
-
|
|
65
|
-
### Logging Levels
|
|
66
|
-
|
|
67
|
-
| Level | Description | When to Use |
|
|
68
|
-
|-------|-------------|-------------|
|
|
69
|
-
| `debug` | Detailed debug info | Development |
|
|
70
|
-
| `info` | General information | Default |
|
|
71
|
-
| `warn` | Warning messages | Production |
|
|
72
|
-
| `error` | Error messages only | Minimal logging |
|
|
73
|
-
|
|
74
|
-
### PM2 Configuration
|
|
75
|
-
|
|
76
|
-
The `ecosystem.config.cjs` file configures PM2 daemon mode:
|
|
77
|
-
|
|
78
|
-
```javascript
|
|
79
|
-
module.exports = {
|
|
80
|
-
apps: [{
|
|
81
|
-
name: 'project-name',
|
|
82
|
-
script: 'dist/index.js',
|
|
83
|
-
instances: 1,
|
|
84
|
-
autorestart: true,
|
|
85
|
-
max_memory_restart: '1G',
|
|
86
|
-
env: {
|
|
87
|
-
NODE_ENV: 'production',
|
|
88
|
-
PORT: 3000
|
|
89
|
-
}
|
|
90
|
-
}]
|
|
91
|
-
};
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Validation
|
|
95
|
-
|
|
96
|
-
Configuration is validated at startup. Invalid configuration will prevent the application from starting.
|
|
97
|
-
|
|
98
|
-
### Common Validation Errors
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
Invalid environment configuration:
|
|
102
|
-
- PORT: Expected number, received string
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**Solution**: Ensure all required variables are set with correct types.
|
|
106
|
-
|
|
107
|
-
## Security Considerations
|
|
108
|
-
|
|
109
|
-
1. **Never commit `.env` files** to version control
|
|
110
|
-
2. **Use strong secrets** in production
|
|
111
|
-
3. **Limit log verbosity** in production
|
|
112
|
-
4. **Rotate secrets** regularly
|
|
113
|
-
|
|
114
|
-
## Next Steps
|
|
115
|
-
|
|
116
|
-
- [API Reference](03-API.md)
|
|
117
|
-
- [Troubleshooting](04-TROUBLESHOOTING.md)
|
|
@@ -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"
|