Skip to content

Commit e540f5f

Browse files
committed
Merge branch 'improvement/platform' into dev
2 parents fe2bc50 + 9c71774 commit e540f5f

1,431 files changed

Lines changed: 97456 additions & 39901 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/add-block/SKILL.md

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,19 +627,78 @@ export const ServiceV2Block: BlockConfig = {
627627
}
628628
```
629629

630+
## Block Metadata (BlockMeta)
631+
632+
Every integration block **must** export a `{Service}BlockMeta` object at the bottom of the block file. This metadata drives the integration catalog, tag filters, and workflow template suggestions shown to users.
633+
634+
### Structure
635+
636+
```typescript
637+
import type { BlockConfig, BlockMeta } from '@/blocks/types'
638+
639+
// ... block definition above ...
640+
641+
export const {Service}BlockMeta = {
642+
tags: ['messaging', 'automation'], // Same tags as the block's tags field
643+
templates: [ // Optional but strongly encouraged
644+
{
645+
icon: {Service}Icon,
646+
title: '{Service} use-case title',
647+
prompt: 'Build a workflow that ...',
648+
modules: ['agent', 'workflows'], // Modules the template uses
649+
category: 'productivity', // Template category
650+
tags: ['automation'], // Template-level tags
651+
alsoIntegrations: ['slack'], // Other blocks referenced in the prompt (optional)
652+
},
653+
],
654+
} as const satisfies BlockMeta
655+
```
656+
657+
### Rules
658+
659+
- **Import `BlockMeta`** from `@/blocks/types` alongside `BlockConfig`
660+
- **`tags`** must match the `tags` array on the block config exactly
661+
- **Templates are optional** but should be added for any integration that has a recognizable use case — aim for 2–4 templates per block
662+
- **Template `prompt`** should start with "Build a workflow that..." or "Create a workflow that..." and be concrete enough to generate a real workflow in Mothership
663+
- **Template `modules`** lists the Sim modules the template relies on: `'knowledge-base' | 'tables' | 'files' | 'workflows' | 'scheduled' | 'agent'`
664+
- **Template `category`** is one of: `'popular' | 'sales' | 'support' | 'engineering' | 'marketing' | 'productivity' | 'operations'`
665+
- **`alsoIntegrations`** names other block types (e.g. `'slack'`, `'linear'`) referenced in the template prompt — helps the catalog surface this template when those blocks are selected
666+
- Place the export **after** the main `{Service}Block` export, at the very bottom of the file
667+
668+
### Register in the blocksMeta object
669+
670+
After adding `{Service}BlockMeta` to the block file, register it in `apps/sim/blocks/registry.ts`:
671+
672+
```typescript
673+
// Add import (alongside the block import, alphabetically)
674+
import { ServiceBlock, ServiceBlockMeta } from '@/blocks/blocks/service'
675+
676+
// Add to blocksMeta object (alphabetically)
677+
export const blocksMeta = {
678+
// ... existing entries ...
679+
service: ServiceBlockMeta,
680+
}
681+
```
682+
630683
## Registering Blocks
631684

632685
After creating the block, remind the user to:
633-
1. Import in `apps/sim/blocks/registry.ts`
686+
1. Import `{Service}Block` and `{Service}BlockMeta` in `apps/sim/blocks/registry.ts`
634687
2. Add to the `registry` object (alphabetically):
688+
3. Add to the `blocksMeta` object (alphabetically):
635689

636690
```typescript
637-
import { ServiceBlock } from '@/blocks/blocks/service'
691+
import { ServiceBlock, ServiceBlockMeta } from '@/blocks/blocks/service'
638692

