@hailer/mcp 0.0.6 → 0.1.1
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/ingrid.md +108 -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/sdk-delete-guard.cjs +2 -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 +135 -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,313 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Create Function Field (Local Config)
|
|
3
|
-
description: Add new calculated function fields to workflows using hailer-sdk local config - use when MCP tools cannot create new fields
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Create Function Field via Local Config
|
|
7
|
-
|
|
8
|
-
## When to Use This Skill
|
|
9
|
-
|
|
10
|
-
Use this when you need to **create a NEW function field** in an existing workflow.
|
|
11
|
-
|
|
12
|
-
| Method | Creates New Fields | Updates Existing |
|
|
13
|
-
|--------|-------------------|------------------|
|
|
14
|
-
| `update_workflow_field` (MCP) | ❌ No | ✅ Yes |
|
|
15
|
-
| Local config + `ws-fields-push` | ✅ Yes | ✅ Yes |
|
|
16
|
-
|
|
17
|
-
**MCP limitation**: The `update_workflow_field` tool can only modify existing fields, not create new ones.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Prerequisites
|
|
22
|
-
|
|
23
|
-
1. **Local workspace config** pulled via `hailer-sdk ws-config pull`
|
|
24
|
-
2. **Workspace directory** structure:
|
|
25
|
-
```
|
|
26
|
-
workspace/
|
|
27
|
-
├── workflow_name_id/
|
|
28
|
-
│ ├── main.ts
|
|
29
|
-
│ ├── fields.ts
|
|
30
|
-
│ ├── phases.ts
|
|
31
|
-
│ └── functions/
|
|
32
|
-
│ ├── index.ts
|
|
33
|
-
│ └── existing_function.ts
|
|
34
|
-
└── enums.ts
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Step-by-Step Process
|
|
40
|
-
|
|
41
|
-
### 1. Create Function File
|
|
42
|
-
|
|
43
|
-
Create `workspace/[workflow]/functions/[function_name].ts`:
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
/**
|
|
47
|
-
* Field function for: Goals Per 90
|
|
48
|
-
* Formula: (goals / minutesPlayed) * 90
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
interface Dependencies {
|
|
52
|
-
goals: number;
|
|
53
|
-
minutesPlayed: number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function goals_per_90(dep: Dependencies): number {
|
|
57
|
-
const goals = dep.goals || 0;
|
|
58
|
-
const minutes = dep.minutesPlayed || 0;
|
|
59
|
-
|
|
60
|
-
if (minutes === 0) return 0;
|
|
61
|
-
|
|
62
|
-
return Math.round(((goals / minutes) * 90) * 100) / 100;
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### 2. Export in index.ts
|
|
67
|
-
|
|
68
|
-
Update `workspace/[workflow]/functions/index.ts`:
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
export { existing_function } from "./existing_function";
|
|
72
|
-
export { goals_per_90 } from "./goals_per_90"; // Add this line
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### 3. Add Field to fields.ts
|
|
76
|
-
|
|
77
|
-
Add to `workspace/[workflow]/fields.ts`:
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
// ⚠️ CRITICAL: Do NOT include _id for new fields!
|
|
81
|
-
{
|
|
82
|
-
// NO _id - SDK will create it
|
|
83
|
-
data: [],
|
|
84
|
-
function: "@function:goals_per_90",
|
|
85
|
-
functionEnabled: true,
|
|
86
|
-
functionVariables: {
|
|
87
|
-
goals: {
|
|
88
|
-
data: [
|
|
89
|
-
Workflow_FieldIds.goals_696 // Use enum reference
|
|
90
|
-
],
|
|
91
|
-
type: "="
|
|
92
|
-
},
|
|
93
|
-
minutesPlayed: {
|
|
94
|
-
data: [
|
|
95
|
-
Workflow_FieldIds.minutes_played_698
|
|
96
|
-
],
|
|
97
|
-
type: "="
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
key: "goalsPer90",
|
|
101
|
-
label: "Goals Per 90",
|
|
102
|
-
type: "numeric"
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### 4. Push Fields
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
npm run ws-fields-push
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### 5. Pull to Sync
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
npm run ws-pull
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
This will:
|
|
119
|
-
- Generate the real field ID
|
|
120
|
-
- Rename function file to include ID suffix (e.g., `goals_per_90_a2e.ts`)
|
|
121
|
-
- Update enums.ts with new field ID
|
|
122
|
-
- Update all references
|
|
123
|
-
|
|
124
|
-
### 6. Push Workflow (if needed)
|
|
125
|
-
|
|
126
|
-
After pull, the field will be added to `phases.ts` and `main.ts` automatically. If not, add manually and push:
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
npm run ws-workflows-push
|
|
130
|
-
npm run ws-phases-push
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## Common Errors & Solutions
|
|
136
|
-
|
|
137
|
-
### Error: "ObjectId must only contain hexadecimal characters"
|
|
138
|
-
|
|
139
|
-
**Cause**: You included an `_id` with invalid format
|
|
140
|
-
|
|
141
|
-
```typescript
|
|
142
|
-
// ❌ WRONG
|
|
143
|
-
{ _id: "goals_per_90", label: "Goals Per 90", ... }
|
|
144
|
-
|
|
145
|
-
// ❌ WRONG
|
|
146
|
-
{ _id: "000000000000000000000001", label: "Goals Per 90", ... }
|
|
147
|
-
|
|
148
|
-
// ✅ CORRECT - omit _id entirely
|
|
149
|
-
{ label: "Goals Per 90", key: "goalsPer90", ... }
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Error: "No matching remote field found, skipping update"
|
|
153
|
-
|
|
154
|
-
**Cause**: SDK is trying to update but field doesn't exist
|
|
155
|
-
|
|
156
|
-
**Solution**: Ensure you omitted `_id` - the SDK creates new fields only when `_id` is missing
|
|
157
|
-
|
|
158
|
-
### Error: "New field order doesn't match process fields"
|
|
159
|
-
|
|
160
|
-
**Cause**: `fieldsOrder` in `main.ts` references a field that doesn't exist yet
|
|
161
|
-
|
|
162
|
-
**Solution**:
|
|
163
|
-
1. Push fields first: `npm run ws-fields-push`
|
|
164
|
-
2. Pull to get IDs: `npm run ws-pull`
|
|
165
|
-
3. Then push workflow: `npm run ws-workflows-push`
|
|
166
|
-
|
|
167
|
-
### Error: "Invalid Login Data"
|
|
168
|
-
|
|
169
|
-
**Cause**: Credentials expired or incorrect
|
|
170
|
-
|
|
171
|
-
**Solution**: Update password in `.env` file:
|
|
172
|
-
```
|
|
173
|
-
HAILER_PASSWORD="your-new-password"
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### Duplicate Fields Created
|
|
177
|
-
|
|
178
|
-
**Cause**: Multiple push attempts before pull
|
|
179
|
-
|
|
180
|
-
**Solution**:
|
|
181
|
-
1. Pull to see current state: `npm run ws-pull`
|
|
182
|
-
2. Remove duplicate from `fields.ts`
|
|
183
|
-
3. Push with deletion: `echo "Y" | npm run ws-push`
|
|
184
|
-
4. Pull again to sync
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Function Field Structure
|
|
189
|
-
|
|
190
|
-
### functionVariables Format
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
functionVariables: {
|
|
194
|
-
variableName: {
|
|
195
|
-
data: ["field-id"], // Array with source field ID
|
|
196
|
-
type: "=" // "=" means same activity
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Accessing Dependencies
|
|
202
|
-
|
|
203
|
-
In function code, use `dep.variableName`:
|
|
204
|
-
|
|
205
|
-
```typescript
|
|
206
|
-
export function my_function(dep: Dependencies): number {
|
|
207
|
-
return (dep.goals || 0) + (dep.assists || 0);
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Return Types
|
|
212
|
-
|
|
213
|
-
| Field Type | Return |
|
|
214
|
-
|------------|--------|
|
|
215
|
-
| `numeric` | `number` |
|
|
216
|
-
| `text` | `string` |
|
|
217
|
-
| `date` | `number` (timestamp) |
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## Complete Example: Goals Per 90
|
|
222
|
-
|
|
223
|
-
### 1. Function File
|
|
224
|
-
`functions/goals_per_90.ts`:
|
|
225
|
-
```typescript
|
|
226
|
-
interface Dependencies {
|
|
227
|
-
goals: number;
|
|
228
|
-
minutesPlayed: number;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export function goals_per_90(dep: Dependencies): number {
|
|
232
|
-
const goals = dep.goals || 0;
|
|
233
|
-
const minutes = dep.minutesPlayed || 0;
|
|
234
|
-
if (minutes === 0) return 0;
|
|
235
|
-
return Math.round(((goals / minutes) * 90) * 100) / 100;
|
|
236
|
-
}
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### 2. Index Export
|
|
240
|
-
`functions/index.ts`:
|
|
241
|
-
```typescript
|
|
242
|
-
export { goals_per_90 } from "./goals_per_90";
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### 3. Field Definition
|
|
246
|
-
`fields.ts`:
|
|
247
|
-
```typescript
|
|
248
|
-
{
|
|
249
|
-
data: [],
|
|
250
|
-
function: "@function:goals_per_90",
|
|
251
|
-
functionEnabled: true,
|
|
252
|
-
functionVariables: {
|
|
253
|
-
goals: {
|
|
254
|
-
data: [Player_Statistics_FieldIds.goals_696],
|
|
255
|
-
type: "="
|
|
256
|
-
},
|
|
257
|
-
minutesPlayed: {
|
|
258
|
-
data: [Player_Statistics_FieldIds.minutes_played_698],
|
|
259
|
-
type: "="
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
key: "goalsPer90",
|
|
263
|
-
label: "Goals Per 90",
|
|
264
|
-
type: "numeric"
|
|
265
|
-
}
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### 4. Commands
|
|
269
|
-
```bash
|
|
270
|
-
npm run ws-fields-push # Create field
|
|
271
|
-
npm run ws-pull # Sync IDs
|
|
272
|
-
npm run ws-push # Update workflow/phases
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Post-Creation
|
|
278
|
-
|
|
279
|
-
After successful creation:
|
|
280
|
-
|
|
281
|
-
1. **Function file renamed**: `goals_per_90.ts` → `goals_per_90_a2e.ts`
|
|
282
|
-
2. **Enum generated**: `Player_Statistics_FieldIds.goals_per_90_a2e`
|
|
283
|
-
3. **Real ID assigned**: `692809f415a6def7ba29da2e`
|
|
284
|
-
|
|
285
|
-
Use the enum in your code for type safety:
|
|
286
|
-
```typescript
|
|
287
|
-
Player_Statistics_FieldIds.goals_per_90_a2e
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
## Workflow Summary
|
|
293
|
-
|
|
294
|
-
```
|
|
295
|
-
1. Create function file → functions/my_function.ts
|
|
296
|
-
2. Export in index.ts → export { my_function }
|
|
297
|
-
3. Add to fields.ts → NO _id, include functionVariables
|
|
298
|
-
4. ws-fields-push → Creates field in Hailer
|
|
299
|
-
5. ws-pull → Syncs real IDs back
|
|
300
|
-
6. ws-push → Updates workflow order
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## Key Rules
|
|
306
|
-
|
|
307
|
-
| Rule | Why |
|
|
308
|
-
|------|-----|
|
|
309
|
-
| **Omit `_id` for new fields** | SDK creates ID on push |
|
|
310
|
-
| **Push fields before workflow** | fieldsOrder must reference existing fields |
|
|
311
|
-
| **Always pull after push** | Syncs real IDs to local config |
|
|
312
|
-
| **Use enums after pull** | Type-safe field references |
|
|
313
|
-
| **Function name = export name** | `@function:name` matches `export function name` |
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: TypeScript Types Generation
|
|
3
|
-
description: Generate TypeScript enums and types from Hailer workspace - workflows, phases, fields, and optional insight types
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# `hailer-sdk generate`
|
|
7
|
-
|
|
8
|
-
Generate TypeScript enums and types from your Hailer workspace.
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
hailer-sdk generate [options]
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**Alias:** `gen`
|
|
17
|
-
|
|
18
|
-
## Description
|
|
19
|
-
|
|
20
|
-
The `generate` command creates TypeScript enums and types from your Hailer workspace. It generates a single `hailer-types.ts` file containing:
|
|
21
|
-
|
|
22
|
-
- **Workflow enums** - All workflows in the workspace
|
|
23
|
-
- **Phase enums** - Phases for each workflow
|
|
24
|
-
- **Field enums** - Fields for each workflow (excludes subheaders and fields without labels)
|
|
25
|
-
- **Insight types** (optional) - TypeScript types inferred from insight data
|
|
26
|
-
|
|
27
|
-
## Options
|
|
28
|
-
|
|
29
|
-
| Option | Alias | Required | Description |
|
|
30
|
-
|--------|-------|----------|-------------|
|
|
31
|
-
| `--output <path>` | `-o` | ✅ | Output directory for generated files |
|
|
32
|
-
| `--email <email>` | `-e` | * | Hailer account email |
|
|
33
|
-
| `--password <password>` | `-p` | * | Hailer account password |
|
|
34
|
-
| `--workspace <id>` | `-w` | * | Workspace ID |
|
|
35
|
-
| `--insights <file>` | `-i` | | Path to JSON file with insights array (optional) |
|
|
36
|
-
| `--ids` | | | Use IDs instead of names/keys as enum values |
|
|
37
|
-
| `--verbose` | | | Show detailed logging |
|
|
38
|
-
|
|
39
|
-
\* Credentials can be provided via CLI options or `config.json` file
|
|
40
|
-
|
|
41
|
-
## Understanding the `--ids` Flag
|
|
42
|
-
|
|
43
|
-
The `--ids` flag controls what values are used in the generated enums:
|
|
44
|
-
|
|
45
|
-
### Without `--ids` (default)
|
|
46
|
-
|
|
47
|
-
Uses human-readable names and keys:
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
export enum MyWorkspace_Workflows {
|
|
51
|
-
SalesPipeline = "Sales Pipeline",
|
|
52
|
-
CustomerSupport = "Customer Support",
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export enum MyWorkspace_SalesPipeline_Fields {
|
|
56
|
-
customer_name = "customer_name", // Uses field.key
|
|
57
|
-
deal_value = "deal_value",
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export enum MyWorkspace_SalesPipeline_Phases {
|
|
61
|
-
Lead = "Lead", // Uses phase.name
|
|
62
|
-
Negotiation = "Negotiation",
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### With `--ids`
|
|
67
|
-
|
|
68
|
-
Uses Hailer internal IDs:
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
export enum MyWorkspace_Workflows {
|
|
72
|
-
SalesPipeline = "507f1f77bcf86cd799439011",
|
|
73
|
-
CustomerSupport = "507f191e810c19729de860ea",
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export enum MyWorkspace_SalesPipeline_Fields {
|
|
77
|
-
customer_name = "507f1f77bcf86cd799439012", // Uses field._id
|
|
78
|
-
deal_value = "507f1f77bcf86cd799439013",
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export enum MyWorkspace_SalesPipeline_Phases {
|
|
82
|
-
Lead = "507f1f77bcf86cd799439014", // Uses phase._id
|
|
83
|
-
Negotiation = "507f1f77bcf86cd799439015",
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## Field Filtering
|
|
89
|
-
|
|
90
|
-
The generator automatically **excludes** certain fields:
|
|
91
|
-
|
|
92
|
-
1. **Subheaders** - Fields with `type: "subheader"` (visual separators, not data fields)
|
|
93
|
-
2. **Fields without keys** - When `--ids` is not used, fields must have a `key` property
|
|
94
|
-
3. **Fields without labels** - All fields must have a `label` property
|
|
95
|
-
|
|
96
|
-
## How Insights Work
|
|
97
|
-
|
|
98
|
-
- If you provide `--insights <file>`, the generator will include insight types in the output
|
|
99
|
-
- If you don't provide `--insights`, only workflow/phase/field enums are generated
|
|
100
|
-
- The types of the each individual insight's property is decided based on the value returned when fetched the insight. It can be a `string`, `number`, `boolean`, `null`, `any` or an array of each of previously mentioned types.
|
|
101
|
-
|
|
102
|
-
## Examples
|
|
103
|
-
|
|
104
|
-
### Basic usage - Generate workflow enums only
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
hailer-sdk generate -e email@example.com -p password -w workspace-id -o ./src/types
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
**Generates:** Workflow, phase, and field enums
|
|
111
|
-
|
|
112
|
-
### Generate with IDs instead of names
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
hailer-sdk generate -e email@example.com -p password -w workspace-id -o ./src/types --ids
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**Generates:** Same enums but with internal IDs as values
|
|
119
|
-
|
|
120
|
-
### Generate workflows + insights types
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
hailer-sdk generate -e email@example.com -p password -w workspace-id -o ./output --insights ./insights.json
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
**Generates:** Workflow enums + insight types (both included)
|
|
127
|
-
|
|
128
|
-
### Using config.json for credentials
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
# Reads credentials from config.json in current directory
|
|
132
|
-
hailer-sdk generate -o ./types
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Verbose output
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
hailer-sdk generate -o ./types --verbose
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Shows:** Detailed information about each workflow being processed
|
|
142
|
-
|
|
143
|
-
## Insights File Format
|
|
144
|
-
|
|
145
|
-
If you want to generate insight types, provide a JSON file with this format:
|
|
146
|
-
|
|
147
|
-
```json
|
|
148
|
-
[
|
|
149
|
-
{
|
|
150
|
-
"id": "insight-id-1",
|
|
151
|
-
"name": "My Insight"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
"id": "insight-id-2",
|
|
155
|
-
"name": "Another Insight"
|
|
156
|
-
}
|
|
157
|
-
]
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## Generated Files
|
|
161
|
-
|
|
162
|
-
The command generates TypeScript file in your specified output directory:
|
|
163
|
-
|
|
164
|
-
- `hailer-types.ts` - Contains all generated enums and types
|
|
165
|
-
|
|
166
|
-
## Credentials Resolution
|
|
167
|
-
|
|
168
|
-
Credentials are resolved in this order (highest priority first):
|
|
169
|
-
|
|
170
|
-
1. CLI options (`--email`, `--password`, `--workspace`)
|
|
171
|
-
2. `config.json` file in current directory
|
|
172
|
-
|
|
173
|
-
## Generated Output Structure
|
|
174
|
-
|
|
175
|
-
The command generates a single `hailer-types.ts` file with this structure:
|
|
176
|
-
|
|
177
|
-
```typescript
|
|
178
|
-
/**
|
|
179
|
-
* All workflows/datasets in the MyWorkspace workspace
|
|
180
|
-
* @generated This enum is auto-generated. Do not edit manually.
|
|
181
|
-
*/
|
|
182
|
-
export enum MyWorkspace_Workflows {
|
|
183
|
-
SalesPipeline = "Sales Pipeline",
|
|
184
|
-
// ... more workflows
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Phases for Sales Pipeline workflow
|
|
189
|
-
* @generated This enum is auto-generated. Do not edit manually.
|
|
190
|
-
*/
|
|
191
|
-
export enum MyWorkspace_SalesPipeline_Phases {
|
|
192
|
-
Lead = "Lead",
|
|
193
|
-
Qualified = "Qualified",
|
|
194
|
-
// ... more phases
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Fields for Sales Pipeline workflow
|
|
199
|
-
* Values are names of the fields
|
|
200
|
-
* @generated This enum is auto-generated. Do not edit manually.
|
|
201
|
-
*/
|
|
202
|
-
export enum MyWorkspace_SalesPipeline_Fields {
|
|
203
|
-
customer_name = "customer_name",
|
|
204
|
-
deal_value = "deal_value",
|
|
205
|
-
// ... more fields
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Insight types (if --insights provided)
|
|
209
|
-
export type MyInsight = {
|
|
210
|
-
"Column1": string;
|
|
211
|
-
"Column2": number;
|
|
212
|
-
// ... inferred from data
|
|
213
|
-
};
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Notes
|
|
217
|
-
|
|
218
|
-
- The generated enums provide type-safe references to workflow, field, and phase IDs
|
|
219
|
-
- Insights are optional - simply omit `--insights` to generate only workflows
|
|
220
|
-
- All generated types include `@generated` JSDoc comments indicating they're auto-generated
|
|
221
|
-
- Enum keys are sanitized (special characters removed, spaces replaced with underscores)
|
|
222
|
-
- Generated file is always named `hailer-types.ts` in the output directory
|
|
223
|
-
- Re-run the command anytime to regenerate types with latest workspace data
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Project Initialization
|
|
3
|
-
description: Complete guide to initializing Hailer projects with hailer-sdk init - project setup, bot accounts, and MCP server configuration
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# `hailer-sdk init`
|
|
7
|
-
|
|
8
|
-
Initialize a new Hailer project with proper structure and configuration.
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
hailer-sdk init
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Description
|
|
17
|
-
|
|
18
|
-
The `init` command is an interactive wizard that guides you through setting up a new Hailer project. It handles authentication, workspace selection, optional bot account creation, optional MCP server setup, and creates all necessary project files and configurations.
|
|
19
|
-
|
|
20
|
-
## Interactive Steps
|
|
21
|
-
|
|
22
|
-
1. **Project name** - Choose a name for your project
|
|
23
|
-
2. **Email** - Enter your Hailer account email
|
|
24
|
-
3. **Password** - Enter your Hailer account password
|
|
25
|
-
4. **Workspace selection** - Choose from your available workspaces or create a new one
|
|
26
|
-
5. **Bot account creation** - Optionally create a bot user for automated workspace operations
|
|
27
|
-
6. **MCP server setup** - Optionally set up the Model Context Protocol server for Claude Code integration
|
|
28
|
-
|
|
29
|
-
## What it Creates
|
|
30
|
-
|
|
31
|
-
The command generates a complete project structure:
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
my-project/
|
|
35
|
-
├── workspace/ # Workflow configurations will be generated here
|
|
36
|
-
├── .claude/ # Claude Code configuration (if MCP enabled)
|
|
37
|
-
├── .mcp.json # MCP configuration (if MCP enabled)
|
|
38
|
-
├── .env.local # MCP server credentials (if MCP enabled)
|
|
39
|
-
├── docs/ # Copy of SDK documentation
|
|
40
|
-
├── .env # Environment variables (password)
|
|
41
|
-
├── .gitignore # Excludes .env and other sensitive files
|
|
42
|
-
├── config.json # Workspace configuration
|
|
43
|
-
├── package.json # Node.js project configuration with useful scripts
|
|
44
|
-
├── tsconfig.json # TypeScript configuration
|
|
45
|
-
├── CLAUDE.md # Claude Code instructions
|
|
46
|
-
└── README.md # Project documentation
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Generated npm scripts
|
|
50
|
-
|
|
51
|
-
The `package.json` includes these helpful scripts:
|
|
52
|
-
|
|
53
|
-
**Workspace Management:**
|
|
54
|
-
- `npm run pull` - Pull workflows from Hailer
|
|
55
|
-
- `npm run push` - Push all configurations to Hailer
|
|
56
|
-
- `npm run workflows-push` - Push only workflow configurations
|
|
57
|
-
- `npm run workflows-sync` - Create/delete workflows
|
|
58
|
-
- `npm run fields-push` - Push only field configurations
|
|
59
|
-
- `npm run phases-push` - Push only phase configurations
|
|
60
|
-
- `npm run groups-push` - Push only group configurations
|
|
61
|
-
- `npm run teams-push` - Push only team configurations
|
|
62
|
-
- `npm run insights-push` - Push only insights configurations
|
|
63
|
-
|
|
64
|
-
**MCP Server (if enabled):**
|
|
65
|
-
- `npm run mcp-start` - Start the MCP server
|
|
66
|
-
- `npm run mcp-update` - Update @hailer/mcp package and refresh .claude directory
|
|
67
|
-
|
|
68
|
-
## Bot Account (Optional)
|
|
69
|
-
|
|
70
|
-
During initialization, you can choose to create a bot account for your workspace. The bot account:
|
|
71
|
-
|
|
72
|
-
- Is created with email pattern: `{workspace}_{timestamp}@botinen.fi`
|
|
73
|
-
- Gets a randomly generated secure password (32 characters)
|
|
74
|
-
- Is added to a "Bots" team in your workspace (created if it doesn't exist)
|
|
75
|
-
- Has "owner" role for full workspace access
|
|
76
|
-
- Its credentials replace your personal credentials in the project's `.env` file
|
|
77
|
-
|
|
78
|
-
**This is useful for:**
|
|
79
|
-
- Separating bot actions from personal user actions
|
|
80
|
-
|
|
81
|
-
**Note:** The bot credentials are displayed once during initialization. But you can see the bot's email in the `config.json` file and the password in `.env` file.
|
|
82
|
-
|
|
83
|
-
## MCP Server Setup (Optional)
|
|
84
|
-
|
|
85
|
-
The MCP (Model Context Protocol) server enables Claude Code to interact with your Hailer workspace programmatically.
|
|
86
|
-
|
|
87
|
-
When enabled, the initialization:
|
|
88
|
-
- Installs `@hailer/mcp` npm package as a dev dependency
|
|
89
|
-
- Creates `.mcp.json` with MCP server connection configuration
|
|
90
|
-
- Creates `.env.local` with client credentials
|
|
91
|
-
- Adds a `postinstall` script that automatically copies `.claude/` directory from `@hailer/mcp` package
|
|
92
|
-
- Adds MCP-specific npm scripts to `package.json`
|
|
93
|
-
|
|
94
|
-
### Starting the MCP Server
|
|
95
|
-
|
|
96
|
-
After initialization and installing dependencies:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
cd my-project
|
|
100
|
-
npm install
|
|
101
|
-
npm run mcp-start
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
The `npm install` step will automatically:
|
|
105
|
-
- Install all dependencies including `@hailer/mcp`
|
|
106
|
-
- Run the `postinstall` script to copy `.claude/` configuration
|
|
107
|
-
|
|
108
|
-
Then open a new terminal and start Claude Code to interact with your workspace through the MCP server.
|
|
109
|
-
|
|
110
|
-
### Updating the MCP Server
|
|
111
|
-
|
|
112
|
-
To get the latest version of the MCP server:
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
npm run mcp-update
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
This will:
|
|
119
|
-
- Update `@hailer/mcp` to the latest version
|
|
120
|
-
- Run the `postinstall` script to refresh `.claude/` configuration
|
|
121
|
-
|
|
122
|
-
**Note:** After updating, restart the MCP server and any running Claude Code agents that depend on it.
|
|
123
|
-
|
|
124
|
-
## Next Steps
|
|
125
|
-
|
|
126
|
-
After initialization:
|
|
127
|
-
|
|
128
|
-
1. Navigate to your project:
|
|
129
|
-
```bash
|
|
130
|
-
cd my-project
|
|
131
|
-
npm install
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
2. Pull your workspace configuration:
|
|
135
|
-
```bash
|
|
136
|
-
npm run pull
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
3. (Optional) If you set up the MCP server, start it:
|
|
140
|
-
```bash
|
|
141
|
-
npm run mcp-start
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
4. Start developing with type-safe workflow definitions!
|
|
145
|
-
|
|
146
|
-
## Notes
|
|
147
|
-
|
|
148
|
-
- The `.env` file contains your credentials - **never commit this to version control**
|
|
149
|
-
- The `.env.local` file (if MCP enabled) contains MCP server credentials - also git-ignored
|
|
150
|
-
- The generated `.gitignore` automatically excludes `.env`, `.env.local`, and `.claude/` for safety
|
|
151
|
-
- Type definitions are copied to your project for IDE support
|
|
152
|
-
- Bot credentials are displayed only once during initialization - save them securely!
|
|
153
|
-
- The MCP server is installed as an npm package (`@hailer/mcp`) in your `node_modules/`
|
|
154
|
-
|
|
155
|
-
## Troubleshooting
|
|
156
|
-
|
|
157
|
-
### MCP Server Setup Fails
|
|
158
|
-
|
|
159
|
-
If the MCP server setup fails during initialization:
|
|
160
|
-
- Check your network connection (npm package must be downloaded)
|
|
161
|
-
- Ensure you have Node.js 18+ installed
|
|
162
|
-
- Verify that `@hailer/mcp` package is available on npm
|
|
163
|
-
- Try running `npm install` manually after initialization to trigger the `postinstall` script
|
|
164
|
-
|
|
165
|
-
### Bot Account Creation Fails
|
|
166
|
-
|
|
167
|
-
If bot account creation fails:
|
|
168
|
-
- You can continue with your personal credentials
|
|
169
|
-
- The project will still be initialized successfully
|
|
170
|
-
- You can manually create a bot account later through the Hailer UI
|
|
171
|
-
|
|
172
|
-
### Workspace Creation Fails
|
|
173
|
-
|
|
174
|
-
If creating a new workspace fails:
|
|
175
|
-
- Select an existing workspace instead
|
|
176
|
-
- Check your account permissions
|
|
177
|
-
- Verify your network connection
|