gorig-cli 1.0.26 → 1.0.28

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/bin/cli.js CHANGED
@@ -1,22 +1,56 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from 'chalk';
4
+ import fs from 'fs';
4
5
  import path from 'path';
6
+ import { fileURLToPath } from 'url';
5
7
 
6
8
  // Get command line arguments
7
9
  const args = process.argv.slice(2);
8
10
 
11
+ // Get current file directory
12
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
13
+
14
+ const availableCommands = 'create, init, doc, skill';
15
+
16
+ const printUsage = () => {
17
+ console.log(`Usage: gorig-cli <command> [options]
18
+
19
+ Commands:
20
+ init Initialize a new Gorig project
21
+ create Create a module in an existing Gorig project
22
+ doc Generate API documentation
23
+ skill Install the bundled gorig-backend skill
24
+
25
+ Options:
26
+ -h, --help Show this help
27
+ -v, --version Show gorig-cli version`);
28
+ };
29
+
30
+ const readPackageVersion = () => {
31
+ const packagePath = path.join(__dirname, '../package.json');
32
+ const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
33
+ return packageJson.version;
34
+ };
35
+
9
36
  // Validate if a command is provided
10
37
  if (args.length < 1) {
11
- console.error(chalk.red('Please provide a valid command, e.g.: create, init, doc, or skill'));
38
+ console.error(chalk.red(`Please provide a valid command, e.g.: ${availableCommands}`));
12
39
  process.exit(1);
13
40
  }
14
41
 
15
42
  // Extract command
16
43
  const command = args[0];
17
44
 
18
- // Get current file directory
19
- const __dirname = path.dirname(new URL(import.meta.url).pathname);
45
+ if (command === '--version' || command === '-v' || command === 'version') {
46
+ console.log(readPackageVersion());
47
+ process.exit(0);
48
+ }
49
+
50
+ if (command === '--help' || command === '-h' || command === 'help') {
51
+ printUsage();
52
+ process.exit(0);
53
+ }
20
54
 
21
55
  // Execute different logic based on command
22
56
  switch (command) {
@@ -59,6 +93,6 @@ switch (command) {
59
93
 
60
94
  default:
61
95
  console.error(chalk.red(`Unknown command: ${command}`));
62
- console.error(chalk.yellow('Available commands: create, init, doc, skill'));
96
+ console.error(chalk.yellow(`Available commands: ${availableCommands}`));
63
97
  process.exit(1);
64
98
  }
package/commands/init.js CHANGED
@@ -340,6 +340,11 @@ export const initProject = async (options, runtime = {}) => {
340
340
  };
341
341
 
342
342
  const initModule = async (args) => {
343
+ if (args.length === 1 && ['--help', '-h', 'help'].includes(args[0])) {
344
+ printUsage();
345
+ return 0;
346
+ }
347
+
343
348
  try {
344
349
  const options = parseInitArgs(args);
345
350
  await initProject(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gorig-cli",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "type": "module",
5
5
  "description": "gorig build tool",
6
6
  "main": "bin/cli.js",
@@ -194,6 +194,8 @@ Controllers must:
194
194
  - Return through `apix.HandleData` with the project's established business code shape.
195
195
  - Keep transport logic only; call service functions for business behavior.
196
196
 
197
+ Model note: `dx.On[T].Complex()` embeds `domainx.Options`; do not add generic `CreatedAt`, `UpdatedAt`, or `DeletedAt` fields to `T`. Keep only business-specific timestamps in `T`, and map audit timestamps from `*domainx.Complex[T]` when a response DTO needs them.
198
+
197
199
  ## MySQL Model Pattern
198
200
 
199
201
  Use MySQL when the user chooses MySQL or the project clearly uses MySQL for similar modules.