639693
export const registry: Record<string, BlockConfig> = {
640694
// ... existing blocks ...
641695
service: ServiceBlock,
642696
}
697+
698+
export const blocksMeta = {
699+
// ... existing entries ...
700+
service: ServiceBlockMeta,
701+
}
643702
```
644703

645704
## Complete Example
@@ -827,7 +886,10 @@ All tool IDs referenced in `tools.access` and returned by `tools.config.tool` MU
827886
- [ ] Tools.access lists all tool IDs (snake_case)
828887
- [ ] Tools.config.tool returns correct tool ID (snake_case)
829888
- [ ] Outputs match tool outputs
830-
- [ ] Block registered in registry.ts
889+
- [ ] Block registered in `registry.ts` blocks object (alphabetically)
890+
- [ ] `{Service}BlockMeta` exported at bottom of block file with `tags` and `templates`
891+
- [ ] `BlockMeta` imported from `@/blocks/types` alongside `BlockConfig`
892+
- [ ] Block meta registered in `registry.ts` blocksMeta object (alphabetically)
831893
- [ ] If icon missing: asked user to provide SVG
832894
- [ ] If triggers exist: `triggers` config set, trigger subBlocks spread
833895
- [ ] Optional/rarely-used fields set to `mode: 'advanced'`

.agents/skills/add-integration/SKILL.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const {service}{Action}Tool: ToolConfig<Params, Response> = {
128128
### Block Structure
129129
```typescript
130130
import { {Service}Icon } from '@/components/icons'
131-
import type { BlockConfig } from '@/blocks/types'
131+
import type { BlockConfig, BlockMeta } from '@/blocks/types'
132132
import { AuthMode } from '@/blocks/types'
133133
import { getScopesForService } from '@/lib/oauth/utils'
134134

@@ -177,8 +177,32 @@ export const {Service}Block: BlockConfig = {
177177

178178
outputs: { /* ... */ },
179179
}
180+
181+
export const {Service}BlockMeta = {
182+
tags: ['tag1', 'tag2'], // IntegrationTag values matching the service's capabilities
183+
templates: [
184+
{
185+
icon: {Service}Icon,
186+
title: '{Service} use-case title',
187+
prompt: 'Build a workflow that ...',
188+
modules: ['agent', 'workflows'],
189+
category: 'productivity',
190+
tags: ['automation'],
191+
alsoIntegrations: ['slack'], // Optional: other blocks referenced in the prompt
192+
},
193+
],
194+
} as const satisfies BlockMeta
180195
```
181196

197+
### BlockMeta rules
198+
199+
- **Tags**: Use `IntegrationTag` values from `@/blocks/types`. Do NOT add a `tags` field to the `BlockConfig` object — tags belong only in `BlockMeta`.
200+
- **`integrationType`**: Must be a valid `IntegrationType` enum value (AI, Analytics, Commerce, Communication, Databases, DevOps, Documents, Email, HR, Marketing, Observability, Productivity, Sales, Search, Security, Support). Never invent a value that doesn't exist in the enum.
201+
- **Templates**: Aim for 2–4 templates per integration. Prompts should be concrete enough to generate a real workflow in Mothership. Start with "Build a workflow that..." or "Create a workflow that...".
202+
- **`alsoIntegrations`**: List other block type IDs referenced in the template prompt (e.g. `'slack'`, `'linear'`).
203+
- Place `{Service}BlockMeta` at the very bottom of the file, after the main block export.
204+
- Register it in both the import and the `blocksMeta` object in `registry.ts`.
205+
182206
### Key SubBlock Patterns
183207

184208
**Condition-based visibility:**
@@ -359,14 +383,20 @@ export const tools: Record<string, ToolConfig> = {
359383
### Block Registry (`apps/sim/blocks/registry.ts`)
360384

361385
```typescript
362-
// Add import (alphabetically)
363-
import { {Service}Block } from '@/blocks/blocks/{service}'
386+
// Add import (alphabetically) — include BlockMeta
387+
import { {Service}Block, {Service}BlockMeta } from '@/blocks/blocks/{service}'
364388

