@dotenvx/dotenvx-ops 0.38.3 → 0.39.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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- [Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.38.3...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.39.1...main)
6
+
7
+ ## [0.39.1](https://github.com/dotenvx/dotenvx-ops/compare/v0.39.0...v0.39.1) (2026-04-23)
8
+
9
+ ### Added
10
+
11
+ * Display install command with update notification ([#54](https://github.com/dotenvx/dotenvx-ops/pull/54))
12
+
13
+ ## [0.39.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.38.3...v0.39.0) (2026-04-23)
14
+
15
+ ### Added
16
+
17
+ * Added `armor up` and `armor down` placeholders ([#53](https://github.com/dotenvx/dotenvx-ops/pull/53))
6
18
 
7
19
  ## [0.38.3](https://github.com/dotenvx/dotenvx-ops/compare/v0.38.2...v0.38.3) (2026-04-21)
8
20
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.38.3",
2
+ "version": "0.39.1",
3
3
  "name": "@dotenvx/dotenvx-ops",
4
4
  "description": "Secrets for agents–from the creator of `dotenv` and `dotenvx`",
5
5
  "author": "@motdotla",
@@ -0,0 +1,17 @@
1
+ const { logger } = require('@dotenvx/dotenvx')
2
+
3
+ const Session = require('./../../../db/session')
4
+
5
+ function down () {
6
+ try {
7
+ const sesh = new Session()
8
+ sesh.notifyUpdate()
9
+
10
+ logger.success('⛨ coming soon')
11
+ } catch (error) {
12
+ logger.error(error.message)
13
+ process.exit(1)
14
+ }
15
+ }
16
+
17
+ module.exports = down
@@ -0,0 +1,17 @@
1
+ const { logger } = require('@dotenvx/dotenvx')
2
+
3
+ const Session = require('./../../../db/session')
4
+
5
+ function up () {
6
+ try {
7
+ const sesh = new Session()
8
+ sesh.notifyUpdate()
9
+
10
+ logger.success('⛨ coming soon')
11
+ } catch (error) {
12
+ logger.error(error.message)
13
+ process.exit(1)
14
+ }
15
+ }
16
+
17
+ module.exports = up
@@ -0,0 +1,28 @@
1
+ const { Command } = require('commander')
2
+ const Session = require('./../../db/session')
3
+
4
+ const armor = new Command('armor')
5
+
6
+ armor
7
+ .description('ARMORED KEYS ⛨')
8
+ .allowUnknownOption()
9
+ .action(async function () {
10
+ const sesh = new Session()
11
+ await sesh.notifyUpdate()
12
+ this.help()
13
+ })
14
+
15
+ // dotenvx-ops armor up
16
+ const upAction = require('./../actions/armor/up')
17
+ armor
18
+ .command('up')
19
+ .description('harden private key')
20
+ .action(upAction)
21
+
22
+ const downAction = require('./../actions/armor/down')
23
+ armor
24
+ .command('down')
25
+ .description('soften private key')
26
+ .action(downAction)
27
+
28
+ module.exports = armor
@@ -7,6 +7,7 @@ const program = new Command()
7
7
  const { setLogLevel } = require('@dotenvx/dotenvx')
8
8
 
9
9
  const packageJson = require('./../lib/helpers/packageJson')
10
+ const Session = require('./../db/session')
10
11
  const argv = process.argv.slice(2)
11
12
  const firstArg = argv[0]
12
13
 
@@ -97,6 +98,9 @@ if (shouldLoadRotateCommand) {
97
98
  program.addCommand(require('./commands/rotate'))
98
99
  }
99
100
 
101
+ // dotenvx-ops armor
102
+ program.addCommand(require('./commands/armor'))
103
+
100
104
  // dotenvx-ops login
101
105
  const loginAction = require('./actions/login')
102
106
  program
@@ -124,7 +128,7 @@ program
124
128
  const keypairAction = require('./actions/keypair')
125
129
  program
126
130
  .command('keypair')
127
- .description('generate keypair')
131
+ .description('generate armored keypair')
128
132
  .argument('[publicKey]', 'existing public key')
129
133
  .option('-h, --hostname <url>', 'set hostname')
130
134
  .option('--token <token>', 'set token')
@@ -147,4 +151,10 @@ program.helpInformation = function () {
147
151
  }
148
152
 
149
153
  /* c8 ignore stop */
150
- program.parse(process.argv)
154
+ program.action(async function () {
155
+ const sesh = new Session()
156
+ await sesh.notifyUpdate()
157
+ this.help()
158
+ })
159
+
160
+ program.parseAsync(process.argv)
package/src/db/session.js CHANGED
@@ -6,6 +6,7 @@ const { logger } = require('@dotenvx/dotenvx')
6
6
 
7
7
  const Device = require('./device')
8
8
  const jsonToEnv = require('./../lib/helpers/jsonToEnv')
9
+ const likelyUpdateCommand = require('./../lib/helpers/likelyUpdateCommand')
9
10
  const packageJson = require('./../lib/helpers/packageJson')
10
11
  const GetVersion = require('./../lib/api/getVersion')
11
12
 
@@ -85,6 +86,8 @@ class Session {
85
86
  //
86
87
  async notifyUpdate () {
87
88
  try {
89
+ logger.debug('checking if update available')
90
+
88
91
  const lastCheck = Number(this.store.get('DOTENVX_OPS_VERSION_LAST_CHECK') || 0)
89
92
  const now = Date.now()
90
93
 
@@ -94,7 +97,10 @@ class Session {
94
97
  let remote = local // in case of http fetch error
95
98
 
96
99
  try {
100
+ logger.debug('fetching latest available version')
97
101
  const VERSION = await new GetVersion().run()
102
+ logger.debug(`latest version: ${VERSION}`)
103
+
98
104
  remote = VERSION
99
105
  this.store.set('DOTENVX_OPS_VERSION', VERSION) // remote version
100
106
  } catch (err) {
@@ -106,7 +112,7 @@ class Session {
106
112
 
107
113
  if (semver.gt(remote, local)) {
108
114
  const diff = semver.diff(local, remote)
109
- console.error(`⛆ update available (${diff})`)
115
+ console.error(`⛆ update available (${diff}) [${likelyUpdateCommand()}]`)
110
116
  }
111
117
  }
112
118
  } catch (err) {
@@ -0,0 +1,33 @@
1
+ const normalizePath = require('./normalizePath')
2
+ const safeRealpath = require('./safeRealpath')
3
+
4
+ const NPM_COMMAND = 'npm i @dotenvx/dotenvx-ops'
5
+ const CURL_COMMAND = 'curl -sfS https://dotenvx.sh/ops | sh'
6
+
7
+ function likelyUpdateCommand () {
8
+ const isPackaged = Boolean(process.pkg)
9
+ const executablePath = isPackaged ? process.execPath : (process.argv[1] || process.execPath)
10
+ const resolvedExecutablePath = safeRealpath(executablePath)
11
+ const normalizedPath = normalizePath(resolvedExecutablePath || executablePath || '')
12
+
13
+ if (
14
+ normalizedPath.includes('/node_modules/@dotenvx/dotenvx-ops/') ||
15
+ normalizedPath.includes('/node_modules/.bin/dotenvx-ops')
16
+ ) {
17
+ return NPM_COMMAND
18
+ }
19
+
20
+ if (
21
+ isPackaged ||
22
+ normalizedPath.endsWith('/usr/local/bin/dotenvx-ops') ||
23
+ normalizedPath.endsWith('/opt/homebrew/bin/dotenvx-ops') ||
24
+ normalizedPath.endsWith('/usr/bin/dotenvx-ops') ||
25
+ normalizedPath.endsWith('/bin/dotenvx-ops')
26
+ ) {
27
+ return CURL_COMMAND
28
+ }
29
+
30
+ return NPM_COMMAND
31
+ }
32
+
33
+ module.exports = likelyUpdateCommand
@@ -0,0 +1,5 @@
1
+ function normalizePath (value) {
2
+ return String(value || '').replace(/\\/g, '/').toLowerCase()
3
+ }
4
+
5
+ module.exports = normalizePath
@@ -0,0 +1,13 @@
1
+ const fs = require('fs')
2
+
3
+ function safeRealpath (filePath) {
4
+ if (!filePath) return filePath
5
+
6
+ try {
7
+ return fs.realpathSync(filePath)
8
+ } catch (e) {
9
+ return filePath
10
+ }
11
+ }
12
+
13
+ module.exports = safeRealpath