{"_id":"@autonoma-ai/envsync","_rev":"4-f4fb2713dd88ef64256efb3f56b52924","name":"@autonoma-ai/envsync","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@autonoma-ai/envsync","version":"2.0.0","author":{"url":"https://github.com/sfmullen","name":"Simon Mullen","email":"sfmullen@autonoma.app"},"license":"MIT","_id":"@autonoma-ai/envsync@2.0.0","maintainers":[{"name":"autonomaai-labs","email":"npm@autonoma.app"},{"name":"sfmullen","email":"sfmullen@autonoma.app"}],"homepage":"https://github.com/Autonoma-AI/envsync#readme","bugs":{"url":"https://github.com/Autonoma-AI/envsync/issues"},"dist":{"shasum":"c0ee87c5d7fe8e9403cee2eb52fcf2d0cf519419","tarball":"https://registry.npmjs.org/@autonoma-ai/envsync/-/envsync-2.0.0.tgz","fileCount":7,"integrity":"sha512-uA9AuCdab6uGBv/Ilbz6Jb+zlt4HyA7EF7sEAv34BNhP7Ms5+mpTHJxYMYVyTN9KMcQyZ4ECD57C7Icv7AsC7Q==","signatures":[{"sig":"MEYCIQCGB3LRwYU/y0NdEyS83E8yBvBGso9oSrLwtg5MMDuo5AIhAIR7Ve4lKYbxfu8TFWBePNHvyKGGLSGnl4aHHYEmdWzq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10841},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"5faa0036557d003fec90f1dc5f52209d94ee7cc3","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc","prepare":"npm run build"},"_npmUser":{"name":"sfmullen","email":"sfmullen@autonoma.app"},"repository":{"url":"git+https://github.com/Autonoma-AI/envsync.git","type":"git"},"_npmVersion":"11.12.1","description":"An NPM package that retrieves secrets from AWS Secrets Manager and writes them to an .env file.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"@aws-sdk/client-secrets-manager":"^3.1045.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/node":"^24.1.0"},"_npmOperationalInternal":{"tmp":"tmp/envsync_2.0.0_1778520929944_0.574940193844153","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@autonoma-ai/envsync","version":"2.0.1","author":{"url":"https://github.com/sfmullen","name":"Simon Mullen","email":"sfmullen@autonoma.app"},"license":"MIT","_id":"@autonoma-ai/envsync@2.0.1","maintainers":[{"name":"autonomaai-labs","email":"npm@autonoma.app"},{"name":"sfmullen","email":"sfmullen@autonoma.app"}],"homepage":"https://github.com/Autonoma-AI/envsync#readme","bugs":{"url":"https://github.com/Autonoma-AI/envsync/issues"},"dist":{"shasum":"47920be013917d47f9db438d1dea754a5bc39ce5","tarball":"https://registry.npmjs.org/@autonoma-ai/envsync/-/envsync-2.0.1.tgz","fileCount":7,"integrity":"sha512-+BMZZGb2xaGq3Phhs50E3QGTFi9S/g9v1p1d7Ejq13Oi3H+KFODWWQrnGBUTCM4v0yKV50BMpgN5Elm867BkfQ==","signatures":[{"sig":"MEYCIQCsJa27KfeCGs4NVDbqo0Ebk4A7mOo7444doU54D045qAIhAPh456fjSB1S/Yne7+W1m/UOta8d+aXQqibKVXF1Tb4L","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@autonoma-ai%2fenvsync@2.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":10841},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"27f91e7d6aeb4d5c2c8b8085a8cfc6921eb4c716","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc","prepare":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d8f480fa-9dc7-4d2b-93ff-75d58f17e1ab"}},"repository":{"url":"git+https://github.com/Autonoma-AI/envsync.git","type":"git"},"_npmVersion":"11.11.0","description":"An NPM package that retrieves secrets from AWS Secrets Manager and writes them to an .env file.","directories":{},"_nodeVersion":"24.14.1","dependencies":{"@aws-sdk/client-secrets-manager":"^3.1045.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^6.0.3","@types/node":"^24.1.0"},"_npmOperationalInternal":{"tmp":"tmp/envsync_2.0.1_1778521502104_0.7363974306254035","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-05-11T17:35:29.832Z","modified":"2026-05-22T15:00:06.421Z","2.0.0":"2026-05-11T17:35:30.137Z","2.0.1":"2026-05-11T17:45:02.252Z"},"bugs":{"url":"https://github.com/Autonoma-AI/envsync/issues"},"author":{"url":"https://github.com/sfmullen","name":"Simon Mullen","email":"sfmullen@autonoma.app"},"license":"MIT","homepage":"https://github.com/Autonoma-AI/envsync#readme","repository":{"url":"git+https://github.com/Autonoma-AI/envsync.git","type":"git"},"description":"An NPM package that retrieves secrets from AWS Secrets Manager and writes them to an .env file.","maintainers":[{"email":"npm@autonoma.app","name":"autonomaai-labs"},{"email":"tom@autonoma.app","name":"automoma"},{"email":"eugenio@autonoma.app","name":"scafati98"},{"email":"sfmullen@autonoma.app","name":"sfmullen"}],"readme":"# envsync\n\nenvsync is a Node.js package that fetches secrets from AWS Secrets Manager and stores them in an environment file. This helps in keeping secrets secure while ensuring they are available for your application during development. ⚡\n\n## ✨ Features\n\n- 🔐 Automatically downloads and updates secrets from AWS Secrets Manager\n- 📄 Stores secrets in an `.env` file for easy access\n- 🚀 Prevents unnecessary downloads by checking the secret version\n- ⚙️ Configuration stored in `package.json`\n- 🔑 Uses the default AWS credential chain on the user's system (env vars, `~/.aws/credentials`, SSO, IAM roles)\n- 🛠️ Designed for **development environments only**\n\n## 📥 Installation\n\nInstall envsync as a **dev dependency**:\n\n```sh\nnpm install @autonoma-ai/envsync --save-dev\n```\n\n## ⚙️ Configuration\n\nAdd the following configuration in your `package.json` file:\n\n```json\n\"envsync\": {\n  \"secretName\": \"your-secret-name\",\n  \"envFile\": \".env\",\n  \"region\": \"us-east-1\"\n}\n```\n\n- **secretName**: The name (or ARN) of the secret in AWS Secrets Manager\n- **envFile**: The target file where the secret will be stored\n- **region** *(optional)*: AWS region. If omitted, the SDK uses `AWS_REGION` / `AWS_DEFAULT_REGION` or your configured profile's region.\n\n### 🔐 Credentials\n\nenvsync uses the standard AWS SDK credential provider chain, so it picks up whatever your system already has configured. In order, it will look at:\n\n1. Environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`)\n2. Shared credentials file (`~/.aws/credentials`) — honors `AWS_PROFILE`\n3. SSO / IAM Identity Center\n4. ECS / EC2 instance metadata\n\nNo credential configuration is required from the package itself.\n\n### 🗂️ Secret format\n\nThe secret payload is written to `envFile` verbatim, so store it in AWS Secrets Manager as the raw contents of a `.env` file, e.g.:\n\n```\nDATABASE_URL=postgres://...\nAPI_KEY=sk-...\n```\n\n## 🚀 Usage\n\nYou can use envsync programmatically within your Node.js application:\n\n```javascript\nimport { saveSecretToEnv } from '@autonoma-ai/envsync';\n\nawait saveSecretToEnv();\n```\n\nAlternatively, add a script in `package.json` to run it easily:\n\n```json\n\"scripts\": {\n  \"fetch-secret\": \"node -e \\\"import('@autonoma-ai/envsync').then(({ saveSecretToEnv }) => saveSecretToEnv())\\\"\"\n}\n```\n\nRun the script with:\n\n```sh\nnpm run fetch-secret\n```\n\n## 🔄 How It Works\n\n1. 📝 envsync reads the configuration from `package.json`.\n2. 🔑 It fetches the latest version of the secret from AWS Secrets Manager (using `AWSCURRENT`).\n3. 🛑 If the secret `VersionId` matches the one tracked in the `.env` file, it skips the update.\n4. ✅ If the version is different, it updates the `.env` file with the new secret and records the new `VersionId`.\n\n## ⚠️ Important\n\n**envsync is designed for development environments only!** 🚧 Do not use it in production to prevent security risks.\n\n## 🔧 Requirements\n\n- 📌 Node.js 14+\n- ☁️ AWS credentials configured on the system with `secretsmanager:GetSecretValue` permission for the target secret\n\n## 📜 License\n\nMIT\n","readmeFilename":"README.md"}