hap-cli 0.5.0__py3-none-any.whl

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 (58) hide show
  1. hap_cli/README.md +194 -0
  2. hap_cli/README_CN.md +601 -0
  3. hap_cli/__init__.py +3 -0
  4. hap_cli/commands/__init__.py +1 -0
  5. hap_cli/commands/ai_cmd.py +224 -0
  6. hap_cli/commands/app_cmd.py +308 -0
  7. hap_cli/commands/calendar_cmd.py +138 -0
  8. hap_cli/commands/chat_cmd.py +101 -0
  9. hap_cli/commands/config_cmd.py +169 -0
  10. hap_cli/commands/contact_cmd.py +125 -0
  11. hap_cli/commands/department_cmd.py +168 -0
  12. hap_cli/commands/group_cmd.py +128 -0
  13. hap_cli/commands/instance_cmd.py +310 -0
  14. hap_cli/commands/node_cmd.py +538 -0
  15. hap_cli/commands/optionset_cmd.py +99 -0
  16. hap_cli/commands/page_cmd.py +102 -0
  17. hap_cli/commands/plugin_cmd.py +133 -0
  18. hap_cli/commands/post_cmd.py +155 -0
  19. hap_cli/commands/record_cmd.py +228 -0
  20. hap_cli/commands/role_cmd.py +221 -0
  21. hap_cli/commands/workflow_cmd.py +284 -0
  22. hap_cli/commands/worksheet_cmd.py +342 -0
  23. hap_cli/context.py +43 -0
  24. hap_cli/core/__init__.py +1 -0
  25. hap_cli/core/ai.py +133 -0
  26. hap_cli/core/app.py +307 -0
  27. hap_cli/core/auth.py +219 -0
  28. hap_cli/core/calendar_mod.py +114 -0
  29. hap_cli/core/chat.py +73 -0
  30. hap_cli/core/contact.py +85 -0
  31. hap_cli/core/department.py +131 -0
  32. hap_cli/core/flow_node.py +1001 -0
  33. hap_cli/core/group.py +99 -0
  34. hap_cli/core/instance.py +572 -0
  35. hap_cli/core/optionset.py +112 -0
  36. hap_cli/core/page.py +138 -0
  37. hap_cli/core/plugin.py +87 -0
  38. hap_cli/core/post.py +118 -0
  39. hap_cli/core/record.py +268 -0
  40. hap_cli/core/role.py +227 -0
  41. hap_cli/core/session.py +348 -0
  42. hap_cli/core/workflow.py +556 -0
  43. hap_cli/core/worksheet.py +403 -0
  44. hap_cli/hap_cli.py +105 -0
  45. hap_cli/skills/SKILL.md +383 -0
  46. hap_cli/skills/__init__.py +0 -0
  47. hap_cli/tests/__init__.py +1 -0
  48. hap_cli/tests/test_core.py +1824 -0
  49. hap_cli/tests/test_full_e2e.py +136 -0
  50. hap_cli/tests/test_integration.py +805 -0
  51. hap_cli/utils/__init__.py +1 -0
  52. hap_cli/utils/formatting.py +111 -0
  53. hap_cli/utils/options.py +10 -0
  54. hap_cli-0.5.0.dist-info/METADATA +223 -0
  55. hap_cli-0.5.0.dist-info/RECORD +58 -0
  56. hap_cli-0.5.0.dist-info/WHEEL +5 -0
  57. hap_cli-0.5.0.dist-info/entry_points.txt +2 -0
  58. hap_cli-0.5.0.dist-info/top_level.txt +1 -0
