hap-cli 0.6.8__tar.gz → 0.6.10__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 (149) hide show
  1. hap_cli-0.6.10/MANIFEST.in +13 -0
  2. hap_cli-0.6.10/PKG-INFO +353 -0
  3. hap_cli-0.6.10/README.md +324 -0
  4. hap_cli-0.6.10/hap_cli/README.md +324 -0
  5. hap_cli-0.6.10/hap_cli/README_CN.md +299 -0
  6. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/__init__.py +1 -1
  7. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/app_cmd.py +85 -10
  8. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/auth_cmd.py +19 -8
  9. hap_cli-0.6.10/hap_cli/commands/chart_cmd.py +218 -0
  10. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/chat_cmd.py +34 -21
  11. hap_cli-0.6.10/hap_cli/commands/chatbot_cmd.py +135 -0
  12. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/department_cmd.py +2 -2
  13. hap_cli-0.6.10/hap_cli/commands/group_cmd.py +110 -0
  14. hap_cli-0.6.10/hap_cli/commands/icon_cmd.py +64 -0
  15. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/node_cmd.py +141 -2
  16. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/page_cmd.py +44 -3
  17. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/record_cmd.py +71 -0
  18. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/role_cmd.py +20 -8
  19. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/v3_registry.py +59 -91
  20. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/workflow_cmd.py +94 -4
  21. hap_cli-0.6.10/hap_cli/commands/worksheet_cmd.py +811 -0
  22. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/context.py +23 -1
  23. hap_cli-0.6.10/hap_cli/core/action_spec_adapter.py +113 -0
  24. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/app.py +237 -1
  25. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/auth.py +45 -12
  26. hap_cli-0.6.10/hap_cli/core/chart.py +223 -0
  27. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/chat.py +89 -4
  28. hap_cli-0.6.10/hap_cli/core/chatbot.py +196 -0
  29. hap_cli-0.6.10/hap_cli/core/control_type_codes.py +210 -0
  30. hap_cli-0.6.10/hap_cli/core/field_normalizer.py +189 -0
  31. hap_cli-0.6.10/hap_cli/core/field_spec_adapter.py +245 -0
  32. hap_cli-0.6.10/hap_cli/core/filter_translator.py +175 -0
  33. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/flow_node.py +412 -1
  34. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/group.py +26 -8
  35. hap_cli-0.6.10/hap_cli/core/icon_index.py +475 -0
  36. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/page.py +130 -5
  37. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/record.py +222 -0
  38. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/role.py +32 -24
  39. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/session.py +118 -45
  40. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/v3/__init__.py +6 -4
  41. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/v3/dispatcher.py +82 -15
  42. hap_cli-0.6.10/hap_cli/core/v3/render.py +196 -0
  43. hap_cli-0.6.10/hap_cli/core/v3/schema.py +262 -0
  44. hap_cli-0.6.10/hap_cli/core/view_spec_adapter.py +283 -0
  45. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/workflow.py +20 -1
  46. hap_cli-0.6.10/hap_cli/core/worksheet.py +1317 -0
  47. hap_cli-0.6.10/hap_cli/core/worksheet_templates.py +658 -0
  48. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/hap_cli.py +20 -0
  49. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/i18n.py +1 -1
  50. hap_cli-0.6.10/hap_cli/tests/test_chart.py +245 -0
  51. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_core.py +2077 -10
  52. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_full_e2e.py +25 -3
  53. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_i18n.py +18 -0
  54. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_org_id_cli.py +8 -0
  55. hap_cli-0.6.10/hap_cli/tests/test_org_id_docs.py +35 -0
  56. hap_cli-0.6.10/hap_cli/tests/test_v3_api_schema_loader.py +359 -0
  57. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_v3_dispatcher.py +34 -10
  58. hap_cli-0.6.10/hap_cli/tests/test_v3_registry_coverage.py +139 -0
  59. hap_cli-0.6.10/hap_cli/tests/test_v3_yaml_translation.py +322 -0
  60. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/utils/options.py +17 -1
  61. hap_cli-0.6.10/hap_cli.egg-info/PKG-INFO +353 -0
  62. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli.egg-info/SOURCES.txt +48 -3
  63. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli.egg-info/requires.txt +1 -0
  64. {hap_cli-0.6.8 → hap_cli-0.6.10}/setup.py +23 -10
  65. hap_cli-0.6.10/sources/v3-api-schema/INDEX.json +262 -0
  66. hap_cli-0.6.10/sources/v3-api-schema/add_member_to_role.yaml +197 -0
  67. hap_cli-0.6.10/sources/v3-api-schema/batch_delete_records.yaml +172 -0
  68. hap_cli-0.6.10/sources/v3-api-schema/create_optionset.yaml +205 -0
  69. hap_cli-0.6.10/sources/v3-api-schema/create_role.yaml +552 -0
  70. hap_cli-0.6.10/sources/v3-api-schema/delete_optionset.yaml +135 -0
  71. hap_cli-0.6.10/sources/v3-api-schema/delete_record.yaml +165 -0
  72. hap_cli-0.6.10/sources/v3-api-schema/delete_role.yaml +136 -0
  73. hap_cli-0.6.10/sources/v3-api-schema/delete_worksheet.yaml +133 -0
  74. hap_cli-0.6.10/sources/v3-api-schema/get_app_info.yaml +275 -0
  75. hap_cli-0.6.10/sources/v3-api-schema/get_app_knowledge_list.yaml +154 -0
  76. hap_cli-0.6.10/sources/v3-api-schema/get_app_worksheets_list.yaml +162 -0
  77. hap_cli-0.6.10/sources/v3-api-schema/get_optionset_list.yaml +238 -0
  78. hap_cli-0.6.10/sources/v3-api-schema/get_record_details.yaml +215 -0
  79. hap_cli-0.6.10/sources/v3-api-schema/get_record_discussions.yaml +336 -0
  80. hap_cli-0.6.10/sources/v3-api-schema/get_record_list.yaml +395 -0
  81. hap_cli-0.6.10/sources/v3-api-schema/get_record_logs.yaml +289 -0
  82. hap_cli-0.6.10/sources/v3-api-schema/get_record_pivot_data.yaml +443 -0
  83. hap_cli-0.6.10/sources/v3-api-schema/get_record_relations.yaml +206 -0
  84. hap_cli-0.6.10/sources/v3-api-schema/get_record_share_link.yaml +170 -0
  85. hap_cli-0.6.10/sources/v3-api-schema/get_regions.yaml +189 -0
  86. hap_cli-0.6.10/sources/v3-api-schema/get_role_details.yaml +460 -0
  87. hap_cli-0.6.10/sources/v3-api-schema/get_role_list.yaml +256 -0
  88. hap_cli-0.6.10/sources/v3-api-schema/knowledge_search.yaml +268 -0
  89. hap_cli-0.6.10/sources/v3-api-schema/leave_all_roles.yaml +133 -0
  90. hap_cli-0.6.10/sources/v3-api-schema/remove_member_from_role.yaml +173 -0
  91. hap_cli-0.6.10/sources/v3-api-schema/update_optionset.yaml +205 -0
  92. hap_cli-0.6.8/PKG-INFO +0 -513
  93. hap_cli-0.6.8/hap_cli/README.md +0 -485
  94. hap_cli-0.6.8/hap_cli/README_CN.md +0 -877
  95. hap_cli-0.6.8/hap_cli/commands/worksheet_cmd.py +0 -459
  96. hap_cli-0.6.8/hap_cli/core/v3/render.py +0 -116
  97. hap_cli-0.6.8/hap_cli/core/v3/schema.py +0 -94
  98. hap_cli-0.6.8/hap_cli/core/worksheet.py +0 -545
  99. hap_cli-0.6.8/hap_cli/skills/SKILL.md +0 -353
  100. hap_cli-0.6.8/hap_cli/skills/__init__.py +0 -0
  101. hap_cli-0.6.8/hap_cli/tests/test_org_id_docs.py +0 -55
  102. hap_cli-0.6.8/hap_cli.egg-info/PKG-INFO +0 -513
  103. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/__init__.py +0 -0
  104. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/calendar_cmd.py +0 -0
  105. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/config_cmd.py +0 -0
  106. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/contact_cmd.py +0 -0
  107. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/instance_cmd.py +0 -0
  108. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/optionset_cmd.py +0 -0
  109. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/post_cmd.py +0 -0
  110. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/commands/region_cmd.py +0 -0
  111. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/__init__.py +0 -0
  112. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/calendar_mod.py +0 -0
  113. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/contact.py +0 -0
  114. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/department.py +0 -0
  115. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/global_meta.py +0 -0
  116. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/instance.py +0 -0
  117. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/logger.py +0 -0
  118. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/optionset.py +0 -0
  119. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/post.py +0 -0
  120. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/response_crypto.py +0 -0
  121. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/core/token_crypto.py +0 -0
  122. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/locale/__init__.py +0 -0
  123. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/locale/messages.json +0 -0
  124. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/locale/messages.schema.json +0 -0
  125. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/__init__.py +0 -0
  126. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/conftest.py +0 -0
  127. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_auth_prerelease.py +0 -0
  128. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_config_cmd.py +0 -0
  129. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_global_meta.py +0 -0
  130. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration.py +0 -0
  131. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_approval.py +0 -0
  132. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_calendar.py +0 -0
  133. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_destructive.py +0 -0
  134. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_misc.py +0 -0
  135. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_post.py +0 -0
  136. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_social.py +0 -0
  137. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_v3.py +0 -0
  138. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_workflow.py +0 -0
  139. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_integration_worksheet_extra.py +0 -0
  140. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_parameter_conventions.py +0 -0
  141. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_parameter_mapping_registry.py +0 -0
  142. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/tests/test_v3_session.py +0 -0
  143. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/utils/__init__.py +0 -0
  144. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/utils/formatting.py +0 -0
  145. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli/utils/parameter_mapping.py +0 -0
  146. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli.egg-info/dependency_links.txt +0 -0
  147. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli.egg-info/entry_points.txt +0 -0
  148. {hap_cli-0.6.8 → hap_cli-0.6.10}/hap_cli.egg-info/top_level.txt +0 -0
  149. {hap_cli-0.6.8 → hap_cli-0.6.10}/setup.cfg +0 -0
