feat(onboard): user onboarding - no default USER.md, guided creation (#37)
- bootstrap no longer creates user/USER.md (owner direction) - scripts/onboard.sh: name REQUIRED (interactive loop or --name), optional fields prompted (profession, marital, age, gender, education, location, timezone, skillset, interests, hobbies, pets); flag-driven non-interactive mode for automation - templates/USER.md: canon skeleton, placeholder rendering, unfilled optional = (not provided) - agent.sh: auto-runs onboarding when profile missing (TTY gate); headless run-task warns and continues without user context - user profile dispatched to all launches (M14 layer) Closes #37 (onboarding requirements from owner layout review)
This commit is contained in:
@@ -352,6 +352,41 @@ else
|
||||
echo "skip live task cases (docker unavailable)"
|
||||
fi
|
||||
|
||||
# ---------- onboarding (M16): deterministic, no Docker ----------
|
||||
ONB="$SANDBOX/data"
|
||||
cat > "$SANDBOX/onb-config.json" <<EOF
|
||||
{"configVersion":1,"environment":"development","dataRoot":"$ONB","execution":{"backend":"docker","provider":"zai","model":"m"}}
|
||||
EOF
|
||||
|
||||
expect_exit "onboard without name exits 4 (non-interactive)" 4 -- \
|
||||
env MOSAIC_CONFIG="$SANDBOX/onb-config.json" scripts/onboard.sh --profession x
|
||||
expect_exit "onboard --name renders profile" 0 -- \
|
||||
env MOSAIC_CONFIG="$SANDBOX/onb-config.json" scripts/onboard.sh --name "Jason" --timezone "Europe/Berlin"
|
||||
[ -f "$ONB/user/USER.md" ] \
|
||||
&& check "profile written" 0 || check "profile written" 1
|
||||
grep -q "name: Jason" "$ONB/user/USER.md" \
|
||||
&& grep -q "(not provided)" "$ONB/user/USER.md" \
|
||||
&& check "canon structure: required filled, optional placeholdered" 0 \
|
||||
|| check "canon structure: required filled, optional placeholdered" 1
|
||||
grep -q "## Skillset" "$ONB/user/USER.md" && grep -q "## Pets" "$ONB/user/USER.md" \
|
||||
&& check "canon sections present" 0 || check "canon sections present" 1
|
||||
|
||||
# Live recall: real pi, real phrasing - assert containment, not exactness
|
||||
printf '{"taskVersion":1,"id":"t-user","prompt":"What is the user name? Reply with only the name.","session":"onb-check","timeoutSeconds":180}' > "$SANDBOX/recall-task.json"
|
||||
RC=0
|
||||
scripts/run-task.sh run "$SANDBOX/recall-task.json" >/dev/null 2>&1 || RC=$?
|
||||
[ "$RC" -eq 0 ] && check "user recall run succeeds" 0 || check "user recall run succeeds (exit $RC)" 1
|
||||
FR="$(ls -dt "$SANDBOX/data/runs"/r-* | head -1)"
|
||||
RESP="$(node -e 'try{const r=JSON.parse(require("fs").readFileSync(process.argv[1],"utf8"));console.log(r.response||"")}catch{console.log("")}' "$FR/result.json" 2>/dev/null)"
|
||||
echo "$RESP" | grep -qi "jason" \
|
||||
&& check "recalled user name (response: $RESP)" 0 || check "recalled user name (response: $RESP)" 1
|
||||
# headless run must NOT carry an agent identity section
|
||||
! grep -q 'AGENT IDENTITY' "$SANDBOX/data/system-prompt.md" 2>/dev/null \
|
||||
&& check "no agent identity on headless run" 0 || check "no agent identity on headless run" 1
|
||||
|
||||
git -C "$SANDBOX/repo" rev-parse >/dev/null 2>&1 || true
|
||||
unset MOSAIC_CONFIG
|
||||
|
||||
echo
|
||||
echo "selftest: $PASS passed, $FAIL failed"
|
||||
[ "$FAIL" -eq 0 ]
|
||||
|
||||
Reference in New Issue
Block a user