add-block
Add new block (Discord, Slack, Notion integrations etc.) workflow. Use when adding new integration blocks or system blocks to the workflow engine.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Add New Block Workflow
新規ブロック(Discord, Slack, Notion等の外部連携)を追加する際のワークフロー。
必読ドキュメント
以下を必ず先に読むこと:
-
docs/designs/UNIFIED_BLOCK_MODEL.md- Block execution architecture -
docs/BLOCK_REGISTRY.md- Existing block definitions -
backend/migrations/011_unified_block_model.sql- 既存パターン確認
標準手順(Migration追加)
ほとんどのブロックはこの方式で追加する:
- Migrationファイル作成:
backend/migrations/XXX_{name}_block.sql -
block_definitionsテーブルにINSERT-
tenant_id = NULLでシステムブロック -
codeにJavaScriptコード(ctx.http等を使用) -
ui_configにアイコン・カラー・設定スキーマ
-
- Migration実行:
make db-reset -
docs/BLOCK_REGISTRY.mdを更新
コード例
INSERT INTO block_definitions (tenant_id, slug, name, category, code, ui_config, is_system)
VALUES (
NULL, -- システムブロック
'discord',
'Discord通知',
'integration',
$code$
const webhookUrl = config.webhook_url || ctx.secrets.DISCORD_WEBHOOK_URL;
const payload = { content: renderTemplate(config.message, input) };
return await ctx.http.post(webhookUrl, payload);
$code$,
'{"icon": "message-circle", "color": "#5865F2", "configSchema": {...}}',
TRUE
);
ctx インターフェース
| Interface | Purpose |
|---|---|
ctx.http |
HTTP requests (GET, POST, etc.) |
ctx.llm |
LLM API calls |
ctx.workflow |
Workflow control |
ctx.human |
Human-in-loop interactions |
ctx.secrets |
Access to stored secrets |
Go Adapterが必要な例外ケース
| ケース | 理由 |
|---|---|
| LLMプロバイダー追加 | ctx.llm経由で呼び出すため |
| 複雑な認証フロー | OAuth2等、JSでは困難な場合 |
| バイナリ処理 | 画像・ファイル処理等 |
Go Adapter追加が必要な場合:
- Create
backend/internal/adapter/{name}.go - Implement
Adapterinterface - Register in registry
- Add test
{name}_test.go - Update
docs/BACKEND.md
参考
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!