@@ -0,0 +1,13 @@
1
+ # V3 OpenAPI schemas live at repo-root sources/v3-api-schema/ (canonical for
2
+ # development). They must be shipped in the sdist so that wheel-from-sdist
3
+ # builds (e.g. `python -m build`) can run setup.py's _CopyV3Schemas step,
4
+ # which relocates them into hap_cli/sources/v3-api-schema/ for the runtime
5
+ # loader (hap_cli/core/v3/schema.py). Without this, the sdist drops the
6
+ # directory and `hap --version` fails with V3SchemaError at import time.
7
+ recursive-include sources/v3-api-schema *.yaml
8
+ include sources/v3-api-schema/INDEX.json
9
+
10
+ # Package data shipped inside the wheel.
11
+ include hap_cli/README.md
12
+ include hap_cli/README_CN.md
13
+ recursive-include hap_cli/locale *.json
@@ -0,0 +1,353 @@
1
+ Metadata-Version: 2.4
2
+ Name: hap-cli
3
+ Version: 0.6.10
4
+ Summary: CLI harness for MingDAO HAP - Enterprise no-code platform
5
+ Author: hap-cli
6
+ License: Apache-2.0
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: click>=8.0
17
+ Requires-Dist: requests>=2.28
18
+ Requires-Dist: pycryptodome>=3.15
19
+ Requires-Dist: python-socketio[client]>=5.10
20
+ Requires-Dist: PyYAML>=6.0
21
+ Dynamic: author
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: license
26
+ Dynamic: requires-dist
27
+ Dynamic: requires-python
28
+ Dynamic: summary
29
+
30
+ # hap-cli
31
+
32
+ CLI harness for **MingDAO HAP** (明道云) — an enterprise no-code platform.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install hap-cli
38
+ ```
39
+
40
+ The package ships with the v3 tool schemas it needs, so no extra setup is
41
+ required after `pip install`.
42
+
43
+ ## Quick start
44
+
45
+ ### 1. Login
46
+
47
+ ```bash
48
+ # MingDAO SaaS (default)
49
+ hap auth login
50
+
51
+ # Specific environment
52
+ hap auth login mingdao # production
53
+ hap auth login nocoly # Nocoly SaaS
54
+ hap auth login https://hap.example.com # self-hosted
55
+
56
+ # Non-interactive (scripts / headless servers)
57
+ hap auth login https://your-server.com --token YOUR_TOKEN
58
+ ```
59
+
60
+ The browser flow opens the MingDAO login page and captures the token. If the
61
+ callback can't reach the CLI (no GUI, restricted network), interrupt the
62
+ command — it falls back to a paste prompt for the token shown on the success
63
+ page.
64
+
65
+ ```bash
66
+ hap auth whoami # current user + current organization
67
+ hap auth logout # clear the saved token
68
+ ```
69
+
70
+ ### 2. Pick an organization and app
71
+
72
+ ```bash
73
+ hap auth list-my-orgs # current org marked with *
74
+ hap auth switch-org ORG_ID # switch the saved current org
75
+ hap app list # uses the saved current org
76
+ hap app list --org-id ORG_ID # explicit override
77
+
78
+ # Save a default app so every --app-id can be omitted
79
+ hap app select APP_ID
80
+ hap app unselect # clear it
81
+ ```
82
+
83
+ `hap auth switch-org` only changes the default organization. The default app
84
+ is managed independently with `hap app select` / `hap app unselect`.
85
+
86
+ ### 3. Explore worksheets and records
87
+
88
+ ```bash
89
+ hap app info APP_ID # sections, worksheets, custom pages
90
+ hap worksheet list # uses the default app
91
+ hap worksheet info WORKSHEET_ID # full structure (settings + fields)
92
+ hap worksheet field-types # reference for field type IDs
93
+ hap worksheet record list WORKSHEET_ID --page-size 10
94
+ ```
95
+
96
+ ### 4. JSON output
97
+
98
+ ```bash
99
+ hap --json worksheet record list WORKSHEET_ID
100
+ ```
101
+
102
+ Every command supports `--json` for machine-readable output.
103
+
104
+ ---
105
+
106
+ ## Commands
107
+
108
+ The full authoritative list lives in [hap-cli-command.md](../hap-cli-command.md).
109
+ The summary below covers the top-level groups; run `hap <group> --help` to
110
+ discover every subcommand.
111
+
112
+ ### auth — authentication & session
113
+
114
+ | Command | Description |
115
+ |---|---|
116
+ | `auth login [SERVER]` | Browser login (use `--token` for scripted login) |
117
+ | `auth logout` | Clear the saved auth token |
118
+ | `auth whoami` | Show current user and current organization |
119
+ | `auth list-my-orgs` | List every org for the current account (current marked `*`) |
120
+ | `auth switch-org ORG_ID` | Switch the saved current organization |
121
+
122
+ ### app — application management
123
+
124
+ | Command | Description |
125
+ |---|---|
126
+ | `app list` | List apps in the org (default app marked `*`) |
127
+ | `app list-managed` | Apps where the current user is admin |
128
+ | `app info APP_ID` | App detail with sections, worksheets, custom pages |
129
+ | `app create / update / delete` | App lifecycle |
130
+ | `app select APP_ID` / `app unselect` | Manage the default app used when `--app-id` is omitted |
131
+ | `app create-section / edit-section / delete-section` | Section management |
132
+ | `app sort-sections / sort-worksheets` | Reorder sections / a section's worksheets |
133
+ | `app create-item` | Batch-create empty worksheets / custom pages |
134
+ | `app backup / restore / export / exports / backup-logs` | Backup & export |
135
+ | `app usage / logs` | Statistics and operation logs |
136
+ | `app role …` | Role CRUD, permissions, members, leave-all, applications |
137
+ | `app optionset …` | Option set CRUD and cross-app moves |
138
+ | `app knowledge list / search` | Vector knowledge bases |
139
+
140
+ ### worksheet — worksheets, views, custom actions, charts
141
+
142
+ | Command | Description |
143
+ |---|---|
144
+ | `worksheet list / info / fields / field-types` | Discover structure |
145
+ | `worksheet create / update / copy / delete` | Worksheet lifecycle |
146
+ | `worksheet rules / save-rule` | Business rules |
147
+ | `worksheet switches / edit-switch` | Feature switches |
148
+ | `worksheet form-settings / save-form-settings` | Form submission settings |
149
+ | `worksheet custom-actions / create-custom-action / delete-custom-action` | Custom action buttons |
150
+ | `worksheet create-chart` | Build a statistics chart on a worksheet |
151
+ | `worksheet view list / info / create / copy / delete / sort` | View management |
152
+
153
+ ### worksheet record — record CRUD
154
+
155
+ | Command | Description |
156
+ |---|---|
157
+ | `worksheet record list / get` | Query and read |
158
+ | `worksheet record create / update / delete` | Single-row CRUD |
159
+ | `worksheet record batch-create / batch-update` | Bulk operations (main-site path; relation/sub-table cells persist) |
160
+ | `worksheet record relations / share-link` | Linked records and share URLs |
161
+ | `worksheet record discussions / add-discussion / delete-discussion` | Discussion threads |
162
+ | `worksheet record logs` | Per-record change log |
163
+ | `worksheet record pivot / bottom-stats` | Aggregations and summary rows |
164
+
165
+ ### workflow — process & node management
166
+
167
+ | Command | Description |
168
+ |---|---|
169
+ | `workflow list / get / structure / history / groups / stats` | Inspect |
170
+ | `workflow create / update / copy / move / delete` | Lifecycle |
171
+ | `workflow publish / rollback` | Versioning |
172
+ | `workflow trigger / trigger-pbp` | Manual trigger |
173
+ | `workflow config-get / config-set` | Global config |
174
+ | `workflow create-approval / update-approval / delete-approval` | Approval blocks |
175
+ | `workflow node …` | Node CRUD, batch-add / batch-update / batch-delete (and `*-approval` variants), test-code / test-webhook / test-ai, controls, types, code templates |
176
+
177
+ > Always run `hap workflow structure PROCESS_ID` before computing insertion
178
+ > points, branch IDs, or approval block IDs. Don't fabricate node / block /
179
+ > branch IDs.
180
+
181
+ ### approval — approvals & todos
182
+
183
+ | Command | Description |
184
+ |---|---|
185
+ | `approval todo / todo-count / todo-filters / archived` | Pending and archived |
186
+ | `approval get / get-by-row / list-by-row / work-item / operations / op-history / history / history-detail` | Read instance state |
187
+ | `approval approve / reject / submit / sign / forward / urge` | Act on a task |
188
+ | `approval revoke / terminate / restart / retry` | Lifecycle |
189
+ | `approval batch / retry-batch / end-batch` | Bulk variants |
190
+ | `approval list-types` | Enum reference |
191
+ | `approval delegation create / list / list-by-company / list-by-principals / update` | Delegation CRUD |
192
+
193
+ ### custom-page — custom pages
194
+
195
+ | Command | Description |
196
+ |---|---|
197
+ | `custom-page info / save / update-config` | Read and write the layout |
198
+ | `custom-page create / rename / copy / delete` | Lifecycle |
199
+ | `custom-page component-types` | Component reference |
200
+
201
+ ### contact — contacts & address book
202
+
203
+ | Command | Description |
204
+ |---|---|
205
+ | `contact search / resolve` | Find members by keyword / name / email / phone |
206
+ | `contact friends / friend-requests` | Address book |
207
+ | `contact add-friend / accept-friend / reject-friend / ignore-friend / remove-friend` | Friend management |
208
+
209
+ ### department — directory
210
+
211
+ | Command | Description |
212
+ |---|---|
213
+ | `department list / tree / info / members / search` | Organization directory queries |
214
+
215
+ ### post — feed posts
216
+
217
+ | Command | Description |
218
+ |---|---|
219
+ | `post list / search / get` | Read |
220
+ | `post create / update / delete` | Author |
221
+ | `post comment / comments / comment-delete` | Comments |
222
+ | `post like / likes / favorite` | Reactions |
223
+ | `post pin / unpin / pinned` | Pinning |
224
+ | `post topics` | Topic-tag autocomplete |
225
+
226
+ ### calendar — calendar & events
227
+
228
+ | Command | Description |
229
+ |---|---|
230
+ | `calendar list / get / create / update / delete` | Event lifecycle |
231
+ | `calendar categories` | Built-in categories |
232
+ | `calendar add-member / remove-member` | Membership |
233
+
234
+ ### chat — chat & messaging
235
+
236
+ | Command | Description |
237
+ |---|---|
238
+ | `chat list` | Recent sessions |
239
+ | `chat messages` | 1-on-1 / group / inbox messages |
240
+ | `chat files` | Files shared in a chat |
241
+ | `chat send-to-one` | Send a plain-text message to one or more users (1-on-1) |
242
+ | `chat send-to-group` | Send a plain-text message to a group chat |
243
+ | `chat card-detail` | Resolve embedded card references |
244
+
245
+ ### group — chat group lifecycle
246
+
247
+ | Command | Description |
248
+ |---|---|
249
+ | `group info GROUP_ID` | Group metadata |
250
+ | `group create` | Create a new group (`--name`, `--org-id`, optional `--member`) |
251
+ | `group add-member` | Add one or more members (`--group-id`, `--account-id`) |
252
+ | `group remove-member` | Remove a single member (`--group-id`, `--account-id`) |
253
+
254
+ ### region — administrative regions
255
+
256
+ | Command | Description |
257
+ |---|---|
258
+ | `region get` | Look up regions by `--id` or `--search` keyword |
259
+
260
+ ### icon — built-in icon catalogue
261
+
262
+ | Command | Description |
263
+ |---|---|
264
+ | `icon search` | Search icons by Chinese/English keyword (OR across terms, more matches rank higher); no keyword lists all |
265
+ | `icon list` | List every icon with its keywords |
266
+
267
+ ### config — local CLI settings
268
+
269
+ | Command | Description |
270
+ |---|---|
271
+ | `config show` | Display the current configuration summary |
272
+ | `config completion [bash\|zsh\|fish] [--install]` | Enable `<Tab>` completion |
273
+ | `config language [LANG]` | Switch UI language (`en` / `zh-Hans` / `zh-Hant` / `ja`) |
274
+ | `config log on / off / status` | Toggle and inspect API logging |
275
+ | `config log level LEVEL` | `DEBUG / INFO / WARNING / ERROR / CRITICAL` |
276
+ | `config log view [--lines N] [--no-follow]` | Tail the log file |
277
+
278
+ Logs land in `~/.hap-cli/hap-cli.log` (10 MB × 3, rotating). When enabled,
279
+ every HAP API call is logged at `INFO` with URL, request body, response
280
+ body, and a redacted `Authorization` header (first 16 chars). `password`
281
+ and other sensitive keys are masked. `HAP_LOG_LEVEL=DEBUG` temporarily
282
+ overrides the persisted level.
283
+
284
+ ---
285
+
286
+ ## Default app & organization
287
+
288
+ Every command that needs an `--app-id` resolves it in this order:
289
+
290
+ 1. The explicit `--app-id` you passed;
291
+ 2. The default app saved by `hap app select`;
292
+ 3. Otherwise the command exits with an error suggesting `hap app select APP_ID`.
293
+
294
+ `hap auth switch-org` changes the default *organization* only — it does not
295
+ touch the default app.
296
+
297
+ ## REPL mode
298
+
299
+ ```bash
300
+ hap repl
301
+ hap> worksheet record list WORKSHEET_ID
302
+ hap> --json workflow list
303
+ hap> approval todo-count
304
+ hap> quit
305
+ ```
306
+
307
+ Drop the leading `hap`. Prefix `--json` to switch to JSON output for one
308
+ command.
309
+
310
+ ## Examples
311
+
312
+ ```bash
313
+ # Create a record
314
+ hap worksheet record create WORKSHEET_ID -f "c001=value1" -f "c002=value2"
315
+
316
+ # Build a workflow
317
+ hap workflow create --name "My Flow" --app-id APP_ID
318
+ hap workflow node add PROCESS_ID --type 4 --name "Manager Approval"
319
+ hap workflow node save PROCESS_ID NODE_ID --config '{"accounts":[...]}'
320
+ hap workflow publish PROCESS_ID
321
+ hap workflow trigger PROCESS_ID --source-id ROW_ID
322
+
323
+ # Approve / reject
324
+ hap approval todo --type 4
325
+ hap approval approve INSTANCE_ID --opinion "Looks good"
326
+ hap approval reject INSTANCE_ID --opinion "Need revision"
327
+ hap approval batch --action 4 -s ID1 -s ID2
328
+
329
+ # Roles
330
+ hap app role list
331
+ hap app role add-member ROLE_ID -u USER_ID
332
+
333
+ # Knowledge base search
334
+ hap app knowledge search --keyword "onboarding" --mode hybrid
335
+ ```
336
+
337
+ ## Project layout
338
+
339
+ ```
340
+ hap_cli/
341
+ commands/ thin Click layer — argument parsing & output formatting only
342
+ core/ business logic (transport, payload assembly, parsing)
343
+ core/v3/ v3 dispatcher — builds Click commands from sources/v3-api-schema/*.yaml
344
+ locale/ translation catalog (English-only at the moment)
345
+ sources/v3-api-schema/
346
+ OpenAPI v3 specs (apifox stable list) + INDEX.json,
347
+ copied into the wheel at build time
348
+ docs/ end-user documentation
349
+ ```
350
+
351
+ ## License
352
+
353
+ Apache 2.0.
@@ -0,0 +1,324 @@
1
+ # hap-cli
2
+
3
+ CLI harness for **MingDAO HAP** (明道云) — an enterprise no-code platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install hap-cli
9
+ ```
10
+
11
+ The package ships with the v3 tool schemas it needs, so no extra setup is
12
+ required after `pip install`.
13
+
14
+ ## Quick start
15
+
16
+ ### 1. Login
17
+
18
+ ```bash
19
+ # MingDAO SaaS (default)
20
+ hap auth login
21
+
22
+ # Specific environment
23
+ hap auth login mingdao # production
24
+ hap auth login nocoly # Nocoly SaaS
25
+ hap auth login https://hap.example.com # self-hosted
26
+
27
+ # Non-interactive (scripts / headless servers)
28
+ hap auth login https://your-server.com --token YOUR_TOKEN
29
+ ```
30
+
31
+ The browser flow opens the MingDAO login page and captures the token. If the
32
+ callback can't reach the CLI (no GUI, restricted network), interrupt the
33
+ command — it falls back to a paste prompt for the token shown on the success
34
+ page.
35
+
36
+ ```bash
37
+ hap auth whoami # current user + current organization
38
+ hap auth logout # clear the saved token
39
+ ```
40
+
41
+ ### 2. Pick an organization and app
42
+
43
+ ```bash
44
+ hap auth list-my-orgs # current org marked with *
45
+ hap auth switch-org ORG_ID # switch the saved current org
46
+ hap app list # uses the saved current org
47
+ hap app list --org-id ORG_ID # explicit override
48
+
49
+ # Save a default app so every --app-id can be omitted
50
+ hap app select APP_ID
51
+ hap app unselect # clear it
52
+ ```
53
+
54
+ `hap auth switch-org` only changes the default organization. The default app
55
+ is managed independently with `hap app select` / `hap app unselect`.
56
+
57
+ ### 3. Explore worksheets and records
58
+
59
+ ```bash
60
+ hap app info APP_ID # sections, worksheets, custom pages
61
+ hap worksheet list # uses the default app
62
+ hap worksheet info WORKSHEET_ID # full structure (settings + fields)
63
+ hap worksheet field-types # reference for field type IDs
64
+ hap worksheet record list WORKSHEET_ID --page-size 10
65
+ ```
66
+
67
+ ### 4. JSON output
68
+
69
+ ```bash
70
+ hap --json worksheet record list WORKSHEET_ID
71
+ ```
72
+
73
+ Every command supports `--json` for machine-readable output.
74
+
75
+ ---
76
+
77
+ ## Commands
78
+
79
+ The full authoritative list lives in [hap-cli-command.md](../hap-cli-command.md).
80
+ The summary below covers the top-level groups; run `hap <group> --help` to
81
+ discover every subcommand.
82
+
83
+ ### auth — authentication & session
84
+
85
+ | Command | Description |
86
+ |---|---|
87
+ | `auth login [SERVER]` | Browser login (use `--token` for scripted login) |
88
+ | `auth logout` | Clear the saved auth token |
89
+ | `auth whoami` | Show current user and current organization |
90
+ | `auth list-my-orgs` | List every org for the current account (current marked `*`) |
91
+ | `auth switch-org ORG_ID` | Switch the saved current organization |
92
+
93
+ ### app — application management
94
+
95
+ | Command | Description |
96
+ |---|---|
97
+ | `app list` | List apps in the org (default app marked `*`) |
98
+ | `app list-managed` | Apps where the current user is admin |
99
+ | `app info APP_ID` | App detail with sections, worksheets, custom pages |
100
+ | `app create / update / delete` | App lifecycle |
101
+ | `app select APP_ID` / `app unselect` | Manage the default app used when `--app-id` is omitted |
102
+ | `app create-section / edit-section / delete-section` | Section management |
103
+ | `app sort-sections / sort-worksheets` | Reorder sections / a section's worksheets |
104
+ | `app create-item` | Batch-create empty worksheets / custom pages |
105
+ | `app backup / restore / export / exports / backup-logs` | Backup & export |
106
+ | `app usage / logs` | Statistics and operation logs |
107
+ | `app role …` | Role CRUD, permissions, members, leave-all, applications |
108
+ | `app optionset …` | Option set CRUD and cross-app moves |
109
+ | `app knowledge list / search` | Vector knowledge bases |
110
+
111
+ ### worksheet — worksheets, views, custom actions, charts
112
+
113
+ | Command | Description |
114
+ |---|---|
115
+ | `worksheet list / info / fields / field-types` | Discover structure |
116
+ | `worksheet create / update / copy / delete` | Worksheet lifecycle |
117
+ | `worksheet rules / save-rule` | Business rules |
118
+ | `worksheet switches / edit-switch` | Feature switches |
119
+ | `worksheet form-settings / save-form-settings` | Form submission settings |
120
+ | `worksheet custom-actions / create-custom-action / delete-custom-action` | Custom action buttons |
121
+ | `worksheet create-chart` | Build a statistics chart on a worksheet |
122
+ | `worksheet view list / info / create / copy / delete / sort` | View management |
123
+
124
+ ### worksheet record — record CRUD
125
+
126
+ | Command | Description |
127
+ |---|---|
128
+ | `worksheet record list / get` | Query and read |
129
+ | `worksheet record create / update / delete` | Single-row CRUD |
130
+ | `worksheet record batch-create / batch-update` | Bulk operations (main-site path; relation/sub-table cells persist) |
131
+ | `worksheet record relations / share-link` | Linked records and share URLs |
132
+ | `worksheet record discussions / add-discussion / delete-discussion` | Discussion threads |
133
+ | `worksheet record logs` | Per-record change log |
134
+ | `worksheet record pivot / bottom-stats` | Aggregations and summary rows |
135
+
136
+ ### workflow — process & node management
137
+
138
+ | Command | Description |
139
+ |---|---|
140
+ | `workflow list / get / structure / history / groups / stats` | Inspect |
141
+ | `workflow create / update / copy / move / delete` | Lifecycle |
142
+ | `workflow publish / rollback` | Versioning |
143
+ | `workflow trigger / trigger-pbp` | Manual trigger |
144
+ | `workflow config-get / config-set` | Global config |
145
+ | `workflow create-approval / update-approval / delete-approval` | Approval blocks |
146
+ | `workflow node …` | Node CRUD, batch-add / batch-update / batch-delete (and `*-approval` variants), test-code / test-webhook / test-ai, controls, types, code templates |
147
+
148
+ > Always run `hap workflow structure PROCESS_ID` before computing insertion
149
+ > points, branch IDs, or approval block IDs. Don't fabricate node / block /
150
+ > branch IDs.
151
+
152
+ ### approval — approvals & todos
153
+
154
+ | Command | Description |
155
+ |---|---|
156
+ | `approval todo / todo-count / todo-filters / archived` | Pending and archived |
157
+ | `approval get / get-by-row / list-by-row / work-item / operations / op-history / history / history-detail` | Read instance state |
158
+ | `approval approve / reject / submit / sign / forward / urge` | Act on a task |
159
+ | `approval revoke / terminate / restart / retry` | Lifecycle |
160
+ | `approval batch / retry-batch / end-batch` | Bulk variants |
161
+ | `approval list-types` | Enum reference |
162
+ | `approval delegation create / list / list-by-company / list-by-principals / update` | Delegation CRUD |
163
+
164
+ ### custom-page — custom pages
165
+
166
+ | Command | Description |
167
+ |---|---|
168
+ | `custom-page info / save / update-config` | Read and write the layout |
169
+ | `custom-page create / rename / copy / delete` | Lifecycle |
170
+ | `custom-page component-types` | Component reference |
171
+
172
+ ### contact — contacts & address book
173
+
174
+ | Command | Description |
175
+ |---|---|
176
+ | `contact search / resolve` | Find members by keyword / name / email / phone |
177
+ | `contact friends / friend-requests` | Address book |
178
+ | `contact add-friend / accept-friend / reject-friend / ignore-friend / remove-friend` | Friend management |
179
+
180
+ ### department — directory
181
+
182
+ | Command | Description |
183
+ |---|---|
184
+ | `department list / tree / info / members / search` | Organization directory queries |
185
+
186
+ ### post — feed posts
187
+
188
+ | Command | Description |
189
+ |---|---|
190
+ | `post list / search / get` | Read |
191
+ | `post create / update / delete` | Author |
192
+ | `post comment / comments / comment-delete` | Comments |
193
+ | `post like / likes / favorite` | Reactions |
194
+ | `post pin / unpin / pinned` | Pinning |
195
+ | `post topics` | Topic-tag autocomplete |
196
+
197
+ ### calendar — calendar & events
198
+
199
+ | Command | Description |
200
+ |---|---|
201
+ | `calendar list / get / create / update / delete` | Event lifecycle |
202
+ | `calendar categories` | Built-in categories |
203
+ | `calendar add-member / remove-member` | Membership |
204
+
205
+ ### chat — chat & messaging
206
+
207
+ | Command | Description |
208
+ |---|---|
209
+ | `chat list` | Recent sessions |
210
+ | `chat messages` | 1-on-1 / group / inbox messages |
211
+ | `chat files` | Files shared in a chat |
212
+ | `chat send-to-one` | Send a plain-text message to one or more users (1-on-1) |
213
+ | `chat send-to-group` | Send a plain-text message to a group chat |
214
+ | `chat card-detail` | Resolve embedded card references |
215
+
216
+ ### group — chat group lifecycle
217
+
218
+ | Command | Description |
219
+ |---|---|
220
+ | `group info GROUP_ID` | Group metadata |
221
+ | `group create` | Create a new group (`--name`, `--org-id`, optional `--member`) |
222
+ | `group add-member` | Add one or more members (`--group-id`, `--account-id`) |
223
+ | `group remove-member` | Remove a single member (`--group-id`, `--account-id`) |
224
+
225
+ ### region — administrative regions
226
+
227
+ | Command | Description |
228
+ |---|---|
229
+ | `region get` | Look up regions by `--id` or `--search` keyword |
230
+
231
+ ### icon — built-in icon catalogue
232
+
233
+ | Command | Description |
234
+ |---|---|
235
+ | `icon search` | Search icons by Chinese/English keyword (OR across terms, more matches rank higher); no keyword lists all |
236
+ | `icon list` | List every icon with its keywords |
237
+
238
+ ### config — local CLI settings
239
+
240
+ | Command | Description |
241
+ |---|---|
242
+ | `config show` | Display the current configuration summary |
243
+ | `config completion [bash\|zsh\|fish] [--install]` | Enable `<Tab>` completion |
244
+ | `config language [LANG]` | Switch UI language (`en` / `zh-Hans` / `zh-Hant` / `ja`) |
245
+ | `config log on / off / status` | Toggle and inspect API logging |
246
+ | `config log level LEVEL` | `DEBUG / INFO / WARNING / ERROR / CRITICAL` |
247
+ | `config log view [--lines N] [--no-follow]` | Tail the log file |
248
+
249
+ Logs land in `~/.hap-cli/hap-cli.log` (10 MB × 3, rotating). When enabled,
250
+ every HAP API call is logged at `INFO` with URL, request body, response
251
+ body, and a redacted `Authorization` header (first 16 chars). `password`
252
+ and other sensitive keys are masked. `HAP_LOG_LEVEL=DEBUG` temporarily
253
+ overrides the persisted level.
254
+
255
+ ---
256
+
257
+ ## Default app & organization
258
+
259
+ Every command that needs an `--app-id` resolves it in this order:
260
+
261
+ 1. The explicit `--app-id` you passed;
262
+ 2. The default app saved by `hap app select`;
263
+ 3. Otherwise the command exits with an error suggesting `hap app select APP_ID`.
264
+
265
+ `hap auth switch-org` changes the default *organization* only — it does not
266
+ touch the default app.
267
+
268
+ ## REPL mode
269
+
270
+ ```bash
271
+ hap repl
272
+ hap> worksheet record list WORKSHEET_ID
273
+ hap> --json workflow list
274
+ hap> approval todo-count
275
+ hap> quit
276
+ ```
277
+
278
+ Drop the leading `hap`. Prefix `--json` to switch to JSON output for one
279
+ command.
280
+
281
+ ## Examples
282
+
283
+ ```bash
284
+ # Create a record
285
+ hap worksheet record create WORKSHEET_ID -f "c001=value1" -f "c002=value2"
286
+
287
+ # Build a workflow
288
+ hap workflow create --name "My Flow" --app-id APP_ID
289
+ hap workflow node add PROCESS_ID --type 4 --name "Manager Approval"
290
+ hap workflow node save PROCESS_ID NODE_ID --config '{"accounts":[...]}'
291
+ hap workflow publish PROCESS_ID
292
+ hap workflow trigger PROCESS_ID --source-id ROW_ID
293
+
294
+ # Approve / reject
295
+ hap approval todo --type 4
296
+ hap approval approve INSTANCE_ID --opinion "Looks good"
297
+ hap approval reject INSTANCE_ID --opinion "Need revision"
298
+ hap approval batch --action 4 -s ID1 -s ID2
299
+
300
+ # Roles
301
+ hap app role list
302
+ hap app role add-member ROLE_ID -u USER_ID
303
+
304
+ # Knowledge base search
305
+ hap app knowledge search --keyword "onboarding" --mode hybrid
306
+ ```
307
+
308
+ ## Project layout
309
+
310
+ ```
311
+ hap_cli/
312
+ commands/ thin Click layer — argument parsing & output formatting only
313
+ core/ business logic (transport, payload assembly, parsing)
314
+ core/v3/ v3 dispatcher — builds Click commands from sources/v3-api-schema/*.yaml
315
+ locale/ translation catalog (English-only at the moment)
316
+ sources/v3-api-schema/
317
+ OpenAPI v3 specs (apifox stable list) + INDEX.json,
318
+ copied into the wheel at build time
319
+ docs/ end-user documentation
320
+ ```
321
+
322
+ ## License
323
+
324
+ Apache 2.0.