@hailer/mcp 0.0.6 → 0.1.0
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.
- package/.claude/agents/ada.md +127 -0
- package/.claude/agents/agent-builder.md +151 -0
- package/.claude/agents/alejandro.md +66 -0
- package/.claude/agents/bjorn.md +305 -0
- package/.claude/agents/dmitri.md +61 -0
- package/.claude/agents/giuseppe.md +66 -0
- package/.claude/agents/gunther.md +355 -0
- package/.claude/agents/helga.md +68 -0
- package/.claude/agents/kenji.md +58 -0
- package/.claude/agents/svetlana.md +394 -0
- package/.claude/agents/viktor.md +63 -0
- package/.claude/agents/yevgeni.md +60 -0
- package/.claude/hooks/agent-failure-detector.cjs +286 -0
- package/.claude/hooks/app-edit-guard.cjs +462 -0
- package/.claude/hooks/interactive-mode.cjs +59 -0
- package/.claude/hooks/mcp-server-guard.cjs +92 -0
- package/.claude/hooks/post-scaffold-hook.cjs +31 -0
- package/.claude/hooks/src-edit-guard.cjs +208 -0
- package/.claude/settings.json +47 -2
- package/.claude/skills/insight-join-patterns/SKILL.md +209 -0
- package/.env.example +13 -1
- package/CLAUDE.md +134 -0
- package/dist/app.js +4 -3
- package/dist/cli.js +0 -0
- package/dist/client/adaptive-documentation-bot.d.ts +0 -2
- package/dist/client/adaptive-documentation-bot.js +5 -16
- package/dist/client/message-processor.js +5 -0
- package/dist/client/providers/anthropic-provider.js +21 -7
- package/dist/mcp/UserContextCache.d.ts +14 -0
- package/dist/mcp/UserContextCache.js +49 -24
- package/dist/mcp/auth.d.ts +7 -0
- package/dist/mcp/auth.js +13 -5
- package/dist/mcp/hailer-clients.d.ts +5 -2
- package/dist/mcp/signal-handler.d.ts +28 -2
- package/dist/mcp/signal-handler.js +4 -2
- package/dist/mcp/tool-registry.d.ts +55 -2
- package/dist/mcp/tool-registry.js +197 -2
- package/dist/mcp/tools/app-core.d.ts +15 -0
- package/dist/mcp/tools/app-core.js +609 -0
- package/dist/mcp/tools/app-marketplace.d.ts +21 -0
- package/dist/mcp/tools/app-marketplace.js +1284 -0
- package/dist/mcp/tools/app-member.d.ts +11 -0
- package/dist/mcp/tools/app-member.js +258 -0
- package/dist/mcp/tools/app-scaffold.d.ts +11 -0
- package/dist/mcp/tools/app-scaffold.js +743 -0
- package/dist/mcp/tools/app.d.ts +13 -22
- package/dist/mcp/tools/app.js +17 -2466
- package/dist/mcp/tools/file.js +6 -6
- package/dist/mcp/tools/insight.d.ts +1 -0
- package/dist/mcp/tools/insight.js +203 -64
- package/dist/mcp/tools/user.js +3 -9
- package/dist/mcp/tools/workflow.js +49 -38
- package/dist/mcp/utils/hailer-api-client.js +4 -13
- package/dist/mcp/utils/tool-helpers.d.ts +102 -0
- package/dist/mcp/utils/tool-helpers.js +179 -0
- package/dist/mcp/utils/types.d.ts +6 -0
- package/dist/mcp/workspace-cache.d.ts +5 -5
- package/dist/mcp/workspace-cache.js +4 -3
- package/package.json +1 -1
- package/.claude/hooks/PreToolUse.sh +0 -52
- package/.claude/hooks/prompt-skill-loader.cjs +0 -553
- package/.claude/hooks/skill-loader.cjs +0 -142
- package/.claude/settings.local.json +0 -49
- package/.claude/skills/MCP-add-app-member-skill/SKILL.md +0 -977
- package/.claude/skills/MCP-build-data-app-skill/SKILL.md +0 -372
- package/.claude/skills/MCP-create-app-skill/SKILL.md +0 -1101
- package/.claude/skills/MCP-create-insight-skill/SKILL.md +0 -1317
- package/.claude/skills/MCP-get-insight-data-skill/SKILL.md +0 -1053
- package/.claude/skills/MCP-insight-api/SKILL.md +0 -185
- package/.claude/skills/MCP-insight-api/references/insight-endpoints.md +0 -514
- package/.claude/skills/MCP-install-workflow-skill/SKILL.md +0 -1056
- package/.claude/skills/MCP-list-apps-skill/SKILL.md +0 -1010
- package/.claude/skills/MCP-list-workflows-minimal-skill/SKILL.md +0 -992
- package/.claude/skills/MCP-local-first-skill/SKILL.md +0 -570
- package/.claude/skills/MCP-populate-workflow-data-skill/SKILL.md +0 -395
- package/.claude/skills/MCP-preview-insight-skill/SKILL.md +0 -1290
- package/.claude/skills/MCP-publish-hailer-app-skill/SKILL.md +0 -453
- package/.claude/skills/MCP-publish-template-skill/SKILL.md +0 -278
- package/.claude/skills/MCP-remove-app-member-skill/SKILL.md +0 -671
- package/.claude/skills/MCP-remove-app-skill/SKILL.md +0 -985
- package/.claude/skills/MCP-remove-insight-skill/SKILL.md +0 -1011
- package/.claude/skills/MCP-remove-workflow-skill/SKILL.md +0 -920
- package/.claude/skills/MCP-scaffold-hailer-app-skill/SKILL.md +0 -1314
- package/.claude/skills/MCP-update-app-skill/SKILL.md +0 -970
- package/.claude/skills/MCP-update-workflow-field-skill/SKILL.md +0 -1098
- package/.claude/skills/SDK-create-function-field-skill/SKILL.md +0 -313
- package/.claude/skills/SDK-generate-skill/SKILL.md +0 -223
- package/.claude/skills/SDK-init-skill/SKILL.md +0 -177
- package/.claude/skills/SDK-workspace-setup-skill/SKILL.md +0 -605
- package/.claude/skills/SDK-ws-config-skill/SKILL.md +0 -435
- package/.claude/skills/activity-api/SKILL.md +0 -96
- package/.claude/skills/activity-api/references/activity-endpoints.md +0 -845
- package/.claude/skills/agent-building/SKILL.md +0 -243
- package/.claude/skills/agent-building/references/architecture-patterns.md +0 -446
- package/.claude/skills/agent-building/references/code-examples.md +0 -587
- package/.claude/skills/agent-building/references/implementation-guide.md +0 -619
- package/.claude/skills/app-api/SKILL.md +0 -219
- package/.claude/skills/app-api/references/app-endpoints.md +0 -759
- package/.claude/skills/building-hailer-apps-skill/SKILL.md +0 -813
- package/.claude/skills/hailer-api/SKILL.md +0 -283
- package/.claude/skills/hailer-api/references/activities.md +0 -620
- package/.claude/skills/hailer-api/references/authentication.md +0 -216
- package/.claude/skills/hailer-api/references/datasets.md +0 -437
- package/.claude/skills/hailer-api/references/files.md +0 -301
- package/.claude/skills/hailer-api/references/insights.md +0 -469
- package/.claude/skills/hailer-api/references/workflows.md +0 -720
- package/.claude/skills/hailer-api/references/workspaces-users.md +0 -445
- package/.claude/skills/hailer-app-builder/SKILL.md +0 -340
- package/.claude/skills/mcp-tools/SKILL.md +0 -419
- package/.claude/skills/mcp-tools/references/api-endpoints.md +0 -499
- package/.claude/skills/mcp-tools/references/data-structures.md +0 -554
- package/.claude/skills/mcp-tools/references/implementation-patterns.md +0 -717
- package/.claude/skills/skill-testing/README.md +0 -137
- package/.claude/skills/skill-testing/SKILL.md +0 -348
- package/.claude/skills/skill-testing/references/test-patterns.md +0 -705
- package/.claude/skills/skill-testing/references/testing-guide.md +0 -603
- package/.claude/skills/skill-testing/references/validation-checklist.md +0 -537
- package/.claude/skills/spawn-app-builder/SKILL.md +0 -366
- package/.claude/skills/tool-builder/SKILL.md +0 -328
- package/tsconfig.json +0 -23
|
@@ -1,605 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Workspace Setup with SDK
|
|
3
|
-
description: Complete guide for one-shot workspace setup - create workflows, fields, and phases using hailer-sdk ws-config commands
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Workspace Setup with SDK - Complete Guide
|
|
7
|
-
|
|
8
|
-
One-shot guide for creating complete workflow systems using `hailer-sdk ws-config` commands. Use this when users ask to create workflows, fields, and phases in their Hailer workspace.
|
|
9
|
-
|
|
10
|
-
## Table of Contents
|
|
11
|
-
1. [Quick Reference - One-Shot Process](#quick-reference---one-shot-process)
|
|
12
|
-
2. [Critical Errors to Avoid](#critical-errors-to-avoid)
|
|
13
|
-
3. [Valid Field Types](#valid-field-types)
|
|
14
|
-
4. [Step-by-Step Process](#step-by-step-process)
|
|
15
|
-
5. [Code Templates](#code-templates)
|
|
16
|
-
6. [Complete Example](#complete-example)
|
|
17
|
-
7. [Troubleshooting](#troubleshooting)
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Quick Reference - One-Shot Process
|
|
22
|
-
|
|
23
|
-
### Command Sequence (MUST follow this order)
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# 1. Pull current state
|
|
27
|
-
npm run pull
|
|
28
|
-
|
|
29
|
-
# 2. Edit workflows.ts with ONLY names (no _id, no folder, no enabledUnlinkedMode)
|
|
30
|
-
# 3. Create workflow will happen automatically in step 4
|
|
31
|
-
|
|
32
|
-
# 4. Create workflows in Hailer
|
|
33
|
-
npm run workflows-sync
|
|
34
|
-
|
|
35
|
-
# 5. Pull to get real IDs (CRITICAL - directories will be renamed)
|
|
36
|
-
npm run pull
|
|
37
|
-
|
|
38
|
-
# 6. Now edit fields.ts and phases.ts in the NEW directories
|
|
39
|
-
|
|
40
|
-
# 7. Push fields and phases
|
|
41
|
-
npm run push
|
|
42
|
-
|
|
43
|
-
# 8. Final pull to sync
|
|
44
|
-
npm run pull
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Key Rules
|
|
48
|
-
|
|
49
|
-
| Rule | Correct | Wrong |
|
|
50
|
-
|------|---------|-------|
|
|
51
|
-
| New workflow entry | `{ name: "My Workflow" }` | `{ name: "X", _id: "_001", folder: "X_001" }` |
|
|
52
|
-
| Field type for dropdowns | `textpredefinedoptions` | `select`, `dropdown`, `options` |
|
|
53
|
-
| Field type for links | `activitylink` | `link`, `reference`, `relation` |
|
|
54
|
-
| Field type for files | NOT SUPPORTED | `files`, `file`, `attachment` |
|
|
55
|
-
| Dropdown options property | `data: ["A", "B"]` | `options: ["A", "B"]` |
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Critical Errors to Avoid
|
|
60
|
-
|
|
61
|
-
### Error 1: Setting properties on new workflows
|
|
62
|
-
|
|
63
|
-
**Error Message:**
|
|
64
|
-
```
|
|
65
|
-
msg: '"[0].folder" is not allowed'
|
|
66
|
-
msg: '"[0]._id" is not allowed'
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Cause:** Trying to set `_id`, `folder`, or `enabledUnlinkedMode` when creating new workflows.
|
|
70
|
-
|
|
71
|
-
**Fix:** For NEW workflows, only set `name`:
|
|
72
|
-
```typescript
|
|
73
|
-
// workflows.ts - CORRECT for new workflows
|
|
74
|
-
export const workflows: WorkflowEntry[] = [
|
|
75
|
-
{ name: "Suppliers" ,enabledUnlinkedMode:true}, // creates a dataset
|
|
76
|
-
{ name: "Purchase Orders" , enabledUnlinkedMode:false}, // creates a workflow
|
|
77
|
-
{ name: "Order Lines" }
|
|
78
|
-
];
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Error 2: Invalid field type
|
|
82
|
-
|
|
83
|
-
**Error Message:**
|
|
84
|
-
```
|
|
85
|
-
msg: '"ProcessFieldType" must be one of [activitylink, country, date, ...]'
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**Cause:** Using invalid field type like `files`, `file`, `select`, etc.
|
|
89
|
-
|
|
90
|
-
**Fix:** Only use valid field types (see [Valid Field Types](#valid-field-types) section).
|
|
91
|
-
|
|
92
|
-
### Error 3: Pushing before workflows exist
|
|
93
|
-
|
|
94
|
-
**Error Message:**
|
|
95
|
-
```
|
|
96
|
-
Workflow with ID X not found in Hailer workspace
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Cause:** Trying to push fields/phases before creating the workflow.
|
|
100
|
-
|
|
101
|
-
**Fix:**
|
|
102
|
-
1. First run `npm run workflows-sync` to create workflows
|
|
103
|
-
2. Then run `npm run pull` to get real IDs
|
|
104
|
-
3. Then edit fields/phases and run `npm run push`
|
|
105
|
-
|
|
106
|
-
### Error 4: Using wrong activitylink IDs
|
|
107
|
-
|
|
108
|
-
**Cause:** Using placeholder IDs like `_0001` instead of real workflow IDs.
|
|
109
|
-
|
|
110
|
-
**Fix:** After `npm run pull`, use the REAL workflow IDs from `enums.ts`:
|
|
111
|
-
```typescript
|
|
112
|
-
// WRONG - placeholder ID
|
|
113
|
-
data: ["_0001"]
|
|
114
|
-
|
|
115
|
-
// CORRECT - real Hailer ID
|
|
116
|
-
data: ["6928027f0619166b709d6944"]
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Error 5: Fields created but NOT visible in UI
|
|
120
|
-
|
|
121
|
-
**Symptom:**
|
|
122
|
-
- Activities created successfully via MCP tools
|
|
123
|
-
- API confirms data is stored (`show_activity_by_id` returns all values)
|
|
124
|
-
- UI only shows activity name - no fields visible in right panel
|
|
125
|
-
|
|
126
|
-
**Root Cause:** The `fields: []` array in `phases.ts` is empty. Fields must be explicitly listed in each phase to display.
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
// phases.ts - WRONG (fields invisible)
|
|
130
|
-
{
|
|
131
|
-
name: "Active",
|
|
132
|
-
fields: [], // ← EMPTY! Fields won't show
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// phases.ts - CORRECT (fields visible)
|
|
136
|
-
import { Suppliers_PhaseIds, Suppliers_FieldIds } from "../enums";
|
|
137
|
-
|
|
138
|
-
{
|
|
139
|
-
_id: Suppliers_PhaseIds.active_6f4,
|
|
140
|
-
name: "Active",
|
|
141
|
-
fields: [
|
|
142
|
-
Suppliers_FieldIds.supplier_number_8bb,
|
|
143
|
-
Suppliers_FieldIds.street_address_8be,
|
|
144
|
-
Suppliers_FieldIds.city_8c4,
|
|
145
|
-
// ... ALL field IDs you want visible
|
|
146
|
-
],
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
**The Fix:**
|
|
151
|
-
1. Import field IDs from `enums.ts`
|
|
152
|
-
2. Add all field IDs to each phase's `fields: []` array
|
|
153
|
-
3. Run `npm run phases-push`
|
|
154
|
-
|
|
155
|
-
**Key Understanding:**
|
|
156
|
-
|
|
157
|
-
| File | Purpose |
|
|
158
|
-
|------|---------|
|
|
159
|
-
| `fields.ts` | **Defines** what fields exist (schema) |
|
|
160
|
-
| `phases.ts` → `fields: []` | **Controls** which fields are **visible** in UI |
|
|
161
|
-
|
|
162
|
-
Creating fields does NOT automatically make them visible. You must add their IDs to each phase.
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## Valid Field Types
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
activitylink - Link to activities in another workflow
|
|
170
|
-
country - Country selector
|
|
171
|
-
date - Date picker
|
|
172
|
-
daterange - Date range (start/end)
|
|
173
|
-
datetime - Date and time picker
|
|
174
|
-
datetimerange - Date/time range
|
|
175
|
-
numeric - Number input
|
|
176
|
-
numericunit - Number with unit (e.g., 5 kg)
|
|
177
|
-
teams - Team selector
|
|
178
|
-
text - Single line text
|
|
179
|
-
textarea - Multi-line text
|
|
180
|
-
textunit - Text with unit
|
|
181
|
-
textpredefinedoptions - Dropdown/select with predefined options
|
|
182
|
-
time - Time picker
|
|
183
|
-
timerange - Time range
|
|
184
|
-
users - User selector
|
|
185
|
-
linkedfrom - Reverse link (shows activities linking TO this one)
|
|
186
|
-
subheader - Visual separator (not a data field)
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
**NOT VALID:** `files`, `file`, `attachment`, `select`, `dropdown`, `options`, `email`, `phone`, `url`
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
## Step-by-Step Process
|
|
194
|
-
|
|
195
|
-
### Step 1: Pull Current State
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
npm run pull
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
This creates/updates the `workspace/` directory with current configuration.
|
|
202
|
-
|
|
203
|
-
### Step 2: Edit workflows.ts
|
|
204
|
-
|
|
205
|
-
Add new workflows with ONLY the `name` property:
|
|
206
|
-
|
|
207
|
-
```typescript
|
|
208
|
-
// workspace/workflows.ts
|
|
209
|
-
export const workflows: WorkflowEntry[] = [
|
|
210
|
-
{ name: "Suppliers" },
|
|
211
|
-
{ name: "Purchase Orders" },
|
|
212
|
-
{ name: "Order Lines" }
|
|
213
|
-
];
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Step 3: Create Workflows
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
npm run workflows-sync
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
This creates the workflows in Hailer.
|
|
223
|
-
|
|
224
|
-
### Step 4: Pull to Get Real IDs
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
npm run pull
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
**IMPORTANT:** This will:
|
|
231
|
-
- Create new directories with real IDs (e.g., `suppliers_6928027f0619166b709d6944/`)
|
|
232
|
-
- Generate `enums.ts` with all IDs
|
|
233
|
-
- Clear field/phase files (they're empty in Hailer)
|
|
234
|
-
|
|
235
|
-
### Step 5: Edit Fields and Phases
|
|
236
|
-
|
|
237
|
-
Now edit the files in the NEW directories:
|
|
238
|
-
|
|
239
|
-
**fields.ts:**
|
|
240
|
-
```typescript
|
|
241
|
-
export const fields: HailerFieldGeneric[] = [
|
|
242
|
-
{
|
|
243
|
-
label: "Company Name",
|
|
244
|
-
key: "companyName",
|
|
245
|
-
type: "text",
|
|
246
|
-
required: true
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
label: "Status",
|
|
250
|
-
key: "status",
|
|
251
|
-
type: "textpredefinedoptions",
|
|
252
|
-
data: ["Active", "Inactive", "Pending"]
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
label: "Related Order",
|
|
256
|
-
key: "relatedOrder",
|
|
257
|
-
type: "activitylink",
|
|
258
|
-
data: ["REAL_WORKFLOW_ID_HERE"] // Use ID from enums.ts
|
|
259
|
-
}
|
|
260
|
-
];
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
**phases.ts:**
|
|
264
|
-
```typescript
|
|
265
|
-
export const phases: HailerPhaseUpdatePayload[] = [
|
|
266
|
-
{
|
|
267
|
-
_id: ExistingPhaseId.from_enums, // Keep existing phase ID
|
|
268
|
-
name: "Active",
|
|
269
|
-
color: "#27ae60"
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
name: "Inactive", // New phases don't need _id
|
|
273
|
-
color: "#95a5a6"
|
|
274
|
-
}
|
|
275
|
-
];
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Step 6: Push Changes
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
npm run push
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### Step 7: Final Pull
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
npm run pull
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
## Code Templates
|
|
293
|
-
|
|
294
|
-
### Basic Workflow Fields Template
|
|
295
|
-
|
|
296
|
-
```typescript
|
|
297
|
-
export const fields: HailerFieldGeneric[] = [
|
|
298
|
-
// Text fields
|
|
299
|
-
{
|
|
300
|
-
label: "Name",
|
|
301
|
-
key: "name",
|
|
302
|
-
type: "text",
|
|
303
|
-
required: true
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
label: "Description",
|
|
307
|
-
key: "description",
|
|
308
|
-
type: "textarea"
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
// Date fields
|
|
312
|
-
{
|
|
313
|
-
label: "Start Date",
|
|
314
|
-
key: "startDate",
|
|
315
|
-
type: "date"
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
label: "Due Date",
|
|
319
|
-
key: "dueDate",
|
|
320
|
-
type: "date"
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
// Numeric fields
|
|
324
|
-
{
|
|
325
|
-
label: "Amount",
|
|
326
|
-
key: "amount",
|
|
327
|
-
type: "numeric"
|
|
328
|
-
},
|
|
329
|
-
|
|
330
|
-
// Dropdown/Select
|
|
331
|
-
{
|
|
332
|
-
label: "Priority",
|
|
333
|
-
key: "priority",
|
|
334
|
-
type: "textpredefinedoptions",
|
|
335
|
-
data: ["Low", "Medium", "High", "Critical"]
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
label: "Status",
|
|
339
|
-
key: "status",
|
|
340
|
-
type: "textpredefinedoptions",
|
|
341
|
-
data: ["Draft", "Active", "Completed", "Cancelled"]
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
// User assignment
|
|
345
|
-
{
|
|
346
|
-
label: "Assigned To",
|
|
347
|
-
key: "assignedTo",
|
|
348
|
-
type: "users"
|
|
349
|
-
},
|
|
350
|
-
|
|
351
|
-
// Team assignment
|
|
352
|
-
{
|
|
353
|
-
label: "Team",
|
|
354
|
-
key: "team",
|
|
355
|
-
type: "teams"
|
|
356
|
-
},
|
|
357
|
-
|
|
358
|
-
// Country
|
|
359
|
-
{
|
|
360
|
-
label: "Country",
|
|
361
|
-
key: "country",
|
|
362
|
-
type: "country"
|
|
363
|
-
},
|
|
364
|
-
|
|
365
|
-
// Link to another workflow
|
|
366
|
-
{
|
|
367
|
-
label: "Related Item",
|
|
368
|
-
key: "relatedItem",
|
|
369
|
-
type: "activitylink",
|
|
370
|
-
data: ["WORKFLOW_ID_HERE"]
|
|
371
|
-
}
|
|
372
|
-
];
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
### Basic Phases Template
|
|
376
|
-
|
|
377
|
-
**IMPORTANT:** You must add field IDs to the `fields` array for them to be visible in the UI!
|
|
378
|
-
|
|
379
|
-
```typescript
|
|
380
|
-
import { MyWorkflow_PhaseIds, MyWorkflow_FieldIds } from "../enums";
|
|
381
|
-
|
|
382
|
-
export const phases: HailerPhaseUpdatePayload[] = [
|
|
383
|
-
{
|
|
384
|
-
_id: MyWorkflow_PhaseIds.new_abc, // Use existing phase ID from enums
|
|
385
|
-
name: "New",
|
|
386
|
-
color: "#3498db", // Blue
|
|
387
|
-
isInitial: true,
|
|
388
|
-
fields: [
|
|
389
|
-
MyWorkflow_FieldIds.title_123,
|
|
390
|
-
MyWorkflow_FieldIds.description_456,
|
|
391
|
-
MyWorkflow_FieldIds.priority_789,
|
|
392
|
-
// Add ALL fields you want visible in this phase
|
|
393
|
-
],
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
name: "In Progress", // New phases don't need _id
|
|
397
|
-
color: "#f39c12", // Orange
|
|
398
|
-
fields: [
|
|
399
|
-
MyWorkflow_FieldIds.title_123,
|
|
400
|
-
MyWorkflow_FieldIds.description_456,
|
|
401
|
-
MyWorkflow_FieldIds.priority_789,
|
|
402
|
-
MyWorkflow_FieldIds.assignedTo_012,
|
|
403
|
-
],
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
name: "Completed",
|
|
407
|
-
color: "#27ae60", // Green
|
|
408
|
-
fields: [
|
|
409
|
-
MyWorkflow_FieldIds.title_123,
|
|
410
|
-
MyWorkflow_FieldIds.completedDate_345,
|
|
411
|
-
],
|
|
412
|
-
}
|
|
413
|
-
];
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
**Note:** Each phase can show different fields. Completed tasks might show fewer fields than active ones.
|
|
417
|
-
|
|
418
|
-
### Common Color Palette
|
|
419
|
-
|
|
420
|
-
```
|
|
421
|
-
#3498db - Blue (New, Open, Active)
|
|
422
|
-
#f39c12 - Orange (In Progress, Pending, Warning)
|
|
423
|
-
#9b59b6 - Purple (Review, Special)
|
|
424
|
-
#27ae60 - Green (Completed, Success, Active)
|
|
425
|
-
#e74c3c - Red (Cancelled, Error, Urgent)
|
|
426
|
-
#95a5a6 - Gray (Inactive, Closed, Draft)
|
|
427
|
-
#16a085 - Teal (Invoiced, Processed)
|
|
428
|
-
#2c3e50 - Dark Blue (Archived, Completed)
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
---
|
|
432
|
-
|
|
433
|
-
## Complete Example
|
|
434
|
-
|
|
435
|
-
### Scenario: Create a CRM System
|
|
436
|
-
|
|
437
|
-
**Workflows to create:**
|
|
438
|
-
1. Companies - Customer/partner companies
|
|
439
|
-
2. Contacts - People at companies
|
|
440
|
-
3. Deals - Sales opportunities
|
|
441
|
-
|
|
442
|
-
### Step 1: Edit workflows.ts
|
|
443
|
-
|
|
444
|
-
```typescript
|
|
445
|
-
export const workflows: WorkflowEntry[] = [
|
|
446
|
-
{ name: "Companies" },
|
|
447
|
-
{ name: "Contacts" },
|
|
448
|
-
{ name: "Deals" }
|
|
449
|
-
];
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
### Step 2: Run workflows-sync and pull
|
|
453
|
-
|
|
454
|
-
```bash
|
|
455
|
-
npm run workflows-sync
|
|
456
|
-
npm run pull
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
### Step 3: Edit fields.ts for each workflow
|
|
460
|
-
|
|
461
|
-
**workspace/companies_[id]/fields.ts:**
|
|
462
|
-
```typescript
|
|
463
|
-
export const fields: HailerFieldGeneric[] = [
|
|
464
|
-
{ label: "Company Name", key: "companyName", type: "text", required: true },
|
|
465
|
-
{ label: "Industry", key: "industry", type: "textpredefinedoptions",
|
|
466
|
-
data: ["Technology", "Finance", "Healthcare", "Retail", "Other"] },
|
|
467
|
-
{ label: "Website", key: "website", type: "text" },
|
|
468
|
-
{ label: "Country", key: "country", type: "country" },
|
|
469
|
-
{ label: "Annual Revenue", key: "annualRevenue", type: "numeric" },
|
|
470
|
-
{ label: "Notes", key: "notes", type: "textarea" }
|
|
471
|
-
];
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
**workspace/contacts_[id]/fields.ts:**
|
|
475
|
-
```typescript
|
|
476
|
-
export const fields: HailerFieldGeneric[] = [
|
|
477
|
-
{ label: "Full Name", key: "fullName", type: "text", required: true },
|
|
478
|
-
{ label: "Email", key: "email", type: "text" },
|
|
479
|
-
{ label: "Phone", key: "phone", type: "text" },
|
|
480
|
-
{ label: "Job Title", key: "jobTitle", type: "text" },
|
|
481
|
-
{ label: "Company", key: "company", type: "activitylink",
|
|
482
|
-
data: ["COMPANIES_WORKFLOW_ID"], required: true },
|
|
483
|
-
{ label: "Notes", key: "notes", type: "textarea" }
|
|
484
|
-
];
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
**workspace/deals_[id]/fields.ts:**
|
|
488
|
-
```typescript
|
|
489
|
-
export const fields: HailerFieldGeneric[] = [
|
|
490
|
-
{ label: "Deal Name", key: "dealName", type: "text", required: true },
|
|
491
|
-
{ label: "Company", key: "company", type: "activitylink",
|
|
492
|
-
data: ["COMPANIES_WORKFLOW_ID"], required: true },
|
|
493
|
-
{ label: "Contact", key: "contact", type: "activitylink",
|
|
494
|
-
data: ["CONTACTS_WORKFLOW_ID"] },
|
|
495
|
-
{ label: "Value", key: "value", type: "numeric", required: true },
|
|
496
|
-
{ label: "Currency", key: "currency", type: "textpredefinedoptions",
|
|
497
|
-
data: ["EUR", "USD", "GBP"] },
|
|
498
|
-
{ label: "Close Date", key: "closeDate", type: "date" },
|
|
499
|
-
{ label: "Owner", key: "owner", type: "users" },
|
|
500
|
-
{ label: "Notes", key: "notes", type: "textarea" }
|
|
501
|
-
];
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
### Step 4: Edit phases.ts for Deals
|
|
505
|
-
|
|
506
|
-
**workspace/deals_[id]/phases.ts:**
|
|
507
|
-
```typescript
|
|
508
|
-
export const phases: HailerPhaseUpdatePayload[] = [
|
|
509
|
-
{ _id: Deals_PhaseIds.existing_phase, name: "Lead", color: "#3498db" },
|
|
510
|
-
{ name: "Qualified", color: "#9b59b6" },
|
|
511
|
-
{ name: "Proposal", color: "#f39c12" },
|
|
512
|
-
{ name: "Negotiation", color: "#e67e22" },
|
|
513
|
-
{ name: "Won", color: "#27ae60" },
|
|
514
|
-
{ name: "Lost", color: "#e74c3c" }
|
|
515
|
-
];
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
### Step 5: Push and final pull
|
|
519
|
-
|
|
520
|
-
```bash
|
|
521
|
-
npm run push
|
|
522
|
-
npm run pull
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
---
|
|
526
|
-
|
|
527
|
-
## Troubleshooting
|
|
528
|
-
|
|
529
|
-
### "Workflow with ID X not found"
|
|
530
|
-
|
|
531
|
-
**Cause:** Workflow doesn't exist in Hailer yet.
|
|
532
|
-
|
|
533
|
-
**Solution:**
|
|
534
|
-
```bash
|
|
535
|
-
npm run workflows-sync # Create workflows first
|
|
536
|
-
npm run pull # Get real IDs
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
### "enabledUnlinkedMode is not allowed"
|
|
540
|
-
|
|
541
|
-
**Cause:** Setting properties that aren't allowed during workflow creation.
|
|
542
|
-
|
|
543
|
-
**Solution:** Only use `{ name: "Workflow Name" }` for new workflows.
|
|
544
|
-
|
|
545
|
-
### "ProcessFieldType must be one of..."
|
|
546
|
-
|
|
547
|
-
**Cause:** Invalid field type.
|
|
548
|
-
|
|
549
|
-
**Solution:** Use only valid types from the list above. Common mistakes:
|
|
550
|
-
- `files` → NOT SUPPORTED (use Hailer's file attachment feature separately)
|
|
551
|
-
- `select` → use `textpredefinedoptions`
|
|
552
|
-
- `email` → use `text`
|
|
553
|
-
|
|
554
|
-
### Fields disappear after pull
|
|
555
|
-
|
|
556
|
-
**Expected behavior:** After `workflows-sync`, the pull creates NEW directories with real IDs. Your old directories (with placeholder IDs) are removed.
|
|
557
|
-
|
|
558
|
-
**Solution:** Always edit fields AFTER the pull that follows `workflows-sync`.
|
|
559
|
-
|
|
560
|
-
### Activitylink not working
|
|
561
|
-
|
|
562
|
-
**Cause:** Using placeholder ID instead of real workflow ID.
|
|
563
|
-
|
|
564
|
-
**Solution:** After pull, check `enums.ts` for real workflow IDs:
|
|
565
|
-
```typescript
|
|
566
|
-
// Use this ID in your activitylink data array
|
|
567
|
-
data: [WorkflowIds.companies_abc123]
|
|
568
|
-
// Or the raw ID
|
|
569
|
-
data: ["6928027f0619166b709d6944"]
|
|
570
|
-
```
|
|
571
|
-
|
|
572
|
-
### Fields not visible in UI (data exists but doesn't show)
|
|
573
|
-
|
|
574
|
-
**Cause:** The `fields: []` array in phases.ts is empty.
|
|
575
|
-
|
|
576
|
-
**Solution:**
|
|
577
|
-
1. Import field IDs: `import { MyWorkflow_FieldIds } from "../enums";`
|
|
578
|
-
2. Add field IDs to each phase's `fields` array
|
|
579
|
-
3. Run `npm run phases-push`
|
|
580
|
-
|
|
581
|
-
See [Error 5](#error-5-fields-created-but-not-visible-in-ui) for full details.
|
|
582
|
-
|
|
583
|
-
---
|
|
584
|
-
|
|
585
|
-
## Summary Checklist
|
|
586
|
-
|
|
587
|
-
Before creating workflows:
|
|
588
|
-
- [ ] Run `npm run pull` to get current state
|
|
589
|
-
- [ ] Edit `workflows.ts` with ONLY `{ name: "..." }` entries
|
|
590
|
-
- [ ] Run `npm run workflows-sync`
|
|
591
|
-
- [ ] Run `npm run pull` to get real IDs
|
|
592
|
-
- [ ] Edit fields.ts in NEW directories (with real IDs in folder names)
|
|
593
|
-
- [ ] Edit phases.ts in NEW directories
|
|
594
|
-
- [ ] **Add field IDs to each phase's `fields: []` array** (or fields won't be visible!)
|
|
595
|
-
- [ ] Update activitylink `data` arrays with REAL workflow IDs
|
|
596
|
-
- [ ] Only use valid field types (no `files`, `select`, `email`, etc.)
|
|
597
|
-
- [ ] Use `data` not `options` for dropdown values
|
|
598
|
-
- [ ] Run `npm run push`
|
|
599
|
-
- [ ] Run `npm run pull` for final sync
|
|
600
|
-
|
|
601
|
-
---
|
|
602
|
-
|
|
603
|
-
## Next Steps
|
|
604
|
-
|
|
605
|
-
After setting up your workflow structure, use the **populate-workflow-data-skill** to learn how to add activities (data) to your workflows.
|