Skip to content

chore: fix op scripts for users with only 1 account#277

Merged
jfoshee merged 1 commit into
mainfrom
jfoshee/op-single-account
May 12, 2026
Merged

chore: fix op scripts for users with only 1 account#277
jfoshee merged 1 commit into
mainfrom
jfoshee/op-single-account

Conversation

@jfoshee
Copy link
Copy Markdown
Contributor

@jfoshee jfoshee commented May 12, 2026

Always setting OP_ACCOUNT="team-clerk" doesn't work for everyone.

The theory behind this is that if you only have one account in 1Password then you don't need to specify an account. You can use empty string.

Test this PR by pulling and running the e2e tests

bun run test:e2e:op

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 12, 2026

⚠️ No Changeset found

Latest commit: 41cf65a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jfoshee jfoshee requested review from dmoerner and rafa-thayto May 12, 2026 16:15
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9ec377ee-b3ac-4c95-9652-f6c0ef8b7557

📥 Commits

Reviewing files that changed from the base of the PR and between d5439c8 and 41cf65a.

📒 Files selected for processing (1)
  • scripts/lib/op.ts

📝 Walkthrough

Walkthrough

This PR modifies scripts/lib/op.ts to dynamically determine which 1Password account to use instead of relying on a hard-coded constant. It adds two new internal helper functions: getOpAccountCount() queries local accounts via op account list --format json with defensive error handling, and getOpAccount() returns team-clerk when multiple accounts are present, otherwise an empty string. The renamed TEAM_CLERK_ACCOUNT constant supports this logic. Both readOpItem() and runWithOpSecrets() now call getOpAccount() to compute and pass the active account to 1Password CLI operations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing 1Password scripts to handle users with a single account, which is the core objective of the PR.
Description check ✅ Passed The description clearly relates to the changeset by explaining the problem (hard-coded OP_ACCOUNT fails for some users) and the solution (use empty string for single accounts).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@jfoshee jfoshee merged commit fc039af into main May 12, 2026
10 checks passed
@jfoshee jfoshee deleted the jfoshee/op-single-account branch May 12, 2026 17:15
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.

3 participants