@objectql/cli 1.8.4 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +2 -2
  2. package/dist/commands/database-push.d.ts +5 -0
  3. package/dist/commands/database-push.js +15 -0
  4. package/dist/commands/database-push.js.map +1 -0
  5. package/dist/commands/dev.d.ts +2 -0
  6. package/dist/commands/dev.js +94 -6
  7. package/dist/commands/dev.js.map +1 -1
  8. package/dist/commands/doctor.d.ts +4 -0
  9. package/dist/commands/doctor.js +37 -0
  10. package/dist/commands/doctor.js.map +1 -0
  11. package/dist/commands/init.js +31 -30
  12. package/dist/commands/init.js.map +1 -1
  13. package/dist/commands/serve.d.ts +2 -0
  14. package/dist/commands/serve.js +122 -46
  15. package/dist/commands/serve.js.map +1 -1
  16. package/dist/commands/start.d.ts +1 -0
  17. package/dist/commands/start.js +15 -0
  18. package/dist/commands/start.js.map +1 -1
  19. package/dist/index.js +173 -210
  20. package/dist/index.js.map +1 -1
  21. package/package.json +13 -7
  22. package/templates/hello-world/.vscode/extensions.json +7 -0
  23. package/templates/hello-world/CHANGELOG.md +41 -0
  24. package/templates/hello-world/README.md +29 -0
  25. package/templates/hello-world/package.json +24 -0
  26. package/templates/hello-world/src/index.ts +58 -0
  27. package/templates/hello-world/tsconfig.json +10 -0
  28. package/templates/starter/.vscode/extensions.json +7 -0
  29. package/{CHANGELOG.md → templates/starter/CHANGELOG.md} +36 -42
  30. package/templates/starter/README.md +17 -0
  31. package/templates/starter/__tests__/projects-hooks-actions.test.ts +490 -0
  32. package/templates/starter/jest.config.js +16 -0
  33. package/templates/starter/package.json +52 -0
  34. package/templates/starter/src/README.pages.md +110 -0
  35. package/templates/starter/src/demo.app.yml +4 -0
  36. package/templates/starter/src/i18n/zh-CN/projects.json +22 -0
  37. package/templates/starter/src/modules/kitchen-sink/kitchen_sink.data.yml +18 -0
  38. package/templates/starter/src/modules/kitchen-sink/kitchen_sink.object.yml +156 -0
  39. package/templates/starter/src/modules/projects/project_approval.workflow.yml +51 -0
  40. package/templates/starter/src/modules/projects/projects.action.ts +472 -0
  41. package/templates/starter/src/modules/projects/projects.data.yml +13 -0
  42. package/templates/starter/src/modules/projects/projects.hook.ts +339 -0
  43. package/templates/starter/src/modules/projects/projects.object.yml +148 -0
  44. package/templates/starter/src/modules/projects/projects.permission.yml +141 -0
  45. package/templates/starter/src/modules/projects/projects.validation.yml +37 -0
  46. package/templates/starter/src/modules/tasks/tasks.data.yml +23 -0
  47. package/templates/starter/src/modules/tasks/tasks.object.yml +34 -0
  48. package/templates/starter/src/modules/tasks/tasks.permission.yml +167 -0
  49. package/templates/starter/src/seed.ts +55 -0
  50. package/templates/starter/src/types/index.ts +3 -0
  51. package/templates/starter/src/types/kitchen_sink.ts +101 -0
  52. package/templates/starter/src/types/projects.ts +49 -0
  53. package/templates/starter/src/types/tasks.ts +33 -0
  54. package/templates/starter/tsconfig.json +11 -0
  55. package/templates/starter/tsconfig.tsbuildinfo +1 -0
  56. package/AI_EXAMPLES.md +0 -154
  57. package/AI_IMPLEMENTATION_SUMMARY.md +0 -509
  58. package/AI_TUTORIAL.md +0 -144
  59. package/IMPLEMENTATION_SUMMARY.md +0 -437
  60. package/USAGE_EXAMPLES.md +0 -951
  61. package/__tests__/commands.test.ts +0 -426
  62. package/jest.config.js +0 -19
  63. package/src/commands/ai.ts +0 -509
  64. package/src/commands/build.ts +0 -98
  65. package/src/commands/dev.ts +0 -23
  66. package/src/commands/format.ts +0 -110
  67. package/src/commands/generate.ts +0 -135
  68. package/src/commands/i18n.ts +0 -303
  69. package/src/commands/init.ts +0 -191
  70. package/src/commands/lint.ts +0 -98
  71. package/src/commands/migrate.ts +0 -314
  72. package/src/commands/new.ts +0 -221
  73. package/src/commands/repl.ts +0 -120
  74. package/src/commands/serve.ts +0 -96
  75. package/src/commands/start.ts +0 -100
  76. package/src/commands/sync.ts +0 -328
  77. package/src/commands/test.ts +0 -98
  78. package/src/index.ts +0 -356
  79. package/tsconfig.json +0 -15
  80. package/tsconfig.tsbuildinfo +0 -1
