@pilatos/bitbucket-cli 1.18.0 → 1.19.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
@@ -93,7 +93,7 @@ bb browse src/cli.ts:20 # open a file at a specific line
93
93
  bb config set defaultWorkspace myworkspace
94
94
  ```
95
95
 
96
- **Global options:** `--json [fields]`, `--jq <expression>`, `--no-color`, `-w, --workspace`, `-r, --repo`
96
+ **Global options** (work on every command): `--json [fields]`, `--jq`, `--no-color`, `--no-unicode`, `--no-truncate`, `--limit`, `--all`, `--locale`, `-w, --workspace`, `-r, --repo`. Full reference: [Global Flags](https://bitbucket-cli.paulvanderlei.com/reference/global-flags/).
97
97
 
98
98
  ### Scripting with `--json` and `--jq`
99
99
 
@@ -135,13 +135,16 @@ Full documentation: **[bitbucket-cli.paulvanderlei.com](https://bitbucket-cli.pa
135
135
 
136
136
  ## Environment Variables
137
137
 
138
- | Variable | Description |
139
- | -------------- | ---------------------------------------------------------- |
140
- | `BB_USERNAME` | Bitbucket username (fallback for `bb auth login`) |
141
- | `BB_API_TOKEN` | Bitbucket API token (fallback for `bb auth login`; for CI) |
142
- | `DEBUG` | Enable HTTP debug logging when set to `true` |
143
- | `NO_COLOR` | Disable color output when set |
144
- | `FORCE_COLOR` | Force color output when set (and not `0`) |
138
+ | Variable | Description |
139
+ | --------------- | ---------------------------------------------------------------------- |
140
+ | `BB_USERNAME` | Bitbucket username (fallback for `bb auth login`) |
141
+ | `BB_API_TOKEN` | Bitbucket API token (fallback for `bb auth login`; for CI) |
142
+ | `BB_WORKSPACE` | Default workspace; overrides `defaultWorkspace` config |
143
+ | `BB_LOCALE` | BCP-47 locale for date/time formatting (e.g. `de-DE`); `--locale` wins |
144
+ | `BB_NO_UNICODE` | Use ASCII fallbacks for symbols when set (any non-empty value) |
145
+ | `DEBUG` | Enable HTTP debug logging — must equal exactly `true` |
146
+ | `NO_COLOR` | Disable color output when set |
147
+ | `FORCE_COLOR` | Force color output when set (and not `0`) |
145
148
 
146
149
  Full reference: [Environment variables](https://bitbucket-cli.paulvanderlei.com/reference/environment-variables/).
147
150
 
package/dist/index.js CHANGED
@@ -17941,8 +17941,7 @@ class ContextService {
17941
17941
  };
17942
17942
  }
17943
17943
  if (options.repo) {
17944
- const config = await this.configService.getConfig();
17945
- const workspace = gitContext?.workspace || config.defaultWorkspace;
17944
+ const workspace = gitContext?.workspace ?? await this.resolveDefaultWorkspace();
17946
17945
  if (workspace) {
17947
17946
  return {
17948
17947
  context: { workspace, repoSlug: options.repo },
@@ -17953,6 +17952,21 @@ class ContextService {
17953
17952
  }
17954
17953
  return gitResult;
17955
17954
  }
17955
+ async resolveDefaultWorkspace() {
17956
+ const fromEnv = process.env.BB_WORKSPACE;
17957
+ if (typeof fromEnv === "string") {
17958
+ const trimmed = fromEnv.trim();
17959
+ if (trimmed.length > 0) {
17960
+ return trimmed;
17961
+ }
17962
+ }
17963
+ const config = await this.configService.getConfig();
17964
+ const fromConfig = config.defaultWorkspace;
17965
+ if (typeof fromConfig === "string" && fromConfig.length > 0) {
17966
+ return fromConfig;
17967
+ }
17968
+ return;
17969
+ }
17956
17970
  async requireRepoContext(options) {
17957
17971
  const result = await this.resolveRepoContext(options);
17958
17972
  if (!result.context) {
@@ -17990,9 +18004,9 @@ class ContextService {
17990
18004
  if (explicit && explicit.length > 0) {
17991
18005
  return explicit;
17992
18006
  }
17993
- const config = await this.configService.getConfig();
17994
- if (config.defaultWorkspace && config.defaultWorkspace.length > 0) {
17995
- return config.defaultWorkspace;
18007
+ const fallback = await this.resolveDefaultWorkspace();
18008
+ if (fallback) {
18009
+ return fallback;
17996
18010
  }
17997
18011
  throw new BBError({
17998
18012
  code: 6002 /* CONTEXT_WORKSPACE_NOT_FOUND */,
@@ -31501,14 +31515,15 @@ function withGlobalOptions(options, context) {
31501
31515
  };
31502
31516
  }
31503
31517
  var cli = new Command;
31504
- cli.name("bb").description("A command-line interface for Bitbucket Cloud").version(pkg2.version).option("--json [fields]", "Output as JSON; optionally project to a comma-separated field list (e.g. number,title,author.display_name)").option("--jq <expression>", `Filter the JSON output through a jq expression \u2014 runs in-process via embedded jq, requires --json (e.g. '.pullRequests[] | select(.state == "OPEN") | .title')`).option("--no-color", "Disable color output").option("--no-unicode", "Use ASCII fallbacks for symbols (separators, arrows, status icons) \u2014 also enabled by BB_NO_UNICODE").option("--no-truncate", "Show full values in table output without truncation").option("--locale <locale>", "BCP-47 locale tag for date/time formatting (e.g. de-DE, ja-JP). Falls back to BB_LOCALE, then LC_TIME/LC_ALL/LANG, then en-US.").option("-w, --workspace <workspace>", "Specify workspace").option("-r, --repo <repo>", "Specify repository").addHelpText("after", buildHelpText({
31518
+ cli.name("bb").description("A command-line interface for Bitbucket Cloud").version(pkg2.version).option("--json [fields]", "Output as JSON; optionally project to a comma-separated field list (e.g. number,title,author.display_name)").option("--jq <expression>", `Filter the JSON output through a jq expression \u2014 runs in-process via embedded jq, requires --json (e.g. '.pullRequests[] | select(.state == "OPEN") | .title')`).option("--no-color", "Disable color output").option("--no-unicode", "Use ASCII fallbacks for symbols (separators, arrows, status icons) \u2014 also enabled by BB_NO_UNICODE").option("--no-truncate", "Show full values in table output without truncation").option("--locale <locale>", "BCP-47 locale tag for date/time formatting (e.g. de-DE, ja-JP). Falls back to BB_LOCALE, then LC_TIME/LC_ALL/LANG, then en-US.").option("-w, --workspace <workspace>", "Specify workspace (falls back to BB_WORKSPACE, then config defaultWorkspace)").option("-r, --repo <repo>", "Specify repository").addHelpText("after", buildHelpText({
31505
31519
  envVars: {
31506
31520
  BB_USERNAME: "Bitbucket username (fallback for auth login)",
31507
31521
  BB_API_TOKEN: "Bitbucket API token (fallback for auth login)",
31522
+ BB_WORKSPACE: "Default workspace (overrides config.defaultWorkspace; --workspace still wins)",
31508
31523
  NO_COLOR: "Disable color output when set",
31509
31524
  FORCE_COLOR: "Force color output when set (and not '0')",
31510
31525
  BB_NO_UNICODE: "Use ASCII fallbacks for symbols when set (any non-empty value)",
31511
- DEBUG: "Enable HTTP debug logging when 'true'",
31526
+ DEBUG: "Enable HTTP debug logging when exactly 'true'",
31512
31527
  BB_LOCALE: "BCP-47 locale tag for date/time formatting; --locale takes precedence"
31513
31528
  },
31514
31529
  seeAlso: [
@@ -32118,5 +32133,5 @@ if (typeof Bun === "undefined") {
32118
32133
  }
32119
32134
  cli.parse(process.argv);
32120
32135
 
32121
- //# debugId=B7A5A47929AA84A364756E2164756E21
32136
+ //# debugId=C24B0C4332F9755664756E2164756E21
32122
32137
  //# sourceMappingURL=index.js.map