hap-cli 0.5.1__tar.gz → 0.6.5__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 (103) hide show
  1. hap_cli-0.6.5/PKG-INFO +505 -0
  2. hap_cli-0.6.5/hap_cli/README.md +476 -0
  3. hap_cli-0.6.5/hap_cli/README_CN.md +862 -0
  4. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/__init__.py +1 -1
  5. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/commands/app_cmd.py +84 -29
  6. hap_cli-0.6.5/hap_cli/commands/auth_cmd.py +220 -0
  7. hap_cli-0.6.5/hap_cli/commands/calendar_cmd.py +546 -0
  8. hap_cli-0.6.5/hap_cli/commands/chat_cmd.py +312 -0
  9. hap_cli-0.6.5/hap_cli/commands/contact_cmd.py +353 -0
  10. hap_cli-0.6.5/hap_cli/commands/department_cmd.py +266 -0
  11. hap_cli-0.6.5/hap_cli/commands/instance_cmd.py +638 -0
  12. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/commands/node_cmd.py +34 -3
  13. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/commands/optionset_cmd.py +31 -17
  14. hap_cli-0.6.5/hap_cli/commands/page_cmd.py +243 -0
  15. hap_cli-0.6.5/hap_cli/commands/post_cmd.py +872 -0
  16. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/commands/record_cmd.py +67 -4
  17. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/commands/workflow_cmd.py +2 -2
  18. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/commands/worksheet_cmd.py +133 -16
  19. hap_cli-0.6.5/hap_cli/context.py +71 -0
  20. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/app.py +108 -15
  21. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/auth.py +62 -9
  22. hap_cli-0.6.5/hap_cli/core/calendar_mod.py +329 -0
  23. hap_cli-0.6.5/hap_cli/core/chat.py +672 -0
  24. hap_cli-0.6.5/hap_cli/core/contact.py +198 -0
  25. hap_cli-0.6.5/hap_cli/core/department.py +132 -0
  26. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/flow_node.py +19 -13
  27. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/group.py +28 -8
  28. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/instance.py +396 -2
  29. hap_cli-0.6.5/hap_cli/core/optionset.py +140 -0
  30. hap_cli-0.6.5/hap_cli/core/page.py +236 -0
  31. hap_cli-0.6.5/hap_cli/core/post.py +332 -0
  32. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/record.py +77 -5
  33. hap_cli-0.6.5/hap_cli/core/response_crypto.py +77 -0
  34. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/role.py +10 -2
  35. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/session.py +173 -22
  36. hap_cli-0.6.5/hap_cli/core/token_crypto.py +128 -0
  37. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/workflow.py +89 -16
  38. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/worksheet.py +156 -14
  39. hap_cli-0.6.5/hap_cli/hap_cli.py +230 -0
  40. hap_cli-0.6.5/hap_cli/skills/SKILL.md +352 -0
  41. hap_cli-0.6.5/hap_cli/tests/conftest.py +107 -0
  42. hap_cli-0.6.5/hap_cli/tests/test_core.py +4689 -0
  43. hap_cli-0.6.5/hap_cli/tests/test_full_e2e.py +149 -0
  44. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/tests/test_integration.py +79 -18
  45. hap_cli-0.6.5/hap_cli/tests/test_integration_approval.py +237 -0
  46. hap_cli-0.6.5/hap_cli/tests/test_integration_calendar.py +283 -0
  47. hap_cli-0.6.5/hap_cli/tests/test_integration_destructive.py +294 -0
  48. hap_cli-0.6.5/hap_cli/tests/test_integration_misc.py +164 -0
  49. hap_cli-0.6.5/hap_cli/tests/test_integration_post.py +118 -0
  50. hap_cli-0.6.5/hap_cli/tests/test_integration_social.py +150 -0
  51. hap_cli-0.6.5/hap_cli/tests/test_integration_workflow.py +145 -0
  52. hap_cli-0.6.5/hap_cli/tests/test_integration_worksheet_extra.py +150 -0
  53. hap_cli-0.6.5/hap_cli/tests/test_org_id_cli.py +104 -0
  54. hap_cli-0.6.5/hap_cli/tests/test_org_id_docs.py +55 -0
  55. hap_cli-0.6.5/hap_cli/tests/test_parameter_conventions.py +41 -0
  56. hap_cli-0.6.5/hap_cli/tests/test_parameter_mapping_registry.py +96 -0
  57. hap_cli-0.6.5/hap_cli/utils/options.py +46 -0
  58. hap_cli-0.6.5/hap_cli/utils/parameter_mapping.py +17 -0
  59. hap_cli-0.6.5/hap_cli.egg-info/PKG-INFO +505 -0
  60. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli.egg-info/SOURCES.txt +18 -7
  61. {hap_cli-0.5.1 → hap_cli-0.6.5}/setup.py +1 -1
  62. hap_cli-0.5.1/PKG-INFO +0 -231
  63. hap_cli-0.5.1/hap_cli/README.md +0 -202
  64. hap_cli-0.5.1/hap_cli/README_CN.md +0 -610
  65. hap_cli-0.5.1/hap_cli/commands/ai_cmd.py +0 -224
  66. hap_cli-0.5.1/hap_cli/commands/calendar_cmd.py +0 -138
  67. hap_cli-0.5.1/hap_cli/commands/chat_cmd.py +0 -101
  68. hap_cli-0.5.1/hap_cli/commands/config_cmd.py +0 -161
  69. hap_cli-0.5.1/hap_cli/commands/contact_cmd.py +0 -125
  70. hap_cli-0.5.1/hap_cli/commands/department_cmd.py +0 -168
  71. hap_cli-0.5.1/hap_cli/commands/group_cmd.py +0 -128
  72. hap_cli-0.5.1/hap_cli/commands/instance_cmd.py +0 -310
  73. hap_cli-0.5.1/hap_cli/commands/page_cmd.py +0 -102
  74. hap_cli-0.5.1/hap_cli/commands/plugin_cmd.py +0 -133
  75. hap_cli-0.5.1/hap_cli/commands/post_cmd.py +0 -155
  76. hap_cli-0.5.1/hap_cli/context.py +0 -43
  77. hap_cli-0.5.1/hap_cli/core/ai.py +0 -133
  78. hap_cli-0.5.1/hap_cli/core/calendar_mod.py +0 -114
  79. hap_cli-0.5.1/hap_cli/core/chat.py +0 -73
  80. hap_cli-0.5.1/hap_cli/core/contact.py +0 -85
  81. hap_cli-0.5.1/hap_cli/core/department.py +0 -131
  82. hap_cli-0.5.1/hap_cli/core/optionset.py +0 -112
  83. hap_cli-0.5.1/hap_cli/core/page.py +0 -138
  84. hap_cli-0.5.1/hap_cli/core/plugin.py +0 -87
  85. hap_cli-0.5.1/hap_cli/core/post.py +0 -118
  86. hap_cli-0.5.1/hap_cli/hap_cli.py +0 -105
  87. hap_cli-0.5.1/hap_cli/skills/SKILL.md +0 -383
  88. hap_cli-0.5.1/hap_cli/tests/test_core.py +0 -1824
  89. hap_cli-0.5.1/hap_cli/tests/test_full_e2e.py +0 -136
  90. hap_cli-0.5.1/hap_cli/utils/options.py +0 -10
  91. hap_cli-0.5.1/hap_cli.egg-info/PKG-INFO +0 -231
  92. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/commands/__init__.py +0 -0
  93. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/commands/role_cmd.py +0 -0
  94. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/core/__init__.py +0 -0
  95. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/skills/__init__.py +0 -0
  96. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/tests/__init__.py +0 -0
  97. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/utils/__init__.py +0 -0
  98. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli/utils/formatting.py +0 -0
  99. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli.egg-info/dependency_links.txt +0 -0
  100. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli.egg-info/entry_points.txt +0 -0
  101. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli.egg-info/requires.txt +0 -0
  102. {hap_cli-0.5.1 → hap_cli-0.6.5}/hap_cli.egg-info/top_level.txt +0 -0
  103. {hap_cli-0.5.1 → hap_cli-0.6.5}/setup.cfg +0 -0
