Files
agenticCode/scripts/restore-projects.sh
Ingo Schnabel c8ab0274c3 UI tests
2026-07-27 08:55:37 +02:00

34 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Recreate the standard test projects (idempotent: delete then create).
# Use after (re)starting the server to get a known baseline for ingest/perf testing.
#
# Snapshot of the live `GET /api/projects` state (regenerate from there if it drifts).
#
# ./scripts/restore-test-projects.sh # recreate all projects
# BASE=http://localhost:8787 ./scripts/restore-test-projects.sh
#
# After running, ingest as needed, e.g.:
# curl -X POST $BASE/api/projects/upms/ingest-call-graph # cheap whole-codebase call graph
# curl -X POST $BASE/api/projects/upms/ingest/KDWWIFN0 # deep-ingest one program
set -euo pipefail
BASE="${BASE:-http://localhost:8787}"
# name | JSON create body (language is required; generatedDir/userExitDir set together or not at all)
create() {
local name="$1" body="$2"
echo "== $name =="
curl -s -o /dev/null -w " delete: %{http_code}\n" -X DELETE "$BASE/api/projects/$name" || true
curl -s -o /dev/null -w " create: %{http_code}\n" -X POST "$BASE/api/projects/$name" \
-H 'Content-Type: application/json' \
-d "$body"
}
create ac '{"root":"/home/ingo/deve/agenticCode","excludeDirs":["target"],"language":"java"}'
create app '{"root":"/home/ingo/deve/uniqa/uniqa-upms-app","excludeDirs":["test","target"],"language":"java"}'
create pur '{"root":"/home/ingo/deve/uniqa/pur-sources/backend","excludeDirs":["test","target"],"language":"java"}'
create upms '{"root":"/home/ingo/deve/tools/conqat/system/src/250401_UMPS/src/pur-analysis/pur-legacy","excludeDirs":[],"language":"natural","generatedDir":"generated_src","userExitDir":"user_exit"}'
echo "Done. Current projects:"
curl -s "$BASE/api/projects"
echo