hap-cli 0.6.5__tar.gz → 0.6.6__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 (73) hide show
  1. {hap_cli-0.6.5 → hap_cli-0.6.6}/PKG-INFO +4 -3
  2. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/README.md +3 -2
  3. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/README_CN.md +3 -2
  4. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/__init__.py +1 -1
  5. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/post_cmd.py +49 -0
  6. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/post.py +12 -0
  7. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/skills/SKILL.md +3 -2
  8. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration_social.py +34 -0
  9. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli.egg-info/PKG-INFO +4 -3
  10. {hap_cli-0.6.5 → hap_cli-0.6.6}/setup.py +1 -1
  11. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/__init__.py +0 -0
  12. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/app_cmd.py +0 -0
  13. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/auth_cmd.py +0 -0
  14. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/calendar_cmd.py +0 -0
  15. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/chat_cmd.py +0 -0
  16. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/contact_cmd.py +0 -0
  17. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/department_cmd.py +0 -0
  18. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/instance_cmd.py +0 -0
  19. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/node_cmd.py +0 -0
  20. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/optionset_cmd.py +0 -0
  21. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/page_cmd.py +0 -0
  22. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/record_cmd.py +0 -0
  23. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/role_cmd.py +0 -0
  24. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/workflow_cmd.py +0 -0
  25. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/commands/worksheet_cmd.py +0 -0
  26. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/context.py +0 -0
  27. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/__init__.py +0 -0
  28. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/app.py +0 -0
  29. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/auth.py +0 -0
  30. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/calendar_mod.py +0 -0
  31. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/chat.py +0 -0
  32. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/contact.py +0 -0
  33. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/department.py +0 -0
  34. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/flow_node.py +0 -0
  35. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/group.py +0 -0
  36. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/instance.py +0 -0
  37. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/optionset.py +0 -0
  38. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/page.py +0 -0
  39. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/record.py +0 -0
  40. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/response_crypto.py +0 -0
  41. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/role.py +0 -0
  42. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/session.py +0 -0
  43. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/token_crypto.py +0 -0
  44. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/workflow.py +0 -0
  45. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/core/worksheet.py +0 -0
  46. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/hap_cli.py +0 -0
  47. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/skills/__init__.py +0 -0
  48. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/__init__.py +0 -0
  49. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/conftest.py +0 -0
  50. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_core.py +0 -0
  51. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_full_e2e.py +0 -0
  52. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration.py +0 -0
  53. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration_approval.py +0 -0
  54. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration_calendar.py +0 -0
  55. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration_destructive.py +0 -0
  56. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration_misc.py +0 -0
  57. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration_post.py +0 -0
  58. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration_workflow.py +0 -0
  59. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_integration_worksheet_extra.py +0 -0
  60. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_org_id_cli.py +0 -0
  61. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_org_id_docs.py +0 -0
  62. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_parameter_conventions.py +0 -0
  63. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/tests/test_parameter_mapping_registry.py +0 -0
  64. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/utils/__init__.py +0 -0
  65. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/utils/formatting.py +0 -0
  66. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/utils/options.py +0 -0
  67. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli/utils/parameter_mapping.py +0 -0
  68. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli.egg-info/SOURCES.txt +0 -0
  69. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli.egg-info/dependency_links.txt +0 -0
  70. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli.egg-info/entry_points.txt +0 -0
  71. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli.egg-info/requires.txt +0 -0
  72. {hap_cli-0.6.5 → hap_cli-0.6.6}/hap_cli.egg-info/top_level.txt +0 -0
  73. {hap_cli-0.6.5 → hap_cli-0.6.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hap-cli
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: CLI harness for MingDAO HAP - Enterprise no-code platform
5
5
  Author: hap-cli
6
6
  License: Apache-2.0
@@ -333,8 +333,8 @@ hap --json worksheet record list WORKSHEET_ID
333
333
 
334
334
  | Command | Description |
335
335
  |---|---|
336
- | `post list` | List feed posts |
337
- | `post search` | Search posts by keyword and date range |
336
+ | `post list` | List feed posts (`--topic-id` filters by topic tag) |
337
+ | `post search` | Search posts by keyword and date range (`--topic-id` filters by topic tag) |
338
338
  | `post get` | Show a post with its comment thread |
339
339
  | `post create` | Create a new post |
340
340
  | `post update` | Edit a post's content |
@@ -348,6 +348,7 @@ hap --json worksheet record list WORKSHEET_ID
348
348
  | `post pin` | Pin a post (`--hours` for duration) |
349
349
  | `post unpin` | Unpin a post |
350
350
  | `post pinned` | List pinned posts |
351
+ | `post topics` | List topic tags (autocomplete) |
351
352
 
352
353
  ### calendar — Calendar Management
353
354
 
@@ -304,8 +304,8 @@ hap --json worksheet record list WORKSHEET_ID
304
304
 
305
305
  | Command | Description |
306
306
  |---|---|
307
- | `post list` | List feed posts |
308
- | `post search` | Search posts by keyword and date range |
307
+ | `post list` | List feed posts (`--topic-id` filters by topic tag) |
308
+ | `post search` | Search posts by keyword and date range (`--topic-id` filters by topic tag) |
309
309
  | `post get` | Show a post with its comment thread |
310
310
  | `post create` | Create a new post |
311
311
  | `post update` | Edit a post's content |
@@ -319,6 +319,7 @@ hap --json worksheet record list WORKSHEET_ID
319
319
  | `post pin` | Pin a post (`--hours` for duration) |
320
320
  | `post unpin` | Unpin a post |
321
321
  | `post pinned` | List pinned posts |
322
+ | `post topics` | List topic tags (autocomplete) |
322
323
 
323
324
  ### calendar — Calendar Management
324
325
 
@@ -311,8 +311,8 @@ hap --json worksheet record list 工作表ID
311
311
 
312
312
  | 命令 | 说明 |
313
313
  |---|---|
314
- | `post list` | 列出动态帖子 |
315
- | `post search` | 按关键词和日期范围搜索帖子 |
314
+ | `post list` | 列出动态帖子(`--topic-id` 按话题标签过滤) |
315
+ | `post search` | 按关键词和日期范围搜索帖子(`--topic-id` 按话题标签过滤) |
316
316
  | `post get` | 查看帖子详情(含评论) |
317
317
  | `post create` | 创建新帖子 |
318
318
  | `post update` | 编辑帖子内容 |
@@ -326,6 +326,7 @@ hap --json worksheet record list 工作表ID
326
326
  | `post pin` | 置顶帖子(`--hours` 指定时长) |
327
327
  | `post unpin` | 取消置顶 |
328
328
  | `post pinned` | 列出置顶帖子 |
329
+ | `post topics` | 列出话题标签(自动补全) |
329
330
 
330
331
  ### calendar — 日程管理
331
332
 
@@ -1,3 +1,3 @@
1
1
  """CLI harness for MingDAO HAP (hap-cli)."""
2
2
 
3
- __version__ = "0.6.5"
3
+ __version__ = "0.6.6"
@@ -431,6 +431,12 @@ def _normalize_scope(scope: str) -> str:
431
431
  @click.option("--start-date", default="", help="Only posts on or after this date (YYYY-MM-DD)")
432
432
  @click.option("--end-date", default="", help="Only posts on or before this date (YYYY-MM-DD)")
433
433
  @click.option("--post-type", default=-1, type=int, show_default=True, help="Filter by post type; -1 means all")
434
+ @click.option(
435
+ "--topic-id",
436
+ "topic_id",
437
+ default="",
438
+ help="Filter by topic tag id (see `hap post topics`)",
439
+ )
434
440
  @click.option("-p", "--page", default=1, show_default=True, help="Page number (1-based)")
435
441
  @click.option(
436
442
  "--cursor",
@@ -449,6 +455,7 @@ def post_list(
449
455
  start_date,
450
456
  end_date,
451
457
  post_type,
458
+ topic_id,
452
459
  page,
453
460
  last_post_auto_id,
454
461
  ):
@@ -487,6 +494,7 @@ def post_list(
487
494
  start_date=start_date,
488
495
  end_date=end_date,
489
496
  post_type=post_type,
497
+ category_id=topic_id,
490
498
  page_index=page,
491
499
  last_post_auto_id=last_post_auto_id,
492
500
  )
@@ -512,6 +520,12 @@ def post_list(
512
520
  @click.option("--post-type", default=-1, type=int, show_default=True, help="Filter by post type; -1 means all")
513
521
  @click.option("--account-id", default="", help="Filter by author member id")
514
522
  @click.option("--group-id", default="", help="Filter by group id")
523
+ @click.option(
524
+ "--topic-id",
525
+ "topic_id",
526
+ default="",
527
+ help="Filter by topic tag id (see `hap post topics`)",
528
+ )
515
529
  @click.option("-p", "--page", default=1, show_default=True, help="Page number (1-based)")
516
530
  @click.option(
517
531
  "--cursor",
@@ -530,6 +544,7 @@ def post_search(
530
544
  post_type,
531
545
  account_id,
532
546
  group_id,
547
+ topic_id,
533
548
  page,
534
549
  last_post_auto_id,
535
550
  ):
@@ -557,6 +572,7 @@ def post_search(
557
572
  account_id=account_id,
558
573
  group_id=group_id,
559
574
  post_type=post_type,
575
+ category_id=topic_id,
560
576
  page_index=page,
561
577
  last_post_auto_id=last_post_auto_id,
562
578
  )
@@ -870,3 +886,36 @@ def post_unpin(ctx, post_id):
870
886
  ))
871
887
  except Exception as e:
872
888
  ctx.handle_error(e)
889
+
890
+
891
+ def _simplify_topic(t: dict) -> dict:
892
+ return {"id": t.get("id"), "name": t.get("value")}
893
+
894
+
895
+ def _render_topics(summary: dict) -> None:
896
+ topics = summary.get("topics") or []
897
+ if not topics:
898
+ click.echo("No topics found.")
899
+ return
900
+ click.echo(f"Topics ({len(topics)}):")
901
+ for t in topics:
902
+ click.echo(f" #{t.get('name')}# id: {t.get('id')}")
903
+
904
+
905
+ @post.command("topics")
906
+ @click.option("--keywords", "-k", default="", help="Filter by keyword")
907
+ @pass_context
908
+ def post_topics(ctx, keywords):
909
+ """List topic tags (autocomplete suggestions).
910
+
911
+ Use a topic inside a post by wrapping its name in hashes
912
+ (e.g. `#周报#`) in the post message. The tag links automatically
913
+ on publish, and unknown names are created on the fly.
914
+ """
915
+ try:
916
+ session = ctx.get_session()
917
+ raw = post_mod.get_topics(session, keywords=keywords)
918
+ topics = [_simplify_topic(t) for t in (raw or []) if isinstance(t, dict)]
919
+ ctx.output({"topics": topics}, _render_topics)
920
+ except Exception as e:
921
+ ctx.handle_error(e)
@@ -330,3 +330,15 @@ def add_top_post(
330
330
  def remove_top_post(session: Session, post_id: str) -> dict[str, Any]:
331
331
  """Unpin via ``Post.RemoveTopPost``."""
332
332
  return session.api_call("Post", "RemoveTopPost", {"postId": post_id})
333
+
334
+
335
+ def get_topics(session: Session, keywords: str = "") -> list[dict[str, Any]]:
336
+ """Autocomplete topic tags via ``Category.AutoCompleteCategory``.
337
+
338
+ Returns ``[{id, value}]``. Callers don't need the id to use a tag
339
+ when posting — the server recognises ``#value#`` in the post body
340
+ and auto-links (or auto-creates) the matching topic.
341
+ """
342
+ return session.api_call(
343
+ "Category", "AutoCompleteCategory", {"keywords": keywords or ""}
344
+ )
@@ -190,8 +190,8 @@ hap department search KEYWORDS --org-id ORG_ID [--include-disabled]
190
190
 
191
191
  ### post - Feed & Post Management
192
192
  ```bash
193
- hap post list [--org-id ORG_ID] [--scope org|user|fav|group|groups|myself] [--cursor AUTO_ID] [-p N]
194
- hap post search --keywords TEXT [--org-id ORG_ID] [--start-date D] [--end-date D]
193
+ hap post list [--org-id ORG_ID] [--scope org|user|fav|group|groups|myself] [--topic-id TOPIC_ID] [--cursor AUTO_ID] [-p N]
194
+ hap post search --keywords TEXT [--org-id ORG_ID] [--start-date D] [--end-date D] [--topic-id TOPIC_ID]
195
195
  hap post get POST_ID
196
196
  hap post create --org-id ORG_ID --message TEXT [--share-group GID]... [--share-org OID]...
197
197
  hap post update POST_ID --message TEXT [--old-message TEXT]
@@ -205,6 +205,7 @@ hap post favorite POST_ID [--remove]
205
205
  hap post pin POST_ID [--hours N]
206
206
  hap post unpin POST_ID
207
207
  hap post pinned [--org-id ORG_ID]
208
+ hap post topics [--keywords K] # Hint: use #NAME# in message to tag
208
209
  ```
209
210
 
210
211
  ### calendar - Calendar & Schedule
@@ -146,5 +146,39 @@ class TestPost:
146
146
  f"GetTopPosts expected list, got {type(result).__name__}"
147
147
  )
148
148
 
149
+ def test_04_topics(self, integration_session):
150
+ """Category.AutoCompleteCategory returns ``[{id, value}]``."""
151
+ result = post.get_topics(integration_session)
152
+ assert isinstance(result, list)
153
+ for t in result:
154
+ assert "id" in t and "value" in t
155
+
156
+ def test_05_topics_keyword_filter(self, integration_session):
157
+ """Keyword filter narrows the suggestions."""
158
+ result = post.get_topics(integration_session, keywords="周")
159
+ assert isinstance(result, list)
160
+ # Every hit should match the keyword substring
161
+ for t in result:
162
+ assert "周" in (t.get("value") or "")
163
+
164
+ def test_06_list_by_topic(self, integration_session):
165
+ """`catId` filter: every returned post carries that topic."""
166
+ topics = post.get_topics(integration_session, keywords="周")
167
+ if not topics:
168
+ pytest.skip("no topic tags available on this server")
169
+ topic_id = topics[0]["id"]
170
+ result = post.get_post_list(
171
+ integration_session,
172
+ list_type="project",
173
+ category_id=topic_id,
174
+ )
175
+ assert_dict_like(result, ["postList"])
176
+ for p in result["postList"]:
177
+ cats = p.get("categories") or []
178
+ ids = {c.get("catID") or c.get("catId") or c.get("id") for c in cats}
179
+ assert topic_id in ids, (
180
+ f"post {p.get('postID')} missing topic {topic_id}; got {ids}"
181
+ )
182
+
149
183
 
150
184
  # Calendar coverage lives in ``test_integration_calendar.py``.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hap-cli
3
- Version: 0.6.5
3
+ Version: 0.6.6
4
4
  Summary: CLI harness for MingDAO HAP - Enterprise no-code platform
5
5
  Author: hap-cli
6
6
  License: Apache-2.0
@@ -333,8 +333,8 @@ hap --json worksheet record list WORKSHEET_ID
333
333
 
334
334
  | Command | Description |
335
335
  |---|---|
336
- | `post list` | List feed posts |
337
- | `post search` | Search posts by keyword and date range |
336
+ | `post list` | List feed posts (`--topic-id` filters by topic tag) |
337
+ | `post search` | Search posts by keyword and date range (`--topic-id` filters by topic tag) |
338
338
  | `post get` | Show a post with its comment thread |
339
339
  | `post create` | Create a new post |
340
340
  | `post update` | Edit a post's content |
@@ -348,6 +348,7 @@ hap --json worksheet record list WORKSHEET_ID
348
348
  | `post pin` | Pin a post (`--hours` for duration) |
349
349
  | `post unpin` | Unpin a post |
350
350
  | `post pinned` | List pinned posts |
351
+ | `post topics` | List topic tags (autocomplete) |
351
352
 
352
353
  ### calendar — Calendar Management
353
354
 
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
4
4
 
5
5
  setup(
6
6
  name="hap-cli",
7
- version="0.6.5",
7
+ version="0.6.6",
8
8
  description="CLI harness for MingDAO HAP - Enterprise no-code platform",
9
9
  long_description=open("hap_cli/README.md").read(),
10
10
  long_description_content_type="text/markdown",
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