33# Tests that plugins/dso/skills/onboarding/SKILL.md has the correct structure
44# for the /dso:onboarding Socratic dialogue skill.
55#
6- # Validates (8 named assertions):
6+ # Validates (30 named assertions):
77# test_skill_file_exists: SKILL.md exists at the expected path
88# test_frontmatter_valid: frontmatter has name=onboarding and user-invocable=true
99# test_sub_agent_guard_present: Orchestrator Signal SUB-AGENT-GUARD block present
1212# test_detection_integration: references project-detect.sh
1313# test_socratic_dialogue_pattern: contains Socratic dialogue indicators
1414# test_architect_foundation_offer: references /dso:architect-foundation
15+ # test_auto_detection_before_asking: reads package.json/.husky before asking
16+ # test_config_key_completeness: references 6+ of 8 required config keys
17+ # test_absolute_path_requirement: mentions absolute path for dso.plugin_root
18+ # test_semicolon_delimited_format: documents semicolon-delimited behavioral_patterns
19+ # test_fallback_behavior: describes fallback/omit behavior for undetected config
20+ # test_ci_workflow_filename_confirmation: instructs listing actual workflow filenames
21+ # test_config_merge_existing: instructs detecting/merging existing dso-config.conf
22+ # test_jira_bridge_project_key: mentions Jira Bridge connection (JIRA_URL/jira bridge)
23+ # test_no_rigid_multiple_choice: must NOT contain rigid (a)/(b)/(c) menu patterns
1524#
1625# These are metadata/schema validation tests per the Behavioral Test Requirement exemption.
1726# All tests will FAIL (RED) until plugins/dso/skills/onboarding/SKILL.md is created.
@@ -389,6 +398,153 @@ test_design_notes_output() {
389398 assert_pass_if_clean " test_design_notes_output"
390399}
391400
401+ # ── RED auto-detection / config / dialogue tests (new — fail until SKILL.md updated) ─────
402+
403+ # test_auto_detection_before_asking: SKILL.md must instruct reading project files
404+ # (package.json, .husky/, .github/workflows/) BEFORE asking questions
405+ test_auto_detection_before_asking () {
406+ _snapshot_fail
407+ local package_json_found husky_found workflows_found result
408+ package_json_found=" no"
409+ husky_found=" no"
410+ workflows_found=" no"
411+ if grep -qF " package.json" " $SKILL_MD " 2> /dev/null; then
412+ package_json_found=" yes"
413+ fi
414+ if grep -qF " .husky/" " $SKILL_MD " 2> /dev/null; then
415+ husky_found=" yes"
416+ fi
417+ if grep -qE " \.github/workflows|workflows/\*\.yml" " $SKILL_MD " 2> /dev/null; then
418+ workflows_found=" yes"
419+ fi
420+ if [[ " $package_json_found " == " yes" && " $husky_found " == " yes" && " $workflows_found " == " yes" ]]; then
421+ result=" found"
422+ else
423+ result=" missing"
424+ fi
425+ assert_eq " test_auto_detection_before_asking" " found" " $result "
426+ assert_pass_if_clean " test_auto_detection_before_asking"
427+ }
428+
429+ # test_config_key_completeness: SKILL.md must reference ALL required config keys:
430+ # dso.plugin_root, format.extensions, format.source_dirs, test_gate.test_dirs,
431+ # commands.validate, tickets.directory, checkpoint.marker_file, review.behavioral_patterns
432+ # Must find at least 6 of 8
433+ test_config_key_completeness () {
434+ _snapshot_fail
435+ local keys_found keys_missing key
436+ keys_found=0
437+ keys_missing=" "
438+ local required_keys=(" dso.plugin_root" " format.extensions" " format.source_dirs" " test_gate.test_dirs" " commands.validate" " tickets.directory" " checkpoint.marker_file" " review.behavioral_patterns" )
439+ for key in " ${required_keys[@]} " ; do
440+ if grep -qF " $key " " $SKILL_MD " 2> /dev/null; then
441+ (( keys_found++ ))
442+ else
443+ keys_missing=" $keys_missing $key "
444+ fi
445+ done
446+ if [[ " $keys_found " -ge 6 ]]; then
447+ assert_eq " test_config_key_completeness" " found" " found"
448+ else
449+ assert_eq " test_config_key_completeness" " at least 6 of 8 config keys" " $keys_found keys found (missing:$keys_missing )"
450+ fi
451+ assert_pass_if_clean " test_config_key_completeness"
452+ }
453+
454+ # test_absolute_path_requirement: SKILL.md must mention absolute path for dso.plugin_root
455+ # grep for 'absolute.*path' or 'realpath' near 'plugin_root'
456+ test_absolute_path_requirement () {
457+ _snapshot_fail
458+ local absolute_found
459+ absolute_found=" missing"
460+ if grep -qiE " absolute.*path|realpath" " $SKILL_MD " 2> /dev/null; then
461+ absolute_found=" found"
462+ fi
463+ assert_eq " test_absolute_path_requirement" " found" " $absolute_found "
464+ assert_pass_if_clean " test_absolute_path_requirement"
465+ }
466+
467+ # test_semicolon_delimited_format: SKILL.md must document semicolon-delimited format
468+ # for review.behavioral_patterns — grep for 'semicolon'
469+ test_semicolon_delimited_format () {
470+ _snapshot_fail
471+ local semicolon_found
472+ semicolon_found=" missing"
473+ if grep -qi " semicolon" " $SKILL_MD " 2> /dev/null; then
474+ semicolon_found=" found"
475+ fi
476+ assert_eq " test_semicolon_delimited_format" " found" " $semicolon_found "
477+ assert_pass_if_clean " test_semicolon_delimited_format"
478+ }
479+
480+ # test_fallback_behavior: SKILL.md must describe fallback when config cannot be auto-detected
481+ # grep for 'fallback' or 'omit.*comment'
482+ test_fallback_behavior () {
483+ _snapshot_fail
484+ local fallback_found
485+ fallback_found=" missing"
486+ if grep -qiE " fallback|omit.*comment" " $SKILL_MD " 2> /dev/null; then
487+ fallback_found=" found"
488+ fi
489+ assert_eq " test_fallback_behavior" " found" " $fallback_found "
490+ assert_pass_if_clean " test_fallback_behavior"
491+ }
492+
493+ # test_ci_workflow_filename_confirmation: SKILL.md must instruct listing actual workflow filenames
494+ # (e.g., scanning existing .github/workflows/ files by name, not just offering examples)
495+ # grep for 'workflow.*filename' (specific — not just any mention of .yml or list)
496+ test_ci_workflow_filename_confirmation () {
497+ _snapshot_fail
498+ local filename_found
499+ filename_found=" missing"
500+ if grep -qiE " workflow.*filename" " $SKILL_MD " 2> /dev/null; then
501+ filename_found=" found"
502+ fi
503+ assert_eq " test_ci_workflow_filename_confirmation" " found" " $filename_found "
504+ assert_pass_if_clean " test_ci_workflow_filename_confirmation"
505+ }
506+
507+ # test_config_merge_existing: SKILL.md must instruct detecting and merging with
508+ # existing dso-config.conf — grep for 'existing.*config' or 'existing dso-config'
509+ test_config_merge_existing () {
510+ _snapshot_fail
511+ local merge_existing_found
512+ merge_existing_found=" missing"
513+ if grep -qiE " existing.*config|existing dso-config" " $SKILL_MD " 2> /dev/null; then
514+ merge_existing_found=" found"
515+ fi
516+ assert_eq " test_config_merge_existing" " found" " $merge_existing_found "
517+ assert_pass_if_clean " test_config_merge_existing"
518+ }
519+
520+ # test_jira_bridge_project_key: SKILL.md must mention Jira Bridge connection with project key
521+ # grep for 'jira bridge' or 'JIRA_URL' (not merely jira.project_key config key)
522+ test_jira_bridge_project_key () {
523+ _snapshot_fail
524+ local jira_bridge_found
525+ jira_bridge_found=" missing"
526+ if grep -qiE " jira bridge|JIRA_URL" " $SKILL_MD " 2> /dev/null; then
527+ jira_bridge_found=" found"
528+ fi
529+ assert_eq " test_jira_bridge_project_key" " found" " $jira_bridge_found "
530+ assert_pass_if_clean " test_jira_bridge_project_key"
531+ }
532+
533+ # test_no_rigid_multiple_choice: SKILL.md must NOT contain rigid quiz-style instruction patterns.
534+ # The skill must use confirmation-based dialogue, not letterd menus like "(a) X (b) Y (c) Z".
535+ # This is a negative assertion: presence of letter-option menus causes failure.
536+ test_no_rigid_multiple_choice () {
537+ _snapshot_fail
538+ local rigid_count
539+ rigid_count=$( grep -cE " ^\s*(a\)|b\)|c\)|d\)|e\))" " $SKILL_MD " 2> /dev/null || echo " 0" )
540+ if [[ " $rigid_count " -eq 0 ]]; then
541+ assert_eq " test_no_rigid_multiple_choice" " found" " found"
542+ else
543+ assert_eq " test_no_rigid_multiple_choice" " no rigid (a)/(b)/(c) menus" " $rigid_count rigid menu lines found"
544+ fi
545+ assert_pass_if_clean " test_no_rigid_multiple_choice"
546+ }
547+
392548# Run all 21 assertion functions — GREEN tests first, RED tests last
393549test_skill_file_exists
394550test_frontmatter_valid
@@ -412,5 +568,15 @@ test_design_skip_non_ui
412568# RED design tests below — these fail until design areas/notes are added to SKILL.md
413569test_design_areas_complete
414570test_design_notes_output
571+ # RED auto-detection/config/dialogue tests — these fail until SKILL.md is updated
572+ test_auto_detection_before_asking
573+ test_config_key_completeness
574+ test_absolute_path_requirement
575+ test_semicolon_delimited_format
576+ test_fallback_behavior
577+ test_ci_workflow_filename_confirmation
578+ test_config_merge_existing
579+ test_jira_bridge_project_key
580+ test_no_rigid_multiple_choice
415581
416582print_summary
0 commit comments