Files
ai-engineering/scripts/native-smoke.sh
T
bquarkz 8160c991a4 feat: support simple projects and root Git repositories
Allow registering a single Git repository at the engineering project root with --path . while retaining path safety checks.

Document Git-optional projects first and cover plain folders, root repositories, and multiple repositories in process tests and native smoke scenarios.

Validated with 23 passing tests and macOS ARM64 native smoke checks for all three layouts.
2026-11-11 16:38:18 +00:00

96 lines
4.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Run from any directory. The executable argument must be an absolute native path.
aie_binary=${1:?Usage: native-smoke.sh /absolute/path/to/ai-engineering}
aie_fixture=$(mktemp -d "${TMPDIR:-/tmp}/ai-engineering-smoke.XXXXXX")
if [[ "${AIE_KEEP_FIXTURE:-0}" != 1 ]]; then trap 'rm -rf "$aie_fixture"' EXIT; fi
cd "$aie_fixture"
"$aie_binary" --help > help.txt
"$aie_binary" --version > version.txt
grep -q 'ai-engineering 0.1.0' version.txt
if "$aie_binary" --unknown > invalid.txt 2>&1; then
echo 'Invalid arguments unexpectedly succeeded' >&2
exit 1
else
test "$?" -eq 2
fi
aie_without_git() {
PATH="$aie_fixture/no-installed-tools" "$aie_binary" "$@"
}
# A source folder is a complete engineering project, even with no Git installed.
mkdir plain
cd plain
printf 'Existing source\n' > main.txt
aie_without_git init --name 'Simple Project' > init.yaml
aie_without_git work create 'Continue application' --goal 'Preserve local context' > work.yaml
aie_without_git discussion add WRK-0001 --text 'No repository is required' > discussion.yaml
aie_without_git artifact add WRK-0001 --file main.txt --purpose 'Initial source evidence' > artifact.yaml
aie_without_git decision draft WRK-0001 --title 'Pilot the protocol' --evidence ART-0001 > decision.yaml
aie_without_git work context WRK-0001 --format json > before.json
mkdir src
cd src
aie_without_git work context WRK-0001 --format json > ../after.json
cd ..
cmp before.json after.json
aie_without_git project validate --format json > validation.json
grep -q '"valid" : true' validation.json
test ! -e .git
cd "$aie_fixture"
# A single Git repository can contain both the source and protocol workspace.
git init -q single
cd single
"$aie_binary" init --name 'Single Repository' > init.yaml
"$aie_binary" repo add app --path . > repo.yaml
"$aie_binary" work create 'Inspect application' --repo app > work.yaml
"$aie_binary" work context WRK-0001 --format json > before.json
mkdir src
cd src
"$aie_binary" work context WRK-0001 --format json > ../after.json
cd ..
cmp before.json after.json
grep -q '"repositoryId" : "app"' after.json
"$aie_binary" project validate --format json > validation.json
grep -q '"valid" : true' validation.json
cd "$aie_fixture"
echo 'Native simple-project continuity smoke passed (without Git and with one root repository).'
# Git initialization is fixture setup, never an implicit CLI operation.
git init -q runtime
git init -q studio
for aie_repo in runtime studio; do
git -C "$aie_repo" -c user.name=Fixture -c user.email=fixture@example.invalid \
commit -q --allow-empty -m fixture
done
"$aie_binary" init --name 'Continuity Experiment' > init.yaml
"$aie_binary" repo add runtime --path runtime --language rust > runtime.yaml
"$aie_binary" repo add studio --path studio --language java > studio.yaml
"$aie_binary" work create 'Improve scene editor' --repo runtime --repo studio \
--goal 'Continue across agents' --constraint 'No server' \
--acceptance 'Fresh process reconstructs state' > work.yaml
"$aie_binary" discussion add WRK-0001 --kind QUESTION --author agent-a \
--text 'Evaluate Canvas rendering?' > discussion.yaml
printf 'Observed fixture result: 60 fps\n' > result.txt
"$aie_binary" artifact add WRK-0001 --file result.txt --purpose 'Rendering evidence' > artifact.yaml
"$aie_binary" decision draft WRK-0001 --title 'Evaluate layered Canvas' \
--evidence ART-0001 > decision.yaml
"$aie_binary" work context WRK-0001 --format json > before.json
mkdir -p studio/src/editor
cd studio/src/editor
"$aie_binary" work context WRK-0001 --format json > "$aie_fixture/after.json"
cd "$aie_fixture"
cmp before.json after.json
for aie_expected in runtime studio agent-a DRAFT sha256 'Continue across agents'; do
grep -q "$aie_expected" after.json
done
"$aie_binary" work context WRK-0001 --format markdown > context.md
"$aie_binary" project validate --format json > validation.json
grep -q '"valid" : true' validation.json
test ! -e .git
echo 'Native multi-repository continuity smoke passed.'
if [[ "${AIE_KEEP_FIXTURE:-0}" == 1 ]]; then echo "Fixture retained: $aie_fixture"; fi