@lenne.tech/cli 1.6.6 → 1.6.8

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.
@@ -0,0 +1,26 @@
1
+ # Directus Configuration
2
+ # Generated by lenne.tech CLI
3
+ # DO NOT COMMIT THIS FILE TO VERSION CONTROL
4
+
5
+ # Directus Version
6
+ DIRECTUS_VERSION='<%=props.version%>'
7
+
8
+ # Directus Port
9
+ DIRECTUS_PORT='<%=props.port%>'
10
+
11
+ # Directus Security Keys (KEEP THESE SECRET)
12
+ KEY='<%=props.keySecret%>'
13
+ SECRET='<%=props.adminSecret%>'
14
+
15
+ # Admin Credentials (CHANGE AFTER FIRST LOGIN)
16
+ ADMIN_EMAIL='<%=props.adminEmail%>'
17
+ ADMIN_PASSWORD='<%=props.adminPassword%>'
18
+
19
+ # Database Configuration
20
+ DB_FILENAME='<%=props.dbType === "sqlite" ? props.dbConfig.database : ""%>'
21
+ DB_DATABASE='<%=props.dbType !== "sqlite" ? props.dbConfig.database : ""%>'
22
+ DB_USER='<%=props.dbType !== "sqlite" ? props.dbConfig.user : ""%>'
23
+ DB_PASSWORD='<%=props.dbType !== "sqlite" ? props.dbConfig.password : ""%>'
24
+
25
+ # MySQL Root Password
26
+ MYSQL_ROOT_PASSWORD='<%=props.dbType === "mysql" ? props.dbConfig.adminPassword : ""%>'
@@ -0,0 +1,159 @@
1
+ # Directus Instance: <%= props.instanceName %>
2
+
3
+ Generated by [lenne.tech CLI](https://github.com/lenneTech/cli)
4
+
5
+ ## Quick Start
6
+
7
+ Start the Directus instance:
8
+ ```bash
9
+ docker-compose up -d
10
+ ```
11
+
12
+ Stop the instance:
13
+ ```bash
14
+ docker-compose down
15
+ ```
16
+
17
+ Restart the instance:
18
+ ```bash
19
+ docker-compose restart
20
+ ```
21
+
22
+ View logs:
23
+ ```bash
24
+ docker-compose logs -f
25
+ ```
26
+
27
+ View only Directus logs:
28
+ ```bash
29
+ docker-compose logs -f directus
30
+ ```
31
+
32
+ ## Access
33
+
34
+ - **URL**: http://localhost:<%= props.port %>
35
+ - **Admin Email**: admin@example.com
36
+ - **Admin Password**: admin
37
+
38
+ **⚠️ IMPORTANT**: Change the admin password after first login!
39
+
40
+ ## Configuration
41
+
42
+ All configuration is stored in the `.env` file. You can modify:
43
+ - Directus version (`DIRECTUS_VERSION`)
44
+ - Admin credentials
45
+ - Database settings
46
+
47
+ After modifying `.env`, restart the instance:
48
+ ```bash
49
+ docker-compose down
50
+ docker-compose up -d
51
+ ```
52
+
53
+ ## Security
54
+
55
+ The `.env` file contains sensitive information:
56
+ - Security keys (KEY, SECRET)
57
+ - Admin credentials
58
+ - Database passwords
59
+
60
+ **Never commit the `.env` file to version control!**
61
+
62
+ ## Volumes
63
+
64
+ The following Docker volumes are created for persistent data:
65
+ - `uploads` - User uploaded files
66
+ - `extensions` - Directus extensions
67
+ <% if (props.dbType === 'sqlite') { -%>
68
+ - `database` - SQLite database file
69
+ <% } else { -%>
70
+ - `db-data` - Database data
71
+ <% } -%>
72
+
73
+ ## Backup
74
+
75
+ To backup your Directus instance:
76
+
77
+ 1. **Backup volumes**:
78
+ ```bash
79
+ docker-compose down
80
+ docker run --rm -v <%= props.instanceName %>-uploads:/data -v $(pwd):/backup alpine tar czf /backup/uploads-backup.tar.gz /data
81
+ docker run --rm -v <%= props.instanceName %>-extensions:/data -v $(pwd):/backup alpine tar czf /backup/extensions-backup.tar.gz /data
82
+ <% if (props.dbType === 'sqlite') { -%>
83
+ docker run --rm -v <%= props.instanceName %>-database:/data -v $(pwd):/backup alpine tar czf /backup/database-backup.tar.gz /data
84
+ <% } else if (props.dbType === 'postgres') { -%>
85
+ docker run --rm -v <%= props.instanceName %>-db-data:/data -v $(pwd):/backup alpine tar czf /backup/db-backup.tar.gz /data
86
+ <% } else if (props.dbType === 'mysql') { -%>
87
+ docker run --rm -v <%= props.instanceName %>-db-data:/data -v $(pwd):/backup alpine tar czf /backup/db-backup.tar.gz /data
88
+ <% } -%>
89
+ ```
90
+
91
+ 2. **Backup `.env` file**:
92
+ ```bash
93
+ cp .env .env.backup
94
+ ```
95
+
96
+ ## Troubleshooting
97
+
98
+ ### Port already in use
99
+ If the port is already in use, update `DIRECTUS_PORT` in `.env`, then restart:
100
+ ```bash
101
+ docker-compose down
102
+ docker-compose up -d
103
+ ```
104
+
105
+ ### Database connection issues
106
+ Check if the database container is healthy:
107
+ ```bash
108
+ docker-compose ps
109
+ ```
110
+
111
+ View database logs:
112
+ ```bash
113
+ docker-compose logs <%= props.dbType %>
114
+ ```
115
+
116
+ ### Reset instance
117
+ To completely reset the instance (⚠️ DELETES ALL DATA):
118
+ ```bash
119
+ docker-compose down -v
120
+ docker-compose up -d
121
+ ```
122
+
123
+ ## Update Directus Version
124
+
125
+ **⚠️ WARNING**: Changing Directus versions may require database migrations. Major version changes often need a fresh database.
126
+
127
+ ### For minor/patch updates (e.g., 10.0.0 → 10.0.1):
128
+ 1. Edit `.env` and change `DIRECTUS_VERSION`
129
+ 2. Pull the new image and restart:
130
+ ```bash
131
+ docker-compose pull
132
+ docker-compose down
133
+ docker-compose up -d
134
+ ```
135
+
136
+ ### For major updates (e.g., 10.x → 11.x):
137
+ **Recommended**: Create a backup first, then recreate with fresh volumes:
138
+ ```bash
139
+ # Backup (see Backup section above)
140
+ docker-compose down -v
141
+ # Edit .env with new version
142
+ docker-compose up -d
143
+ ```
144
+
145
+ **Note**: This will delete all data. Always backup before major version changes!
146
+
147
+ ## Remove Instance
148
+
149
+ To completely remove this instance:
150
+ ```bash
151
+ docker-compose down -v
152
+ cd ..
153
+ rm -rf <%= props.instanceName %>
154
+ ```
155
+
156
+ ## More Information
157
+
158
+ - [Directus Documentation](https://docs.directus.io/)
159
+ - [Docker Compose Documentation](https://docs.docker.com/compose/)
@@ -0,0 +1,81 @@
1
+ version: "3.8"
2
+
3
+ services:
4
+ <% if (props.dbType !== 'sqlite') { -%>
5
+ <%= props.dbType %>:
6
+ image: <%= props.dbConfig.image %>
7
+ container_name: <%= props.instanceName %>-<%= props.dbType %>
8
+ environment:
9
+ <% if (props.dbType === 'postgres') { -%>
10
+ POSTGRES_USER: ${DB_USER}
11
+ POSTGRES_PASSWORD: ${DB_PASSWORD}
12
+ POSTGRES_DB: ${DB_DATABASE}
13
+ <% } else if (props.dbType === 'mysql') { -%>
14
+ MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
15
+ MYSQL_DATABASE: ${DB_DATABASE}
16
+ MYSQL_USER: ${DB_USER}
17
+ MYSQL_PASSWORD: ${DB_PASSWORD}
18
+ <% } -%>
19
+ volumes:
20
+ - db-data:<%= props.dbType === 'postgres' ? '/var/lib/postgresql/data' : '/var/lib/mysql' %>
21
+ networks:
22
+ - directus-net
23
+ restart: unless-stopped
24
+ healthcheck:
25
+ <% if (props.dbType === 'postgres') { -%>
26
+ test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
27
+ <% } else if (props.dbType === 'mysql') { -%>
28
+ test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
29
+ <% } -%>
30
+ interval: 10s
31
+ timeout: 5s
32
+ retries: 5
33
+
34
+ <% } -%>
35
+ directus:
36
+ image: directus/directus:${DIRECTUS_VERSION}
37
+ container_name: <%= props.instanceName %>
38
+ ports:
39
+ - "${DIRECTUS_PORT}:8055"
40
+ environment:
41
+ KEY: ${KEY}
42
+ SECRET: ${SECRET}
43
+ ADMIN_EMAIL: ${ADMIN_EMAIL}
44
+ ADMIN_PASSWORD: ${ADMIN_PASSWORD}
45
+ DB_CLIENT: <%= props.dbConfig.client %>
46
+ <% if (props.dbType === 'sqlite') { -%>
47
+ DB_FILENAME: ${DB_FILENAME}
48
+ <% } else { -%>
49
+ DB_HOST: <%= props.dbType %>
50
+ DB_PORT: <%= props.dbConfig.port %>
51
+ DB_DATABASE: ${DB_DATABASE}
52
+ DB_USER: ${DB_USER}
53
+ DB_PASSWORD: ${DB_PASSWORD}
54
+ <% } -%>
55
+ WEBSOCKETS_ENABLED: true
56
+ volumes:
57
+ - uploads:/directus/uploads
58
+ - extensions:/directus/extensions
59
+ <% if (props.dbType === 'sqlite') { -%>
60
+ - database:/directus/database
61
+ <% } -%>
62
+ networks:
63
+ - directus-net
64
+ <% if (props.dbType !== 'sqlite') { -%>
65
+ depends_on:
66
+ <%= props.dbType %>:
67
+ condition: service_healthy
68
+ <% } -%>
69
+ restart: unless-stopped
70
+
71
+ volumes:
72
+ <% if (props.dbType !== 'sqlite') { -%>
73
+ db-data:
74
+ <% } else { -%>
75
+ database:
76
+ <% } -%>
77
+ uploads:
78
+ extensions:
79
+
80
+ networks:
81
+ directus-net:
package/docs/commands.md CHANGED
@@ -14,6 +14,7 @@ This document provides a comprehensive reference for all `lt` CLI commands. For
14
14
  - [Config Commands](#config-commands)
15
15
  - [Utility Commands](#utility-commands)
16
16
  - [Database Commands](#database-commands)
17
+ - [Directus Commands](#directus-commands)
17
18
  - [TypeScript Commands](#typescript-commands)
18
19
  - [Starter Commands](#starter-commands)
19
20
  - [Claude Commands](#claude-commands)
@@ -794,6 +795,129 @@ lt qdrant delete
794
795
 
795
796
  ---
796
797
 
798
+ ## Directus Commands
799
+
800
+ ### `lt directus docker-setup`
801
+
802
+ Sets up a local Directus Docker instance using docker-compose.
803
+
804
+ **Usage:**
805
+ ```bash
806
+ lt directus docker-setup [options]
807
+ ```
808
+
809
+ **Options:**
810
+ | Option | Description |
811
+ |--------|-------------|
812
+ | `--name <name>` / `-n` | Instance name (stored in ~/.lt/directus/<name>) |
813
+ | `--version <version>` / `-v` | Directus version (default: latest) |
814
+ | `--database <type>` / `--db <type>` | Database type: `postgres`, `mysql`, `sqlite` |
815
+ | `--port <number>` / `-p` | Port number (default: auto-detect starting from 8055) |
816
+ | `--update` | Update existing instance configuration |
817
+ | `--noConfirm` | Skip confirmation prompts |
818
+
819
+ **Configuration:** `commands.directus.dockerSetup.*`, `defaults.noConfirm`
820
+
821
+ **Port Auto-detection:**
822
+ - If `--port` is not specified, the CLI automatically finds an available port starting from 8055
823
+ - Each instance gets its own port (8055, 8056, 8057, etc.)
824
+ - This allows running multiple Directus instances simultaneously
825
+
826
+ **Generated files:**
827
+ - `~/.lt/directus/<name>/docker-compose.yml` - Container configuration
828
+ - `~/.lt/directus/<name>/.env` - Secrets and environment variables
829
+ - `~/.lt/directus/<name>/README.md` - Usage instructions
830
+
831
+ **Examples:**
832
+ ```bash
833
+ # Create PostgreSQL instance (auto-detects port 8055)
834
+ lt directus docker-setup --name my-project --database postgres
835
+
836
+ # Create second instance (auto-detects port 8056)
837
+ lt directus docker-setup --name another-project --database mysql
838
+
839
+ # Create with specific port
840
+ lt directus docker-setup --name custom-app --database sqlite --port 9000
841
+
842
+ # Create with specific version
843
+ lt directus docker-setup --name my-app --database mysql --version 10
844
+
845
+ # Update existing instance
846
+ lt directus docker-setup --name my-project --version 11 --update
847
+ ```
848
+
849
+ ---
850
+
851
+ ### `lt directus remove`
852
+
853
+ Removes a Directus Docker instance and all its data.
854
+
855
+ **Usage:**
856
+ ```bash
857
+ lt directus remove [name] [options]
858
+ ```
859
+
860
+ **Arguments:**
861
+ | Argument | Description |
862
+ |----------|-------------|
863
+ | `name` | Instance name to remove (optional, will prompt if omitted) |
864
+
865
+ **Options:**
866
+ | Option | Description |
867
+ |--------|-------------|
868
+ | `--noConfirm` | Skip confirmation prompts |
869
+
870
+ **Configuration:** `commands.directus.remove.*`, `defaults.noConfirm`
871
+
872
+ **What gets removed:**
873
+ - Stops and removes Docker containers
874
+ - Removes all Docker volumes (database, uploads, extensions)
875
+ - Deletes instance directory from ~/.lt/directus/
876
+
877
+ **Examples:**
878
+ ```bash
879
+ # Interactive (shows list of instances)
880
+ lt directus remove
881
+
882
+ # Remove specific instance
883
+ lt directus remove my-project
884
+
885
+ # Skip confirmation
886
+ lt directus remove my-project --noConfirm
887
+ ```
888
+
889
+ ---
890
+
891
+ ### `lt directus typegen`
892
+
893
+ Generates TypeScript types from Directus collections.
894
+
895
+ **Usage:**
896
+ ```bash
897
+ lt directus typegen [options]
898
+ ```
899
+
900
+ **Options:**
901
+ | Option | Description |
902
+ |--------|-------------|
903
+ | `--url <url>` / `-u` | Directus API URL |
904
+ | `--token <token>` / `-t` | Directus API token (Administrator permissions required) |
905
+ | `--output <path>` / `-o` | Output file path |
906
+ | `--noConfirm` | Skip confirmation prompts |
907
+
908
+ **Configuration:** `commands.directus.typegen.*`, `defaults.noConfirm`
909
+
910
+ **Examples:**
911
+ ```bash
912
+ # Interactive
913
+ lt directus typegen
914
+
915
+ # With all options
916
+ lt directus typegen --url http://localhost:8055 --token <token> --output ./types.ts
917
+ ```
918
+
919
+ ---
920
+
797
921
  ## TypeScript Commands
798
922
 
799
923
  ### `lt typescript create`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/cli",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "lenne.Tech CLI: lt",
5
5
  "keywords": [
6
6
  "lenne.Tech",
@@ -59,7 +59,7 @@
59
59
  "gluegun": "5.2.2",
60
60
  "js-sha256": "0.11.1",
61
61
  "js-yaml": "4.1.1",
62
- "lodash": "4.17.21",
62
+ "lodash": "4.17.23",
63
63
  "open": "11.0.0",
64
64
  "ts-morph": "27.0.2",
65
65
  "ts-node": "10.9.2",