atlassian-cli 0.6.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.
Files changed (29) hide show
  1. {atlassian_cli-0.6.0/src/atlassian_cli.egg-info → atlassian_cli-0.8.0}/PKG-INFO +1 -1
  2. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/pyproject.toml +1 -1
  3. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/confluence.py +64 -0
  4. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/jira.py +2 -0
  5. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/jira_issues.py +36 -28
  6. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0/src/atlassian_cli.egg-info}/PKG-INFO +1 -1
  7. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/LICENSE +0 -0
  8. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/README.md +0 -0
  9. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/setup.cfg +0 -0
  10. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/__init__.py +0 -0
  11. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/adf.py +0 -0
  12. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/config.py +0 -0
  13. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/hints.py +0 -0
  14. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/http.py +0 -0
  15. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/jira_assets.py +0 -0
  16. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/output.py +0 -0
  17. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli/update_check.py +0 -0
  18. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/SOURCES.txt +0 -0
  19. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/dependency_links.txt +0 -0
  20. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/entry_points.txt +0 -0
  21. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/requires.txt +0 -0
  22. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/src/atlassian_cli.egg-info/top_level.txt +0 -0
  23. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/tests/test_adf.py +0 -0
  24. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/tests/test_config.py +0 -0
  25. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/tests/test_confluence.py +0 -0
  26. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/tests/test_http.py +0 -0
  27. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/tests/test_jira_assets.py +0 -0
  28. {atlassian_cli-0.6.0 → atlassian_cli-0.8.0}/tests/test_jira_issues.py +0 -0
  29. {atlassian_cli-0.6.0 → atlassian_cli-0.8.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.6.0
3
+ Version: 0.8.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.6.0"
7
+ version = "0.8.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"
@@ -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)')
@@ -48,6 +48,8 @@ def main():
48
48
  p.add_argument('--labels', nargs='*', help='Labels')
49
49
  p.add_argument('--assignee', help='Assignee account ID')
50
50
  p.add_argument('--parent', help='Parent issue key (for sub-tasks)')
51
+ p.add_argument('--fields', help='JSON string of additional fields '
52
+ '(e.g. components, custom fields, ADF description)')
51
53
  p.set_defaults(func=jira_issues.cmd_create)
52
54
 
53
55
  p = issue_sub.add_parser('update', help='Update issue fields')
@@ -34,6 +34,12 @@ def _text_adf(text):
34
34
  def cmd_get(args):
35
35
  session, base = setup()
36
36
  data = api_get(session, base, f'{V3}/issue/{args.key}')
37
+ if is_json_mode():
38
+ # preserve the full API response so callers can read components,
39
+ # custom fields, finding type, etc.
40
+ emit_json(data)
41
+ return
42
+
37
43
  fields = data.get('fields', {})
38
44
  key = data['key']
39
45
  status = fields.get('status', {}).get('name', '?')
@@ -47,24 +53,14 @@ def cmd_get(args):
47
53
  updated = fields.get('updated', '')[:10]
48
54
  description = fields.get('description')
49
55
 
50
- json_data = {
51
- 'key': key, 'id': data['id'], 'status': status, 'summary': summary,
52
- 'type': issue_type, 'assignee': assignee_name, 'labels': labels,
53
- 'priority': priority, 'created': created, 'updated': updated,
54
- 'description': adf_to_markdown(description) if description else None,
55
- }
56
-
57
- if is_json_mode():
58
- emit_json(json_data)
59
- else:
60
- print(f'{key} [{status}] {summary}')
61
- print(f' Type: {issue_type} Priority: {priority} Assignee: {assignee_name}')
62
- if labels:
63
- print(f' Labels: {", ".join(labels)}')
64
- print(f' Created: {created} Updated: {updated}')
65
- if description:
66
- print()
67
- print(adf_to_markdown(description))
56
+ print(f'{key} [{status}] {summary}')
57
+ print(f' Type: {issue_type} Priority: {priority} Assignee: {assignee_name}')
58
+ if labels:
59
+ print(f' Labels: {", ".join(labels)}')
60
+ print(f' Created: {created} Updated: {updated}')
61
+ if description:
62
+ print()
63
+ print(adf_to_markdown(description))
68
64
 
69
65
 
70
66
  def cmd_create(args):
@@ -82,6 +78,10 @@ def cmd_create(args):
82
78
  fields['assignee'] = {'accountId': args.assignee}
83
79
  if args.parent:
84
80
  fields['parent'] = {'key': args.parent}
81
+ if getattr(args, 'fields', None):
82
+ # extra fields override the convenience flags above; useful for
83
+ # components, finding-type custom fields, full-ADF descriptions, etc.
84
+ fields.update(json.loads(args.fields))
85
85
 
86
86
  result = api_post(session, base, f'{V3}/issue', {'fields': fields})
87
87
  emit('OK', f'Created {result["key"]}', data=result)
@@ -146,7 +146,13 @@ def _search_page(session, base, jql, max_results, fields, next_page_token=None):
146
146
 
147
147
  def cmd_search(args):
148
148
  session, base = setup()
149
- fields = args.fields.split(',')
149
+ # In JSON mode, default to '*all' so callers see components and custom
150
+ # fields. The user can still narrow via an explicit --fields.
151
+ user_explicit_fields = args.fields != 'summary,status,assignee,issuetype'
152
+ if is_json_mode() and not user_explicit_fields:
153
+ fields = ['*all']
154
+ else:
155
+ fields = args.fields.split(',')
150
156
  all_issues = []
151
157
  token = None
152
158
 
@@ -162,19 +168,21 @@ def cmd_search(args):
162
168
  if not args.all and len(all_issues) >= args.max:
163
169
  break
164
170
 
165
- for issue in all_issues:
166
- f = issue.get('fields', {})
167
- status = f.get('status', {}).get('name', '?')
168
- summary = f.get('summary', '')
169
- assignee = f.get('assignee', {})
170
- assignee_name = assignee.get('displayName', '') if assignee else ''
171
- extra = f' ({assignee_name})' if assignee_name else ''
172
- print(f'{issue["key"]} [{status}] {summary}{extra}')
171
+ if not is_json_mode():
172
+ for issue in all_issues:
173
+ f = issue.get('fields', {})
174
+ status = f.get('status', {}).get('name', '?')
175
+ summary = f.get('summary', '')
176
+ assignee = f.get('assignee', {})
177
+ assignee_name = assignee.get('displayName', '') if assignee else ''
178
+ extra = f' ({assignee_name})' if assignee_name else ''
179
+ print(f'{issue["key"]} [{status}] {summary}{extra}')
173
180
 
174
181
  if args.dump:
175
182
  with open(args.dump, 'w') as fh:
176
183
  json.dump({'total': len(all_issues), 'issues': all_issues}, fh, indent=2)
177
- print(f'Saved {len(all_issues)} issues to {args.dump}')
184
+ if not is_json_mode():
185
+ print(f'Saved {len(all_issues)} issues to {args.dump}')
178
186
 
179
187
  emit('DONE', f'{len(all_issues)} issues found',
180
188
  data={'total': len(all_issues), 'issues': all_issues})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlassian-cli
3
- Version: 0.6.0
3
+ Version: 0.8.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