package/src/index.ts DELETED
@@ -1,356 +0,0 @@
1
- import { Command } from 'commander';
2
- import { generateTypes } from './commands/generate';
3
- import { startRepl } from './commands/repl';
4
- import { serve } from './commands/serve';
5
- import { dev } from './commands/dev';
6
- import { start } from './commands/start';
7
- import { build } from './commands/build';
8
- import { test } from './commands/test';
9
- import { lint } from './commands/lint';
10
- import { format } from './commands/format';
11
- import { initProject } from './commands/init';
12
- import { newMetadata } from './commands/new';
13
- import { i18nExtract, i18nInit, i18nValidate } from './commands/i18n';
14
- import { migrate, migrateCreate, migrateStatus } from './commands/migrate';
15
- import { aiGenerate, aiValidate, aiChat, aiConversational } from './commands/ai';
16
- import { syncDatabase } from './commands/sync';
17
-
18
- const program = new Command();
19
-
20
- program
21
- .name('objectql')
22
- .description('ObjectQL CLI tool')
23
- .version('1.5.0');
24
-
25
- // Init command - Create new project
26
- program
27
- .command('init')
28
- .description('Create a new ObjectQL project from template')
29
- .option('-t, --template <template>', 'Template to use (basic, express-api, enterprise)', 'basic')
30
- .option('-n, --name <name>', 'Project name')
31
- .option('-d, --dir <path>', 'Target directory')
32
- .option('--skip-install', 'Skip dependency installation')
33
- .option('--skip-git', 'Skip git initialization')
34
- .action(async (options) => {
35
- try {
36
- await initProject(options);
37
- } catch (error) {
38
- console.error(error);
39
- process.exit(1);
40
- }
41
- });
42
-
43
- // New command - Generate metadata files
44
- program
45
- .command('new <type> <name>')
46
- .description('Generate a new metadata file (object, view, form, etc.)')
47
- .option('-d, --dir <path>', 'Output directory', '.')
48
- .action(async (type, name, options) => {
49
- try {
50
- await newMetadata({ type, name, dir: options.dir });
51
- } catch (error) {
52
- console.error(error);
53
- process.exit(1);
54
- }
55
- });
56
-
57
- // Generate command - Generate TypeScript types
58
- program
59
- .command('generate')
60
- .alias('g')
61
- .description('Generate TypeScript interfaces from ObjectQL schema files')
62
- .option('-s, --source <path>', 'Source directory containing *.object.yml', '.')
63
- .option('-o, --output <path>', 'Output directory for generated types', './src/generated')
64
- .action(async (options) => {
65
- try {
66
- await generateTypes(options.source, options.output);
67
- } catch (error) {
68
- console.error(error);
69
- process.exit(1);
70
- }
71
- });
72
-
73
- // I18n commands
74
- const i18nCmd = program
75
- .command('i18n')
76
- .description('Internationalization commands');
77
-
78
- i18nCmd
79
- .command('extract')
80
- .description('Extract translatable strings from metadata files')
81
- .option('-s, --source <path>', 'Source directory', '.')
82
- .option('-o, --output <path>', 'Output directory', './src/i18n')
83
- .option('-l, --lang <lang>', 'Language code', 'en')
84
- .action(async (options) => {
85
- try {
86
- await i18nExtract(options);
87
- } catch (error) {
88
- console.error(error);
89
- process.exit(1);
90
- }
91
- });
92
-
93
- i18nCmd
94
- .command('init <lang>')
95
- .description('Initialize i18n for a new language')
96
- .option('-b, --base-dir <path>', 'Base i18n directory', './src/i18n')
97
- .action(async (lang, options) => {
98
- try {
99
- await i18nInit({ lang, baseDir: options.baseDir });
100
- } catch (error) {
101
- console.error(error);
102
- process.exit(1);
103
- }
104
- });
105
-
106
- i18nCmd
107
- .command('validate <lang>')
108
- .description('Validate translation completeness')
109
- .option('-b, --base-dir <path>', 'Base i18n directory', './src/i18n')
110
- .option('--base-lang <lang>', 'Base language to compare against', 'en')
111
- .action(async (lang, options) => {
112
- try {
113
- await i18nValidate({ lang, baseDir: options.baseDir, baseLang: options.baseLang });
114
- } catch (error) {
115
- console.error(error);
116
- process.exit(1);
117
- }
118
- });
119
-
120
- // Migration commands
121
- const migrateCmd = program
122
- .command('migrate')
123
- .description('Run pending database migrations')
124
- .option('-c, --config <path>', 'Path to objectql.config.ts/js')
125
- .option('-d, --dir <path>', 'Migrations directory', './migrations')
126
- .action(async (options) => {
127
- try {
128
- await migrate(options);
129
- } catch (error) {
130
- console.error(error);
131
- process.exit(1);
132
- }
133
- });
134
-
135
- migrateCmd
136
- .command('create <name>')
137
- .description('Create a new migration file')
138
- .option('-d, --dir <path>', 'Migrations directory', './migrations')
139
- .action(async (name, options) => {
140
- try {
141
- await migrateCreate({ name, dir: options.dir });
142
- } catch (error) {
143
- console.error(error);
144
- process.exit(1);
145
- }
146
- });
147
-
148
- migrateCmd
149
- .command('status')
150
- .description('Show migration status')
151
- .option('-c, --config <path>', 'Path to objectql.config.ts/js')
152
- .option('-d, --dir <path>', 'Migrations directory', './migrations')
153
- .action(async (options) => {
154
- try {
155
- await migrateStatus(options);
156
- } catch (error) {
157
- console.error(error);
158
- process.exit(1);
159
- }
160
- });
161
-
162
- // Sync command - Introspect database and generate .object.yml files
163
- program
164
- .command('sync')
165
- .description('Sync database schema to ObjectQL object definitions')
166
- .option('-c, --config <path>', 'Path to objectql.config.ts/js')
167
- .option('-o, --output <path>', 'Output directory for .object.yml files', './src/objects')
168
- .option('-t, --tables <tables...>', 'Specific tables to sync (default: all)')
169
- .option('-f, --force', 'Overwrite existing files')
170
- .action(async (options) => {
171
- try {
172
- await syncDatabase(options);
173
- } catch (error) {
174
- console.error(error);
175
- process.exit(1);
176
- }
177
- });
178
-
179
- // REPL command
180
- program
181
- .command('repl')
182
- .alias('r')
183
- .description('Start an interactive shell (REPL) to query the database')
184
- .option('-c, --config <path>', 'Path to objectql.config.ts/js')
185
- .action(async (options) => {
186
- await startRepl(options.config);
187
- });
188
-
189
- // Dev command - Start development server
190
- program
191
- .command('dev')
192
- .alias('d')
193
- .description('Start development server with hot reload')
194
- .option('-p, --port <number>', 'Port to listen on', '3000')
195
- .option('-d, --dir <path>', 'Directory containing schema', '.')
196
- .option('--no-watch', 'Disable file watching')
197
- .action(async (options) => {
198
- await dev({
199
- port: parseInt(options.port),
200
- dir: options.dir,
201
- watch: options.watch
202
- });
203
- });
204
-
205
- // Start command - Production server
206
- program
207
- .command('start')
208
- .description('Start production server')
209
- .option('-p, --port <number>', 'Port to listen on', '3000')
210
- .option('-d, --dir <path>', 'Directory containing schema', '.')
211
- .option('-c, --config <path>', 'Path to objectql.config.ts/js')
212
- .action(async (options) => {
213
- await start({
214
- port: parseInt(options.port),
215
- dir: options.dir,
216
- config: options.config
217
- });
218
- });
219
-
220
- // Build command - Build project for production
221
- program
222
- .command('build')
223
- .alias('b')
224
- .description('Build project and generate types')
225
- .option('-d, --dir <path>', 'Source directory', '.')
226
- .option('-o, --output <path>', 'Output directory', './dist')
227
- .option('--no-types', 'Skip TypeScript type generation')
228
- .option('--no-validate', 'Skip metadata validation')
229
- .action(async (options) => {
230
- await build({
231
- dir: options.dir,
232
- output: options.output,
233
- types: options.types,
234
- validate: options.validate
235
- });
236
- });
237
-
238
- // Test command - Run tests
239
- program
240
- .command('test')
241
- .alias('t')
242
- .description('Run tests')
243
- .option('-d, --dir <path>', 'Project directory', '.')
244
- .option('-w, --watch', 'Watch mode')
245
- .option('--coverage', 'Generate coverage report')
246
- .action(async (options) => {
247
- await test({
248
- dir: options.dir,
249
- watch: options.watch,
250
- coverage: options.coverage
251
- });
252
- });
253
-
254
- // Lint command - Validate metadata
255
- program
256
- .command('lint')
257
- .alias('l')
258
- .description('Validate metadata files')
259
- .option('-d, --dir <path>', 'Directory to lint', '.')
260
- .option('--fix', 'Automatically fix issues')
261
- .action(async (options) => {
262
- await lint({
263
- dir: options.dir,
264
- fix: options.fix
265
- });
266
- });
267
-
268
- // Format command - Format metadata files
269
- program
270
- .command('format')
271
- .alias('fmt')
272
- .description('Format metadata files with Prettier')
273
- .option('-d, --dir <path>', 'Directory to format', '.')
274
- .option('--check', 'Check if files are formatted without modifying')
275
- .action(async (options) => {
276
- await format({
277
- dir: options.dir,
278
- check: options.check
279
- });
280
- });
281
-
282
- // Serve command (kept for backwards compatibility)
283
- program
284
- .command('serve')
285
- .alias('s')
286
- .description('Start a development server (alias for dev)')
287
- .option('-p, --port <number>', 'Port to listen on', '3000')
288
- .option('-d, --dir <path>', 'Directory containing schema', '.')
289
- .action(async (options) => {
290
- await serve({ port: parseInt(options.port), dir: options.dir });
291
- });
292
-
293
- // AI command - Interactive by default, with specific subcommands for other modes
294
- const aiCmd = program
295
- .command('ai')
296
- .description('AI-powered interactive application builder (starts conversational mode by default)');
297
-
298
- // Default action: Interactive conversational mode
299
- aiCmd
300
- .argument('[output-dir]', 'Output directory for generated files', './src')
301
- .action(async (outputDir) => {
302
- try {
303
- await aiConversational({ output: outputDir });
304
- } catch (error) {
305
- console.error(error);
306
- process.exit(1);
307
- }
308
- });
309
-
310
- // Subcommand: Generate (one-shot generation)
311
- aiCmd
312
- .command('generate')
313
- .description('Generate application from description (one-shot, non-interactive)')
314
- .requiredOption('-d, --description <text>', 'Application description')
315
- .option('-o, --output <path>', 'Output directory', './src')
316
- .option('-t, --type <type>', 'Generation type: basic, complete, or custom', 'custom')
317
- .action(async (options) => {
318
- try {
319
- await aiGenerate(options);
320
- } catch (error) {
321
- console.error(error);
322
- process.exit(1);
323
- }
324
- });
325
-
326
- // Subcommand: Validate
327
- aiCmd
328
- .command('validate')
329
- .description('Validate metadata files with AI analysis')
330
- .argument('<path>', 'Path to metadata files directory')
331
- .option('--fix', 'Automatically fix issues')
332
- .option('-v, --verbose', 'Detailed output')
333
- .action(async (pathArg, options) => {
334
- try {
335
- await aiValidate({ path: pathArg, ...options });
336
- } catch (error) {
337
- console.error(error);
338
- process.exit(1);
339
- }
340
- });
341
-
342
- // Subcommand: Chat
343
- aiCmd
344
- .command('chat')
345
- .description('AI assistant for questions and guidance')
346
- .option('-p, --prompt <text>', 'Initial prompt')
347
- .action(async (options) => {
348
- try {
349
- await aiChat({ initialPrompt: options.prompt });
350
- } catch (error) {
351
- console.error(error);
352
- process.exit(1);
353
- }
354
- });
355
-
356
- program.parse();
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src"
6
- },
7
- "include": ["src"],
8
- "references": [
9
- { "path": "../../foundation/types" },
10
- { "path": "../../foundation/core" },
11
- { "path": "../../runtime/server" },
12
- { "path": "../../foundation/platform-node" },
13
- { "path": "../../drivers/sql" }
14
- ]
15
- }