@lenne.tech/cli 0.0.124 → 1.0.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 (30) hide show
  1. package/bin/lt +145 -14
  2. package/build/commands/claude/claude.js +25 -0
  3. package/build/commands/claude/install-skills.js +622 -0
  4. package/build/commands/config/config.js +25 -0
  5. package/build/commands/config/help.js +167 -0
  6. package/build/commands/config/init.js +143 -0
  7. package/build/commands/config/show.js +68 -0
  8. package/build/commands/fullstack/init.js +38 -16
  9. package/build/commands/server/add-property.js +199 -36
  10. package/build/commands/server/create.js +66 -4
  11. package/build/commands/server/module.js +150 -27
  12. package/build/commands/server/object.js +38 -22
  13. package/build/extensions/config.js +157 -0
  14. package/build/extensions/parse-properties.js +119 -0
  15. package/build/extensions/server.js +82 -47
  16. package/build/interfaces/lt-config.interface.js +3 -0
  17. package/build/templates/claude-skills/lt-cli/SKILL.md +272 -0
  18. package/build/templates/claude-skills/lt-cli/examples.md +542 -0
  19. package/build/templates/claude-skills/lt-cli/reference.md +506 -0
  20. package/build/templates/claude-skills/nest-server-generator/SKILL.md +2833 -0
  21. package/build/templates/claude-skills/nest-server-generator/examples.md +760 -0
  22. package/build/templates/claude-skills/nest-server-generator/reference.md +417 -0
  23. package/build/templates/nest-server-module/inputs/template-create.input.ts.ejs +1 -3
  24. package/build/templates/nest-server-module/inputs/template.input.ts.ejs +1 -1
  25. package/build/templates/nest-server-module/template.controller.ts.ejs +24 -13
  26. package/build/templates/nest-server-module/template.model.ts.ejs +2 -2
  27. package/build/templates/nest-server-module/template.module.ts.ejs +4 -0
  28. package/build/templates/nest-server-module/template.service.ts.ejs +6 -6
  29. package/build/templates/nest-server-object/template.object.ts.ejs +2 -2
  30. package/package.json +13 -11
package/bin/lt CHANGED
@@ -2,20 +2,151 @@
2
2
 
3
3
 
4
4
  /* tslint:disable */
