Files
windmill_workflow/.agent/workflows/windmill-new-script.md
2026-04-04 09:15:09 +09:00

54 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: 新しいWindmillスクリプトを作成する
---
# 新しいWindmillスクリプトの作成
Windmillに新しいスクリプトを追加する手順。
## 手順
1. **スクリプトファイルの作成**: スクリプトは以下のディレクトリ構造に従って作成する
- ユーザースクリプト: `u/<username>/<script_name>/`
- フォルダスクリプト: `f/<folder_name>/<script_name>/`
2. **ファイル構成**: 各スクリプトフォルダには以下のファイルが必要
- `script.yaml` — メタデータ(言語、概要、スキーマなど)
- スクリプト本体(例: `script.py`, `script.ts`, `script.sh`
3. **script.yaml のテンプレート**
```yaml
summary: '<スクリプトの説明>'
description: '<詳細な説明>'
lock: []
schema:
$schema: 'https://json-schema.org/draft/2020-12/schema'
type: object
properties:
param1:
type: string
description: '<パラメータの説明>'
required:
- param1
kind: script
tag: ''
```
4. **Pythonスクリプト (`script.py`) のテンプレート**
```python
def main(param1: str):
"""
スクリプトの説明
"""
return {"result": f"Hello, {param1}!"}
```
5. **TypeScriptスクリプト (`script.ts`) のテンプレート**
```typescript
export async function main(param1: string): Promise<any> {
return { result: `Hello, ${param1}!` };
}
```
6. **サーバーに反映**: `/windmill-push` ワークフローを実行してpush