hap_cli/README.md ADDED
@@ -0,0 +1,194 @@
1
+ # hap-cli
2
+
3
+ CLI harness for **MingDAO HAP** (明道云) - an enterprise no-code platform (hap).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install -e .
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### 1. Login
14
+
15
+ **Option A: Browser login (recommended)**
16
+
17
+ ```bash
18
+ # MingDAO SaaS (default)
19
+ hap config login
20
+
21
+ # Specify server
22
+ hap config login mingdao # MingDAO
23
+ hap config login nocoly # Nocoly
24
+ hap config login https://hap.example.com # Self-hosted
25
+ ```
26
+
27
+ Opens your browser to the MingDAO login page. Token is saved automatically after login.
28
+
29
+ **Option B: Manual token**
30
+
31
+ ```bash
32
+ hap config set \
33
+ --server https://your-mingdao-server.com \
34
+ --token YOUR_MD_PSS_ID_TOKEN \
35
+ --app-id YOUR_DEFAULT_APP_ID \
36
+ --project-id YOUR_PROJECT_ID
37
+ ```
38
+
39
+ **Other auth commands**
40
+
41
+ ```bash
42
+ hap config whoami # Show current user info
43
+ hap config logout # Clear saved token
44
+ ```
45
+
46
+ ### 2. List worksheets
47
+
48
+ ```bash
49
+ hap app worksheets
50
+ ```
51
+
52
+ ### 3. Query records
53
+
54
+ ```bash
55
+ hap record list WORKSHEET_ID --page-size 10
56
+ ```
57
+
58
+ ### 4. JSON output (for automation)
59
+
60
+ ```bash
61
+ hap --json record list WORKSHEET_ID
62
+ ```
63
+
64
+ ## Command Groups
65
+
66
+ | Group | Description |
67
+ |-------|-------------|
68
+ | `config` | Server connection and auth |
69
+ | `app` | Application management |
70
+ | `worksheet` | Worksheet info, fields, views |
71
+ | `record` | Record CRUD (list, get, create, update, delete) |
72
+ | `workflow` | Process lifecycle (create, update, publish, trigger, rollback, config) |
73
+ | `node` | Node management (add, delete, save config, test code/webhook/AI) |
74
+ | `instance` | Approval & todo (approve, reject, forward, sign, batch, history) |
75
+ | `role` | Role management and members |
76
+ | `repl` | Interactive REPL mode |
77
+
78
+ ## Workflow Management
79
+
80
+ ```bash
81
+ # Create a workflow
82
+ hap workflow create --company-id CID --name "My Flow" --app-id APP_ID
83
+
84
+ # Add an approval node
85
+ hap node add PROCESS_ID --type 4 --name "Manager Approval"
86
+
87
+ # Configure the node
88
+ hap node save PROCESS_ID NODE_ID --type 4 --config '{"accounts":[...]}'
89
+
90
+ # Test a code node
91
+ hap node test-code PROCESS_ID NODE_ID --code "return 1+1"
92
+
93
+ # Test a webhook node
94
+ hap node test-webhook PROCESS_ID NODE_ID --url https://api.example.com
95
+
96
+ # Publish the workflow
97
+ hap workflow publish PROCESS_ID
98
+
99
+ # Trigger it
100
+ hap workflow trigger PROCESS_ID --source-id ROW_ID
101
+
102
+ # Check version history
103
+ hap workflow history PROCESS_ID
104
+
105
+ # Rollback to previous version
106
+ hap workflow rollback PROCESS_ID
107
+
108
+ # Get/set global config
109
+ hap workflow config-get PROCESS_ID
110
+ hap workflow config-set PROCESS_ID --config '{"allowRevoke":true}'
111
+ ```
112
+
113
+ ## Approval & Todo
114
+
115
+ ```bash
116
+ # Check pending task count
117
+ hap instance todo-count
118
+
119
+ # List pending approval tasks
120
+ hap instance todo --type 4
121
+
122
+ # View instance detail
123
+ hap instance get INSTANCE_ID
124
+
125
+ # Approve
126
+ hap instance approve INSTANCE_ID --opinion "Looks good"
127
+
128
+ # Reject with reason
129
+ hap instance reject INSTANCE_ID --opinion "Need revision"
130
+
131
+ # Forward to another user
132
+ hap instance forward INSTANCE_ID --to USER_ID
133
+
134
+ # Add co-signer
135
+ hap instance sign INSTANCE_ID --to USER_ID --before
136
+
137
+ # Batch approve
138
+ hap instance batch --action 4 -s ID1 -s ID2
139
+
140
+ # View execution history
141
+ hap instance history --process-id PROCESS_ID --status 2
142
+ ```
143
+
144
+ ## REPL Mode
145
+
146
+ ```bash
147
+ hap repl
148
+ hap> record list WORKSHEET_ID
149
+ hap> --json workflow list APP_ID
150
+ hap> instance todo-count
151
+ hap> quit
152
+ ```
153
+
154
+ ## API Authentication
155
+
156
+ The CLI uses MingDAO's `md_pss_id` session token. Use `hap config login` for
157
+ browser-based login, or `hap config set --token TOKEN` to set the token manually.
158
+
159
+ For private deployments with encrypted API responses, install crypto support:
160
+
161
+ ```bash
162
+ pip install hap-cli[crypto]
163
+ ```
164
+
165
+ ## More Examples
166
+
167
+ ```bash
168
+ # List apps
169
+ hap app list --project-id PROJECT_ID
170
+
171
+ # Get worksheet fields
172
+ hap worksheet fields WORKSHEET_ID
173
+
174
+ # Create a record
175
+ hap record create WORKSHEET_ID -f "c001=value1" -f "c002=value2"
176
+
177
+ # Copy a workflow
178
+ hap workflow copy PROCESS_ID --name "Copy of Flow"
179
+
180
+ # Move workflow to another app
181
+ hap workflow move PROCESS_ID TARGET_APP_ID
182
+
183
+ # List code templates
184
+ hap node code-templates --keyword "email"
185
+
186
+ # Test AI node
187
+ hap node test-ai PROCESS_ID NODE_ID --prompt "Summarize this" --model gpt-4
188
+
189
+ # Terminate a stuck instance
190
+ hap instance terminate INSTANCE_ID --yes
191
+
192
+ # Retry a failed instance
193
+ hap instance retry INSTANCE_ID
194
+ ```