Compare commits

..

1 commit

Author SHA1 Message Date
Agent
e06c3030f4 fix: feat(20b): dev-agent reads formula from .profile repo (#85)
Some checks failed
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline failed
2026-04-01 07:58:41 +00:00

View file

@ -155,7 +155,8 @@ load_formula_or_profile() {
if [ -n "$AGENT_IDENTITY" ] && ensure_profile_repo "$AGENT_IDENTITY"; then if [ -n "$AGENT_IDENTITY" ] && ensure_profile_repo "$AGENT_IDENTITY"; then
if [ -f "$PROFILE_FORMULA_PATH" ]; then if [ -f "$PROFILE_FORMULA_PATH" ]; then
log "formula source: .profile (${PROFILE_FORMULA_PATH})" log "formula source: .profile (${PROFILE_FORMULA_PATH})"
FORMULA_CONTENT=$(cat "$PROFILE_FORMULA_PATH") # shellcheck disable=SC2034
FORMULA_CONTENT="$(cat "$PROFILE_FORMULA_PATH")"
FORMULA_SOURCE=".profile" FORMULA_SOURCE=".profile"
return 0 return 0
else else
@ -167,7 +168,8 @@ load_formula_or_profile() {
if [ -n "$fallback_formula" ]; then if [ -n "$fallback_formula" ]; then
if [ -f "$fallback_formula" ]; then if [ -f "$fallback_formula" ]; then
log "formula source: formulas/ (fallback) — ${fallback_formula}" log "formula source: formulas/ (fallback) — ${fallback_formula}"
FORMULA_CONTENT=$(cat "$fallback_formula") # shellcheck disable=SC2034
FORMULA_CONTENT="$(cat "$fallback_formula")"
FORMULA_SOURCE="formulas/" FORMULA_SOURCE="formulas/"
return 0 return 0
else else
@ -176,6 +178,19 @@ load_formula_or_profile() {
fi fi
fi fi
# No fallback specified but role provided — construct fallback path
if [ -n "$role" ]; then
fallback_formula="${FACTORY_ROOT}/formulas/${role}.toml"
if [ -f "$fallback_formula" ]; then
log "formula source: formulas/ (fallback) — ${fallback_formula}"
# shellcheck disable=SC2034
FORMULA_CONTENT="$(cat "$fallback_formula")"
# shellcheck disable=SC2034
FORMULA_SOURCE="formulas/"
return 0
fi
fi
# No fallback specified # No fallback specified
log "ERROR: formula not found in .profile and no fallback specified" log "ERROR: formula not found in .profile and no fallback specified"
return 1 return 1