bbdc-cli 0.3.1__tar.gz
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.
- bbdc_cli-0.3.1/PKG-INFO +209 -0
- bbdc_cli-0.3.1/README.md +190 -0
- bbdc_cli-0.3.1/bbdc_cli/__init__.py +0 -0
- bbdc_cli-0.3.1/bbdc_cli/__main__.py +1465 -0
- bbdc_cli-0.3.1/bbdc_cli.egg-info/PKG-INFO +209 -0
- bbdc_cli-0.3.1/bbdc_cli.egg-info/SOURCES.txt +10 -0
- bbdc_cli-0.3.1/bbdc_cli.egg-info/dependency_links.txt +1 -0
- bbdc_cli-0.3.1/bbdc_cli.egg-info/entry_points.txt +2 -0
- bbdc_cli-0.3.1/bbdc_cli.egg-info/requires.txt +6 -0
- bbdc_cli-0.3.1/bbdc_cli.egg-info/top_level.txt +1 -0
- bbdc_cli-0.3.1/pyproject.toml +37 -0
- bbdc_cli-0.3.1/setup.cfg +4 -0
bbdc_cli-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bbdc-cli
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Typer CLI for Bitbucket Data Center
|
|
5
|
+
Project-URL: Repository, https://github.com/marcosgalleterobbva/bb-cli
|
|
6
|
+
Keywords: bitbucket,cli,typer,data-center,server
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: typer>=0.9
|
|
15
|
+
Requires-Dist: requests>=2.31
|
|
16
|
+
Provides-Extra: build
|
|
17
|
+
Requires-Dist: build>=1.2.1; extra == "build"
|
|
18
|
+
Requires-Dist: twine>=5.0.0; extra == "build"
|
|
19
|
+
|
|
20
|
+
# bbdc-cli
|
|
21
|
+
|
|
22
|
+
A small, practical Typer CLI for Bitbucket Data Center / Server REST API.
|
|
23
|
+
|
|
24
|
+
It reads credentials from environment variables and provides high-signal PR workflows (list, create, comment,
|
|
25
|
+
approve, merge, update metadata, manage reviewers/participants, review completion, diffs, etc.) without needing a
|
|
26
|
+
full SDK.
|
|
27
|
+
|
|
28
|
+
## Requirements
|
|
29
|
+
|
|
30
|
+
- Python 3.9+
|
|
31
|
+
- `pipx` recommended for isolated install
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
From PyPI:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pipx install bbdc-cli
|
|
39
|
+
# or
|
|
40
|
+
pip install bbdc-cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
From source (repo root with `pyproject.toml`):
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pipx install .
|
|
47
|
+
|
|
48
|
+
# If you are iterating locally:
|
|
49
|
+
pipx install -e .
|
|
50
|
+
|
|
51
|
+
# Reinstall after changes (non-editable install):
|
|
52
|
+
pipx reinstall bbdc-cli
|
|
53
|
+
|
|
54
|
+
# Uninstall:
|
|
55
|
+
pipx uninstall bbdc-cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
The CLI uses two environment variables:
|
|
61
|
+
|
|
62
|
+
- `BITBUCKET_SERVER`: base REST URL ending in `/rest`
|
|
63
|
+
- `BITBUCKET_API_TOKEN`: Bitbucket personal access token (PAT)
|
|
64
|
+
|
|
65
|
+
Example (BBVA-style context path):
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
https://bitbucket.globaldevtools.bbva.com/bitbucket/rest
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Set them:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
export BITBUCKET_SERVER="https://bitbucket.globaldevtools.bbva.com/bitbucket/rest"
|
|
75
|
+
export BITBUCKET_API_TOKEN="YOUR_TOKEN"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick check
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
bbdc doctor
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If this succeeds, your base URL + token are working.
|
|
85
|
+
|
|
86
|
+
## Common commands
|
|
87
|
+
|
|
88
|
+
Show help:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
bbdc --help
|
|
92
|
+
bbdc pr --help
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
List pull requests:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
bbdc pr list --project GL_KAIF_APP-ID-2866825_DSG --repo mercury-viz
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Get a pull request:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
bbdc pr get -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Create a pull request:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
bbdc pr create \
|
|
111
|
+
--project GL_KAIF_APP-ID-2866825_DSG \
|
|
112
|
+
--repo mercury-viz \
|
|
113
|
+
--from-branch feature/my-branch \
|
|
114
|
+
--to-branch develop \
|
|
115
|
+
--title "Add viz panel" \
|
|
116
|
+
--description "Implements X"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Add reviewers (repeat `--reviewer`):
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
bbdc pr create \
|
|
123
|
+
-p GL_KAIF_APP-ID-2866825_DSG \
|
|
124
|
+
-r mercury-viz \
|
|
125
|
+
--from-branch feature/my-branch \
|
|
126
|
+
--to-branch develop \
|
|
127
|
+
--title "Add viz panel" \
|
|
128
|
+
--description "Implements X" \
|
|
129
|
+
--reviewer some.username \
|
|
130
|
+
--reviewer other.username
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Approve, decline, merge:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
bbdc pr approve -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
137
|
+
bbdc pr decline -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --comment "Not proceeding"
|
|
138
|
+
bbdc pr merge -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --message "LGTM"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Update metadata:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
bbdc pr update -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 \
|
|
145
|
+
--title "New title" \
|
|
146
|
+
--description "Updated description" \
|
|
147
|
+
--reviewer some.username
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Participants / reviewers:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
bbdc pr participants list -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
154
|
+
bbdc pr participants add -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --user alice --role REVIEWER
|
|
155
|
+
bbdc pr participants status -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 alice --status APPROVED
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Review completion and comments:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
bbdc pr review complete -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --comment "Looks good" --status APPROVED
|
|
162
|
+
bbdc pr comments add -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --text "LGTM"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Diffs and commits:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
bbdc pr commits -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
169
|
+
bbdc pr diff -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
170
|
+
bbdc pr diff-file -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 src/main.py
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
See the full command reference in `docs/CLI.md` and usage examples in `docs/examples.md`.
|
|
174
|
+
|
|
175
|
+
## Troubleshooting
|
|
176
|
+
|
|
177
|
+
`BITBUCKET_SERVER` must end with `/rest`.
|
|
178
|
+
|
|
179
|
+
Use the REST base, not the UI URL. For instances hosted under `/bitbucket`, the REST base is often:
|
|
180
|
+
|
|
181
|
+
- UI: `https://host/bitbucket/...`
|
|
182
|
+
- REST: `https://host/bitbucket/rest`
|
|
183
|
+
|
|
184
|
+
Unauthorized / 401 / 403:
|
|
185
|
+
|
|
186
|
+
- Token missing or incorrect
|
|
187
|
+
- Token lacks required permissions for that project/repo
|
|
188
|
+
- Your Bitbucket instance may require a different auth scheme (rare if PAT is enabled)
|
|
189
|
+
|
|
190
|
+
404 Not Found:
|
|
191
|
+
|
|
192
|
+
Usually one of:
|
|
193
|
+
|
|
194
|
+
- Wrong `BITBUCKET_SERVER` base path (`/rest` vs `/bitbucket/rest`)
|
|
195
|
+
- Wrong `--project` key or `--repo` slug
|
|
196
|
+
- PR id does not exist in that repo
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
Run without installing:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python -m bbdc_cli --help
|
|
204
|
+
python -m bbdc_cli doctor
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
Mercury - BBVA
|
bbdc_cli-0.3.1/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# bbdc-cli
|
|
2
|
+
|
|
3
|
+
A small, practical Typer CLI for Bitbucket Data Center / Server REST API.
|
|
4
|
+
|
|
5
|
+
It reads credentials from environment variables and provides high-signal PR workflows (list, create, comment,
|
|
6
|
+
approve, merge, update metadata, manage reviewers/participants, review completion, diffs, etc.) without needing a
|
|
7
|
+
full SDK.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- Python 3.9+
|
|
12
|
+
- `pipx` recommended for isolated install
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
From PyPI:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pipx install bbdc-cli
|
|
20
|
+
# or
|
|
21
|
+
pip install bbdc-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
From source (repo root with `pyproject.toml`):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pipx install .
|
|
28
|
+
|
|
29
|
+
# If you are iterating locally:
|
|
30
|
+
pipx install -e .
|
|
31
|
+
|
|
32
|
+
# Reinstall after changes (non-editable install):
|
|
33
|
+
pipx reinstall bbdc-cli
|
|
34
|
+
|
|
35
|
+
# Uninstall:
|
|
36
|
+
pipx uninstall bbdc-cli
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
The CLI uses two environment variables:
|
|
42
|
+
|
|
43
|
+
- `BITBUCKET_SERVER`: base REST URL ending in `/rest`
|
|
44
|
+
- `BITBUCKET_API_TOKEN`: Bitbucket personal access token (PAT)
|
|
45
|
+
|
|
46
|
+
Example (BBVA-style context path):
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
https://bitbucket.globaldevtools.bbva.com/bitbucket/rest
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Set them:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export BITBUCKET_SERVER="https://bitbucket.globaldevtools.bbva.com/bitbucket/rest"
|
|
56
|
+
export BITBUCKET_API_TOKEN="YOUR_TOKEN"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Quick check
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
bbdc doctor
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If this succeeds, your base URL + token are working.
|
|
66
|
+
|
|
67
|
+
## Common commands
|
|
68
|
+
|
|
69
|
+
Show help:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bbdc --help
|
|
73
|
+
bbdc pr --help
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
List pull requests:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
bbdc pr list --project GL_KAIF_APP-ID-2866825_DSG --repo mercury-viz
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Get a pull request:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
bbdc pr get -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Create a pull request:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
bbdc pr create \
|
|
92
|
+
--project GL_KAIF_APP-ID-2866825_DSG \
|
|
93
|
+
--repo mercury-viz \
|
|
94
|
+
--from-branch feature/my-branch \
|
|
95
|
+
--to-branch develop \
|
|
96
|
+
--title "Add viz panel" \
|
|
97
|
+
--description "Implements X"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Add reviewers (repeat `--reviewer`):
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
bbdc pr create \
|
|
104
|
+
-p GL_KAIF_APP-ID-2866825_DSG \
|
|
105
|
+
-r mercury-viz \
|
|
106
|
+
--from-branch feature/my-branch \
|
|
107
|
+
--to-branch develop \
|
|
108
|
+
--title "Add viz panel" \
|
|
109
|
+
--description "Implements X" \
|
|
110
|
+
--reviewer some.username \
|
|
111
|
+
--reviewer other.username
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Approve, decline, merge:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
bbdc pr approve -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
118
|
+
bbdc pr decline -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --comment "Not proceeding"
|
|
119
|
+
bbdc pr merge -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --message "LGTM"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Update metadata:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
bbdc pr update -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 \
|
|
126
|
+
--title "New title" \
|
|
127
|
+
--description "Updated description" \
|
|
128
|
+
--reviewer some.username
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Participants / reviewers:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
bbdc pr participants list -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
135
|
+
bbdc pr participants add -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --user alice --role REVIEWER
|
|
136
|
+
bbdc pr participants status -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 alice --status APPROVED
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Review completion and comments:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
bbdc pr review complete -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --comment "Looks good" --status APPROVED
|
|
143
|
+
bbdc pr comments add -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 --text "LGTM"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Diffs and commits:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
bbdc pr commits -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
150
|
+
bbdc pr diff -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123
|
|
151
|
+
bbdc pr diff-file -p GL_KAIF_APP-ID-2866825_DSG -r mercury-viz 123 src/main.py
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
See the full command reference in `docs/CLI.md` and usage examples in `docs/examples.md`.
|
|
155
|
+
|
|
156
|
+
## Troubleshooting
|
|
157
|
+
|
|
158
|
+
`BITBUCKET_SERVER` must end with `/rest`.
|
|
159
|
+
|
|
160
|
+
Use the REST base, not the UI URL. For instances hosted under `/bitbucket`, the REST base is often:
|
|
161
|
+
|
|
162
|
+
- UI: `https://host/bitbucket/...`
|
|
163
|
+
- REST: `https://host/bitbucket/rest`
|
|
164
|
+
|
|
165
|
+
Unauthorized / 401 / 403:
|
|
166
|
+
|
|
167
|
+
- Token missing or incorrect
|
|
168
|
+
- Token lacks required permissions for that project/repo
|
|
169
|
+
- Your Bitbucket instance may require a different auth scheme (rare if PAT is enabled)
|
|
170
|
+
|
|
171
|
+
404 Not Found:
|
|
172
|
+
|
|
173
|
+
Usually one of:
|
|
174
|
+
|
|
175
|
+
- Wrong `BITBUCKET_SERVER` base path (`/rest` vs `/bitbucket/rest`)
|
|
176
|
+
- Wrong `--project` key or `--repo` slug
|
|
177
|
+
- PR id does not exist in that repo
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
Run without installing:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
python -m bbdc_cli --help
|
|
185
|
+
python -m bbdc_cli doctor
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
Mercury - BBVA
|
|
File without changes
|