lsh-framework 2.0.0 → 2.0.1

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.
@@ -175,6 +175,8 @@ export class SecretsManager {
175
175
  if (filename !== '.env' && !filename.startsWith('.env.')) {
176
176
  throw new Error(`Invalid filename: ${filename}. Must be '.env' or start with '.env.'`);
177
177
  }
178
+ // Get the effective environment name (repo-aware)
179
+ const effectiveEnv = this.getRepoAwareEnvironment(environment);
178
180
  // Warn if using default key
179
181
  if (!process.env.LSH_SECRETS_KEY) {
180
182
  logger.warn('⚠️ Warning: No LSH_SECRETS_KEY set. Using machine-specific key.');
@@ -182,15 +184,15 @@ export class SecretsManager {
182
184
  logger.warn(' Then add LSH_SECRETS_KEY=<key> to your .env on all machines');
183
185
  console.log();
184
186
  }
185
- logger.info(`Pushing ${envFilePath} to IPFS (${this.getRepoAwareEnvironment(environment)})...`);
187
+ logger.info(`Pushing ${envFilePath} to IPFS (${effectiveEnv})...`);
186
188
  const content = fs.readFileSync(envFilePath, 'utf8');
187
189
  const env = this.parseEnvFile(content);
188
190
  // Check for destructive changes unless force is true
189
191
  if (!force) {
190
192
  try {
191
193
  // Check if secrets already exist for this environment
192
- if (this.storage.exists(environment, this.gitInfo?.repoName)) {
193
- const existingSecrets = await this.storage.pull(environment, this.encryptionKey, this.gitInfo?.repoName);
194
+ if (this.storage.exists(effectiveEnv, this.gitInfo?.repoName)) {
195
+ const existingSecrets = await this.storage.pull(effectiveEnv, this.encryptionKey, this.gitInfo?.repoName);
194
196
  const cloudEnv = {};
195
197
  existingSecrets.forEach(s => {
196
198
  cloudEnv[s.key] = s.value;
@@ -214,16 +216,16 @@ export class SecretsManager {
214
216
  const secrets = Object.entries(env).map(([key, value]) => ({
215
217
  key,
216
218
  value,
217
- environment,
219
+ environment: effectiveEnv,
218
220
  createdAt: new Date(),
219
221
  updatedAt: new Date(),
220
222
  }));
221
223
  // Store on IPFS
222
- const cid = await this.storage.push(secrets, environment, this.encryptionKey, this.gitInfo?.repoName, this.gitInfo?.currentBranch);
224
+ const cid = await this.storage.push(secrets, effectiveEnv, this.encryptionKey, this.gitInfo?.repoName, this.gitInfo?.currentBranch);
223
225
  logger.info(`✅ Pushed ${secrets.length} secrets from ${filename} to IPFS`);
224
226
  console.log(`📦 IPFS CID: ${cid}`);
225
227
  // Log to IPFS for immutable audit record
226
- await this.logToIPFS('push', environment, secrets.length);
228
+ await this.logToIPFS('push', effectiveEnv, secrets.length);
227
229
  }
228
230
  /**
229
231
  * Pull .env from IPFS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lsh-framework",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Simple, cross-platform encrypted secrets manager with automatic sync, IPFS audit logs, and multi-environment support. Just run lsh sync and start managing your secrets.",
5
5
  "main": "dist/app.js",
6
6
  "bin": {