hap_cli-0.6.5/PKG-INFO ADDED
@@ -0,0 +1,505 @@
1
+ Metadata-Version: 2.4
2
+ Name: hap-cli
3
+ Version: 0.6.5
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
+ Provides-Extra: crypto
19
+ Requires-Dist: pycryptodome>=3.15; extra == "crypto"
20
+ Dynamic: author
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: license
25
+ Dynamic: provides-extra
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 (hap).
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install hap-cli
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### 1. Login
43
+
44
+ **Option A: Browser login (recommended)**
45
+
46
+ ```bash
47
+ # MingDAO SaaS (default)
48
+ hap auth login
49
+
50
+ # Specify server
51
+ hap auth login mingdao # MingDAO
52
+ hap auth login nocoly # Nocoly
53
+ hap auth login https://hap.example.com # Self-hosted
54
+ ```
55
+
56
+ Opens your browser to the MingDAO login page. After login, your organizations are fetched immediately, and the first org is stored as the current org.
57
+
58
+ **Option B: Manual token (headless / scripted)**
59
+
60
+ ```bash
61
+ hap auth login https://your-mingdao-server.com --token YOUR_PERSONAL_ACCESS_TOKEN
62
+ ```
63
+
64
+ If the browser flow is running but the callback never reaches the CLI (e.g. remote
65
+ server, restrictive firewall), interrupt the command (the usual shell interrupt
66
+ shortcut for your terminal) to fall back to an interactive paste prompt for the
67
+ token shown on the success page.
68
+
69
+ **Other auth commands**
70
+
71
+ ```bash
72
+ hap auth whoami # Show current user info
73
+ hap auth logout # Clear saved token
74
+ ```
75
+
76
+ ### 2. Find your org and app IDs
77
+
78
+ ```bash
79
+ hap auth list-my-orgs # list orgs, current one is marked with *
80
+ hap auth switch-org ORG_ID # switch the saved current org
81
+ hap app list # uses the saved current org by default
82
+ hap app list --org-id ORG_ID # or override it explicitly
83
+ hap app list-managed # also uses the saved current org
84
+ hap app list-managed --org-id ORG_ID # explicit org override
85
+ ```
86
+
87
+ ### 3. List worksheets
88
+
89
+ ```bash
90
+ hap app worksheets APP_ID
91
+ ```
92
+
93
+ ### 4. Query records
94
+
95
+ ```bash
96
+ hap worksheet record list WORKSHEET_ID --page-size 10
97
+ ```
98
+
99
+ ### 5. JSON output (for automation)
100
+
101
+ ```bash
102
+ hap --json worksheet record list WORKSHEET_ID
103
+ ```
104
+
105
+ ## Commands
106
+
107
+ ### auth — Authentication & Session
108
+
109
+ | Command | Description |
110
+ |---|---|
111
+ | `auth login` | Login via browser (use `--token` for scripted login) |
112
+ | `auth logout` | Clear saved auth token |
113
+ | `auth whoami` | Show current logged-in user and current organization |
114
+ | `auth list-my-orgs` | List all organizations for current user |
115
+ | `auth switch-org` | Switch saved current organization |
116
+
117
+ ### app — Application Management
118
+
119
+ | Command | Description |
120
+ |---|---|
121
+ | `app list` | List applications in organization |
122
+ | `app list-managed` | List apps where current user is admin |
123
+ | `app info` | Get application info |
124
+ | `app worksheets` | List worksheets in an application |
125
+ | `app create` | Create a new application |
126
+ | `app update` | Update application info |
127
+ | `app delete` | Delete an application |
128
+ | `app add-section` | Add a section to an application |
129
+ | `app edit-section` | Edit section name |
130
+ | `app delete-section` | Delete an application section |
131
+ | `app backup` | Backup an application |
132
+ | `app restore` | Restore application from backup |
133
+ | `app export` | Batch export applications |
134
+ | `app exports` | List export records for an application |
135
+ | `app backup-logs` | Get backup/restore operation logs |
136
+ | `app usage` | Get application usage statistics |
137
+ | `app logs` | Get application operation logs (org-level; pass APP_ID to filter) |
138
+
139
+ #### app optionset — Option Set Management
140
+
141
+ | Command | Description |
142
+ |---|---|
143
+ | `app optionset list` | List option sets for an application |
144
+ | `app optionset get` | Get option set details |
145
+ | `app optionset save` | Create or update an option set |
146
+ | `app optionset delete` | Delete (or disable) an option set |
147
+ | `app optionset move` | Move an option set to another application |
148
+
149
+ #### app role — Role Management
150
+
151
+ | Command | Description |
152
+ |---|---|
153
+ | `app role list` | List roles for an application |
154
+ | `app role permissions` | Get role details and permissions |
155
+ | `app role create` | Create a new role |
156
+ | `app role rename` | Rename a role |
157
+ | `app role delete` | Delete a role |
158
+ | `app role set-permissions` | Edit role permissions |
159
+ | `app role add-member` | Add member to a role |
160
+ | `app role remove-member` | Remove member from a role |
161
+ | `app role apply` | Apply to join a role |
162
+ | `app role approve` | Approve role application |
163
+ | `app role reject` | Reject role application |
164
+ | `app role pending` | Get pending role applications |
165
+
166
+ ### worksheet — Worksheet Operations
167
+
168
+ | Command | Description |
169
+ |---|---|
170
+ | `worksheet info` | Get worksheet information |
171
+ | `worksheet fields` | List worksheet fields/controls |
172
+ | `worksheet views` | List worksheet views |
173
+ | `worksheet view-detail` | Get detailed configuration of a single view |
174
+ | `worksheet create` | Create a new worksheet |
175
+ | `worksheet update` | Update worksheet alias and/or description |
176
+ | `worksheet copy` | Copy a worksheet |
177
+ | `worksheet add-view` | Create a new view |
178
+ | `worksheet delete-view` | Delete a view |
179
+ | `worksheet copy-view` | Copy a view |
180
+ | `worksheet sort-views` | Reorder views |
181
+ | `worksheet buttons` | Get custom action buttons for a worksheet |
182
+ | `worksheet save-button` | Create or update a custom action button |
183
+ | `worksheet delete-button` | Delete a custom action button |
184
+ | `worksheet rules` | Get business rules for a worksheet |
185
+ | `worksheet save-rule` | Save a single business rule |
186
+ | `worksheet switches` | Get feature switches for a worksheet |
187
+ | `worksheet edit-switch` | Edit a single feature switch |
188
+ | `worksheet form-settings` | Get worksheet form submission/advanced settings |
189
+ | `worksheet save-form-settings` | Update worksheet form submission/advanced settings |
190
+ | `worksheet save-fields` | Save the complete fields/controls list for a worksheet |
191
+ | `worksheet field-types` | Show field type constants reference table |
192
+
193
+ #### worksheet record — Record CRUD
194
+
195
+ | Command | Description |
196
+ |---|---|
197
+ | `worksheet record list` | Query records (with filtering and pagination) |
198
+ | `worksheet record get` | Get a single record by ID |
199
+ | `worksheet record create` | Create a new record |
200
+ | `worksheet record update` | Update a record |
201
+ | `worksheet record delete` | Delete record(s) by ID |
202
+ | `worksheet record discussions` | Get discussions/comments for a record |
203
+ | `worksheet record add-discussion` | Add a discussion/comment to a record |
204
+ | `worksheet record delete-discussion` | Delete a discussion/comment |
205
+ | `worksheet record logs` | Get operation logs for a record |
206
+ | `worksheet record pivot` | Get pivot table data via statistics service |
207
+ | `worksheet record bottom-stats` | Get worksheet bottom summary statistics |
208
+
209
+ ### workflow — Workflow Management
210
+
211
+ | Command | Description |
212
+ |---|---|
213
+ | `workflow list` | List workflows in an application |
214
+ | `workflow get` | Get workflow details |
215
+ | `workflow create` | Create a new workflow |
216
+ | `workflow update` | Update workflow info |
217
+ | `workflow copy` | Copy/clone a workflow |
218
+ | `workflow move` | Move a workflow to another application |
219
+ | `workflow delete` | Delete a workflow |
220
+ | `workflow publish` | Publish (enable) or disable a workflow |
221
+ | `workflow rollback` | Rollback to previous version |
222
+ | `workflow history` | Get workflow version history |
223
+ | `workflow config-get` | Get workflow global configuration |
224
+ | `workflow config-set` | Save workflow global configuration (JSON string) |
225
+ | `workflow trigger` | Trigger/start a workflow by process ID |
226
+ | `workflow trigger-pbp` | Trigger a PBP (packaged business process) workflow |
227
+ | `workflow stats` | Get workflow usage statistics |
228
+ | `workflow groups` | List workflow groups |
229
+
230
+ #### workflow node — Workflow Node Management
231
+
232
+ | Command | Description |
233
+ |---|---|
234
+ | `workflow node list` | List all nodes in a workflow |
235
+ | `workflow node get` | Get node details/configuration |
236
+ | `workflow node add` | Add a node to a workflow |
237
+ | `workflow node delete` | Delete a node from a workflow |
238
+ | `workflow node rename` | Rename a node |
239
+ | `workflow node desc` | Update node description/alias |
240
+ | `workflow node save` | Save full node configuration (JSON string) |
241
+ | `workflow node save-action` | Configure data operation node (add/edit/delete records) |
242
+ | `workflow node save-search` | Configure search node (get single record) |
243
+ | `workflow node save-get-more` | Configure get-more-records node |
244
+ | `workflow node controls` | Get worksheet fields/controls available for node config |
245
+ | `workflow node form-property` | Get node form property |
246
+ | `workflow node sub-processes` | List available sub-processes |
247
+ | `workflow node test-code` | Test a code block node |
248
+ | `workflow node test-webhook` | Test a WebHook node |
249
+ | `workflow node test-ai` | Test an AI text generation node |
250
+ | `workflow node json-to-controls` | Convert JSON to workflow controls |
251
+ | `workflow node code-templates` | List code templates |
252
+ | `workflow node create-code-template` | Create a code template |
253
+ | `workflow node types` | Show all available node types and action IDs |
254
+ | `workflow node list-types` | List NODE_TYPE enum as a table |
255
+
256
+ ### approval — Approval Management
257
+
258
+ | Command | Description |
259
+ |---|---|
260
+ | `approval todo` | List pending tasks |
261
+ | `approval todo-count` | Get pending workflow task count |
262
+ | `approval todo-filters` | Advanced pending list (full RequestTodo filters) |
263
+ | `approval archived` | List archived processes |
264
+ | `approval history` | Get workflow execution history |
265
+ | `approval history-detail` | Get execution history detail (with node info) |
266
+ | `approval get` | Get process instance details |
267
+ | `approval work-item` | Get work items for a process instance |
268
+ | `approval operations` | Get available operations for a task |
269
+ | `approval op-history` | Get operation history for a process instance |
270
+ | `approval approve` | Approve a workflow task |
271
+ | `approval reject` | Reject a workflow task |
272
+ | `approval submit` | Submit a fill-in task |
273
+ | `approval sign` | Add a co-signer to a task |
274
+ | `approval forward` | Forward a task to another user |
275
+ | `approval urge` | Send a reminder for a pending task |
276
+ | `approval revoke` | Revoke a submitted process instance |
277
+ | `approval terminate` | Terminate a running process instance |
278
+ | `approval restart` | Restart a completed/rejected process |
279
+ | `approval retry` | Retry a failed process instance |
280
+ | `approval batch` | Batch approve or reject tasks |
281
+ | `approval retry-batch` | Batch retry failed process instances |
282
+ | `approval end-batch` | Batch terminate process instances |
283
+ | `approval list-types` | Show approval-related enum values (operationType etc.) |
284
+
285
+ #### approval delegation — Approval Delegation
286
+
287
+ | Command | Description |
288
+ |---|---|
289
+ | `approval delegation create` | Create a delegation |
290
+ | `approval delegation list` | List current user's delegations |
291
+ | `approval delegation list-by-company` | List all delegations in organization |
292
+ | `approval delegation list-by-principals` | List delegations for specified principals |
293
+ | `approval delegation update` | Edit delegation; pass `--status 0` to end |
294
+
295
+ ### custom-page — Custom Page Management
296
+
297
+ | Command | Description |
298
+ |---|---|
299
+ | `custom-page info` | Get saved custom page layout |
300
+ | `custom-page create` | Create a new custom page |
301
+ | `custom-page rename` | Edit custom page meta info |
302
+ | `custom-page copy` | Copy a custom page |
303
+ | `custom-page delete` | Delete a custom page |
304
+ | `custom-page save` | Save complete custom page layout |
305
+ | `custom-page update-config` | Update custom page metadata (description/config) |
306
+ | `custom-page component-types` | Show available custom page component types (reference) |
307
+
308
+ ### contact — Contacts & Address Book
309
+
310
+ | Command | Description |
311
+ |---|---|
312
+ | `contact search` | Search contacts by keyword within an organization |
313
+ | `contact resolve` | Resolve accountId by name/email/phone |
314
+ | `contact friends` | List contacts in address book |
315
+ | `contact friend-requests` | List pending friend requests |
316
+ | `contact add-friend` | Send a friend request |
317
+ | `contact accept-friend` | Accept a friend request |
318
+ | `contact reject-friend` | Reject a friend request (notifies requester) |
319
+ | `contact ignore-friend` | Silently ignore a pending friend request |
320
+ | `contact remove-friend` | Remove a friend from address book |
321
+
322
+ ### department — Department Queries
323
+
324
+ | Command | Description |
325
+ |---|---|
326
+ | `department list` | List sub-departments |
327
+ | `department tree` | Get full department tree |
328
+ | `department info` | Get department details |
329
+ | `department members` | Get department members |
330
+ | `department search` | Search departments and users |
331
+
332
+ ### post — Feed Posts
333
+
334
+ | Command | Description |
335
+ |---|---|
336
+ | `post list` | List feed posts |
337
+ | `post search` | Search posts by keyword and date range |
338
+ | `post get` | Show a post with its comment thread |
339
+ | `post create` | Create a new post |
340
+ | `post update` | Edit a post's content |
341
+ | `post delete` | Delete a post |
342
+ | `post comment` | Add a comment to a post |
343
+ | `post comments` | List all comments on a post |
344
+ | `post comment-delete` | Delete a comment |
345
+ | `post like` | Like a post (`--remove` to unlike) |
346
+ | `post likes` | List users who liked a post |
347
+ | `post favorite` | Favorite a post (`--remove` to unfavorite) |
348
+ | `post pin` | Pin a post (`--hours` for duration) |
349
+ | `post unpin` | Unpin a post |
350
+ | `post pinned` | List pinned posts |
351
+
352
+ ### calendar — Calendar Management
353
+
354
+ | Command | Description |
355
+ |---|---|
356
+ | `calendar list` | List calendar events within a date range (filterable) |
357
+ | `calendar get` | Get calendar event details |
358
+ | `calendar create` | Create a new calendar event |
359
+ | `calendar update` | Update a calendar event |
360
+ | `calendar delete` | Delete a calendar event |
361
+ | `calendar categories` | List calendar categories |
362
+ | `calendar add-member` | Add member to a calendar event |
363
+ | `calendar remove-member` | Remove member from a calendar event |
364
+
365
+ ### chat — Chat & Messaging
366
+
367
+ | Command | Description |
368
+ |---|---|
369
+ | `chat list` | List recent chat sessions |
370
+ | `chat files` | List files shared in a 1-on-1 or group chat |
371
+ | `chat messages` | Fetch 1-on-1, group, or inbox (system / app / workflow / ...) messages |
372
+ | `chat send` | Send a message to one or more users |
373
+ | `chat group-info` | Get information about a chat group |
374
+ | `chat card-detail` | Resolve card references embedded in chat messages |
375
+
376
+ ## Workflow Management
377
+
378
+ ```bash
379
+ # Create a workflow
380
+ hap workflow create --company-id CID --name "My Flow" --app-id APP_ID
381
+
382
+ # Add an approval node
383
+ hap workflow node add PROCESS_ID --type 4 --name "Manager Approval"
384
+
385
+ # Configure the node
386
+ hap workflow node save PROCESS_ID NODE_ID --type 4 --config '{"accounts":[...]}'
387
+
388
+ # Test a code node
389
+ hap workflow node test-code PROCESS_ID NODE_ID --code "return 1+1"
390
+
391
+ # Test a webhook node
392
+ hap workflow node test-webhook PROCESS_ID NODE_ID --url https://api.example.com
393
+
394
+ # Publish the workflow
395
+ hap workflow publish PROCESS_ID
396
+
397
+ # Trigger it
398
+ hap workflow trigger PROCESS_ID --source-id ROW_ID
399
+
400
+ # Check version history
401
+ hap workflow history PROCESS_ID
402
+
403
+ # Rollback to previous version
404
+ hap workflow rollback PROCESS_ID
405
+
406
+ # Get/set global config
407
+ hap workflow config-get PROCESS_ID
408
+ hap workflow config-set PROCESS_ID --config '{"allowRevoke":true}'
409
+ ```
410
+
411
+ ## Approval & Todo
412
+
413
+ ```bash
414
+ # Check pending task count
415
+ hap approval todo-count
416
+
417
+ # List pending approval tasks
418
+ hap approval todo --type 4
419
+
420
+ # View instance detail
421
+ hap approval get INSTANCE_ID
422
+
423
+ # Approve
424
+ hap approval approve INSTANCE_ID --opinion "Looks good"
425
+
426
+ # Reject with reason
427
+ hap approval reject INSTANCE_ID --opinion "Need revision"
428
+
429
+ # Forward to another user
430
+ hap approval forward INSTANCE_ID --to USER_ID
431
+
432
+ # Add co-signer
433
+ hap approval sign INSTANCE_ID --to USER_ID --before
434
+
435
+ # Batch approve
436
+ hap approval batch --action 4 -s ID1 -s ID2
437
+
438
+ # View execution history
439
+ hap approval history --process-id PROCESS_ID --status 2
440
+ ```
441
+
442
+ ## REPL Mode
443
+
444
+ ```bash
445
+ hap repl
446
+ hap> worksheet record list WORKSHEET_ID
447
+ hap> --json workflow list APP_ID
448
+ hap> approval todo-count
449
+ hap> quit
450
+ ```
451
+
452
+ ## API Authentication
453
+
454
+ The CLI uses MingDAO's `md_pss_id` session token. Use `hap auth login` for
455
+ browser-based login, or `hap auth login --token TOKEN` to supply a token
456
+ non-interactively (e.g. on a headless server).
457
+
458
+ Commands that expose `--org-id` will use the saved current org when you omit the option.
459
+
460
+ For private deployments with encrypted API responses, install crypto support:
461
+
462
+ ```bash
463
+ pip install hap-cli[crypto]
464
+ ```
465
+
466
+ ## More Examples
467
+
468
+ ```bash
469
+ # List orgs, then apps
470
+ hap auth list-my-orgs
471
+ hap app list
472
+ hap auth switch-org ORG_ID
473
+ hap app list-managed
474
+
475
+ # Get worksheet fields
476
+ hap worksheet fields WORKSHEET_ID
477
+
478
+ # Create a record
479
+ hap worksheet record create WORKSHEET_ID -f "c001=value1" -f "c002=value2"
480
+
481
+ # Copy a workflow
482
+ hap workflow copy PROCESS_ID --name "Copy of Flow"
483
+
484
+ # Move workflow to another app
485
+ hap workflow move PROCESS_ID TARGET_APP_ID
486
+
487
+ # List code templates
488
+ hap workflow node code-templates --keyword "email"
489
+
490
+ # Test AI node
491
+ hap workflow node test-ai PROCESS_ID NODE_ID --prompt "Summarize this" --model gpt-4
492
+
493
+ # Manage app roles
494
+ hap app role list APP_ID
495
+ hap app role add-member APP_ID ROLE_ID -u USER_ID
496
+
497
+ # Manage option sets
498
+ hap app optionset list APP_ID
499
+
500
+ # Terminate a stuck instance
501
+ hap approval terminate INSTANCE_ID --yes
502
+
503
+ # Retry a failed instance
504
+ hap approval retry INSTANCE_ID
505
+ ```