5
- // check if we're running in dev mode
6
- var devMode = require('fs').existsSync(`${__dirname}/../src`);
7
- // or want to "force" running the compiled version with --compiled-build
8
- var wantsCompiled = process.argv.indexOf('--compiled-build') >= 0;
9
-
10
- if (wantsCompiled || !devMode) {
11
- // this runs from the compiled javascript source
12
- require(`${__dirname}/../build/cli`).run(process.argv);
13
- } else {
14
- // this runs from the typescript source (for dev only)
15
- // hook into ts-node so we can run typescript on the fly
16
- require('ts-node').register({ project: `${__dirname}/../tsconfig.json` });
17
- // run the CLI with the current process arguments
18
- require(`${__dirname}/../src/cli`).run(process.argv);
5
+
6
+ // Handle case where current working directory no longer exists
7
+ try {
8
+ process.cwd();
9
+ } catch (err) {
10
+ // Current directory doesn't exist - offer interactive solutions
11
+ var fs = require('fs');
12
+ var path = require('path');
13
+ var os = require('os');
14
+ var readline = require('readline');
15
+
16
+ console.error('\nError: Current working directory no longer exists.');
17
+ console.error('The directory you were in has been deleted or is no longer accessible.\n');
18
+
19
+ // Try to find the next existing parent directory
20
+ var originalPath = process.env.PWD || process.env.OLDPWD || '';
21
+ var parentDir = null;
22
+
23
+ if (originalPath) {
24
+ var testPath = path.dirname(originalPath);
25
+ while (testPath && testPath !== '/' && testPath !== '.') {
26
+ try {
27
+ if (fs.existsSync(testPath) && fs.statSync(testPath).isDirectory()) {
28
+ parentDir = testPath;
29
+ break;
30
+ }
31
+ } catch (e) {
32
+ // Continue searching
33
+ }
34
+ testPath = path.dirname(testPath);
35
+ }
36
+ }
37
+
38
+ // Build options
39
+ var options = [];
40
+ if (parentDir) {
41
+ options.push({ key: '1', label: 'Change to nearest existing parent directory: ' + parentDir, action: parentDir });
42
+ }
43
+ options.push({ key: parentDir ? '2' : '1', label: 'Change to home directory: ' + os.homedir(), action: os.homedir() });
44
+ options.push({ key: parentDir ? '3' : '2', label: 'Enter a custom directory path', action: 'custom' });
45
+ options.push({ key: parentDir ? '4' : '3', label: 'Cancel and exit', action: 'exit' });
46
+
47
+ // Display options
48
+ console.log('Please choose an option:\n');
49
+ options.forEach(function(opt) {
50
+ console.log(' ' + opt.key + ') ' + opt.label);
51
+ });
52
+ console.log('');
53
+
54
+ // Read user input
55
+ var rl = readline.createInterface({
56
+ input: process.stdin,
57
+ output: process.stdout
58
+ });
59
+
60
+ rl.question('Enter your choice: ', function(answer) {
61
+ var choice = options.find(function(opt) { return opt.key === answer.trim(); });
62
+
63
+ if (!choice) {
64
+ console.error('\nInvalid choice. Exiting.\n');
65
+ rl.close();
66
+ process.exit(1);
67
+ return;
68
+ }
69
+
70
+ if (choice.action === 'exit') {
71
+ console.log('\nCancelled.\n');
72
+ rl.close();
73
+ process.exit(0);
74
+ return;
75
+ }
76
+
77
+ if (choice.action === 'custom') {
78
+ rl.question('Enter directory path (absolute or relative to ' + (parentDir || os.homedir()) + '): ', function(customPath) {
79
+ var targetPath = customPath.trim();
80
+
81
+ // If relative path, resolve it relative to parent or home
82
+ if (!path.isAbsolute(targetPath)) {
83
+ targetPath = path.resolve(parentDir || os.homedir(), targetPath);
84
+ }
85
+
86
+ try {
87
+ if (!fs.existsSync(targetPath)) {
88
+ console.error('\nError: Directory does not exist: ' + targetPath + '\n');
89
+ rl.close();
90
+ process.exit(1);
91
+ return;
92
+ }
93
+
94
+ process.chdir(targetPath);
95
+ console.log('\nChanged to: ' + targetPath + '\n');
96
+ rl.close();
97
+ continueExecution();
98
+ } catch (e) {
99
+ console.error('\nError: Cannot change to directory: ' + targetPath);
100
+ console.error(e.message + '\n');
101
+ rl.close();
102
+ process.exit(1);
103
+ }
104
+ });
105
+ return;
106
+ }
107
+
108
+ // Change to selected directory
109
+ try {
110
+ process.chdir(choice.action);
111
+ console.log('\nChanged to: ' + choice.action + '\n');
112
+ rl.close();
113
+ continueExecution();
114
+ } catch (e) {
115
+ console.error('\nError: Cannot change to directory: ' + choice.action);
116
+ console.error(e.message + '\n');
117
+ rl.close();
118
+ process.exit(1);
119
+ }
120
+ });
121
+
122
+ // Function to continue CLI execution after directory change
123
+ function continueExecution() {
124
+ runCLI();
125
+ }
126
+
127
+ // Don't continue execution here - wait for user choice
128
+ return;
129
+ }
130
+
131
+ // Normal execution path
132
+ runCLI();
133
+
134
+ function runCLI() {
135
+ // check if we're running in dev mode
136
+ var devMode = require('fs').existsSync(`${__dirname}/../src`);
137
+ // or want to "force" running the compiled version with --compiled-build
138
+ var wantsCompiled = process.argv.indexOf('--compiled-build') >= 0;
139
+
140
+ if (wantsCompiled || !devMode) {
141
+ // this runs from the compiled javascript source
142
+ require(`${__dirname}/../build/cli`).run(process.argv);
143
+ } else {
144
+ // this runs from the typescript source (for dev only)
145
+ // hook into ts-node so we can run typescript on the fly
146
+ require('ts-node').register({ project: `${__dirname}/../tsconfig.json` });
147
+ // run the CLI with the current process arguments
148
+ require(`${__dirname}/../src/cli`).run(process.argv);
149
+ }
19
150
  }
20
151
 
21
152
 
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**
13
+ * Claude commands
14
+ */
15
+ module.exports = {
16
+ alias: ['c'],
17
+ description: 'Claude commands',
18
+ hidden: true,
19
+ name: 'claude',
20
+ run: (toolbox) => __awaiter(void 0, void 0, void 0, function* () {
21
+ yield toolbox.helper.showMenu('claude');
22
+ return 'claude';
23
+ }),
24
+ };
25
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhdWRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbW1hbmRzL2NsYXVkZS9jbGF1ZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFFQTs7R0FFRztBQUNILE1BQU0sQ0FBQyxPQUFPLEdBQUc7SUFDZixLQUFLLEVBQUUsQ0FBQyxHQUFHLENBQUM7SUFDWixXQUFXLEVBQUUsaUJBQWlCO0lBQzlCLE1BQU0sRUFBRSxJQUFJO0lBQ1osSUFBSSxFQUFFLFFBQVE7SUFDZCxHQUFHLEVBQUUsQ0FBTyxPQUErQixFQUFFLEVBQUU7UUFDN0MsTUFBTSxPQUFPLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsQ0FBQztRQUN4QyxPQUFPLFFBQVEsQ0FBQztJQUNsQixDQUFDLENBQUE7Q0FDRixDQUFDIn0=