@qui-cli/env-1password 1.2.2 → 1.2.4

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,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.2.4](https://github.com/battis/qui-cli/compare/env-1password/1.2.3...env-1password/1.2.4) (2025-12-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * no longer logging service account token ([4303652](https://github.com/battis/qui-cli/commit/4303652a0ddbd6bf323dd548f07fd99bc95b2cc4))
11
+ * update color-coding to current standards ([2fccf74](https://github.com/battis/qui-cli/commit/2fccf7433f729020022b7df85578e05576b47958))
12
+
13
+ ## [1.2.3](https://github.com/battis/qui-cli/compare/env-1password/1.2.2...env-1password/1.2.3) (2025-12-24)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * handle inconsistencies of 1password-sdk sectionIds more gracefully ([bfa2be1](https://github.com/battis/qui-cli/commit/bfa2be1750da265676b31f7162f24e7d75a31502))
19
+
5
20
  ## [1.2.2](https://github.com/battis/qui-cli/compare/env-1password/1.2.1...env-1password/1.2.2) (2025-12-24)
6
21
 
7
22
 
package/README.md CHANGED
@@ -38,7 +38,7 @@ This package integrates with [@1password/sdk](https://www.npmjs.com/package/@1pa
38
38
  3. Update environment variables to be [secret references](https://developer.1password.com/docs/cli/secret-references)
39
39
  4. Run!
40
40
 
41
- See [dev-1password-env](https://github.com/battis/qui-cli/tree/main/examples/dev-1password-env#readme) for an example using the 1Password implementation of this package.
41
+ See [dev-env-1password](https://github.com/battis/qui-cli/tree/main/examples/dev-env-1password#readme) for an example using the 1Password implementation of this package.
42
42
 
43
43
  ## Configuration
44
44
 
package/dist/1Password.js CHANGED
@@ -19,7 +19,8 @@ export async function configure(proposal = {}) {
19
19
  if (config.opItem && !config.opToken) {
20
20
  const silent = Shell.isSilent();
21
21
  const showCommands = Shell.commandsShown();
22
- Shell.configure({ silent: true, showCommands: false });
22
+ const logging = Shell.isLogging();
23
+ Shell.configure({ silent: true, showCommands: false, logging: true });
23
24
  const { stdout, stderr } = Shell.exec(`op item get ${config.opAccount ? `--account "${config.opAccount}" ` : ''}--reveal --fields credential "${config.opItem}"`);
24
25
  if (stdout.length) {
25
26
  config.opToken = stdout.trim();
@@ -28,7 +29,7 @@ export async function configure(proposal = {}) {
28
29
  Log.fatal(stderr);
29
30
  process.exit(1);
30
31
  }
31
- Shell.configure({ silent, showCommands });
32
+ Shell.configure({ silent, showCommands, logging });
32
33
  }
33
34
  if (config.opToken) {
34
35
  const pkg = await importLocal(path.join(import.meta.dirname, '../package.json'));
@@ -56,7 +57,7 @@ export function options() {
56
57
  text: 'Store 1Password secret references in your environment, rather than the actual secrets.'
57
58
  },
58
59
  {
59
- text: `If 1Password secret references are stored in the environment, a 1Password service account token is required to access the secret values, which will be loaded into ${Colors.value('process.env')}. The service account token can be passed directly as the ${Colors.optionArg('--opToken')} argument (e.g. ${Colors.command(`${Colors.keyword('example')} --opToken "$(${Colors.keyword('op')} item get myToken)"`)}) or, if the 1Password CLI tool is also installed, by simply passing the name or ID of the API Credential in your 1Password vault that holds the service account token (e.g. ${Colors.command(`${Colors.keyword('example')} --opItem myToken`)}). If you are signed into multiple 1Password account, use the ${Colors.optionArg('--opAccount')} argument to specify the account containing the token.`
60
+ text: `If 1Password secret references are stored in the environment, a 1Password service account token is required to access the secret values, which will be loaded into ${Colors.varName('process.env')}. The service account token can be passed directly as the ${Colors.optionArg('--opToken')} argument (e.g. ${Colors.command(`example --opToken "$(${Colors.keyword('op')} item get myToken)"`, Colors.keyword)}) or, if the 1Password CLI tool is also installed, by simply passing the name or ID of the API Credential in your 1Password vault that holds the service account token (e.g. ${Colors.command(`example --opItem myToken`, Colors.keyword)}). If you are signed into multiple 1Password account, use the ${Colors.optionArg('--opAccount')} argument to specify the account containing the token.`
60
61
  },
61
62
  { text: Colors.url('https://developer.1password.com/docs/cli') }
62
63
  ],
@@ -67,7 +68,7 @@ export function options() {
67
68
  default: config.opAccount
68
69
  },
69
70
  opItem: {
70
- description: `Name or ID of the 1Password API Credential item storing the 1Password service account token; will use environmen variable ${Colors.varName('OP_ITEM')} if present`,
71
+ description: `Name or ID of the 1Password API Credential item storing the 1Password service account token; will use environment variable ${Colors.varName('OP_ITEM')} if present`,
71
72
  hint: '1Password unique identifier',
72
73
  default: config.opItem
73
74
  },
@@ -100,6 +101,8 @@ function isSecretReference(value) {
100
101
  function secretReferences(parsed) {
101
102
  return Object.fromEntries(Object.entries(parsed).filter((entry) => isSecretReference(entry[1])));
102
103
  }
104
+ // FIXME parse is not loading 1Password secrets into process.env
105
+ // Issue URL: https://github.com/battis/qui-cli/issues/81
103
106
  export async function parse(file) {
104
107
  const parsed = await Env.parse(file);
105
108
  if (client) {
@@ -120,8 +123,14 @@ export async function exists({ key, file }) {
120
123
  return Env.exists({ key, file });
121
124
  }
122
125
  function secretFrom(secretReference) {
123
- const [, vault, item, , section, field] = secretReference.match(/^op:\/\/([^/]+)\/([^/]+)\/(([^/]+)\/)?([^/]+)$/) ||
124
- [];
126
+ // eslint-disable-next-line prefer-const
127
+ let [vault, item, section, field] = secretReference
128
+ .replace(/^op:\/\//, '')
129
+ .split('/');
130
+ if (field === undefined) {
131
+ field = section;
132
+ section = '';
133
+ }
125
134
  return { vault, item, section, field };
126
135
  }
127
136
  async function itemFrom(secret) {
@@ -153,7 +162,8 @@ export async function set({ key, value, file, ...rest }) {
153
162
  fields: item.fields.map((field) => {
154
163
  const section = item.sections.find((s) => s.id === field.sectionId);
155
164
  if (secret.field === field.title || secret.field === field.id) {
156
- if ((!secret.section && field.sectionId === 'add more') ||
165
+ if ((!secret.section &&
166
+ (field.sectionId === '' || field.sectionId === 'add more')) ||
157
167
  secret.section === section?.title ||
158
168
  secret.section === section?.id) {
159
169
  return { ...field, value };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qui-cli/env-1password",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "@qui-cli Plugin: Standardized environment configuration",
5
5
  "homepage": "https://github.com/battis/qui-cli/tree/main/packages/env-1password#readme",
6
6
  "repository": {
@@ -28,12 +28,12 @@
28
28
  "del-cli": "^6.0.0",
29
29
  "npm-run-all": "^4.1.5",
30
30
  "typescript": "^5.9.3",
31
- "@qui-cli/colors": "3.1.1",
32
- "@qui-cli/env": "5.0.2",
33
31
  "@qui-cli/log": "4.0.1",
32
+ "@qui-cli/colors": "3.2.0",
33
+ "@qui-cli/env": "5.0.2",
34
34
  "@qui-cli/plugin": "4.0.0",
35
- "@qui-cli/shell": "3.0.3",
36
- "@qui-cli/root": "3.0.4"
35
+ "@qui-cli/root": "3.0.4",
36
+ "@qui-cli/shell": "3.1.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@qui-cli/env": "5.x",