set -e
side=$1
cd "$MAC_WORK/$side"
mkdir -p "$MAC_WORK/$side-fixture"
cat > "$MAC_WORK/$side-fixture/graphql.config.ts" <<'FILE'
import type { CodegenConfig } from '@graphql-codegen/cli';

// Synthetic IME editing fixture.
const schema = './schema.graphql';

export default defineConfig({
  schema,
  documents: ['./src/**/*.graphql'],
});
FILE
git -C "$MAC_WORK/$side-fixture" init -q
node apps/server/src/bin.ts project add "$MAC_WORK/$side-fixture" --title 'IME proof' --base-dir "$MAC_WORK/$side-data" > "$MAC_WORK/$side-project.json"
node apps/server/src/bin.ts thread start "$MAC_WORK/$side-fixture" 'Ready for the file editor check.' --provider devReplay --model multi-turn --title 'IME Escape proof' --wait --json --base-dir "$MAC_WORK/$side-data" > "$MAC_WORK/$side-thread.json"
cat "$MAC_WORK/$side-thread.json"
