Skip to content

preparing ops pks#746

Merged
motdotla merged 18 commits intomainfrom
ops-hook
Mar 13, 2026
Merged

preparing ops pks#746
motdotla merged 18 commits intomainfrom
ops-hook

Conversation

@motdotla
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the legacy ProKeypair integration and starts wiring key lookup behavior toward dotenvx-ops, alongside updating related CLI/test messaging and help text.

Changes:

  • Remove ProKeypair helper + tests and simplify findPublicKey/findPrivateKey to no longer depend on it.
  • Add Ops.keypair() and extend findPrivateKey to optionally fetch a private key via dotenvx-ops using a public key.
  • Update CLI/tests: rename “radar” output to “ops”, add an encrypt --ops-off option, and remove the “ops backup” guidance from output/templates.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
tests/lib/services/sets.test.js Removes ProKeypair stubbing from Sets encryption tests.
tests/lib/services/ops.test.js Updates “radar” text to “ops” and adds unit tests for Ops.keypair().
tests/lib/services/encrypt.test.js Adds coverage for encrypt behavior with ops disabled.
tests/lib/main.test.js Removes assertion for “ops backup” help message.
tests/lib/helpers/proKeypair.test.js Deletes ProKeypair tests.
tests/lib/helpers/findPrivateKey.test.js Adds tests for ops-backed private key lookup and fallback behavior.
tests/e2e/encrypt.test.js Updates CLI invocation/output expectations for ops-off + help text removal.
tests/cli/actions/set.test.js Removes assertion for “ops backup” help message.
tests/cli/actions/rotate.test.js Removes assertion for “ops backup” help message.
tests/cli/actions/encrypt.test.js Removes assertion for “ops backup” help message.
src/lib/services/sets.js Passes public key into private-key lookup; removes ops backup header line (commented out).
src/lib/services/run.js Threads public key into findPrivateKey for ops lookup support.
src/lib/services/rotate.js Passes public key into private-key lookup.
src/lib/services/ops.js Renames user-facing log label and adds keypair() subprocess integration.
src/lib/services/encrypt.js Adds opsOn plumbing and uses ops-aware private key lookup; removes ops backup header line (commented out).
src/lib/services/decrypt.js Threads public key into findPrivateKey.
src/lib/main.js Removes “ops backup” help message (commented out).
src/lib/helpers/proKeypair.js Deletes ProKeypair implementation.
src/lib/helpers/findPublicKey.js Removes ProKeypair usage; resolves only via Keypair.
src/lib/helpers/findPrivateKey.js Replaces ProKeypair behavior with optional ops key lookup + local fallback.
src/cli/dotenvx.js Adds boolean parsing helper and introduces encrypt --ops-off <boolean>.
src/cli/actions/set.js Removes “ops backup” help message (commented out).
src/cli/actions/rotate.js Removes “ops backup” help message (commented out).
src/cli/actions/encrypt.js Plumbs opsOn into Encrypt and removes “ops backup” help message (commented out).
CHANGELOG.md Notes removal of ProKeypair.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (processedEnv.privateKeyAdded) {
logger.success(`✔ key added to ${processedEnv.envKeysFilepath} (${processedEnv.privateKeyName})`)
logger.help('⮕ optional: [dotenvx ops backup] to securely backup private key')
// logger.help('⮕ optional: [dotenvx ops backup] to securely backup private key')
if (processedEnv.privateKeyAdded) {
logger.success(`✔ key added to ${processedEnv.envKeysFilepath} (${processedEnv.privateKeyName})`)
logger.help('⮕ optional: [dotenvx ops backup] to securely backup private key')
// logger.help('⮕ optional: [dotenvx ops backup] to securely backup private key')
envSrc = `${firstLinePreserved}${prependPublicKey}\n${envSrc}`
}
} else if (existingPublicKey) {
// throw new Error('implement for remote Ops existingPrivateKey')
Comment on lines +38 to +56
const stub = sinon.stub(Ops.prototype, 'keypair').returns('remote-private')

const envFilepath = 'tests/monorepo/apps/encrypted/.env'
const privateKey = findPrivateKey(envFilepath, null, true, 'pub')

t.equal(privateKey, 'remote-private')
t.ok(stub.calledOnceWith('pub'), 'Ops.keypair called with public key')

ct.end()
})

t.test('#findPrivateKey falls back to local when ops lookup fails', ct => {
const stub = sinon.stub(Ops.prototype, 'keypair').returns(null)

const envFilepath = 'tests/monorepo/apps/encrypted/.env'
const privateKey = findPrivateKey(envFilepath, null, true, 'pub')

t.equal(privateKey, 'ec9e80073d7ace817d35acb8b7293cbf8e5981b4d2f5708ee5be405122993cd1')
t.ok(stub.calledOnceWith('pub'), 'Ops keypair attempted once')
const relativeFilepath = path.relative(path.dirname(filepath), envKeysFilepath)

if (existingPrivateKey) {
// throw new Error('implement for remote Ops existingPrivateKey')
'#/ private decryption keys. DO NOT commit to source control /',
'#/ [how it works](https://dotenvx.com/encryption) /',
'#/ backup with: `dotenvx ops backup` /',
// '#/ backup with: `dotenvx ops backup` /',
'#/ private decryption keys. DO NOT commit to source control /',
'#/ [how it works](https://dotenvx.com/encryption) /',
'#/ backup with: `dotenvx ops backup` /',
// '#/ backup with: `dotenvx ops backup` /',
@motdotla motdotla merged commit f844177 into main Mar 13, 2026
28 checks passed
@motdotla motdotla deleted the ops-hook branch March 13, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants