Skip to content

Commit bb55f07

Browse files
authored
Merge pull request #334 from Data-Wise/dev
Release: v6.3.0 — Teaching Style Consolidation + Help Compliance
2 parents 16b8f43 + 3ae8598 commit bb55f07

10 files changed

Lines changed: 1240 additions & 15 deletions

flow.plugin.zsh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ source "$FLOW_PLUGIN_DIR/lib/ai-usage.zsh"
4040
source "$FLOW_PLUGIN_DIR/lib/help-browser.zsh"
4141
source "$FLOW_PLUGIN_DIR/lib/inventory.zsh"
4242
source "$FLOW_PLUGIN_DIR/lib/teaching-utils.zsh"
43+
source "$FLOW_PLUGIN_DIR/lib/teach-style-helpers.zsh"
4344
source "$FLOW_PLUGIN_DIR/lib/keychain-helpers.zsh"
4445
source "$FLOW_PLUGIN_DIR/lib/backup-helpers.zsh"
4546
source "$FLOW_PLUGIN_DIR/lib/cache-helpers.zsh"

lib/dispatchers/teach-dispatcher.zsh

Lines changed: 256 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4638,6 +4638,252 @@ ${FLOW_COLORS[bold]}LEARN MORE${FLOW_COLORS[reset]}
46384638
EOF
46394639
}
46404640

4641+
# =============================================================================
4642+
# TEACHING STYLE COMMANDS (v6.3.0 - Teaching Style Consolidation)
4643+
# =============================================================================
4644+
4645+
_teach_style() {
4646+
local subcmd="${1:-show}"
4647+
shift 2>/dev/null
4648+
4649+
case "$subcmd" in
4650+
show|s|"")
4651+
_teach_style_show "$@"
4652+
;;
4653+
check|c)
4654+
_teach_style_check "$@"
4655+
;;
4656+
help|--help|-h)
4657+
_teach_style_help
4658+
;;
4659+
*)
4660+
_teach_error "Unknown style command: $subcmd"
4661+
_teach_style_help
4662+
return 1
4663+
;;
4664+
esac
4665+
}
4666+
4667+
_teach_style_show() {
4668+
# Color fallbacks
4669+
if [[ -z "$_C_BOLD" ]]; then
4670+
_C_BOLD='\033[1m'
4671+
_C_DIM='\033[2m'
4672+
_C_NC='\033[0m'
4673+
_C_GREEN='\033[32m'
4674+
_C_YELLOW='\033[33m'
4675+
_C_CYAN='\033[36m'
4676+
fi
4677+
4678+
echo ""
4679+
echo -e "${_C_BOLD}╭─────────────────────────────────────────────╮${_C_NC}"
4680+
echo -e "${_C_BOLD}│ 📚 Teaching Style Configuration │${_C_NC}"
4681+
echo -e "${_C_BOLD}╰─────────────────────────────────────────────╯${_C_NC}"
4682+
echo ""
4683+
4684+
# Find source
4685+
if ! typeset -f _teach_find_style_source >/dev/null 2>&1; then
4686+
echo " ${FLOW_COLORS[error]}${FLOW_COLORS[reset]} Teaching style helpers not loaded"
4687+
return 1
4688+
fi
4689+
4690+
local source
4691+
source=$(_teach_find_style_source "." 2>/dev/null)
4692+
4693+
if [[ -z "$source" ]]; then
4694+
echo " ${FLOW_COLORS[warning]}${FLOW_COLORS[reset]} No teaching style configured"
4695+
echo ""
4696+
echo " ${FLOW_COLORS[muted]}Add a teaching_style section to .flow/teach-config.yml${FLOW_COLORS[reset]}"
4697+
echo " ${FLOW_COLORS[muted]}See: docs/reference/REFCARD-TEACH-CONFIG-SCHEMA.md${FLOW_COLORS[reset]}"
4698+
echo ""
4699+
return 0
4700+
fi
4701+
4702+
local path="${source%%:*}"
4703+
local type="${source##*:}"
4704+
4705+
# Source info
4706+
echo -e " ${_C_BOLD}Source:${_C_NC} $path"
4707+
case "$type" in
4708+
teach-config)
4709+
echo -e " ${_C_BOLD}Type:${_C_NC} ${_C_GREEN}Unified config${_C_NC} (recommended)"
4710+
;;
4711+
legacy-md)
4712+
if _teach_style_is_redirect "."; then
4713+
echo -e " ${_C_BOLD}Type:${_C_NC} ${_C_YELLOW}Redirect shim${_C_NC} → .flow/teach-config.yml"
4714+
else
4715+
echo -e " ${_C_BOLD}Type:${_C_NC} ${_C_YELLOW}Legacy markdown${_C_NC} (consider migrating)"
4716+
fi
4717+
;;
4718+
esac
4719+
echo ""
4720+
4721+
# Display key settings
4722+
if ! command -v yq &>/dev/null; then
4723+
echo " ${FLOW_COLORS[error]}${FLOW_COLORS[reset]} yq required to display settings"
4724+
return 1
4725+
fi
4726+
4727+
local approach=$(_teach_get_style "pedagogical_approach.primary" 2>/dev/null)
4728+
local formality=$(_teach_get_style "explanation_style.formality" 2>/dev/null)
4729+
local proof_style=$(_teach_get_style "explanation_style.proof_style" 2>/dev/null)
4730+
local code_style=$(_teach_get_style "content_preferences.code_style" 2>/dev/null)
4731+
local tools=$(_teach_get_style "content_preferences.computational_tools" 2>/dev/null)
4732+
local exam_fmt=$(_teach_get_style "assessment_philosophy.exam_format" 2>/dev/null)
4733+
4734+
echo -e " ${_C_BOLD}Key Settings:${_C_NC}"
4735+
[[ -n "$approach" && "$approach" != "null" ]] && echo -e " Approach: ${_C_CYAN}$approach${_C_NC}"
4736+
[[ -n "$formality" && "$formality" != "null" ]] && echo -e " Formality: ${_C_CYAN}$formality${_C_NC}"
4737+
[[ -n "$proof_style" && "$proof_style" != "null" ]] && echo -e " Proofs: ${_C_CYAN}$proof_style${_C_NC}"
4738+
[[ -n "$code_style" && "$code_style" != "null" ]] && echo -e " Code style: ${_C_CYAN}$code_style${_C_NC}"
4739+
[[ -n "$tools" && "$tools" != "null" ]] && echo -e " Tools: ${_C_CYAN}$tools${_C_NC}"
4740+
[[ -n "$exam_fmt" && "$exam_fmt" != "null" ]] && echo -e " Exams: ${_C_CYAN}$exam_fmt${_C_NC}"
4741+
echo ""
4742+
4743+
# Show command overrides summary
4744+
if [[ "$type" == "teach-config" && -f ".flow/teach-config.yml" ]]; then
4745+
local overrides
4746+
overrides=$(yq '.teaching_style.command_overrides // ""' ".flow/teach-config.yml" 2>/dev/null)
4747+
if [[ -n "$overrides" && "$overrides" != "null" && "$overrides" != "" ]]; then
4748+
local -a cmds
4749+
cmds=($(yq '.teaching_style.command_overrides | keys | .[]' ".flow/teach-config.yml" 2>/dev/null))
4750+
if (( ${#cmds} > 0 )); then
4751+
echo -e " ${_C_BOLD}Command Overrides:${_C_NC}"
4752+
for cmd in "${cmds[@]}"; do
4753+
echo -e " ${_C_CYAN}$cmd${_C_NC}"
4754+
done
4755+
echo ""
4756+
fi
4757+
fi
4758+
fi
4759+
}
4760+
4761+
_teach_style_check() {
4762+
echo ""
4763+
echo "Running teaching style validation..."
4764+
echo ""
4765+
4766+
if ! typeset -f _teach_find_style_source >/dev/null 2>&1; then
4767+
echo " ${FLOW_COLORS[error]}${FLOW_COLORS[reset]} Teaching style helpers not loaded"
4768+
return 1
4769+
fi
4770+
4771+
local -i issues=0
4772+
4773+
# 1. Check source exists
4774+
local source
4775+
source=$(_teach_find_style_source "." 2>/dev/null)
4776+
4777+
if [[ -z "$source" ]]; then
4778+
echo " ${FLOW_COLORS[warning]}${FLOW_COLORS[reset]} No teaching style configured"
4779+
((issues++))
4780+
else
4781+
local path="${source%%:*}"
4782+
local type="${source##*:}"
4783+
echo " ${FLOW_COLORS[success]}${FLOW_COLORS[reset]} Source: $path ($type)"
4784+
4785+
# 2. Check yq can parse it
4786+
if command -v yq &>/dev/null; then
4787+
if [[ "$type" == "teach-config" ]]; then
4788+
if yq '.teaching_style' "$path" &>/dev/null; then
4789+
echo " ${FLOW_COLORS[success]}${FLOW_COLORS[reset]} YAML syntax valid"
4790+
else
4791+
echo " ${FLOW_COLORS[error]}${FLOW_COLORS[reset]} YAML parse error in teaching_style"
4792+
((issues++))
4793+
fi
4794+
fi
4795+
4796+
# 3. Check required sub-sections
4797+
local approach=$(_teach_get_style "pedagogical_approach" 2>/dev/null)
4798+
if [[ -z "$approach" || "$approach" == "null" ]]; then
4799+
echo " ${FLOW_COLORS[warning]}${FLOW_COLORS[reset]} Missing: pedagogical_approach"
4800+
((issues++))
4801+
else
4802+
echo " ${FLOW_COLORS[success]}${FLOW_COLORS[reset]} Has pedagogical_approach"
4803+
fi
4804+
4805+
local explanation=$(_teach_get_style "explanation_style" 2>/dev/null)
4806+
if [[ -z "$explanation" || "$explanation" == "null" ]]; then
4807+
echo " ${FLOW_COLORS[warning]}${FLOW_COLORS[reset]} Missing: explanation_style"
4808+
((issues++))
4809+
else
4810+
echo " ${FLOW_COLORS[success]}${FLOW_COLORS[reset]} Has explanation_style"
4811+
fi
4812+
4813+
local content=$(_teach_get_style "content_preferences" 2>/dev/null)
4814+
if [[ -z "$content" || "$content" == "null" ]]; then
4815+
echo " ${FLOW_COLORS[warning]}${FLOW_COLORS[reset]} Missing: content_preferences"
4816+
((issues++))
4817+
else
4818+
echo " ${FLOW_COLORS[success]}${FLOW_COLORS[reset]} Has content_preferences"
4819+
fi
4820+
else
4821+
echo " ${FLOW_COLORS[warning]}${FLOW_COLORS[reset]} yq not installed (brew install yq)"
4822+
((issues++))
4823+
fi
4824+
4825+
# 4. Check redirect shim consistency
4826+
if [[ "$type" == "teach-config" && -f ".claude/teaching-style.local.md" ]]; then
4827+
if _teach_style_is_redirect "."; then
4828+
echo " ${FLOW_COLORS[success]}${FLOW_COLORS[reset]} Legacy shim has redirect"
4829+
else
4830+
echo " ${FLOW_COLORS[warning]}${FLOW_COLORS[reset]} Legacy file exists without redirect"
4831+
((issues++))
4832+
fi
4833+
fi
4834+
fi
4835+
4836+
echo ""
4837+
if (( issues == 0 )); then
4838+
echo " ${FLOW_COLORS[success]}✓ All checks passed${FLOW_COLORS[reset]}"
4839+
else
4840+
echo " ${FLOW_COLORS[warning]}$issues issue(s) found${FLOW_COLORS[reset]}"
4841+
fi
4842+
echo ""
4843+
4844+
return $((issues > 0 ? 1 : 0))
4845+
}
4846+
4847+
_teach_style_help() {
4848+
# Color fallbacks
4849+
if [[ -z "$_C_BOLD" ]]; then
4850+
_C_BOLD='\033[1m'
4851+
_C_DIM='\033[2m'
4852+
_C_NC='\033[0m'
4853+
_C_GREEN='\033[32m'
4854+
_C_YELLOW='\033[33m'
4855+
_C_CYAN='\033[36m'
4856+
fi
4857+
4858+
echo -e "
4859+
${_C_BOLD}╭─────────────────────────────────────────────╮${_C_NC}
4860+
${_C_BOLD}│ teach style - Teaching Style Management │${_C_NC}
4861+
${_C_BOLD}╰─────────────────────────────────────────────╯${_C_NC}
4862+
4863+
${_C_GREEN}🔥 MOST COMMON${_C_NC}:
4864+
${_C_CYAN}teach style${_C_NC} Show current teaching style
4865+
${_C_CYAN}teach style check${_C_NC} Validate configuration
4866+
4867+
${_C_YELLOW}💡 QUICK EXAMPLES${_C_NC}:
4868+
${_C_DIM}\$${_C_NC} teach style ${_C_DIM}# Display settings${_C_NC}
4869+
${_C_DIM}\$${_C_NC} teach style show ${_C_DIM}# Same as above${_C_NC}
4870+
${_C_DIM}\$${_C_NC} teach style check ${_C_DIM}# Validate config${_C_NC}
4871+
4872+
${_C_BOLD}SUBCOMMANDS${_C_NC}:
4873+
${_C_CYAN}show${_C_NC} (default) Display current style source and key settings
4874+
${_C_CYAN}check${_C_NC} Validate teaching style configuration
4875+
4876+
${_C_BOLD}RESOLUTION ORDER${_C_NC}:
4877+
1. .flow/teach-config.yml → teaching_style section (preferred)
4878+
2. .claude/teaching-style.local.md → YAML frontmatter (legacy)
4879+
4880+
${_C_YELLOW}💡 TIP${_C_NC}: Consolidate your teaching style into .flow/teach-config.yml
4881+
for a single source of truth.
4882+
4883+
${_C_DIM}📚 See also: teach config, teach doctor${_C_NC}
4884+
"
4885+
}
4886+
46414887
_teach_dispatcher_help() {
46424888
# Color fallbacks
46434889
if [[ -z "$_C_BOLD" ]]; then
@@ -4684,6 +4930,7 @@ ${_C_BLUE}📋 SETUP & CONFIGURATION${_C_NC}:
46844930
${_C_CYAN}teach templates${_C_NC} Template management
46854931
${_C_CYAN}teach macros${_C_NC} LaTeX macro management
46864932
${_C_CYAN}teach prompt${_C_NC} AI prompt management
4933+
${_C_CYAN}teach style${_C_NC} Teaching style management
46874934
${_C_CYAN}teach migrate-config${_C_NC} Extract lesson plans
46884935
46894936
${_C_BLUE}📋 CONTENT CREATION${_C_NC} ${_C_DIM}(Scholar AI)${_C_NC}:
@@ -4719,7 +4966,7 @@ ${_C_MAGENTA}💡 TIP${_C_NC}: Content generation requires Scholar plugin
47194966
${_C_DIM} hw=assignment syl=syllabus rb=rubric fb=feedback${_C_NC}
47204967
${_C_DIM} Quality: val=validate concept=analyze prof=profiles cl=clean${_C_NC}
47214968
${_C_DIM} Manage: d=deploy s=status w=week bk=backup a=archive${_C_NC}
4722-
${_C_DIM} Tools: pl=plan tmpl=templates m=macros pr=prompt migrate=migrate-config${_C_NC}
4969+
${_C_DIM} Tools: pl=plan tmpl=templates m=macros pr=prompt st=style migrate=migrate-config${_C_NC}
47234970
47244971
${_C_DIM}📚 See also:${_C_NC}
47254972
${_C_CYAN}qu${_C_NC} - Quarto commands (qu preview, qu render)
@@ -4977,6 +5224,14 @@ teach() {
49775224
esac
49785225
;;
49795226

5227+
# Teaching style management (v6.3.0 - Teaching Style Consolidation)
5228+
style|st)
5229+
case "$1" in
5230+
--help|-h|help) _teach_style_help; return 0 ;;
5231+
*) _teach_style "$@" ;;
5232+
esac
5233+
;;
5234+
49805235
*)
49815236
_teach_error "Unknown command: $cmd"
49825237
echo ""

lib/dispatchers/teach-doctor-impl.zsh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ _teach_doctor() {
7777
echo ""
7878
fi
7979
_teach_doctor_check_macros
80+
if [[ "$json" == "false" ]]; then
81+
echo ""
82+
fi
83+
_teach_doctor_check_teaching_style
8084

8185
# Output results
8286
if [[ "$json" == "true" ]]; then
@@ -731,5 +735,78 @@ _teach_doctor_check_macros() {
731735
fi
732736
}
733737

738+
# Check teaching style configuration (v6.3.0 - Teaching Style Consolidation)
739+
_teach_doctor_check_teaching_style() {
740+
if [[ "$json" == "false" ]]; then
741+
echo "Teaching Style:"
742+
fi
743+
744+
# Ensure helpers are loaded
745+
if ! typeset -f _teach_find_style_source >/dev/null 2>&1; then
746+
_teach_doctor_warn "Teaching style helpers not loaded"
747+
json_results+=("{\"check\":\"teaching_style\",\"status\":\"warn\",\"message\":\"helpers not loaded\"}")
748+
return 0
749+
fi
750+
751+
local source
752+
source=$(_teach_find_style_source "." 2>/dev/null)
753+
754+
if [[ -z "$source" ]]; then
755+
_teach_doctor_warn "No teaching style configured" "Add teaching_style section to .flow/teach-config.yml"
756+
json_results+=("{\"check\":\"teaching_style\",\"status\":\"warn\",\"message\":\"not configured\"}")
757+
return 0
758+
fi
759+
760+
local path="${source%%:*}"
761+
local type="${source##*:}"
762+
763+
case "$type" in
764+
teach-config)
765+
_teach_doctor_pass "Teaching style in .flow/teach-config.yml"
766+
json_results+=("{\"check\":\"teaching_style_source\",\"status\":\"pass\",\"message\":\"teach-config.yml\"}")
767+
768+
# Check key sub-sections
769+
local approach
770+
approach=$(_teach_get_style "pedagogical_approach.primary" "." 2>/dev/null)
771+
if [[ -n "$approach" && "$approach" != "null" ]]; then
772+
_teach_doctor_pass "Pedagogical approach: $approach"
773+
json_results+=("{\"check\":\"teaching_style_approach\",\"status\":\"pass\",\"message\":\"$approach\"}")
774+
fi
775+
776+
# Check for command overrides
777+
local overrides
778+
overrides=$(yq '.teaching_style.command_overrides // ""' ".flow/teach-config.yml" 2>/dev/null)
779+
if [[ -n "$overrides" && "$overrides" != "null" && "$overrides" != "" ]]; then
780+
local override_count
781+
override_count=$(yq '.teaching_style.command_overrides | keys | length' ".flow/teach-config.yml" 2>/dev/null)
782+
_teach_doctor_pass "Command overrides: $override_count command(s)"
783+
json_results+=("{\"check\":\"command_overrides\",\"status\":\"pass\",\"message\":\"$override_count commands\"}")
784+
fi
785+
786+
# Check if legacy redirect shim exists
787+
if _teach_style_is_redirect "."; then
788+
_teach_doctor_pass "Legacy shim detected (redirect active)"
789+
json_results+=("{\"check\":\"teaching_style_shim\",\"status\":\"pass\",\"message\":\"redirect active\"}")
790+
elif [[ -f ".claude/teaching-style.local.md" ]]; then
791+
_teach_doctor_warn "Legacy .claude/teaching-style.local.md exists without redirect" \
792+
"Consider migrating to .flow/teach-config.yml or adding _redirect: true"
793+
json_results+=("{\"check\":\"teaching_style_shim\",\"status\":\"warn\",\"message\":\"no redirect\"}")
794+
fi
795+
;;
796+
legacy-md)
797+
# Check if it's a redirect shim
798+
if _teach_style_is_redirect "."; then
799+
_teach_doctor_warn "Using redirect shim but .flow/teach-config.yml has no teaching_style" \
800+
"Add teaching_style section to .flow/teach-config.yml"
801+
json_results+=("{\"check\":\"teaching_style_source\",\"status\":\"warn\",\"message\":\"shim without target\"}")
802+
else
803+
_teach_doctor_warn "Using legacy .claude/teaching-style.local.md" \
804+
"Migrate to .flow/teach-config.yml for unified config"
805+
json_results+=("{\"check\":\"teaching_style_source\",\"status\":\"warn\",\"message\":\"legacy location\"}")
806+
fi
807+
;;
808+
esac
809+
}
810+
734811
# Help function for teach doctor
735812
# MOVED to lib/dispatchers/teach-dispatcher.zsh (comprehensive-help branch)

0 commit comments

Comments
 (0)