main
John Lauer Publish 0.1.60 ae904c3
#!/bin/bash
# Start a new flow app from this template: new-flow.sh <stage> <dest dir>
# e.g. new-flow.sh probing ~/project/adom-aiflow-probing  ->  binary adom-aiflow-probing, project folder probing-flow/
set -e
STAGE="$1"; DEST="$2"
[ -n "$STAGE" ] && [ -n "$DEST" ] || { echo "usage: new-flow.sh <stage> <dest dir>"; exit 1; }
[ -e "$DEST" ] && { echo "ERROR: $DEST exists"; exit 1; }
HERE="$(cd "$(dirname "$0")" && pwd)"
cp -r "$HERE" "$DEST"; rm -rf "$DEST/target" "$DEST/new-flow.sh"
grep -rl "adom-aiflow-example\|example-flow" "$DEST" | xargs sed -i "s/adom-aiflow-example/adom-aiflow-$STAGE/g; s/example-flow/$STAGE-flow/g"
sed -i "s/\"name\": \"example\"/\"name\": \"$STAGE\"/" "$DEST/flows/flow.json"
mv "$DEST/skill" "$DEST/skills-tmp"; mkdir -p "$DEST/skills/adom-aiflow-$STAGE"; mv "$DEST/skills-tmp/SKILL.md" "$DEST/skills/adom-aiflow-$STAGE/SKILL.md"; rmdir "$DEST/skills-tmp"
echo "OK: adom-aiflow-$STAGE in $DEST. Next: write flows/flow.json and skills/adom-aiflow-$STAGE/SKILL.md, add your verbs, ./build.sh"