Windmillワークフロー開発環境の構築結果まとめ。サーバー接続確認、REST APIヘルパースクリプト作成、ワークフロー定義ファイル作成、wmill CLI制限の発見と代替策の実装を記録。

This commit is contained in:
Akira
2026-02-21 12:38:25 +09:00
parent d5cad8a691
commit 6172e800c2
5 changed files with 250 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
---
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