@simplysf/simply-gitlab-core 0.10.0 → 0.11.0

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/README.md CHANGED
@@ -21,7 +21,7 @@ npm install @simplysf/simply-gitlab-core
21
21
  ```ts
22
22
  import { GitLabClient, resolveGitLabConfig } from '@simplysf/simply-gitlab-core';
23
23
 
24
- // Reads GITLAB_URL (default https://gitlab.com) and GITLAB_TOKEN, and throws a ConfigError
24
+ // Reads SIMPLY_GITLAB_URL (default https://gitlab.com) and SIMPLY_GITLAB_TOKEN, and throws a ConfigError
25
25
  // naming what is missing.
26
26
  const client = new GitLabClient(resolveGitLabConfig());
27
27
 
@@ -47,7 +47,7 @@ traces, and its offset-pagination headers.
47
47
  **Errors** — `ConfigError` (exit 2), `AuthError` (3), `NetworkError` (1), `HttpError` (1), all
48
48
  extending `CliError`.
49
49
 
50
- **Safety** — `assertWritesAllowed`/`isReadOnly` for `GITLAB_READ_ONLY`; `redactSecrets` and
50
+ **Safety** — `assertWritesAllowed`/`isReadOnly` for `SIMPLY_GITLAB_READ_ONLY`; `redactSecrets` and
51
51
  `sanitiseDeep` to keep a token out of any message or response body; `stripControl` and
52
52
  `stripControlOneLine` for text the instance chose.
53
53
 
package/lib/config.d.ts CHANGED
@@ -10,10 +10,10 @@ export interface ConfigOverrides {
10
10
  readonly token?: string;
11
11
  }
12
12
  export type EnvLike = Record<string, string | undefined>;
13
- export declare const URL_ENV = "GITLAB_URL";
14
- export declare const TOKEN_ENV = "GITLAB_TOKEN";
13
+ export declare const URL_ENV = "SIMPLY_GITLAB_URL";
14
+ export declare const TOKEN_ENV = "SIMPLY_GITLAB_TOKEN";
15
15
  /**
16
- * Where an unconfigured `GITLAB_URL` points. GitLab is one product with one API, and the great
16
+ * Where an unconfigured `SIMPLY_GITLAB_URL` points. GitLab is one product with one API, and the great
17
17
  * majority of tokens are gitlab.com tokens, so requiring the URL would be ceremony for the common
18
18
  * case. A self-managed instance sets the variable.
19
19
  */
package/lib/config.js CHANGED
@@ -14,12 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import process from 'node:process';
17
+ import { envValue } from './env-vars.js';
17
18
  import { ConfigError } from './errors.js';
18
- export const URL_ENV = 'GITLAB_URL';
19
- export const TOKEN_ENV = 'GITLAB_TOKEN';
20
- const SSL_VERIFY_ENV = 'GITLAB_SSL_VERIFY';
19
+ // The deprecated unprefixed names are still read, as a fallback: see env-vars.ts.
20
+ export const URL_ENV = 'SIMPLY_GITLAB_URL';
21
+ export const TOKEN_ENV = 'SIMPLY_GITLAB_TOKEN';
22
+ const SSL_VERIFY_ENV = 'SIMPLY_GITLAB_SSL_VERIFY';
21
23
  /**
22
- * Where an unconfigured `GITLAB_URL` points. GitLab is one product with one API, and the great
24
+ * Where an unconfigured `SIMPLY_GITLAB_URL` points. GitLab is one product with one API, and the great
23
25
  * majority of tokens are gitlab.com tokens, so requiring the URL would be ceremony for the common
24
26
  * case. A self-managed instance sets the variable.
25
27
  */
@@ -51,13 +53,13 @@ function normalizeUrl(rawUrl) {
51
53
  return `${parsed.origin}${parsed.pathname.replace(/\/+$/, '')}`;
52
54
  }
53
55
  /**
54
- * Certificate verification is not negotiable, so a `GITLAB_SSL_VERIFY=false` carried over from
56
+ * Certificate verification is not negotiable, so a `*_SSL_VERIFY=false` carried over from
55
57
  * other GitLab tooling fails loudly rather than being silently ignored — the alternative is a
56
58
  * user believing verification is off when it is on, or vice versa. The fix keeps verification
57
59
  * intact.
58
60
  */
59
61
  function rejectSslOptOut(env) {
60
- const raw = env[SSL_VERIFY_ENV];
62
+ const raw = envValue(env, SSL_VERIFY_ENV);
61
63
  if (raw !== undefined && FALSE_VALUES.has(raw.trim().toLowerCase())) {
62
64
  throw new ConfigError(`${SSL_VERIFY_ENV}=${raw} is not supported: this CLI always verifies TLS certificates. ` +
63
65
  `If your GitLab instance is behind an internal or agency CA, trust that CA instead with ${CA_BUNDLE_HINT}.`);
@@ -65,8 +67,8 @@ function rejectSslOptOut(env) {
65
67
  }
66
68
  export function resolveGitLabConfig(overrides = {}, env = process.env) {
67
69
  rejectSslOptOut(env);
68
- const rawUrl = (overrides.url ?? env[URL_ENV])?.trim();
69
- const token = (overrides.token ?? env[TOKEN_ENV])?.trim();
70
+ const rawUrl = (overrides.url ?? envValue(env, URL_ENV))?.trim();
71
+ const token = (overrides.token ?? envValue(env, TOKEN_ENV))?.trim();
70
72
  if (!token) {
71
73
  throw new ConfigError(`GitLab authentication requires a token. Set ${TOKEN_ENV} or pass --gitlab-token. ` +
72
74
  'Create one under Preferences > Access tokens with the api scope (read_api is enough for read-only use).');
package/lib/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiB1C,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,cAAc,CAAC;AACxC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEhD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAC1D,MAAM,cAAc,GAAG,qCAAqC,CAAC;AAE7D;;;;;GAKG;AACH,SAAS,YAAY,CAAC,MAAc;IAClC,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,WAAW,CACnB,kCAAkC,MAAM,SAAS,OAAO,gDAAgD,CACzG,CAAC;IACJ,CAAC;IAED,IAAI,MA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CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;AACpG,CAAC"}
package/lib/env-file.js CHANGED
@@ -15,22 +15,25 @@
15
15
  */
16
16
  import { readFileSync } from 'node:fs';
17
17
  import process from 'node:process';
18
+ import { CONNECTION_ENV, LEGACY_ENV } from './env-vars.js';
18
19
  import { ConfigError } from './errors.js';
19
20
  /**
20
- * The only variables a `.env` file may set. Without this, a file the user did not write — one
21
- * from a repo, a shared drive, or generated by an agent — could set `NODE_TLS_REJECT_UNAUTHORIZED`
22
- * and turn off the certificate verification this CLI otherwise guarantees, handing the token to
23
- * whoever answers. `GITLAB_SSL_VERIFY` is deliberately included so that setting it still produces the
24
- * explanatory ConfigError rather than silence.
21
+ * The only variables a `.env` file may set: each connection setting, under its `SIMPLY_` name or its
22
+ * deprecated unprefixed one. Without this, a file the user did not write — one from a repo, a shared
23
+ * drive, or generated by an agent — could set `NODE_TLS_REJECT_UNAUTHORIZED` and turn off the
24
+ * certificate verification this CLI otherwise guarantees, handing the token to whoever answers.
25
+ * `*_SSL_VERIFY` is deliberately included so that setting it still produces the explanatory
26
+ * ConfigError rather than silence. `SIMPLY_GITLAB_READ_ONLY` is safe to allow: the real environment
27
+ * still wins, so a file can turn the guard on but never off.
28
+ *
29
+ * Each key maps to both spellings of its setting, so the file is checked against either.
25
30
  */
26
- const APPLICABLE_KEYS = new Set([
27
- // Safe to allow: the real environment still wins, so a file can turn the guard on but never
28
- // off. A read-only credential file carrying this is the intended arrangement.
29
- 'GITLAB_READ_ONLY',
30
- 'GITLAB_URL',
31
- 'GITLAB_TOKEN',
32
- 'GITLAB_SSL_VERIFY',
33
- ]);
31
+ const APPLICABLE_KEYS = new Map();
32
+ for (const current of CONNECTION_ENV) {
33
+ const names = [current, LEGACY_ENV[current]];
34
+ for (const name of names)
35
+ APPLICABLE_KEYS.set(name, names);
36
+ }
34
37
  /** Matches `KEY=value`, tolerating a leading `export` and surrounding whitespace. */
35
38
  const ASSIGNMENT = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/;
36
39
  /**
@@ -86,12 +89,16 @@ export function loadEnvFile(path, env = process.env) {
86
89
  throw new ConfigError(`Env file ${path} ${reason}.`);
87
90
  }
88
91
  for (const [key, value] of Object.entries(parseEnvFile(contents))) {
89
- if (!APPLICABLE_KEYS.has(key))
92
+ const names = APPLICABLE_KEYS.get(key);
93
+ if (names === undefined)
90
94
  continue;
95
+ // The environment wins if it sets the setting under *either* name. Checking only `key` would
96
+ // let a file's `SIMPLY_GITLAB_READ_ONLY=0` outrank a real `GITLAB_READ_ONLY=1` — the prefixed
97
+ // name wins on lookup — and so turn the guard off from a file.
91
98
  // A variable exported as the empty string carries no value, so it must not outrank the
92
- // file the user explicitly named — otherwise `export GITLAB_TOKEN=` in a wrapper script
93
- // silently discards the real token and the run fails as if nothing were configured.
94
- if (env[key] === undefined || env[key] === '')
99
+ // file the user explicitly named — otherwise `export SIMPLY_GITLAB_TOKEN=` in a wrapper
100
+ // script silently discards the real token and the run fails as if nothing were configured.
101
+ if (names.every((name) => env[name] === undefined || env[name] === ''))
95
102
  env[key] = value;
96
103
  }
97
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"env-file.js","sourceRoot":"","sources":["../src/env-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,4FAA4F;IAC5F,8EAA8E;IAC9E,kBAAkB;IAClB,YAAY;IACZ,cAAc;IACd,mBAAmB;CACpB,CAAC,CAAC;AAEH,qFAAqF;AACrF,MAAM,UAAU,GAAG,wDAAwD,CAAC;AAE5E;;;GAGG;AACH,SAAS,OAAO,CAAC,GAAW;I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AY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAI,KAA+B,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC;QACtG,MAAM,IAAI,WAAW,CAAC,YAAY,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAClE,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,6FAA6F;QAC7F,8FAA8F;QAC9F,+DAA+D;QAC/D,uFAAuF;QACvF,wFAAwF;QACxF,2FAA2F;QAC3F,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC3F,CAAC;AACH,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { EnvLike } from './config.js';
2
+ /**
3
+ * Every environment variable this project reads, mapped to the unprefixed name it replaced.
4
+ *
5
+ * The `SIMPLY_` prefix exists because the unprefixed names are shared with other GitLab tooling
6
+ * (`GITLAB_TOKEN` and `GITLAB_URL` are what glab, CI scripts, and most GitLab MCP servers read), so
7
+ * a shell configured for one tool silently configured this one too. See
8
+ * docs/design/0012-simply-env-prefix.md.
9
+ *
10
+ * The legacy names still work while the prefixed name is unset, and every use of one is reported
11
+ * by {@link deprecatedEnvWarning}. They will be removed in a future major release.
12
+ *
13
+ * `SIMPLY_GITLAB_PROJECT` is read only by the CLI's `--project` flag, not by this package; it is
14
+ * listed so the rename and its warning live in one place.
15
+ */
16
+ export declare const LEGACY_ENV: {
17
+ readonly SIMPLY_GITLAB_URL: "GITLAB_URL";
18
+ readonly SIMPLY_GITLAB_TOKEN: "GITLAB_TOKEN";
19
+ readonly SIMPLY_GITLAB_SSL_VERIFY: "GITLAB_SSL_VERIFY";
20
+ readonly SIMPLY_GITLAB_READ_ONLY: "GITLAB_READ_ONLY";
21
+ readonly SIMPLY_GITLAB_PROJECT: "GITLAB_PROJECT";
22
+ };
23
+ /** A current, `SIMPLY_`-prefixed variable name. */
24
+ export type EnvName = keyof typeof LEGACY_ENV;
25
+ /** The names a consumer without a `--project` flag, such as the MCP server, actually reads. */
26
+ export declare const CONNECTION_ENV: readonly EnvName[];
27
+ /**
28
+ * Reads a setting: the prefixed name when it has a value, otherwise the deprecated unprefixed one.
29
+ * The prefixed name always wins, so a legacy variable left behind for another tool cannot override
30
+ * a setting made for this one.
31
+ */
32
+ export declare function envValue(env: EnvLike, name: EnvName): string | undefined;
33
+ /**
34
+ * The deprecated names this environment is actually relying on, among `names`: set, with the
35
+ * prefixed name unset. A legacy name shadowed by its prefixed one is not reported — it is most
36
+ * likely there for another tool, and this project already ignores it.
37
+ */
38
+ export declare function deprecatedEnvInUse(env: EnvLike, names?: readonly EnvName[]): Array<{
39
+ readonly legacy: string;
40
+ readonly current: EnvName;
41
+ }>;
42
+ /**
43
+ * One line naming each deprecated variable in use and its replacement, or `undefined` when there
44
+ * are none. Returned rather than written, so each surface reports it on its own diagnostic channel.
45
+ */
46
+ export declare function deprecatedEnvWarning(env: EnvLike, names?: readonly EnvName[]): string | undefined;
@@ -0,0 +1,83 @@
1
+ /*
2
+ * Copyright (c) 2026, SimplySF.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Every environment variable this project reads, mapped to the unprefixed name it replaced.
18
+ *
19
+ * The `SIMPLY_` prefix exists because the unprefixed names are shared with other GitLab tooling
20
+ * (`GITLAB_TOKEN` and `GITLAB_URL` are what glab, CI scripts, and most GitLab MCP servers read), so
21
+ * a shell configured for one tool silently configured this one too. See
22
+ * docs/design/0012-simply-env-prefix.md.
23
+ *
24
+ * The legacy names still work while the prefixed name is unset, and every use of one is reported
25
+ * by {@link deprecatedEnvWarning}. They will be removed in a future major release.
26
+ *
27
+ * `SIMPLY_GITLAB_PROJECT` is read only by the CLI's `--project` flag, not by this package; it is
28
+ * listed so the rename and its warning live in one place.
29
+ */
30
+ export const LEGACY_ENV = {
31
+ SIMPLY_GITLAB_URL: 'GITLAB_URL',
32
+ SIMPLY_GITLAB_TOKEN: 'GITLAB_TOKEN',
33
+ SIMPLY_GITLAB_SSL_VERIFY: 'GITLAB_SSL_VERIFY',
34
+ SIMPLY_GITLAB_READ_ONLY: 'GITLAB_READ_ONLY',
35
+ SIMPLY_GITLAB_PROJECT: 'GITLAB_PROJECT',
36
+ };
37
+ /** The names a consumer without a `--project` flag, such as the MCP server, actually reads. */
38
+ export const CONNECTION_ENV = [
39
+ 'SIMPLY_GITLAB_URL',
40
+ 'SIMPLY_GITLAB_TOKEN',
41
+ 'SIMPLY_GITLAB_SSL_VERIFY',
42
+ 'SIMPLY_GITLAB_READ_ONLY',
43
+ ];
44
+ const ALL_ENV = Object.keys(LEGACY_ENV);
45
+ function present(value) {
46
+ // An empty export carries no value, matching how `loadEnvFile` treats one.
47
+ return value !== undefined && value !== '';
48
+ }
49
+ /**
50
+ * Reads a setting: the prefixed name when it has a value, otherwise the deprecated unprefixed one.
51
+ * The prefixed name always wins, so a legacy variable left behind for another tool cannot override
52
+ * a setting made for this one.
53
+ */
54
+ export function envValue(env, name) {
55
+ const current = env[name];
56
+ if (present(current))
57
+ return current;
58
+ const legacy = env[LEGACY_ENV[name]];
59
+ return present(legacy) ? legacy : current;
60
+ }
61
+ /**
62
+ * The deprecated names this environment is actually relying on, among `names`: set, with the
63
+ * prefixed name unset. A legacy name shadowed by its prefixed one is not reported — it is most
64
+ * likely there for another tool, and this project already ignores it.
65
+ */
66
+ export function deprecatedEnvInUse(env, names = ALL_ENV) {
67
+ return names
68
+ .filter((current) => !present(env[current]) && present(env[LEGACY_ENV[current]]))
69
+ .map((current) => ({ legacy: LEGACY_ENV[current], current }));
70
+ }
71
+ /**
72
+ * One line naming each deprecated variable in use and its replacement, or `undefined` when there
73
+ * are none. Returned rather than written, so each surface reports it on its own diagnostic channel.
74
+ */
75
+ export function deprecatedEnvWarning(env, names = ALL_ENV) {
76
+ const inUse = deprecatedEnvInUse(env, names);
77
+ if (inUse.length === 0)
78
+ return undefined;
79
+ const renames = inUse.map(({ legacy, current }) => `${legacy} → ${current}`).join(', ');
80
+ return (`Deprecated environment variable${inUse.length === 1 ? '' : 's'} in use: ${renames}. ` +
81
+ 'Rename to the SIMPLY_ prefix; the unprefixed names will stop working in a future major release.');
82
+ }
83
+ //# sourceMappingURL=env-vars.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-vars.js","sourceRoot":"","sources":["../src/env-vars.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,iBAAiB,EAAE,YAAY;IAC/B,mBAAmB,EAAE,cAAc;IACnC,wBAAwB,EAAE,mBAAmB;IAC7C,uBAAuB,EAAE,kBAAkB;IAC3C,qBAAqB,EAAE,gBAAgB;CAC/B,CAAC;AAKX,+FAA+F;AAC/F,MAAM,CAAC,MAAM,cAAc,GAAuB;IAChD,mBAAmB;IACnB,qBAAqB;IACr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AC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,MAAM,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxF,OAAO,CACL,kCAAkC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,YAAY,OAAO,IAAI;QACtF,iGAAiG,CAClG,CAAC;AACJ,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { buildAuthHeaders } from './auth.js';
2
2
  export { DEFAULT_URL, resolveGitLabConfig, TOKEN_ENV, URL_ENV, type ConfigOverrides, type EnvLike, type GitLabConfig, } from './config.js';
3
3
  export { loadEnvFile, parseEnvFile } from './env-file.js';
4
+ export { CONNECTION_ENV, deprecatedEnvInUse, deprecatedEnvWarning, envValue, LEGACY_ENV, type EnvName, } from './env-vars.js';
4
5
  export { AuthError, CliError, ConfigError, HttpError, NetworkError } from './errors.js';
5
6
  export { HttpTransport, type JsonCall, type Paged, type Pagination, type QueryValue, type TransportTarget, } from './http.js';
6
7
  export { GitLabClient, type CommitAction, type FileOptions, type JobScope, type ListBranchesOptions, type ListCommitsOptions, type ListEnvironmentsOptions, type ListJobsOptions, type ListMergeRequestNotesOptions, type ListMergeRequestsOptions, type ListProjectsOptions, type ListResult, type ListTagsOptions, type MergeRequestState, type ProjectRef, type SearchOptions, type SearchScope, type WriteFileInput, } from './gitlab-client.js';
package/lib/index.js CHANGED
@@ -26,6 +26,7 @@
26
26
  export { buildAuthHeaders } from './auth.js';
27
27
  export { DEFAULT_URL, resolveGitLabConfig, TOKEN_ENV, URL_ENV, } from './config.js';
28
28
  export { loadEnvFile, parseEnvFile } from './env-file.js';
29
+ export { CONNECTION_ENV, deprecatedEnvInUse, deprecatedEnvWarning, envValue, LEGACY_ENV, } from './env-vars.js';
29
30
  export { AuthError, CliError, ConfigError, HttpError, NetworkError } from './errors.js';
30
31
  export { HttpTransport, } from './http.js';
31
32
  export { GitLabClient, } from './gitlab-client.js';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,gGAAgG;AAChG,+EAA+E;AAC/E,gGAAgG;AAChG,8FAA8F;AAC9F,sEAAsE;AACtE,EAAE;AACF,iGAAiG;AACjG,8FAA8F;AAC9F,+FAA+F;AAE/F,mDAAmD;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,OAAO,GAIR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EACL,aAAa,GAMd,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,YAAY,GAkBb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE9D,yFAAyF;AACzF,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEvG,8CAA8C;AAC9C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAC;AAClF,OAAO,EACL,aAAa,EACb,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,c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,mBAAmB,EACnB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,GAIV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAuC,MAAM,qBAAqB,CAAC;AACjH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,aAAa,GAGd,MAAM,sBAAsB,CAAC"}
@@ -1,6 +1,10 @@
1
1
  import type { EnvLike } from './config.js';
2
- /** The environment variables that carry credentials, and so must never reach any output. */
3
- export declare const SECRET_ENV: readonly ["GITLAB_TOKEN"];
2
+ /**
3
+ * The environment variables that carry credentials, and so must never reach any output. The
4
+ * deprecated unprefixed name is listed too: redaction is about what is in the environment, not
5
+ * which name won, so a shadowed legacy token is still scrubbed.
6
+ */
7
+ export declare const SECRET_ENV: readonly ["SIMPLY_GITLAB_TOKEN", "GITLAB_TOKEN"];
4
8
  /**
5
9
  * Keeps the values worth redacting out of whatever a caller collected — the environment, a
6
10
  * command line, a config file — and drops the ones too short to be a credential.
package/lib/redaction.js CHANGED
@@ -15,8 +15,12 @@
15
15
  */
16
16
  import process from 'node:process';
17
17
  import { stripControl } from './text.js';
18
- /** The environment variables that carry credentials, and so must never reach any output. */
19
- export const SECRET_ENV = ['GITLAB_TOKEN'];
18
+ /**
19
+ * The environment variables that carry credentials, and so must never reach any output. The
20
+ * deprecated unprefixed name is listed too: redaction is about what is in the environment, not
21
+ * which name won, so a shadowed legacy token is still scrubbed.
22
+ */
23
+ export const SECRET_ENV = ['SIMPLY_GITLAB_TOKEN', 'GITLAB_TOKEN'];
20
24
  /** Shorter values would mangle unrelated text; real tokens are far longer than this. */
21
25
  const MIN_SECRET_LENGTH = 8;
22
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"redaction.js","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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C,CAAC,CAAC,CAAC,CACxG,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { EnvLike } from './config.js';
2
2
  /** The environment variable that marks a context as one that does not make changes. */
3
- export declare const READ_ONLY_ENV = "GITLAB_READ_ONLY";
3
+ export declare const READ_ONLY_ENV = "SIMPLY_GITLAB_READ_ONLY";
4
4
  /** Whether the environment says this context does not write. Any value not meaning "yes" is ignored. */
5
5
  export declare function isReadOnly(env?: EnvLike): boolean;
6
6
  /**
@@ -14,13 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import process from 'node:process';
17
+ import { envValue } from './env-vars.js';
17
18
  import { ConfigError } from './errors.js';
18
19
  /** The environment variable that marks a context as one that does not make changes. */
19
- export const READ_ONLY_ENV = 'GITLAB_READ_ONLY';
20
+ export const READ_ONLY_ENV = 'SIMPLY_GITLAB_READ_ONLY';
20
21
  const TRUTHY = new Set(['1', 'true', 'yes', 'on']);
21
22
  /** Whether the environment says this context does not write. Any value not meaning "yes" is ignored. */
22
23
  export function isReadOnly(env = process.env) {
23
- const raw = env[READ_ONLY_ENV];
24
+ const raw = envValue(env, READ_ONLY_ENV);
24
25
  return raw !== undefined && TRUTHY.has(raw.trim().toLowerCase());
25
26
  }
26
27
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"write-safety.js","sourceRoot":"","sources":["../src/write-safety.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,uFAAuF;AACvF,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEhD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAEnD,wGAAwG;AACxG,MAAM,UAAU,UAAU,CAAC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CAAC;QACpB,MAAM,IAAI,WAAW,CACnB,GAAG,aAAa,sEAAsE;YACpF,wDAAwD,CAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplysf/simply-gitlab-core",
3
3
  "description": "Configuration, authentication, HTTP client, and shared logic for working with GitLab",
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
5
5
  "author": "@ClayChipps",
6
6
  "homepage": "https://github.com/SimplySF/simply-gitlab",
7
7
  "bugs": "https://github.com/SimplySF/simply-gitlab/issues",
@@ -127,5 +127,5 @@
127
127
  "output": []
128
128
  }
129
129
  },
130
- "gitHead": "c4ed406af1c5f63fb4343fe32f9caff05135f2df"
130
+ "gitHead": "9ce677fa464231625d87dd6794daa2e6ca9f22d6"
131
131
  }