@darkj/create-db 1.0.0 → 1.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jaimehuaycho
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,4 +1,7 @@
1
- # create-db
1
+ # @darkj/create-db
2
+
3
+ [![CI](https://github.com/jaimehuaycho/create-db/actions/workflows/ci.yml/badge.svg)](https://github.com/jaimehuaycho/create-db/actions/workflows/ci.yml)
4
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
2
5
 
3
6
  CLI to scaffold PostgreSQL database projects with a modular, maintainable structure.
4
7
 
@@ -9,16 +12,18 @@ Generates a project with two independent layers:
9
12
  ## Usage
10
13
 
11
14
  ```bash
12
- npx create-db
15
+ npx @darkj/create-db
13
16
  ```
14
17
 
15
- Prompts for a project name and whether you'll use Claude Code, then scaffolds the project and installs dependencies.
18
+ Prompts for a project name, whether you'll use Claude Code, and the language for user-facing docs
19
+ (English or Spanish), then scaffolds the project and installs dependencies.
16
20
 
17
21
  ## What gets generated
18
22
 
19
23
  ```
20
24
  my-project-db/
21
25
  ├── init.sql ← DROP ALL + reload schema (for fresh DBs)
26
+ ├── README.md ← in the language you picked
22
27
  ├── package.json ← npm run build / migrate / rollback
23
28
  ├── tsconfig.json
24
29
  ├── .env.example ← copy to .env and fill credentials
@@ -32,6 +37,9 @@ my-project-db/
32
37
  └── backups/ ← pg_dump outputs go here (gitignored)
33
38
  ```
34
39
 
40
+ Only `README.md` and each table's `DICTIONARY.md` follow the language you pick — everything else,
41
+ including the `.claude/` folder, is always in English.
42
+
35
43
  ## Available commands in the generated project
36
44
 
37
45
  ```bash
@@ -41,6 +49,9 @@ npm run rollback # revert last migration
41
49
  npm run rollback 3 # revert last 3 migrations
42
50
  ```
43
51
 
52
+ Each run of `migrate`/`rollback` is wrapped in a single transaction — if any migration in the
53
+ batch fails, everything applied earlier in that same run is rolled back too.
54
+
44
55
  ## Two workflows
45
56
 
46
57
  **Fresh database (dev, CI, new environment)**
@@ -55,16 +66,24 @@ npm run migrate
55
66
 
56
67
  ## Requirements
57
68
 
58
- - Node.js >= 18
69
+ - Node.js >= 20
59
70
  - PostgreSQL
60
71
 
61
72
  ## Getting started
62
73
 
63
74
  ```bash
64
- npx create-db
75
+ npx @darkj/create-db
65
76
 
66
77
  cd my-project-db
67
78
  cp .env.example .env # fill in DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
68
79
  npm run build # test with no DB needed
69
80
  psql -U user -d mydb -f init.sql # initialize a fresh DB
70
81
  ```
82
+
83
+ ## Development
84
+
85
+ ```bash
86
+ npm install
87
+ npm run build # tsc
88
+ npm test # vitest — template copying, placeholder substitution
89
+ ```
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildReadme = buildReadme;
4
+ // The generated project's top-level README — the one thing (along with each table's
5
+ // DICTIONARY.md) that follows the language picked at scaffold time. Everything else
6
+ // the CLI generates, including .claude/, stays in English regardless of this choice.
7
+ function buildReadme(projectName, language) {
8
+ return language === 'es' ? buildSpanish(projectName) : buildEnglish(projectName);
9
+ }
10
+ function buildEnglish(projectName) {
11
+ return `# ${projectName}
12
+
13
+ PostgreSQL database project generated with [create-db](https://www.npmjs.com/package/@darkj/create-db).
14
+
15
+ ## Structure
16
+
17
+ - \`schema/\` — current design: table definitions organized by domain
18
+ - \`migrations/\` — history: incremental changes applied to existing databases
19
+
20
+ ## Commands
21
+
22
+ | Command | Does | Needs a DB |
23
+ |---|---|---|
24
+ | \`npm run build\` | Merges \`schema/\` into \`db-output.sql\` | No |
25
+ | \`npm run migrate\` | Applies pending migrations | Yes |
26
+ | \`npm run rollback [N]\` | Reverts the last N migrations (default 1) | Yes |
27
+
28
+ ## Two workflows
29
+
30
+ **Fresh database (dev, CI, new environment)**
31
+ \`\`\`bash
32
+ psql -U user -d dbname -f init.sql
33
+ \`\`\`
34
+
35
+ **Existing database with data**
36
+ \`\`\`bash
37
+ npm run migrate
38
+ \`\`\`
39
+
40
+ ## Getting started
41
+
42
+ \`\`\`bash
43
+ cp .env.example .env # fill in DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
44
+ npm run build # test with no DB needed
45
+ psql -U user -d dbname -f init.sql # initialize a fresh DB
46
+ \`\`\`
47
+ `;
48
+ }
49
+ function buildSpanish(projectName) {
50
+ return `# ${projectName}
51
+
52
+ Proyecto de base de datos PostgreSQL generado con [create-db](https://www.npmjs.com/package/@darkj/create-db).
53
+
54
+ ## Estructura
55
+
56
+ - \`schema/\` — diseño actual: definición de tablas organizadas por dominio
57
+ - \`migrations/\` — historia: cambios incrementales aplicados a bases de datos existentes
58
+
59
+ ## Comandos
60
+
61
+ | Comando | Hace | Necesita DB |
62
+ |---|---|---|
63
+ | \`npm run build\` | Fusiona \`schema/\` en \`db-output.sql\` | No |
64
+ | \`npm run migrate\` | Aplica las migraciones pendientes | Sí |
65
+ | \`npm run rollback [N]\` | Revierte las últimas N migraciones (default 1) | Sí |
66
+
67
+ ## Dos flujos
68
+
69
+ **Base de datos vacía (dev, CI, entorno nuevo)**
70
+ \`\`\`bash
71
+ psql -U user -d dbname -f init.sql
72
+ \`\`\`
73
+
74
+ **Base de datos existente con datos**
75
+ \`\`\`bash
76
+ npm run migrate
77
+ \`\`\`
78
+
79
+ ## Cómo empezar
80
+
81
+ \`\`\`bash
82
+ cp .env.example .env # completar DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
83
+ npm run build # probar sin necesidad de DB
84
+ psql -U user -d dbname -f init.sql # inicializar una DB nueva
85
+ \`\`\`
86
+ `;
87
+ }
package/dist/generator.js CHANGED
@@ -33,11 +33,17 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.copyDir = copyDir;
36
37
  exports.generateProject = generateProject;
37
38
  const fs = __importStar(require("fs"));
38
39
  const path = __importStar(require("path"));
39
40
  const child_process_1 = require("child_process");
41
+ const readme_1 = require("./builders/readme");
40
42
  const TEMPLATES_DIR = path.join(__dirname, '..', 'templates');
43
+ const LANGUAGE_LABELS = {
44
+ en: 'English',
45
+ es: 'Spanish',
46
+ };
41
47
  function copyDir(src, dest, vars = {}, skip = []) {
42
48
  fs.mkdirSync(dest, { recursive: true });
43
49
  for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
@@ -58,15 +64,22 @@ function copyDir(src, dest, vars = {}, skip = []) {
58
64
  }
59
65
  }
60
66
  }
61
- async function generateProject({ projectName, targetDir, withClaude }) {
67
+ async function generateProject({ projectName, targetDir, withClaude, language }) {
62
68
  if (fs.existsSync(targetDir)) {
63
69
  throw new Error(`Directory "${projectName}" already exists.`);
64
70
  }
65
71
  // 1. Copy template files (skip .claude if not needed)
72
+ // DOC_LANGUAGE_LABEL only affects .claude/CLAUDE.md — it tells Claude which language to
73
+ // write user-facing docs (README.md, table DICTIONARY.md) in. The .claude/ prose itself
74
+ // always stays in English, regardless of this choice.
66
75
  const skip = withClaude ? [] : ['.claude'];
67
- copyDir(path.join(TEMPLATES_DIR, 'base'), targetDir, { PROJECT_NAME: projectName }, skip);
76
+ const vars = { PROJECT_NAME: projectName, DOC_LANGUAGE_LABEL: LANGUAGE_LABELS[language] };
77
+ copyDir(path.join(TEMPLATES_DIR, 'base'), targetDir, vars, skip);
68
78
  console.log(` ✓ Template files copied${withClaude ? ' (with .claude)' : ''}`);
69
- // 2. Generate package.json with the project name and scripts (no pinned versions)
79
+ // 2. Generate the project README in the chosen language
80
+ fs.writeFileSync(path.join(targetDir, 'README.md'), (0, readme_1.buildReadme)(projectName, language));
81
+ console.log(` ✓ README.md generated (${LANGUAGE_LABELS[language]})`);
82
+ // 3. Generate package.json with the project name and scripts (no pinned versions)
70
83
  const pkg = {
71
84
  name: projectName,
72
85
  version: '1.0.0',
@@ -78,7 +91,7 @@ async function generateProject({ projectName, targetDir, withClaude }) {
78
91
  };
79
92
  fs.writeFileSync(path.join(targetDir, 'package.json'), JSON.stringify(pkg, null, 2) + '\n');
80
93
  console.log(' ✓ package.json generated');
81
- // 3. Install dependencies (latest versions at scaffold time)
94
+ // 4. Install dependencies (latest versions at scaffold time)
82
95
  console.log(' Installing dependencies...');
83
96
  (0, child_process_1.execSync)('npm install pg', { cwd: targetDir, stdio: 'inherit' });
84
97
  (0, child_process_1.execSync)('npm install -D tsx typescript @types/node @types/pg', { cwd: targetDir, stdio: 'inherit' });
package/dist/index.js CHANGED
@@ -57,12 +57,29 @@ async function main() {
57
57
  p.cancel('Cancelled.');
58
58
  process.exit(0);
59
59
  }
60
+ const language = await p.select({
61
+ message: 'Language for README.md and table dictionaries',
62
+ options: [
63
+ { value: 'en', label: 'English' },
64
+ { value: 'es', label: 'Español' },
65
+ ],
66
+ initialValue: 'en',
67
+ });
68
+ if (p.isCancel(language)) {
69
+ p.cancel('Cancelled.');
70
+ process.exit(0);
71
+ }
60
72
  const name = projectName;
61
73
  const targetDir = path.join(process.cwd(), name);
62
74
  p.log.step('Scaffolding database project...');
63
75
  console.log();
64
76
  try {
65
- await (0, generator_1.generateProject)({ projectName: name, targetDir, withClaude: useClaude });
77
+ await (0, generator_1.generateProject)({
78
+ projectName: name,
79
+ targetDir,
80
+ withClaude: useClaude,
81
+ language: language,
82
+ });
66
83
  }
67
84
  catch (err) {
68
85
  p.log.error(String(err));
package/package.json CHANGED
@@ -1,32 +1,55 @@
1
1
  {
2
2
  "name": "@darkj/create-db",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "CLI to scaffold PostgreSQL database projects with a modular, maintainable structure",
5
- "bin": {
6
- "create-db": "./dist/index.js"
5
+ "author": "jaimehuaycho",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/jaimehuaycho/create-db.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/jaimehuaycho/create-db/issues"
13
+ },
14
+ "homepage": "https://github.com/jaimehuaycho/create-db#readme",
15
+ "engines": {
16
+ "node": ">=20"
7
17
  },
8
18
  "publishConfig": {
9
19
  "access": "public"
10
20
  },
11
- "scripts": {
12
- "build": "tsc",
13
- "prepare": "npm run build",
14
- "dev": "ts-node src/index.ts",
15
- "start": "node dist/index.js"
21
+ "bin": {
22
+ "create-db": "./dist/index.js"
16
23
  },
17
- "engines": {
18
- "node": ">=18"
24
+ "scripts": {
25
+ "build": "tsc",
26
+ "prepare": "npm run build",
27
+ "dev": "ts-node src/index.ts",
28
+ "start": "node dist/index.js",
29
+ "test": "vitest run",
30
+ "test:watch": "vitest",
31
+ "prepublishOnly": "npm run build"
19
32
  },
20
33
  "files": [
21
34
  "dist",
22
35
  "templates"
23
36
  ],
37
+ "keywords": [
38
+ "postgresql",
39
+ "postgres",
40
+ "scaffold",
41
+ "cli",
42
+ "generator",
43
+ "sql",
44
+ "migrations"
45
+ ],
24
46
  "dependencies": {
25
47
  "@clack/prompts": "^0.7.0"
26
48
  },
27
49
  "devDependencies": {
28
50
  "@types/node": "^20.11.5",
29
51
  "ts-node": "^10.9.2",
30
- "typescript": "^5.3.3"
52
+ "typescript": "^5.3.3",
53
+ "vitest": "^4.1.11"
31
54
  }
32
55
  }
@@ -1,83 +1,92 @@
1
1
  # {{PROJECT_NAME}}
2
2
 
3
- Base de datos PostgreSQL generada con `create-db`.
4
- Mi rol aquí es asistir en el diseño, organización, análisis y evolución de esta DB.
3
+ PostgreSQL databasegenerated with `create-db`.
4
+ My role here is to assist with the design, organization, analysis, and evolution of this database.
5
5
 
6
6
  ---
7
7
 
8
- ## Cómo funciona
8
+ ## Documentation language
9
9
 
10
- ### Dos capas independientes
10
+ User-facing docs `README.md` and each table's `DICTIONARY.md` — are written in **{{DOC_LANGUAGE_LABEL}}**.
11
+ Everything else (this file, `.claude/rules/`, `.claude/commands/`, code comments) stays in English,
12
+ regardless of that choice.
13
+
14
+ ---
15
+
16
+ ## How it works
17
+
18
+ ### Two independent layers
11
19
 
12
20
  ```
13
- schema/ → diseño actual: qué tablas existen y cómo están definidas
14
- migrations/ → historia: qué cambió, en qué orden, ya aplicado a DBs reales
21
+ schema/ → current design: which tables exist and how they're defined
22
+ migrations/ → history: what changed, in what order, already applied to real databases
15
23
  ```
16
24
 
17
- Editar `schema/` no afecta una DB existente. Para cambiar una DB con datos, siempre hay que crear una migración.
25
+ Editing `schema/` does not affect an existing database. To change a database that has data,
26
+ a migration must always be created.
18
27
 
19
- ### Dos flujos
28
+ ### Two workflows
20
29
 
21
- | Situación | Comando |
30
+ | Situation | Command |
22
31
  |---|---|
23
- | DB vacía (dev, CI, nuevo entorno) | `psql -U user -d dbname -f init.sql` |
24
- | DB existente con datos reales | `npm run migrate` |
32
+ | Empty DB (dev, CI, new environment) | `psql -U user -d dbname -f init.sql` |
33
+ | Existing DB with real data | `npm run migrate` |
25
34
 
26
35
  ### Scripts
27
36
 
28
- | Comando | Hace | Necesita DB |
37
+ | Command | Does | Needs a DB |
29
38
  |---|---|---|
30
- | `npm run build` | Fusiona todo `schema/` en `db-output.sql` siguiendo los `\i` recursivamente | No |
31
- | `init.sql` | DROP de todo + carga `schema/` desde cero | |
32
- | `npm run migrate` | Aplica solo las migraciones de `migrations/` aún no registradas en `_migrations` | |
33
- | `npm run rollback [N]` | Revierte las últimas N migraciones ejecutando su `down.sql` (default: 1) | |
39
+ | `npm run build` | Merges all of `schema/` into `db-output.sql`, following the `\i` recursively | No |
40
+ | `init.sql` | Drops everything + loads `schema/` from scratch | Yes |
41
+ | `npm run migrate` | Applies only the `migrations/` not yet registered in `migrations` | Yes |
42
+ | `npm run rollback [N]` | Reverts the last N migrations by running their `down.sql` (default: 1) | Yes |
34
43
 
35
- ### Estructura del schema
44
+ ### Schema structure
36
45
 
37
46
  ```
38
47
  schema/
39
- ├── init.sql ← orden global (dependencias primero)
40
- ├── tabla-standalone/ ← tabla transversal a varios dominios
48
+ ├── init.sql ← global order (dependencies first)
49
+ ├── standalone-table/ ← table shared across several domains
41
50
  │ ├── create.sql
42
51
  │ ├── data.sql
43
52
  │ ├── init.sql
44
53
  │ └── DICTIONARY.md
45
- └── nombre-grupo/ dominio lógico (auth, orders, catalog…)
46
- ├── init.sql orden dentro del grupo
47
- └── tabla/
54
+ └── group-name/ logical domain (auth, orders, catalog…)
55
+ ├── init.sql order within the group
56
+ └── table/
48
57
  ├── create.sql
49
58
  ├── data.sql
50
- ├── triggers.sql solo si aplica
59
+ ├── triggers.sql only if it applies
51
60
  ├── init.sql
52
61
  └── DICTIONARY.md
53
62
  ```
54
63
 
55
- El orden de dependencias es **siempre manual**. Quien referencia va después del referenciado.
64
+ Dependency order is **always manual**. Whatever references another table goes after the referenced one.
56
65
 
57
66
  ---
58
67
 
59
- ## Comandos disponibles
68
+ ## Available commands
60
69
 
61
- - `/analyze` — análisis rápido de la DB actual (estructura, relaciones, catálogos, triggers)
62
- - `/new-migration` — guía interactiva para crear una migración correctamente
63
- - `/new-dictionary` — genera el `DICTIONARY.md` de una tabla a partir de su `create.sql`
64
- - `/build` — corre `npm run build` y explica el `db-output.sql` generado
65
- - `/backup` — crea un dump de la DB con nombre y ubicación correctos
70
+ - `/analyze` — quick analysis of the current DB (structure, relationships, catalogs, triggers)
71
+ - `/new-migration` — interactive guide to correctly create a migration
72
+ - `/new-dictionary` — generates a table's `DICTIONARY.md` from its `create.sql`
73
+ - `/build` — runs `npm run build` and explains the generated `db-output.sql`
74
+ - `/backup` — creates a DB dump with the correct name and location
66
75
 
67
76
  ---
68
77
 
69
78
  ## Backups
70
79
 
71
- Los dumps van en `backups/` con formato: `YYYYMMDD_HHMMSS_descripcion.sql`
80
+ Dumps go in `backups/` with the format: `YYYYMMDD_HHMMSS_description.sql`
72
81
 
73
82
  ```bash
74
- pg_dump -U user -d dbname -F p -f backups/$(date +%Y%m%d_%H%M%S)_descripcion.sql
83
+ pg_dump -U user -d dbname -F p -f backups/$(date +%Y%m%d_%H%M%S)_description.sql
75
84
  ```
76
85
 
77
- Los archivos `.sql` dentro de `backups/` están en `.gitignore` — no se suben al repo.
86
+ The `.sql` files inside `backups/` are in `.gitignore` — they are not pushed to the repo.
78
87
 
79
88
  ---
80
89
 
81
- ## Learnings de este proyecto
90
+ ## Learnings from this project
82
91
 
83
- <!-- Aquí se van agregando decisiones, patrones y convenciones específicas de esta DB -->
92
+ <!-- Decisions, patterns, and conventions specific to this DB get added here -->
@@ -1,18 +1,18 @@
1
- Analiza la base de datos de este proyecto siguiendo estos pasos en orden:
1
+ Analyze this project's database following these steps in order:
2
2
 
3
- 1. Lee `schema/init.sql` para ver el orden global: qué grupos y tablas standalone existen
4
- 2. Por cada grupo, lee su `init.sql` para ver las tablas que contiene y su orden de dependencia
5
- 3. Por cada tabla, lee su `create.sql` para ver estructura de columnas, tipos, constraints y FKs
6
- 4. Lee cada `data.sql` para identificar qué datos son de catálogo/configuración inicial
7
- 5. Lee cada `triggers.sql` donde exista para entender lógica automática en la DB
8
- 6. Lee `migrations/` en orden para ver la historia de cambios desde el baseline
3
+ 1. Read `schema/init.sql` to see the global order: which groups and standalone tables exist
4
+ 2. For each group, read its `init.sql` to see the tables it contains and their dependency order
5
+ 3. For each table, read its `create.sql` to see column structure, types, constraints, and FKs
6
+ 4. Read each `data.sql` to identify which data is catalog/initial configuration
7
+ 5. Read each `triggers.sql` where it exists to understand automatic logic in the DB
8
+ 6. Read `migrations/` in order to see the history of changes since the baseline
9
9
 
10
- Con todo eso, produce un reporte estructurado que incluya:
10
+ With all that, produce a structured report that includes:
11
11
 
12
- - **Resumen**: qué hace esta base de datos, en una oración
13
- - **Grupos y tablas**: lista jerárquica de grupostablas con descripción de cada una
14
- - **Relaciones clave**: las FKs más importantes y qué representan
15
- - **Datos de catálogo**: qué tablas tienen datos iniciales y qué contienen
16
- - **Lógica en DB**: triggers existentes y qué hacen
17
- - **Historia de cambios**: qué migraciones hay y qué cambió en cada una
18
- - **Observaciones**: algo que llame la atención (diseño, dependencias, datos faltantes, etc.)
12
+ - **Summary**: what this database does, in one sentence
13
+ - **Groups and tables**: hierarchical list of groupstables with a description of each
14
+ - **Key relationships**: the most important FKs and what they represent
15
+ - **Catalog data**: which tables have initial data and what it contains
16
+ - **Logic in the DB**: existing triggers and what they do
17
+ - **Change history**: which migrations exist and what changed in each
18
+ - **Observations**: anything noteworthy (design, dependencies, missing data, etc.)
@@ -1,19 +1,19 @@
1
- Creá un backup de la base de datos en el directorio `backups/`.
1
+ Create a database backup in the `backups/` directory.
2
2
 
3
- Primero leé `.env` para obtener las credenciales (DB_HOST, DB_PORT, DB_USER, DB_NAME).
3
+ First read `.env` to get the credentials (DB_HOST, DB_PORT, DB_USER, DB_NAME).
4
4
 
5
- Preguntame una descripción breve del backup (ej: "before_migration_005", "pre_launch", "post_seed").
5
+ Ask for a short description of the backup (e.g. "before_migration_005", "pre_launch", "post_seed").
6
6
 
7
- Luego mostrá el comando exacto a correr:
7
+ Then show the exact command to run:
8
8
 
9
9
  ```bash
10
10
  pg_dump -U {DB_USER} -h {DB_HOST} -p {DB_PORT} -d {DB_NAME} -F p \
11
- -f backups/$(date +%Y%m%d_%H%M%S)_{descripcion}.sql
11
+ -f backups/$(date +%Y%m%d_%H%M%S)_{description}.sql
12
12
  ```
13
13
 
14
- El formato del nombre es: `YYYYMMDD_HHMMSS_descripcion.sql`
14
+ The name format is: `YYYYMMDD_HHMMSS_description.sql`
15
15
 
16
- Recordá que los `.sql` dentro de `backups/` están en `.gitignore` — no se suben al repo.
17
- El directorio `backups/` está trackeado (gracias al `.gitkeep`).
16
+ Remember that the `.sql` files inside `backups/` are in `.gitignore` — they are not pushed to the repo.
17
+ The `backups/` directory itself is tracked (thanks to the `.gitkeep`).
18
18
 
19
- Después de correr el comando, verificá que el archivo existe y mostrá su tamaño.
19
+ After running the command, verify the file exists and show its size.
@@ -1,17 +1,17 @@
1
- Ejecutá el script de build desde la raíz del proyecto:
1
+ Run the build script from the project root:
2
2
 
3
3
  ```bash
4
4
  npm run build
5
5
  ```
6
6
 
7
- Luego leé el archivo `db-output.sql` generado y reportá:
8
- - Cuántas tablas/grupos fueron incluidos
9
- - El orden final de carga (útil para detectar errores de dependencia)
10
- - Si hay alguna advertencia de `[WARN] Not found` en la salida del script
7
+ Then read the generated `db-output.sql` file and report:
8
+ - How many tables/groups were included
9
+ - The final load order (useful for spotting dependency errors)
10
+ - Whether there's any `[WARN] Not found` warning in the script's output
11
11
 
12
- Si el usuario quiere usar el output para inicializar una DB:
12
+ If the user wants to use the output to initialize a DB:
13
13
  ```bash
14
14
  psql -U user -d dbname -f db-output.sql
15
15
  ```
16
16
 
17
- Recordá que `db-output.sql` está en `.gitignore` — es un archivo generado, no se sube al repo.
17
+ Remember that `db-output.sql` is in `.gitignore` — it's a generated file, not pushed to the repo.
@@ -1,44 +1,47 @@
1
- Genera el archivo DICTIONARY.md para una tabla de este proyecto.
1
+ Generate the DICTIONARY.md file for a table in this project.
2
2
 
3
- Si el usuario no especificó qué tabla, preguntá cuál.
3
+ If the user didn't specify which table, ask which one.
4
4
 
5
- Luego:
6
- 1. Leé el `create.sql` de esa tabla para obtener columnas, tipos, constraints y FKs
7
- 2. Leé el `data.sql` para entender qué datos iniciales maneja (útil para las reglas de negocio)
8
- 3. Si existe `triggers.sql`, leélo para documentarlo en Notas técnicas
5
+ Then:
6
+ 1. Read that table's `create.sql` to get columns, types, constraints, and FKs
7
+ 2. Read `data.sql` to understand what initial data it holds (useful for business rules)
8
+ 3. If `triggers.sql` exists, read it to document it under Technical notes
9
9
 
10
- Generá el `DICTIONARY.md` siguiendo exactamente esta plantilla:
10
+ Write the DICTIONARY.md content in the language noted under "Documentation language" in
11
+ `.claude/CLAUDE.md` — these instructions stay in English, but the generated file follows that setting.
12
+
13
+ Generate the `DICTIONARY.md` following exactly this template:
11
14
 
12
15
  ---
13
16
 
14
- # {nombre_tabla}
17
+ # {table_name}
15
18
 
16
- {Descripción en 1-2 líneas: qué representa esta tabla en el dominio del negocio.}
19
+ {1-2 line description: what this table represents in the business domain.}
17
20
 
18
- ## Columnas
21
+ ## Columns
19
22
 
20
- | Columna | Tipo | Nulo | Default | Descripción |
21
- |---------|------|------|---------|-------------|
22
- | {col} | {tipo} | NO/SÍ | {default o —} | {descripción en lenguaje de negocio} |
23
+ | Column | Type | Nullable | Default | Description |
24
+ |--------|------|----------|---------|-------------|
25
+ | {col} | {type} | YES/NO | {default or —} | {description in business language} |
23
26
 
24
- ## Relaciones
27
+ ## Relationships
25
28
 
26
- | Columna | Referencia | Descripción |
27
- |---------|------------|-------------|
28
- | {fk_col} | {tabla.col} | {qué representa esta relación en el negocio} |
29
+ | Column | Reference | Description |
30
+ |--------|-----------|--------------|
31
+ | {fk_col} | {table.col} | {what this relationship means in the business} |
29
32
 
30
- ## Reglas de negocio
33
+ ## Business rules
31
34
 
32
- - {regla o restricción relevante para el negocio}
35
+ - {rule or constraint relevant to the business}
33
36
 
34
- ## Notas técnicas
37
+ ## Technical notes
35
38
 
36
- - {constraints, triggers, índices relevantes que no son obvios del create.sql}
39
+ - {constraints, triggers, indexes relevant that aren't obvious from create.sql}
37
40
 
38
41
  ---
39
42
 
40
- Reglas al generar:
41
- - Descripciones siempre en lenguaje de negocio, no técnico
42
- - Si una sección no aplica (sin FKs, sin reglas especiales), omitirla completamente
43
- - El orden de filas en Columnas debe seguir el mismo orden que en el create.sql
44
- - Guardarlo en: schema/{grupo-si-aplica}/{tabla}/DICTIONARY.md
43
+ Rules when generating:
44
+ - Descriptions always in business language, not technical
45
+ - If a section doesn't apply (no FKs, no special rules), omit it entirely
46
+ - The row order in Columns must follow the same order as in create.sql
47
+ - Save it to: schema/{group-if-applicable}/{table}/DICTIONARY.md