環境設定ファイルを追加し、make-json.shにエラーハンドリングとJSONスキーマのバリデーションを追加。新しいスクリプトpromote-manifest.shを作成し、マニフェスト生成のプロセスを強化。README.mdを更新し、プロンプト生成の構造を明確化。シーンとスタイルの登録ルールを整理し、スキーマファイルを追加。
This commit is contained in:
50
promote-manifest.sh
Normal file
50
promote-manifest.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PROMPT_JSON="$ROOT_DIR/output/prompt.json"
|
||||
MANIFEST_JSON="$ROOT_DIR/manifest.json"
|
||||
|
||||
if [ ! -f "$PROMPT_JSON" ]; then
|
||||
echo "[ERROR] prompt.json not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v jq >/dev/null 2>&1; then
|
||||
echo "[ERROR] jq not found. Install jq first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WORLD_ID=$(jq -r '.meta.world_id' "$PROMPT_JSON")
|
||||
WORLD_VERSION=$(jq -r '.meta.world_version' "$PROMPT_JSON")
|
||||
STYLE_ID=$(jq -r '.meta.style_id' "$PROMPT_JSON")
|
||||
SCENE_ID=$(jq -r '.meta.scene_id' "$PROMPT_JSON")
|
||||
TASK_TYPE=$(jq -r '.meta.task_type' "$PROMPT_JSON")
|
||||
|
||||
if [[ "$WORLD_ID" == "null" || "$STYLE_ID" == "null" || "$TASK_TYPE" == "null" ]]; then
|
||||
echo "[ERROR] Invalid meta fields in prompt.json"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat > "$MANIFEST_JSON" <<EOF
|
||||
{
|
||||
"version": "1.0",
|
||||
"world": {
|
||||
"id": "$WORLD_ID",
|
||||
"version": "$WORLD_VERSION"
|
||||
},
|
||||
"style": {
|
||||
"id": "$STYLE_ID"
|
||||
},
|
||||
"scene": {
|
||||
"id": "$SCENE_ID"
|
||||
},
|
||||
"task": {
|
||||
"type": "$TASK_TYPE",
|
||||
"prompt_ref": "output/prompt.json"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "[OK] manifest.json generated successfully."
|
||||
echo "[DONE] $MANIFEST_JSON"
|
||||
Reference in New Issue
Block a user