lsh-framework 0.9.2 → 0.9.3

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.
@@ -220,9 +220,11 @@ API_KEY=
220
220
  });
221
221
  // Get a specific secret value
222
222
  program
223
- .command('get <key>')
224
- .description('Get a specific secret value from .env file')
223
+ .command('get [key]')
224
+ .description('Get a specific secret value from .env file, or all secrets with --all')
225
225
  .option('-f, --file <path>', 'Path to .env file', '.env')
226
+ .option('--all', 'Get all secrets from the file')
227
+ .option('--export', 'Output in export format for shell evaluation')
226
228
  .action(async (key, options) => {
227
229
  try {
228
230
  const envPath = path.resolve(options.file);
@@ -232,6 +234,45 @@ API_KEY=
232
234
  }
233
235
  const content = fs.readFileSync(envPath, 'utf8');
234
236
  const lines = content.split('\n');
237
+ // Handle --all flag
238
+ if (options.all) {
239
+ const secrets = [];
240
+ for (const line of lines) {
241
+ if (line.trim().startsWith('#') || !line.trim())
242
+ continue;
243
+ const match = line.match(/^([^=]+)=(.*)$/);
244
+ if (match) {
245
+ const key = match[1].trim();
246
+ let value = match[2].trim();
247
+ // Remove quotes if present
248
+ if ((value.startsWith('"') && value.endsWith('"')) ||
249
+ (value.startsWith("'") && value.endsWith("'"))) {
250
+ value = value.slice(1, -1);
251
+ }
252
+ secrets.push({ key, value });
253
+ }
254
+ }
255
+ if (options.export) {
256
+ // Output in export format for shell evaluation
257
+ for (const { key, value } of secrets) {
258
+ // Escape single quotes in value and wrap in single quotes
259
+ const escapedValue = value.replace(/'/g, "'\\''");
260
+ console.log(`export ${key}='${escapedValue}'`);
261
+ }
262
+ }
263
+ else {
264
+ // Output in KEY=VALUE format
265
+ for (const { key, value } of secrets) {
266
+ console.log(`${key}=${value}`);
267
+ }
268
+ }
269
+ return;
270
+ }
271
+ // Handle single key lookup
272
+ if (!key) {
273
+ console.error('❌ Please provide a key or use --all flag');
274
+ process.exit(1);
275
+ }
235
276
  for (const line of lines) {
236
277
  if (line.trim().startsWith('#') || !line.trim())
237
278
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lsh-framework",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Encrypted secrets manager with automatic rotation, team sync, and multi-environment support. Built on a powerful shell with daemon scheduling and CI/CD integration.",
5
5
  "main": "dist/app.js",
6
6
  "bin": {