atlassian-cli 0.7.0__tar.gz → 0.9.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.
Files changed (29) hide show
  1. {atlassian_cli-0.7.0/src/atlassian_cli.egg-info → atlassian_cli-0.9.0}/PKG-INFO +1 -1
  2. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/pyproject.toml +1 -1
  3. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/confluence.py +77 -4
  4. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0/src/atlassian_cli.egg-info}/PKG-INFO +1 -1
  5. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/LICENSE +0 -0
  6. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/README.md +0 -0
  7. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/setup.cfg +0 -0
  8. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/__init__.py +0 -0
  9. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/adf.py +0 -0
  10. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/config.py +0 -0
  11. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/hints.py +0 -0
  12. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/http.py +0 -0
  13. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/jira.py +0 -0
  14. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/jira_assets.py +0 -0
  15. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/jira_issues.py +0 -0
  16. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/output.py +0 -0
  17. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli/update_check.py +0 -0
  18. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli.egg-info/SOURCES.txt +0 -0
  19. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli.egg-info/dependency_links.txt +0 -0
  20. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli.egg-info/entry_points.txt +0 -0
  21. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli.egg-info/requires.txt +0 -0
  22. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/src/atlassian_cli.egg-info/top_level.txt +0 -0
  23. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/tests/test_adf.py +0 -0
  24. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/tests/test_config.py +0 -0
  25. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/tests/test_confluence.py +0 -0
  26. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/tests/test_http.py +0 -0
  27. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/tests/test_jira_assets.py +0 -0
  28. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/tests/test_jira_issues.py +0 -0
  29. {atlassian_cli-0.7.0 → atlassian_cli-0.9.0}/tests/test_output.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlassian-cli
3
- Version: 0.7.0
3
+ Version: 0.9.0
4
4
  Summary: Fast CLI tools for Atlassian Cloud (Confluence + Jira) — optimized for AI agents
5
5
  Author-email: Alex Fishlock <alex.fishlock@catapult.cx>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "atlassian-cli"
7
- version = "0.7.0"
7
+ version = "0.9.0"
8
8
  description = "Fast CLI tools for Atlassian Cloud (Confluence + Jira) — optimized for AI agents"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -72,10 +72,15 @@ def get_space(session, base, *, key=None, space_id=None):
72
72
  return space
73
73
 
74
74
 
75
- def list_pages(session, base, space_id):
76
- """Cursor-paginated listing of all pages in a space."""
75
+ def list_pages(session, base, space_id, statuses=('current',)):
76
+ """Cursor-paginated listing of pages in a space, filtered by status.
77
+
78
+ The V2 default returns *all* statuses (current, archived, draft, deleted)
79
+ which is rarely what callers want. We default to current-only and let the
80
+ caller widen the filter if needed."""
77
81
  pages = []
78
- url = f'{base}{V2}/spaces/{space_id}/pages?limit=250&sort=id'
82
+ status_q = '&'.join(f'status={s}' for s in statuses)
83
+ url = f'{base}{V2}/spaces/{space_id}/pages?limit=250&sort=id&{status_q}'
79
84
  while url:
80
85
  resp = _retry(session.get, url)
81
86
  resp.raise_for_status()
@@ -212,6 +217,58 @@ def cmd_create(args):
212
217
  emit('OK', f'Created {result.get("title", args.title)} ({page_id})')
213
218
 
214
219
 
