lsh-framework 0.5.10 → 0.5.12

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/dist/cli.js CHANGED
@@ -64,17 +64,36 @@ program
64
64
  await startInteractiveShell(options);
65
65
  }
66
66
  else {
67
- // No arguments - show brief usage message
67
+ // No arguments - show commands without verbose options
68
68
  console.log('LSH - A modern shell with ZSH features and superior job management');
69
69
  console.log('');
70
70
  console.log('Usage: lsh [options] [command]');
71
71
  console.log('');
72
+ console.log('Commands:');
73
+ console.log(' repl JavaScript REPL interactive shell');
74
+ console.log(' script <file> Execute shell script');
75
+ console.log(' config Manage configuration');
76
+ console.log(' zsh ZSH compatibility commands');
77
+ console.log(' help Show detailed help');
78
+ console.log('');
79
+ console.log('Self-Management:');
80
+ console.log(' self update Update to latest version');
81
+ console.log(' self version Show version information');
82
+ console.log(' self uninstall Uninstall LSH from system');
83
+ console.log(' self theme Manage themes');
84
+ console.log(' self zsh-import Import ZSH configs');
85
+ console.log('');
86
+ console.log('Library Services:');
87
+ console.log(' lib api API server management');
88
+ console.log(' lib daemon Daemon management');
89
+ console.log(' lib cron Cron job management');
90
+ console.log(' lib secrets Secrets management');
91
+ console.log(' lib supabase Supabase database management');
92
+ console.log('');
72
93
  console.log('Quick Start:');
73
94
  console.log(' lsh -i Start interactive shell');
74
- console.log(' lsh --help Show detailed help');
75
- console.log(' lsh self update Update to latest version');
76
- console.log('');
77
- console.log('For full documentation, run: lsh help');
95
+ console.log(' lsh --help Show all options');
96
+ console.log(' lsh help Show detailed help with examples');
78
97
  }
79
98
  }
80
99
  catch (error) {
@@ -3,6 +3,9 @@
3
3
  * Sync .env files across development environments
4
4
  */
5
5
  import SecretsManager from '../../lib/secrets-manager.js';
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import * as readline from 'readline';
6
9
  export async function init_secrets(program) {
7
10
  const secretsCmd = program
8
11
  .command('secrets')
@@ -96,5 +99,113 @@ export async function init_secrets(program) {
96
99
  console.log('💡 Tip: Share this key securely with your team to sync secrets.');
97
100
  console.log(' Never commit it to git!\n');
98
101
  });
102
+ // Create .env file
103
+ secretsCmd
104
+ .command('create')
105
+ .description('Create a new .env file')
106
+ .option('-f, --file <path>', 'Path to .env file', '.env')
107
+ .option('-t, --template', 'Create with common template variables')
108
+ .action(async (options) => {
109
+ try {
110
+ const envPath = path.resolve(options.file);
111
+ // Check if file already exists
112
+ if (fs.existsSync(envPath)) {
113
+ console.log(`❌ File already exists: ${envPath}`);
114
+ console.log('💡 Use a different path or delete the existing file first.');
115
+ process.exit(1);
116
+ }
117
+ // Create template content if requested
118
+ let content = '';
119
+ if (options.template) {
120
+ content = `# Environment Configuration
121
+ # Generated by LSH Secrets Manager
122
+
123
+ # Application
124
+ NODE_ENV=development
125
+ PORT=3000
126
+
127
+ # Database
128
+ DATABASE_URL=
129
+
130
+ # API Keys
131
+ API_KEY=
132
+
133
+ # LSH Secrets (for cross-machine sync)
134
+ # LSH_SECRETS_KEY=
135
+
136
+ # Add your environment variables below
137
+ `;
138
+ }
139
+ // Create the file
140
+ fs.writeFileSync(envPath, content, 'utf8');
141
+ console.log(`✅ Created .env file: ${envPath}`);
142
+ if (options.template) {
143
+ console.log('📝 Template variables added - update with your values');
144
+ }
145
+ console.log('');
146
+ console.log('Next steps:');
147
+ console.log(` 1. Edit the file: ${options.file}`);
148
+ console.log(` 2. Push to cloud: lsh lib secrets push -f ${options.file}`);
149
+ console.log('');
150
+ }
151
+ catch (error) {
152
+ console.error('❌ Failed to create .env file:', error.message);
153
+ process.exit(1);
154
+ }
155
+ });
156
+ // Delete .env file with confirmation
157
+ secretsCmd
158
+ .command('delete')
159
+ .description('Delete .env file (requires confirmation)')
160
+ .option('-f, --file <path>', 'Path to .env file', '.env')
161
+ .option('-y, --yes', 'Skip confirmation prompt')
162
+ .action(async (options) => {
163
+ try {
164
+ const envPath = path.resolve(options.file);
165
+ // Check if file exists
166
+ if (!fs.existsSync(envPath)) {
167
+ console.log(`❌ File not found: ${envPath}`);
168
+ process.exit(1);
169
+ }
170
+ console.log('⚠️ WARNING: You are about to delete a .env file!');
171
+ console.log('');
172
+ console.log(`File: ${envPath}`);
173
+ console.log('');
174
+ // Skip confirmation if --yes flag is provided
175
+ if (!options.yes) {
176
+ console.log('To confirm deletion, please type the full path of the file:');
177
+ console.log(`Expected: ${envPath}`);
178
+ console.log('');
179
+ const rl = readline.createInterface({
180
+ input: process.stdin,
181
+ output: process.stdout,
182
+ });
183
+ const answer = await new Promise((resolve) => {
184
+ rl.question('Enter path to confirm: ', (ans) => {
185
+ rl.close();
186
+ resolve(ans.trim());
187
+ });
188
+ });
189
+ if (answer !== envPath) {
190
+ console.log('');
191
+ console.log('❌ Confirmation failed - path does not match');
192
+ console.log('Deletion cancelled');
193
+ process.exit(1);
194
+ }
195
+ }
196
+ // Delete the file
197
+ fs.unlinkSync(envPath);
198
+ console.log('');
199
+ console.log(`✅ Deleted: ${envPath}`);
200
+ console.log('');
201
+ console.log('💡 Tip: You can still pull from cloud if you pushed previously:');
202
+ console.log(` lsh lib secrets pull -f ${options.file}`);
203
+ console.log('');
204
+ }
205
+ catch (error) {
206
+ console.error('❌ Failed to delete .env file:', error.message);
207
+ process.exit(1);
208
+ }
209
+ });
99
210
  }
100
211
  export default init_secrets;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lsh-framework",
3
- "version": "0.5.10",
3
+ "version": "0.5.12",
4
4
  "description": "A powerful, extensible shell with advanced job management, database persistence, and modern CLI features",
5
5
  "main": "dist/app.js",
6
6
  "bin": {