atlassian-cli 0.7.0__tar.gz → 0.8.0__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.
- {atlassian_cli-0.7.0/src/atlassian_cli.egg-info → atlassian_cli-0.8.0}/PKG-INFO +1 -1
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/pyproject.toml +1 -1
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/confluence.py +64 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0/src/atlassian_cli.egg-info}/PKG-INFO +1 -1
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/LICENSE +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/README.md +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/setup.cfg +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/__init__.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/adf.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/config.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/hints.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/http.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/jira.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/jira_assets.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/jira_issues.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/output.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli/update_check.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/SOURCES.txt +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/dependency_links.txt +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/entry_points.txt +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/requires.txt +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/top_level.txt +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/tests/test_adf.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/tests/test_config.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/tests/test_confluence.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/tests/test_http.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/tests/test_jira_assets.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/tests/test_jira_issues.py +0 -0
- {atlassian_cli-0.7.0 → atlassian_cli-0.8.0}/tests/test_output.py +0 -0
|
@@ -212,6 +212,58 @@ def cmd_create(args):
|
|
|
212
212
|
emit('OK', f'Created {result.get("title", args.title)} ({page_id})')
|
|
213
213
|
|
|
214
214
|
|
|
215
|
+
def _modify_page_metadata(session, base, page_id, *,
|
|
216
|
+
new_title=None, new_parent_id=None, message=None):
|
|
217
|
+
"""Update a page's title and/or parentId without touching the body.
|
|
218
|
+
|
|
219
|
+
Confluence has no dedicated 'move' or 'rename' endpoint — both go through
|
|
220
|
+
PUT /pages/{id}, which requires the full body and a bumped version. Here
|
|
221
|
+
we fetch the current state and round-trip it with the requested changes.
|
|
222
|
+
"""
|
|
223
|
+
remote = get_page(session, base, page_id)
|
|
224
|
+
current_title = remote.get('title', '')
|
|
225
|
+
title = new_title if new_title is not None else current_title
|
|
226
|
+
body_value = remote.get('body', {}).get('atlas_doc_format', {}).get('value')
|
|
227
|
+
if body_value is None:
|
|
228
|
+
body_value = {'type': 'doc', 'version': 1, 'content': []}
|
|
229
|
+
body_payload = {
|
|
230
|
+
'representation': 'atlas_doc_format',
|
|
231
|
+
'value': json.dumps(body_value) if not isinstance(body_value, str) else body_value,
|
|
232
|
+
}
|
|
233
|
+
new_version = _ver(remote) + 1
|
|
234
|
+
payload = {
|
|
235
|
+
'id': str(page_id),
|
|
236
|
+
'status': 'current',
|
|
237
|
+
'title': title,
|
|
238
|
+
'body': body_payload,
|
|
239
|
+
'version': {'number': new_version, 'message': message or 'Metadata updated'},
|
|
240
|
+
}
|
|
241
|
+
if new_parent_id is not None:
|
|
242
|
+
payload['parentId'] = str(new_parent_id)
|
|
243
|
+
api_put(session, base, f'{V2}/pages/{page_id}', payload)
|
|
244
|
+
return title, new_version
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def cmd_move(args):
|
|
248
|
+
session, base = setup()
|
|
249
|
+
new_title, new_version = _modify_page_metadata(
|
|
250
|
+
session, base, args.page_id,
|
|
251
|
+
new_parent_id=args.parent_id,
|
|
252
|
+
message=getattr(args, 'message', None) or f'Moved under parent {args.parent_id}',
|
|
253
|
+
)
|
|
254
|
+
emit('OK', f'Moved {args.page_id} ({new_title}) -> parent {args.parent_id} (v{new_version})')
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def cmd_rename(args):
|
|
258
|
+
session, base = setup()
|
|
259
|
+
new_title, new_version = _modify_page_metadata(
|
|
260
|
+
session, base, args.page_id,
|
|
261
|
+
new_title=args.title,
|
|
262
|
+
message=getattr(args, 'message', None) or f'Renamed to {args.title!r}',
|
|
263
|
+
)
|
|
264
|
+
emit('OK', f'Renamed {args.page_id} -> {new_title!r} (v{new_version})')
|
|
265
|
+
|
|
266
|
+
|
|
215
267
|
def cmd_delete(args):
|
|
216
268
|
session, base = setup()
|
|
217
269
|
page = get_page(session, base, args.page_id)
|
|
@@ -904,6 +956,18 @@ def main():
|
|
|
904
956
|
p.add_argument('page_id', help='Confluence page ID')
|
|
905
957
|
p.set_defaults(func=cmd_delete)
|
|
906
958
|
|
|
959
|
+
p = sub.add_parser('move', help='Move a page to a new parent (preserves body)')
|
|
960
|
+
p.add_argument('page_id', help='Confluence page ID to move')
|
|
961
|
+
p.add_argument('parent_id', help='New parent page ID')
|
|
962
|
+
p.add_argument('--message', '-m', help='Version message')
|
|
963
|
+
p.set_defaults(func=cmd_move)
|
|
964
|
+
|
|
965
|
+
p = sub.add_parser('rename', help='Rename a page (preserves body and parent)')
|
|
966
|
+
p.add_argument('page_id', help='Confluence page ID')
|
|
967
|
+
p.add_argument('title', help='New page title')
|
|
968
|
+
p.add_argument('--message', '-m', help='Version message')
|
|
969
|
+
p.set_defaults(func=cmd_rename)
|
|
970
|
+
|
|
907
971
|
p = sub.add_parser('put', help='Upload local ADF to Confluence')
|
|
908
972
|
p.add_argument('page_id', help='Confluence page ID')
|
|
909
973
|
p.add_argument('--dir', default='pages', help='Pages directory (default: pages)')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|