365-
// Add to registry (alphabetically)
389+
// Add to blocks registry (alphabetically)
366390
export const registry: Record<string, BlockConfig> = {
367391
// ... existing blocks ...
368392
{service}: {Service}Block,
369393
}
394+
395+
// Add to blocksMeta registry (alphabetically)
396+
export const blocksMeta = {
397+
// ... existing entries ...
398+
{service}: {Service}BlockMeta,
399+
}
370400
```
371401

372402
### Trigger Registry (`apps/sim/triggers/registry.ts`) - If triggers exist
@@ -433,7 +463,12 @@ If creating V2 versions (API-aligned outputs):
433463
- [ ] Configured tools.access with all tool IDs
434464
- [ ] Configured tools.config.tool selector
435465
- [ ] Defined outputs matching tool outputs
436-
- [ ] Registered block in `blocks/registry.ts`
466+
- [ ] `integrationType` uses a valid `IntegrationType` enum value (no invented values)
467+
- [ ] No `tags` field on the `BlockConfig` object (tags live only in `BlockMeta`)
468+
- [ ] `{Service}BlockMeta` exported at bottom of file with `tags` and `templates`
469+
- [ ] `BlockMeta` type imported from `@/blocks/types` alongside `BlockConfig`
470+
- [ ] Block registered in `blocks/registry.ts` blocks object (alphabetically)
471+
- [ ] Block meta registered in `blocks/registry.ts` blocksMeta object (alphabetically)
437472
- [ ] If triggers: set `triggers.enabled` and `triggers.available`
438473
- [ ] If triggers: spread trigger subBlocks with `getTrigger()`
439474

.claude/commands/add-block.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,33 @@ Use `wandConfig` for fields that are hard to fill out manually, such as timestam
798798

799799
All tool IDs referenced in `tools.access` and returned by `tools.config.tool` MUST use `snake_case` (e.g., `x_create_tweet`, `slack_send_message`). Never use camelCase or PascalCase.
800800

801+
## BlockMeta (Required)
802+
803+
Every block file must export a `{Service}BlockMeta` alongside the block — **minimum 7 templates**. Look at existing examples in `apps/sim/blocks/blocks/` (e.g. `browser_use.ts`, `google_sheets.ts`) for the pattern.
804+
805+
```typescript
806+
import type { BlockMeta } from '@/blocks/types'
807+
808+
export const {Service}BlockMeta = {
809+
tags: ['tag1', 'tag2'], // IntegrationTag[]
810+
templates: [
811+
{
812+
icon: {Service}Icon,
813+
title: '{Service} <use-case>', // 2–5 words
814+
prompt: 'Build a workflow that...', // specific use case, 1–3 sentences
815+
modules: ['agent', 'workflows'], // 'agent' | 'workflows' | 'tables' | 'files' | 'scheduled' | 'knowledge-base'
816+
category: 'operations', // 'operations' | 'marketing' | 'sales' | 'engineering' | 'productivity' | 'support' | 'popular'
817+
tags: ['automation'],
818+
alsoIntegrations: ['slack'], // optional — other block IDs referenced in the prompt
819+
featured: true, // optional
820+
},
821+
// ... at least 6 more
822+
],
823+
} as const satisfies BlockMeta
824+
```
825+
826+
Derive templates from the service's real use cases. Each prompt should name a concrete trigger, transformation, and output — not a generic description of what the service does.
827+
801828
## Checklist Before Finishing
802829

803830
- [ ] `integrationType` is set to the correct `IntegrationType` enum value
@@ -816,6 +843,7 @@ All tool IDs referenced in `tools.access` and returned by `tools.config.tool` MU
816843
- [ ] If triggers exist: `triggers` config set, trigger subBlocks spread
817844
- [ ] Optional/rarely-used fields set to `mode: 'advanced'`
818845
- [ ] Timestamps and complex inputs have `wandConfig` enabled
846+
- [ ] Exported `{Service}BlockMeta` with at least 7 templates
819847

820848
## Final Validation (Required)
821849

@@ -829,3 +857,4 @@ After creating the block, you MUST validate it against every tool it references:
829857
- Type coercions in `tools.config.params` for any params that need conversion (Number(), Boolean(), JSON.parse())
830858
3. **Verify block outputs** cover the key fields returned by all tools
831859
4. **Verify conditions** — each subBlock should only show for the operations that actually use it
860+
5. **Verify `{Service}BlockMeta` is exported** with at least 7 templates, each having `icon`, `title`, `prompt`, `modules`, `category`, and `tags`

.claude/commands/add-integration.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,28 @@ export const {Service}Block: BlockConfig = {
221221
- **Inputs section:** Must list canonical param IDs (e.g., `fileId`), NOT raw subblock IDs (e.g., `fileSelector`, `manualFileId`)
222222
- **Params function:** Must use canonical param IDs, NOT raw subblock IDs (raw IDs are deleted after canonical transformation)
223223

224+
### BlockMeta (Required)
225+
226+
Export a `{Service}BlockMeta` in the same file as the block — **minimum 7 templates**. See `add-block.md` → "BlockMeta (Required)" for valid `modules` and `category` values and the full pattern.
227+
228+
```typescript
229+
export const {Service}BlockMeta = {
230+
tags: ['tag1', 'tag2'],
231+
templates: [
232+
{
233+
icon: {Service}Icon,
234+
title: '{Service} <use-case>',
235+
prompt: 'Build a workflow that...', // concrete trigger → transformation → output
236+
modules: ['agent', 'workflows'],
237+
category: 'operations',
238+
tags: ['automation'],
239+
alsoIntegrations: ['slack'], // when the prompt references another service
240+
},
241+
// ... at least 6 more
242+
],
243+
} as const satisfies BlockMeta
244+
```
245+
224246
## Step 4: Add Icon
225247

226248
### File Location
@@ -424,6 +446,7 @@ If creating V2 versions (API-aligned outputs):
424446
- [ ] Registered block in `blocks/registry.ts`
425447
- [ ] If triggers: set `triggers.enabled` and `triggers.available`
426448
- [ ] If triggers: spread trigger subBlocks with `getTrigger()`
449+
- [ ] Exported `{Service}BlockMeta` with at least 7 templates
427450

428451
### OAuth Scopes (if OAuth service)
429452
- [ ] Defined scopes in `lib/oauth/oauth.ts` under `OAUTH_PROVIDERS`
@@ -454,6 +477,7 @@ If creating V2 versions (API-aligned outputs):
454477
- [ ] Verified block subBlocks cover all required tool params with correct conditions
455478
- [ ] Verified block outputs match what the tools actually return
456479
- [ ] Verified `tools.config.params` correctly maps and coerces all param types
480+
- [ ] `{Service}BlockMeta` exported with at least 7 templates, each having `icon`, `title`, `prompt`, `modules`, `category`, and `tags`
457481

458482
## Example Command
459483

.claude/commands/validate-integration.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ For **each tool** in `tools.access`:
192192
- [ ] `authMode` is set correctly (`AuthMode.OAuth` or `AuthMode.ApiKey`)
193193
- [ ] Block is registered in `blocks/registry.ts` alphabetically
194194

195+
### BlockMeta
196+
- [ ] `{Service}BlockMeta` is exported in the same file as the block
197+
- [ ] Has at least 7 templates, each with `icon`, `title`, `prompt`, `modules`, `category`, and `tags`
198+
- [ ] Prompts describe concrete use cases, not generic descriptions of what the service does
199+
- [ ] `alsoIntegrations` is set on any template whose prompt references another service
200+
195201
### Block Inputs
196202
- [ ] `inputs` section lists all subBlock params that the block accepts
197203
- [ ] Input types match the subBlock types
@@ -282,6 +288,7 @@ After fixing, confirm:
282288
- [ ] Validated pagination consistency across tools and block
283289
- [ ] Validated error handling (error checks, meaningful messages)
284290
- [ ] Validated registry entries (tools and block, alphabetical, correct imports)
291+
- [ ] Validated `{Service}BlockMeta` exported with at least 7 templates
285292
- [ ] Reported all issues grouped by severity
286293
- [ ] Fixed all critical and warning issues
287294
- [ ] Ran `bun run lint` after fixes

0 commit comments

Comments
 (0)