220
+ def _modify_page_metadata(session, base, page_id, *,
221
+ new_title=None, new_parent_id=None, message=None):
222
+ """Update a page's title and/or parentId without touching the body.
223
+
224
+ Confluence has no dedicated 'move' or 'rename' endpoint — both go through
225
+ PUT /pages/{id}, which requires the full body and a bumped version. Here
226
+ we fetch the current state and round-trip it with the requested changes.
227
+ """
228
+ remote = get_page(session, base, page_id)
229
+ current_title = remote.get('title', '')
230
+ title = new_title if new_title is not None else current_title
231
+ body_value = remote.get('body', {}).get('atlas_doc_format', {}).get('value')
232
+ if body_value is None:
233
+ body_value = {'type': 'doc', 'version': 1, 'content': []}
234
+ body_payload = {
235
+ 'representation': 'atlas_doc_format',
236
+ 'value': json.dumps(body_value) if not isinstance(body_value, str) else body_value,
237
+ }
238
+ new_version = _ver(remote) + 1
239
+ payload = {
240
+ 'id': str(page_id),
241
+ 'status': 'current',
242
+ 'title': title,
243
+ 'body': body_payload,
244
+ 'version': {'number': new_version, 'message': message or 'Metadata updated'},
245
+ }
246
+ if new_parent_id is not None:
247
+ payload['parentId'] = str(new_parent_id)
248
+ api_put(session, base, f'{V2}/pages/{page_id}', payload)
249
+ return title, new_version
250
+
251
+
252
+ def cmd_move(args):
253
+ session, base = setup()
254
+ new_title, new_version = _modify_page_metadata(
255
+ session, base, args.page_id,
256
+ new_parent_id=args.parent_id,
257
+ message=getattr(args, 'message', None) or f'Moved under parent {args.parent_id}',
258
+ )
259
+ emit('OK', f'Moved {args.page_id} ({new_title}) -> parent {args.parent_id} (v{new_version})')
260
+
261
+
262
+ def cmd_rename(args):
263
+ session, base = setup()
264
+ new_title, new_version = _modify_page_metadata(
265
+ session, base, args.page_id,
266
+ new_title=args.title,
267
+ message=getattr(args, 'message', None) or f'Renamed to {args.title!r}',
268
+ )
269
+ emit('OK', f'Renamed {args.page_id} -> {new_title!r} (v{new_version})')
270
+
271
+
215
272
  def cmd_delete(args):
216
273
  session, base = setup()
217
274
  page = get_page(session, base, args.page_id)
@@ -379,11 +436,12 @@ def cmd_index(args):
379
436
  spaces = args.space if args.space else ['POL', 'COMPLY']
380
437
  index = {}
381
438
 
439
+ statuses = ('current', 'archived') if args.include_archived else ('current',)
382
440
  for space_key in spaces:
383
441
  space = get_space(session, base, key=space_key)
384
442
  space_id = space['id']
385
443
  print(f'Indexing {space_key}…', file=sys.stderr)
386
- pages = list_pages(session, base, space_id)
444
+ pages = list_pages(session, base, space_id, statuses=statuses)
387
445
 
388
446
  index[space_key] = []
389
447
  for page in pages:
@@ -393,6 +451,7 @@ def cmd_index(args):
393
451
  'parentId': page.get('parentId', ''),
394
452
  'version': _ver(page),
395
453
  'updatedAt': _ver_ts(page),
454
+ 'status': page.get('status', 'current'),
396
455
  })
397
456
  print(f' {space_key}: {len(pages)} pages', file=sys.stderr)
398
457
 
@@ -904,6 +963,18 @@ def main():
904
963
  p.add_argument('page_id', help='Confluence page ID')
905
964
  p.set_defaults(func=cmd_delete)
906
965
 
966
+ p = sub.add_parser('move', help='Move a page to a new parent (preserves body)')
967
+ p.add_argument('page_id', help='Confluence page ID to move')
968
+ p.add_argument('parent_id', help='New parent page ID')
969
+ p.add_argument('--message', '-m', help='Version message')
970
+ p.set_defaults(func=cmd_move)
971
+
972
+ p = sub.add_parser('rename', help='Rename a page (preserves body and parent)')
973
+ p.add_argument('page_id', help='Confluence page ID')
974
+ p.add_argument('title', help='New page title')
975
+ p.add_argument('--message', '-m', help='Version message')
976
+ p.set_defaults(func=cmd_rename)
977
+
907
978
  p = sub.add_parser('put', help='Upload local ADF to Confluence')
908
979
  p.add_argument('page_id', help='Confluence page ID')
909
980
  p.add_argument('--dir', default='pages', help='Pages directory (default: pages)')
@@ -931,6 +1002,8 @@ def main():
931
1002
  p = sub.add_parser('index', help='Rebuild page-index.json from API')
932
1003
  p.add_argument('--space', action='append', help='Space key(s) to index (default: POL COMPLY)')
933
1004
  p.add_argument('--output', default='page-index.json', help='Output file (default: page-index.json)')
1005
+ p.add_argument('--include-archived', action='store_true',
1006
+ help='Also include archived pages (default is current only)')
934
1007
  p.set_defaults(func=cmd_index)
935
1008
 
936
1009
  p = sub.add_parser('comments', help='List comments on a page')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlassian-cli
3
- Version: 0.7.0
3
+ Version: 0.9.0
4
4
  Summary: Fast CLI tools for Atlassian Cloud (Confluence + Jira) — optimized for AI agents
5
5
  Author-email: Alex Fishlock <alex.fishlock@catapult.cx>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes