@slingr/cli 0.0.3 → 0.0.4
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.txt +202 -0
- package/README.md +490 -319
- package/bin/dev.cmd +2 -2
- package/bin/dev.js +5 -5
- package/bin/run.cmd +2 -2
- package/bin/run.js +4 -4
- package/bin/slingr +1 -0
- package/dist/commands/build.d.ts +20 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +206 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/create-app.d.ts +0 -1
- package/dist/commands/create-app.d.ts.map +1 -1
- package/dist/commands/create-app.js +38 -57
- package/dist/commands/create-app.js.map +1 -1
- package/dist/commands/debug.d.ts +28 -0
- package/dist/commands/debug.d.ts.map +1 -0
- package/dist/commands/debug.js +474 -0
- package/dist/commands/debug.js.map +1 -0
- package/dist/commands/ds.d.ts +14 -1
- package/dist/commands/ds.d.ts.map +1 -1
- package/dist/commands/ds.js +450 -121
- package/dist/commands/ds.js.map +1 -1
- package/dist/commands/gql.d.ts +1 -1
- package/dist/commands/gql.d.ts.map +1 -1
- package/dist/commands/gql.js +190 -184
- package/dist/commands/gql.js.map +1 -1
- package/dist/commands/infra/down.d.ts.map +1 -1
- package/dist/commands/infra/down.js +8 -7
- package/dist/commands/infra/down.js.map +1 -1
- package/dist/commands/infra/up.d.ts.map +1 -1
- package/dist/commands/infra/up.js +8 -7
- package/dist/commands/infra/up.js.map +1 -1
- package/dist/commands/infra/update.d.ts +1 -0
- package/dist/commands/infra/update.d.ts.map +1 -1
- package/dist/commands/infra/update.js +33 -69
- package/dist/commands/infra/update.js.map +1 -1
- package/dist/commands/run.d.ts +29 -2
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +628 -130
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/setup.d.ts +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +34 -71
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/sync-metadata.d.ts +15 -0
- package/dist/commands/sync-metadata.d.ts.map +1 -0
- package/dist/commands/sync-metadata.js +225 -0
- package/dist/commands/sync-metadata.js.map +1 -0
- package/dist/commands/users.d.ts +30 -0
- package/dist/commands/users.d.ts.map +1 -0
- package/dist/commands/users.js +472 -0
- package/dist/commands/users.js.map +1 -0
- package/dist/commands/views.d.ts +11 -0
- package/dist/commands/views.d.ts.map +1 -0
- package/dist/commands/views.js +73 -0
- package/dist/commands/views.js.map +1 -0
- package/dist/projectStructure.d.ts +2 -2
- package/dist/projectStructure.d.ts.map +1 -1
- package/dist/projectStructure.js +281 -69
- package/dist/projectStructure.js.map +1 -1
- package/dist/scripts/generate-metadata.d.ts +13 -0
- package/dist/scripts/generate-metadata.d.ts.map +1 -0
- package/dist/scripts/generate-metadata.js +412 -0
- package/dist/scripts/generate-metadata.js.map +1 -0
- package/dist/scripts/generate-metadata.ts +498 -0
- package/dist/scripts/generate-schema.d.ts +1 -1
- package/dist/scripts/generate-schema.js +168 -74
- package/dist/scripts/generate-schema.js.map +1 -1
- package/dist/scripts/generate-schema.ts +258 -143
- package/dist/templates/.env.template +23 -0
- package/dist/templates/.firebaserc.template +5 -0
- package/dist/templates/.github/copilot-instructions.md.template +652 -17
- package/dist/templates/backend/Dockerfile.template +30 -0
- package/dist/templates/config/datasource.ts.template +12 -9
- package/dist/templates/config/jest.config.ts +30 -30
- package/dist/templates/config/jest.setup.ts +1 -1
- package/dist/templates/config/tsconfig.json.template +50 -29
- package/dist/templates/dataSources/mysql.ts.template +16 -13
- package/dist/templates/dataSources/postgres.ts.template +15 -13
- package/dist/templates/dataset-generator-script.ts.template +139 -139
- package/dist/templates/datasets/mysql-default/.slingr-schema.json.template +5 -0
- package/dist/templates/datasets/mysql-default/Address.jsonl.template +3 -3
- package/dist/templates/datasets/mysql-default/App.jsonl.template +4 -4
- package/dist/templates/datasets/mysql-default/Company.jsonl.template +3 -3
- package/dist/templates/datasets/mysql-default/Person.jsonl.template +2 -2
- package/dist/templates/datasets/mysql-default/User.jsonl.template +1 -0
- package/dist/templates/datasets/mysql-default/instructions.md.template +1 -0
- package/dist/templates/datasets/postgres-default/.slingr-schema.json.template +5 -0
- package/dist/templates/datasets/postgres-default/Address.jsonl.template +3 -3
- package/dist/templates/datasets/postgres-default/App.jsonl.template +4 -4
- package/dist/templates/datasets/postgres-default/Company.jsonl.template +3 -3
- package/dist/templates/datasets/postgres-default/Person.jsonl.template +2 -2
- package/dist/templates/datasets/postgres-default/User.jsonl.template +1 -0
- package/dist/templates/datasets/postgres-default/instructions.md.template +1 -0
- package/dist/templates/docker-compose.prod-test.yml.template +32 -0
- package/dist/templates/docker-compose.yml.template +24 -0
- package/dist/templates/docs/app-description.md.template +33 -33
- package/dist/templates/firebase.json.template +68 -0
- package/dist/templates/frontend/.umirc.ts.template +23 -0
- package/dist/templates/frontend/package.json.template +45 -0
- package/dist/templates/frontend/public/config.json +6 -0
- package/dist/templates/frontend/public/logo.svg +6 -0
- package/dist/templates/frontend/src/app.tsx.template +44 -0
- package/dist/templates/frontend/src/global.less.template +117 -0
- package/dist/templates/frontend/src/layouts/MainLayout.tsx.template +75 -0
- package/dist/templates/frontend/src/types/graphql-augmentation.d.ts.template +44 -0
- package/dist/templates/frontend/src/views/customViews/user/UserCreateView.tsx.template +18 -0
- package/dist/templates/frontend/src/views/customViews/user/UserEditView.tsx.template +29 -0
- package/dist/templates/frontend/src/views/customViews/user/UserReadView.tsx.template +24 -0
- package/dist/templates/frontend/src/views/customViews/user/UserTableView.tsx.template +38 -0
- package/dist/templates/frontend/src/views/customViews/welcome.tsx.template +34 -0
- package/dist/templates/frontend/tsconfig.json.template +50 -0
- package/dist/templates/gql/codegen.yml.template +25 -25
- package/dist/templates/gql/index.ts.template +17 -24
- package/dist/templates/gql/operations.graphql.template +30 -30
- package/dist/templates/ops/README.md.template +1045 -0
- package/dist/templates/ops/cloudbuild.yaml.template +161 -0
- package/dist/templates/ops/scripts/_utils.js.template +217 -0
- package/dist/templates/ops/scripts/deploy.js.template +145 -0
- package/dist/templates/ops/scripts/setup-gcp.js.template +330 -0
- package/dist/templates/ops/scripts/setup-secrets.js.template +76 -0
- package/dist/templates/ops/scripts/test-prod-local.js.template +49 -0
- package/dist/templates/package.json.template +50 -38
- package/dist/templates/pnpm-workspace.yaml.template +3 -0
- package/dist/templates/prompt-analysis.md.template +110 -110
- package/dist/templates/prompt-script-generation.md.template +258 -258
- package/dist/templates/src/Address.ts.template +28 -31
- package/dist/templates/src/App.ts.template +17 -61
- package/dist/templates/src/Company.ts.template +41 -47
- package/dist/templates/src/Models.test.ts.template +654 -654
- package/dist/templates/src/Person.test.ts.template +289 -289
- package/dist/templates/src/Person.ts.template +90 -105
- package/dist/templates/src/actions/index.ts.template +11 -11
- package/dist/templates/src/auth/permissions.ts.template +34 -0
- package/dist/templates/src/data/App.ts.template +48 -0
- package/dist/templates/src/data/User.ts.template +35 -0
- package/dist/templates/src/types/gql.d.ts.template +17 -17
- package/dist/templates/vscode/extensions.json +4 -3
- package/dist/templates/vscode/settings.json +17 -11
- package/dist/templates/workspace-package.json.template +21 -0
- package/dist/utils/buildCache.d.ts +12 -0
- package/dist/utils/buildCache.d.ts.map +1 -0
- package/dist/utils/buildCache.js +102 -0
- package/dist/utils/buildCache.js.map +1 -0
- package/dist/utils/checkFramework.d.ts +27 -0
- package/dist/utils/checkFramework.d.ts.map +1 -0
- package/dist/utils/checkFramework.js +104 -0
- package/dist/utils/checkFramework.js.map +1 -0
- package/dist/utils/datasourceParser.d.ts +11 -0
- package/dist/utils/datasourceParser.d.ts.map +1 -1
- package/dist/utils/datasourceParser.js +154 -56
- package/dist/utils/datasourceParser.js.map +1 -1
- package/dist/utils/dockerManager.d.ts +25 -0
- package/dist/utils/dockerManager.d.ts.map +1 -0
- package/dist/utils/dockerManager.js +281 -0
- package/dist/utils/dockerManager.js.map +1 -0
- package/dist/utils/infraFileParser.d.ts +26 -0
- package/dist/utils/infraFileParser.d.ts.map +1 -0
- package/dist/utils/infraFileParser.js +75 -0
- package/dist/utils/infraFileParser.js.map +1 -0
- package/dist/utils/jsonlLoader.d.ts +91 -12
- package/dist/utils/jsonlLoader.d.ts.map +1 -1
- package/dist/utils/jsonlLoader.js +674 -63
- package/dist/utils/jsonlLoader.js.map +1 -1
- package/dist/utils/model-analyzer.d.ts.map +1 -1
- package/dist/utils/model-analyzer.js +67 -13
- package/dist/utils/model-analyzer.js.map +1 -1
- package/dist/utils/userManagement.d.ts +57 -0
- package/dist/utils/userManagement.d.ts.map +1 -0
- package/dist/utils/userManagement.js +288 -0
- package/dist/utils/userManagement.js.map +1 -0
- package/dist/utils/viewsGenerator.d.ts +15 -0
- package/dist/utils/viewsGenerator.d.ts.map +1 -0
- package/dist/utils/viewsGenerator.js +311 -0
- package/dist/utils/viewsGenerator.js.map +1 -0
- package/oclif.manifest.json +445 -20
- package/package.json +29 -26
- package/src/templates/.env.template +23 -0
- package/src/templates/.firebaserc.template +5 -0
- package/src/templates/.github/copilot-instructions.md.template +652 -17
- package/src/templates/backend/Dockerfile.template +30 -0
- package/src/templates/config/datasource.ts.template +12 -9
- package/src/templates/config/jest.config.ts +30 -30
- package/src/templates/config/jest.setup.ts +1 -1
- package/src/templates/config/tsconfig.json.template +50 -29
- package/src/templates/dataSources/mysql.ts.template +16 -13
- package/src/templates/dataSources/postgres.ts.template +15 -13
- package/src/templates/dataset-generator-script.ts.template +139 -139
- package/src/templates/datasets/mysql-default/.slingr-schema.json.template +5 -0
- package/src/templates/datasets/mysql-default/Address.jsonl.template +3 -3
- package/src/templates/datasets/mysql-default/App.jsonl.template +4 -4
- package/src/templates/datasets/mysql-default/Company.jsonl.template +3 -3
- package/src/templates/datasets/mysql-default/Person.jsonl.template +2 -2
- package/src/templates/datasets/mysql-default/User.jsonl.template +1 -0
- package/src/templates/datasets/mysql-default/instructions.md.template +1 -0
- package/src/templates/datasets/postgres-default/.slingr-schema.json.template +5 -0
- package/src/templates/datasets/postgres-default/Address.jsonl.template +3 -3
- package/src/templates/datasets/postgres-default/App.jsonl.template +4 -4
- package/src/templates/datasets/postgres-default/Company.jsonl.template +3 -3
- package/src/templates/datasets/postgres-default/Person.jsonl.template +2 -2
- package/src/templates/datasets/postgres-default/User.jsonl.template +1 -0
- package/src/templates/datasets/postgres-default/instructions.md.template +1 -0
- package/src/templates/docker-compose.prod-test.yml.template +32 -0
- package/src/templates/docker-compose.yml.template +24 -0
- package/src/templates/docs/app-description.md.template +33 -33
- package/src/templates/firebase.json.template +68 -0
- package/src/templates/frontend/.umirc.ts.template +23 -0
- package/src/templates/frontend/package.json.template +45 -0
- package/src/templates/frontend/public/config.json +6 -0
- package/src/templates/frontend/public/logo.svg +6 -0
- package/src/templates/frontend/src/app.tsx.template +44 -0
- package/src/templates/frontend/src/global.less.template +117 -0
- package/src/templates/frontend/src/layouts/MainLayout.tsx.template +75 -0
- package/src/templates/frontend/src/types/graphql-augmentation.d.ts.template +44 -0
- package/src/templates/frontend/src/views/customViews/user/UserCreateView.tsx.template +18 -0
- package/src/templates/frontend/src/views/customViews/user/UserEditView.tsx.template +29 -0
- package/src/templates/frontend/src/views/customViews/user/UserReadView.tsx.template +24 -0
- package/src/templates/frontend/src/views/customViews/user/UserTableView.tsx.template +38 -0
- package/src/templates/frontend/src/views/customViews/welcome.tsx.template +34 -0
- package/src/templates/frontend/tsconfig.json.template +50 -0
- package/src/templates/gql/codegen.yml.template +25 -25
- package/src/templates/gql/index.ts.template +17 -24
- package/src/templates/gql/operations.graphql.template +30 -30
- package/src/templates/ops/README.md.template +1045 -0
- package/src/templates/ops/cloudbuild.yaml.template +161 -0
- package/src/templates/ops/scripts/_utils.js.template +217 -0
- package/src/templates/ops/scripts/deploy.js.template +145 -0
- package/src/templates/ops/scripts/setup-gcp.js.template +330 -0
- package/src/templates/ops/scripts/setup-secrets.js.template +76 -0
- package/src/templates/ops/scripts/test-prod-local.js.template +49 -0
- package/src/templates/package.json.template +50 -38
- package/src/templates/pnpm-workspace.yaml.template +3 -0
- package/src/templates/prompt-analysis.md.template +110 -110
- package/src/templates/prompt-script-generation.md.template +258 -258
- package/src/templates/src/Address.ts.template +28 -31
- package/src/templates/src/App.ts.template +17 -61
- package/src/templates/src/Company.ts.template +41 -47
- package/src/templates/src/Models.test.ts.template +654 -654
- package/src/templates/src/Person.test.ts.template +289 -289
- package/src/templates/src/Person.ts.template +90 -105
- package/src/templates/src/actions/index.ts.template +11 -11
- package/src/templates/src/auth/permissions.ts.template +34 -0
- package/src/templates/src/data/App.ts.template +48 -0
- package/src/templates/src/data/User.ts.template +35 -0
- package/src/templates/src/types/gql.d.ts.template +17 -17
- package/src/templates/vscode/extensions.json +4 -3
- package/src/templates/vscode/settings.json +17 -11
- package/src/templates/workspace-package.json.template +21 -0
- package/dist/templates/src/index.ts +0 -66
- package/src/templates/src/index.ts +0 -66
package/README.md
CHANGED
|
@@ -1,320 +1,491 @@
|
|
|
1
|
-
# Slingr CLI
|
|
2
|
-
|
|
3
|
-
A command-line tool for creating and managing Slingr applications.
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
6
|
-
|
|
7
|
-
###
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
#
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
#
|
|
173
|
-
slingr
|
|
174
|
-
|
|
175
|
-
#
|
|
176
|
-
slingr
|
|
177
|
-
|
|
178
|
-
#
|
|
179
|
-
slingr
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
1
|
+
# Slingr CLI
|
|
2
|
+
|
|
3
|
+
A command-line tool for creating and managing Slingr applications.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Clone the repository
|
|
11
|
+
git clone https://github.com/slingr-stack/framework.git
|
|
12
|
+
cd framework/cli
|
|
13
|
+
|
|
14
|
+
# Install dependencies
|
|
15
|
+
npm install
|
|
16
|
+
|
|
17
|
+
# Build the CLI
|
|
18
|
+
npm run build
|
|
19
|
+
|
|
20
|
+
# Link globally to use the 'slingr' command
|
|
21
|
+
npm link
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
You can also build from the repository root:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm run build:cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Documentation
|
|
31
|
+
|
|
32
|
+
For detailed CLI documentation and guides:
|
|
33
|
+
|
|
34
|
+
| Document | Description |
|
|
35
|
+
| ----------------------------------------------------------------- | ------------------------------------- |
|
|
36
|
+
| [CLI Introduction](../docs/cli/intro.md) | Getting started with the CLI |
|
|
37
|
+
| [CLI Architecture](../docs/cli/architecture.md) | CLI design and architecture |
|
|
38
|
+
| [Run Command Guide](../docs/cli/run-command.md) | Using the run command |
|
|
39
|
+
| [Repository Overview](../README.md) | Main repository setup and overview |
|
|
40
|
+
| [Setup Guide](../docs/framework/setup-guide.md) | Detailed installation and setup guide |
|
|
41
|
+
| [Framework Documentation](../framework/README.md) | Core framework usage and examples |
|
|
42
|
+
| [VS Code Extension Documentation](../vs-code-extension/README.md) | IDE extension features and setup |
|
|
43
|
+
|
|
44
|
+
See the [framework documentation](../docs/framework/) for detailed guides on data models, actions, and database configuration.
|
|
45
|
+
|
|
46
|
+
## Testing the CLI
|
|
47
|
+
|
|
48
|
+
To test the CLI commands:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Display help
|
|
52
|
+
slingr --help
|
|
53
|
+
|
|
54
|
+
# Run tests (from repository root)
|
|
55
|
+
npm run test:cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## CLI Development (For Contributors)
|
|
59
|
+
|
|
60
|
+
If you're contributing to the CLI itself:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Rebuild the CLI tool
|
|
64
|
+
slingr cli-build
|
|
65
|
+
|
|
66
|
+
# Or from repository root
|
|
67
|
+
npm run build:cli
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For more information on contributing to the Slingr Framework, see the [Repository Overview](../README.md) and [Setup Guide](../docs/framework/setup-guide.md).
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
### Create a new application
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
slingr create-app my-app
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This command will:
|
|
81
|
+
|
|
82
|
+
1. Ask you questions about your application type and requirements
|
|
83
|
+
2. Create a project directory with the specified name
|
|
84
|
+
3. Set up a complete TypeScript project structure with database configuration
|
|
85
|
+
4. Generate sample files and configurations
|
|
86
|
+
5. Configure VS Code settings and recommended extensions
|
|
87
|
+
6. Set up Docker infrastructure files for database management
|
|
88
|
+
|
|
89
|
+
After creating your app, you can set it up with:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
cd my-app
|
|
93
|
+
npm run setup
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This will install dependencies, generate the GraphQL schema, and generate the TypeScript SDK. Alternatively, you can run each step manually:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd my-app
|
|
100
|
+
npm install
|
|
101
|
+
npx slingr gql generate-schema
|
|
102
|
+
npx slingr gql generate-sdk
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Create-app flags
|
|
106
|
+
|
|
107
|
+
You can skip the interactive prompts by using command flags.
|
|
108
|
+
|
|
109
|
+
Available flags:
|
|
110
|
+
|
|
111
|
+
- `--type, -t`: Type of application (e.g., CRM, task manager, ERP)
|
|
112
|
+
- `--backend, -b`: Include backend for the application (default: true)
|
|
113
|
+
- `--frontend, -f`: Include frontend for the application (default: true)
|
|
114
|
+
- `--database, -d`: Database to use (postgres or mysql)
|
|
115
|
+
- `--description, -D`: Description of what the application needs to do
|
|
116
|
+
- `--templates, -T`: Include data models and sample data (default: `false`)
|
|
117
|
+
- `--skip-infra, -i`: Skip infrastructure setup and checks
|
|
118
|
+
|
|
119
|
+
For example:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Create app with all flags
|
|
123
|
+
slingr create-app my-crm --type="CRM" --backend --frontend --database=postgres --description="A CRM system for managing customers"
|
|
124
|
+
|
|
125
|
+
# Create app without frontend
|
|
126
|
+
slingr create-app my-api --type="API" --backend --no-frontend --database=mysql --description="A REST API for data management"
|
|
127
|
+
|
|
128
|
+
# Create app with sample data models and datasets
|
|
129
|
+
slingr create-app my-erp --type="ERP" --backend --frontend --database=postgres --description="An ERP system for business management" --templates
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Run your application
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
slingr run
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
This command will:
|
|
139
|
+
|
|
140
|
+
1. Build the @slingr-framework if needed
|
|
141
|
+
2. Build the UI (if present) with Vite
|
|
142
|
+
3. Compile your TypeScript code
|
|
143
|
+
4. Check and start Docker infrastructure services
|
|
144
|
+
5. Run your application with hot reload
|
|
145
|
+
6. Serve the UI and GraphQL API on the same port (default: 3000)
|
|
146
|
+
|
|
147
|
+
Access your application:
|
|
148
|
+
|
|
149
|
+
- Frontend UI: `http://localhost:3000/`
|
|
150
|
+
- GraphQL API: `http://localhost:3000/graphql`
|
|
151
|
+
|
|
152
|
+
### Debug your application
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
slingr debug
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This command runs your application with Node.js debugging enabled, allowing you to attach a debugger for troubleshooting and development. The command performs the same setup as `slingr run` but starts the application with the Node.js inspector enabled. The UI is also built and served alongside the backend.
|
|
159
|
+
|
|
160
|
+
#### Debug command options
|
|
161
|
+
|
|
162
|
+
- `--inspect-port, -p`: Port for Node.js debugger (default: 9229)
|
|
163
|
+
- `--inspect-brk, -b`: Break before user code starts (useful for debugging startup issues)
|
|
164
|
+
- `--skip-infra, -i`: Skip infrastructure setup and checks
|
|
165
|
+
|
|
166
|
+
#### Examples
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Run with default debug port (9229)
|
|
170
|
+
slingr debug
|
|
171
|
+
|
|
172
|
+
# Run with custom debug port
|
|
173
|
+
slingr debug --inspect-port 9230
|
|
174
|
+
|
|
175
|
+
# Break before user code starts (useful for debugging initialization)
|
|
176
|
+
slingr debug --inspect-brk
|
|
177
|
+
|
|
178
|
+
# Run without starting infrastructure services
|
|
179
|
+
slingr debug --skip-infra
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
#### Attaching a debugger
|
|
183
|
+
|
|
184
|
+
Once the application is running in debug mode, you can attach a debugger:
|
|
185
|
+
|
|
186
|
+
**VS Code:**
|
|
187
|
+
|
|
188
|
+
1. Create a debug configuration in `.vscode/launch.json`:
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"type": "node",
|
|
193
|
+
"request": "attach",
|
|
194
|
+
"name": "Attach to Slingr",
|
|
195
|
+
"port": 9229,
|
|
196
|
+
"skipFiles": ["<node_internals>/**"]
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
2. Press F5 or use the "Run and Debug" panel to attach
|
|
201
|
+
|
|
202
|
+
**Chrome DevTools:**
|
|
203
|
+
|
|
204
|
+
1. Open Chrome and navigate to `chrome://inspect`
|
|
205
|
+
2. Click "Open dedicated DevTools for Node"
|
|
206
|
+
3. Your application should appear in the list of inspectable targets
|
|
207
|
+
|
|
208
|
+
### Manage datasets
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Load default dataset for a datasource
|
|
212
|
+
slingr ds postgres load
|
|
213
|
+
|
|
214
|
+
# Load specific dataset
|
|
215
|
+
slingr ds postgres load custom-dataset
|
|
216
|
+
|
|
217
|
+
# Load dataset for MySQL datasource
|
|
218
|
+
slingr ds mysql load default
|
|
219
|
+
|
|
220
|
+
# Reset datasource infrastructure (clears container and volume data)
|
|
221
|
+
slingr ds postgres reset
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
These commands help you load JSONL datasets into your database and reset datasource infrastructure for a clean state when testing and development require it.
|
|
225
|
+
|
|
226
|
+
### User Management
|
|
227
|
+
|
|
228
|
+
Every new Slingr application comes with built-in authentication and user management. A default System user is created automatically when you load the initial dataset.
|
|
229
|
+
|
|
230
|
+
#### List Users
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
slingr users list
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Displays all users in the application with their status and roles.
|
|
237
|
+
|
|
238
|
+
#### Create User
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Interactive mode
|
|
242
|
+
slingr users create
|
|
243
|
+
|
|
244
|
+
# With flags
|
|
245
|
+
slingr users create \
|
|
246
|
+
--email john@example.com \
|
|
247
|
+
--first-name John \
|
|
248
|
+
--last-name Doe \
|
|
249
|
+
--password secret123 \
|
|
250
|
+
--roles "Admin,User"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Creates a new user in the application. Passwords are automatically hashed using bcrypt.
|
|
254
|
+
|
|
255
|
+
#### Manage Passwords
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Set a new password (interactive)
|
|
259
|
+
slingr users set-password john@example.com
|
|
260
|
+
|
|
261
|
+
# Set a new password (with flag)
|
|
262
|
+
slingr users set-password john@example.com --new-password newpass123
|
|
263
|
+
|
|
264
|
+
# Reset password (generates random password)
|
|
265
|
+
slingr users reset-password john@example.com
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
The reset-password command generates a secure random password and displays it once.
|
|
269
|
+
|
|
270
|
+
#### Activate/Deactivate Users
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
# Activate a user
|
|
274
|
+
slingr users activate john@example.com
|
|
275
|
+
|
|
276
|
+
# Deactivate a user
|
|
277
|
+
slingr users deactivate john@example.com
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Deactivated users cannot log in to the application.
|
|
281
|
+
|
|
282
|
+
#### Delete User
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# Delete with confirmation
|
|
286
|
+
slingr users delete john@example.com
|
|
287
|
+
|
|
288
|
+
# Delete without confirmation
|
|
289
|
+
slingr users delete john@example.com --force
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Note**: System users cannot be deleted for security reasons.
|
|
293
|
+
|
|
294
|
+
#### User Management Options
|
|
295
|
+
|
|
296
|
+
- `--datasource, -d`: Specify datasource name (auto-discovered from User model if not specified)
|
|
297
|
+
- `--force, -f`: Skip confirmation prompts
|
|
298
|
+
- `--help, -h`: Show command help
|
|
299
|
+
|
|
300
|
+
**Note**: All user commands automatically discover the datasource configured in your User model, so you typically don't need to specify the `--datasource` flag.
|
|
301
|
+
|
|
302
|
+
#### Default System User
|
|
303
|
+
|
|
304
|
+
When you create a new app and load the initial dataset, a System user is created with:
|
|
305
|
+
|
|
306
|
+
- **Email**: sys@app.com
|
|
307
|
+
- **Password**: 12345678 (change this in production!)
|
|
308
|
+
- **Role**: System (full access)
|
|
309
|
+
|
|
310
|
+
To change the System user password:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
slingr users set-password sys@app.com
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Infrastructure management
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# Update infrastructure for all datasources
|
|
320
|
+
slingr infra update --all
|
|
321
|
+
|
|
322
|
+
# Update infrastructure for specific datasource
|
|
323
|
+
slingr infra update --file postgres.ts
|
|
324
|
+
|
|
325
|
+
# Start infrastructure services
|
|
326
|
+
slingr infra up
|
|
327
|
+
|
|
328
|
+
# Stop infrastructure services
|
|
329
|
+
slingr infra down
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Infrastructure commands help you manage Docker containers for your databases.
|
|
333
|
+
|
|
334
|
+
### GraphQL API
|
|
335
|
+
|
|
336
|
+
The Slingr Framework includes built-in GraphQL API support powered by Apollo Server. These commands help you generate GraphQL schemas and SDKs.
|
|
337
|
+
|
|
338
|
+
#### Generate GraphQL schema
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
# Generate schema in generated/gql/schema.graphql
|
|
342
|
+
slingr gql generate-schema
|
|
343
|
+
|
|
344
|
+
# Keep Apollo Server running after generating schema
|
|
345
|
+
slingr gql generate-schema --no-exit
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
This command generates the GraphQL schema file from your application's actions and models.
|
|
349
|
+
|
|
350
|
+
#### Generate GraphQL SDK
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Generate type-safe SDK (automatically generates schema if needed)
|
|
354
|
+
slingr gql generate-sdk
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
This command generates a type-safe GraphQL SDK in `generated/gql/sdk.ts` that you can use to interact with your API. Use it in your code with:
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
import gql from '@gql';
|
|
361
|
+
|
|
362
|
+
const result = await gql.yourQuery();
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### CLI development
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
# Rebuild the CLI tool itself (for CLI developers)
|
|
369
|
+
slingr cli-build
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## Generated Project Structure
|
|
373
|
+
|
|
374
|
+
When you create a new app with the `--templates` flag, the following structure is generated:
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
your-app/
|
|
378
|
+
├── .vscode/
|
|
379
|
+
│ ├── extensions.json # Recommended VS Code extensions
|
|
380
|
+
│ └── settings.json # VS Code settings for optimal development
|
|
381
|
+
├── docs/
|
|
382
|
+
│ └── app-description.md # Generated app documentation
|
|
383
|
+
├── src/
|
|
384
|
+
│ ├── index.ts # Main application entry point
|
|
385
|
+
│ ├── data/ # Data models
|
|
386
|
+
│ │ ├── User.ts # User model with authentication (always generated)
|
|
387
|
+
│ │ ├── App.ts # Application model (with --templates)
|
|
388
|
+
│ │ ├── Address.ts # Address model (with --templates)
|
|
389
|
+
│ │ ├── Company.ts # Company model (with --templates)
|
|
390
|
+
│ │ ├── Person.ts # Person model (with --templates)
|
|
391
|
+
│ │ ├── Models.test.ts # Integration tests (with --templates)
|
|
392
|
+
│ │ └── Person.test.ts # Unit tests (with --templates)
|
|
393
|
+
│ ├── auth/ # Authentication and permissions (always generated)
|
|
394
|
+
│ │ └── permissions.ts # Permission definitions
|
|
395
|
+
│ ├── dataSources/ # Database configurations
|
|
396
|
+
│ │ ├── postgres.ts # PostgreSQL datasource config
|
|
397
|
+
│ │ └── mysql.ts # MySQL datasource config (if selected)
|
|
398
|
+
│ └── datasets/ # Sample data for development
|
|
399
|
+
│ ├── postgres-default/
|
|
400
|
+
│ │ ├── User.jsonl # System user (always generated)
|
|
401
|
+
│ │ ├── App.jsonl # (with --templates)
|
|
402
|
+
│ │ ├── Company.jsonl # (with --templates)
|
|
403
|
+
│ │ └── Person.jsonl # (with --templates)
|
|
404
|
+
│ └── mysql-default/ # If MySQL was selected
|
|
405
|
+
│ ├── User.jsonl
|
|
406
|
+
│ └── ... (same structure)
|
|
407
|
+
├── .env.example # Environment variables template
|
|
408
|
+
├── docker-compose.yml # Database infrastructure (generated on first run)
|
|
409
|
+
├── jest.config.ts # Jest configuration for testing
|
|
410
|
+
├── jest.setup.ts # Jest setup file
|
|
411
|
+
├── package.json # Project configuration with @slingr-framework dependency
|
|
412
|
+
└── tsconfig.json # TypeScript configuration
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**Note**: Sample data models and tests are only generated when using the `--templates` flag. Without it, you get a minimal project structure with just the basic setup.
|
|
416
|
+
|
|
417
|
+
## Features
|
|
418
|
+
|
|
419
|
+
### Core Development Features
|
|
420
|
+
|
|
421
|
+
- **TypeScript Setup**: Pre-configured TypeScript with strict settings
|
|
422
|
+
- **Testing**: Jest test framework with comprehensive sample tests (when using `--templates`)
|
|
423
|
+
- **Linting**: ESLint with TypeScript support
|
|
424
|
+
- **VS Code Integration**: Optimized settings and extension recommendations
|
|
425
|
+
- **Sample Code**: Working model examples with validation and relationships (with `--templates` flag)
|
|
426
|
+
|
|
427
|
+
### Database & Infrastructure
|
|
428
|
+
|
|
429
|
+
- **Multi-Database Support**: PostgreSQL and MySQL with automatic Docker setup
|
|
430
|
+
- **Infrastructure as Code**: Automatic Docker Compose generation for databases
|
|
431
|
+
- **Dataset Management**: Load JSONL datasets into your databases for testing
|
|
432
|
+
- **Port Conflict Detection**: Automatic detection and resolution of port conflicts
|
|
433
|
+
- **Health Checks**: Built-in database health monitoring
|
|
434
|
+
|
|
435
|
+
### Development Workflow
|
|
436
|
+
|
|
437
|
+
- **Hot Reload**: Automatic application restart on code changes
|
|
438
|
+
- **Docker Integration**: Seamless database container management
|
|
439
|
+
- **Framework Building**: Automatic @slingr-framework compilation when needed
|
|
440
|
+
- **Dependency Management**: Smart dependency installation based on database choice
|
|
441
|
+
|
|
442
|
+
## Database Support
|
|
443
|
+
|
|
444
|
+
The CLI supports the following databases with automatic infrastructure setup:
|
|
445
|
+
|
|
446
|
+
### PostgreSQL
|
|
447
|
+
|
|
448
|
+
- **Default Port**: 5433
|
|
449
|
+
- **Docker Image**: postgres:15-alpine
|
|
450
|
+
- **Health Checks**: Built-in pg_isready monitoring
|
|
451
|
+
- **Data Persistence**: Automatic volume management
|
|
452
|
+
|
|
453
|
+
### MySQL
|
|
454
|
+
|
|
455
|
+
- **Default Port**: 3306
|
|
456
|
+
- **Docker Image**: mysql:8.0
|
|
457
|
+
- **Health Checks**: Built-in mysqladmin ping monitoring
|
|
458
|
+
- **Data Persistence**: Automatic volume management
|
|
459
|
+
|
|
460
|
+
## Dataset Management
|
|
461
|
+
|
|
462
|
+
The CLI includes a powerful dataset management system:
|
|
463
|
+
|
|
464
|
+
### JSONL Format
|
|
465
|
+
|
|
466
|
+
Datasets are stored in JSONL (JSON Lines) format, with one JSON object per line:
|
|
467
|
+
|
|
468
|
+
```jsonl
|
|
469
|
+
{"id": 1, "name": "John Doe", "email": "john@example.com"}
|
|
470
|
+
{"id": 2, "name": "Jane Smith", "email": "jane@example.com"}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Loading Datasets
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
# Load default dataset for PostgreSQL
|
|
477
|
+
slingr ds postgres load
|
|
478
|
+
|
|
479
|
+
# Load specific dataset
|
|
480
|
+
slingr ds postgres load my-custom-dataset
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Dataset Structure
|
|
484
|
+
|
|
485
|
+
Datasets are organized by datasource and dataset name:
|
|
486
|
+
|
|
487
|
+
```
|
|
488
|
+
src/datasets/
|
|
489
|
+
├── postgres-default/ # Default PostgreSQL dataset
|
|
490
|
+
└── mysql-custom/ # Custom MySQL dataset
|
|
320
491
|
```
|