@keshavsoft/kschema-cli 1.10.2 → 1.10.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/bin/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import getLatestVersion from "./core/getLatestVersion.js";
4
4
  import loadRunner from "./core/loadRunner.js";
@@ -0,0 +1,42 @@
1
+ /*
2
+ KSchema CLI – Entry Flow
3
+
4
+ 1. Read user input from terminal (parseInput)
5
+ 2. If no command → show usage (first-time user safety)
6
+ 3. If help flags → show usage (quick guidance)
7
+ 4. Resolve command dynamically (no hardcoding logic)
8
+ 5. If command not found → inform + guide back to usage
9
+ 6. Execute command with parsed input
10
+
11
+ Goal:
12
+ - Zero confusion for user
13
+ - Single source of truth (showUsage)
14
+ - Easy to extend (just add commands, no core changes)
15
+ */
16
+
17
+ export default function showUsage(version) {
18
+ const g = "\x1b[32m";
19
+ const y = "\x1b[33m";
20
+ const c = "\x1b[36m";
21
+ const gray = "\x1b[90m";
22
+ const r = "\x1b[0m";
23
+
24
+ console.log(`
25
+ ${c}🚀 KSchema CLI v${version}${r}
26
+
27
+ ${y}Usage:${r}
28
+ ${g}npx @keshavsoft/kschema-cli${r} <command> [options]
29
+
30
+ ${y}Commands:${r}
31
+ ${g}init${r} Initialize a new schema setup
32
+ ${g}test${r} Run schema validations/tests
33
+ ${g}generate-samples${r} Generate sample schema files
34
+
35
+ ${y}Examples:${r}
36
+ ${gray}npx @keshavsoft/kschema-cli init${r}
37
+ ${gray}npx @keshavsoft/kschema-cli test users${r}
38
+
39
+ ${y}Tip:${r}
40
+ ${gray}npm i -g @keshavsoft/kschema-cli${r}
41
+ `);
42
+ }
package/bin/v10/start.js CHANGED
@@ -1,63 +1,22 @@
1
1
  import parseInput from "./core/parseInput.js";
2
2
  import resolveCommand from "./core/resolveCommand.js";
3
+ import showUsage from './core/showUsage.js';
4
+ import pkg from '../../package.json' with { type: 'json' };
3
5
 
4
- /*
5
- KSchema CLI – Entry Flow
6
-
7
- 1. Read user input from terminal (parseInput)
8
- 2. If no command → show usage (first-time user safety)
9
- 3. If help flags → show usage (quick guidance)
10
- 4. Resolve command dynamically (no hardcoding logic)
11
- 5. If command not found → inform + guide back to usage
12
- 6. Execute command with parsed input
13
-
14
- Goal:
15
- - Zero confusion for user
16
- - Single source of truth (showUsage)
17
- - Easy to extend (just add commands, no core changes)
18
- */
6
+ const version = pkg.version;
19
7
 
20
8
  const run = async () => {
21
- const input = parseInput();
9
+ const input = parseInput();
22
10
 
23
- if (!input.cmd) return showUsage();
11
+ if (!input.cmd) return showUsage(version);
24
12
 
25
- if (input.cmd === "--help" || input.cmd === "-h" || input.cmd === "help") return showUsage();
13
+ if (input.cmd === "--help" || input.cmd === "-h" || input.cmd === "help") return showUsage(version);
26
14
 
27
- const command = resolveCommand(input.cmd);
15
+ const command = resolveCommand(input.cmd);
28
16
 
29
- if (!command) return (console.log(`Unknown command: ${input.cmd}\n`), showUsage());
17
+ if (!command) return (console.log(`Unknown command: ${input.cmd}\n`), showUsage(version));
30
18
 
31
- await command(input);
19
+ await command(input);
32
20
  };
33
21
 
34
- export default run;
35
-
36
- const showUsage = () => {
37
- const g = "\x1b[32m";
38
- const y = "\x1b[33m";
39
- const c = "\x1b[36m";
40
- const gray = "\x1b[90m";
41
- const r = "\x1b[0m";
42
-
43
- console.log(`
44
- ${c}🚀 KSchema CLI v1.9.3${r}
45
-
46
- ${y}Usage:${r}
47
- ${g}npx @keshavsoft/kschema-cli${r} <command> [options]
48
-
49
- // inside showUsage()
50
- ${y}Commands:${r}
51
- ${g}init${r} 🛠 Initialize a new schema setup
52
- ${g}test${r} ✅ Run schema validations/tests
53
- ${g}generate-samples${r} 📦 Generate sample schema files
54
-
55
- ${y}Examples:${r}
56
- ${gray}npx @keshavsoft/kschema-cli init${r}
57
- ${gray}npx @keshavsoft/kschema-cli test users${r}
58
-
59
- ${y}Tip:${r}
60
- 💡 npm i -g @keshavsoft/kschema-cli
61
- ${g}kschema${r} <command>
62
- `);
63
- };
22
+ export default run;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keshavsoft/kschema-cli",
3
- "version": "1.10.2",
3
+ "version": "1.10.4",
4
4
  "description": "CLI to scaffold projects using templates",
5
5
  "keywords": [
6
6
  "cli",
@@ -10,7 +10,7 @@
10
10
  "project-generator"
11
11
  ],
12
12
  "dependencies": {
13
- "@keshavsoft/kschema": "^1.17.5"
13
+ "@keshavsoft/kschema": "^1.17.7"
14
14
  },
15
15
  "type": "module",
16
16
  "bin": {