@@ -616,34 +616,10 @@ migrate_v2_2_to_v2_2_1() {
616616 echo " Version updated to $target_version "
617617}
618618
619- # Migrate v2.2.x to v2.3.0 - Plugin architecture and AGENTS.md support
620- migrate_v2_2_to_v2_3_0 () {
619+ # Generate basic AGENTS.md as fallback
620+ _generate_basic_agents_md () {
621621 local project_root=$1
622-
623- local target_version=" $( get_intent_version 2> /dev/null || echo " 2.3.0" ) "
624- echo " Upgrading to Intent v$target_version with plugin architecture..."
625-
626- # 1. Create plugin directory structure
627- echo " Creating plugin architecture..."
628- mkdir -p " $project_root /intent/plugins/claude/subagents"
629- mkdir -p " $project_root /intent/plugins/agents/templates"
630-
631- # 2. Migrate agents to plugin location
632- if [ -d " $project_root /agents" ]; then
633- echo " Migrating agents to plugin location..."
634- if [ " $( ls -A " $project_root /agents" 2> /dev/null) " ]; then
635- cp -r " $project_root /agents/" * " $project_root /intent/plugins/claude/subagents/" 2> /dev/null || true
636- fi
637- # Keep old agents directory for now, will be cleaned up later
638- fi
639-
640- # 3. Create AGENTS.md if it doesn't exist
641- if [ ! -f " $project_root /AGENTS.md" ] && [ ! -f " $project_root /intent/llm/AGENTS.md" ]; then
642- echo " Generating AGENTS.md..."
643- mkdir -p " $project_root /intent/llm"
644-
645- # Generate basic AGENTS.md
646- cat > " $project_root /intent/llm/AGENTS.md" << 'EOF '
622+ cat > " $project_root /intent/llm/AGENTS.md" << 'EOF '
647623# AGENTS.md
648624
649625## Project Overview
@@ -657,28 +633,76 @@ This is an Intent project. See CLAUDE.md for project-specific guidelines.
657633## Build and Test Commands
658634### Testing
659635```bash
660- # Run tests if configured
636+ # Check for test scripts in your project
661637intent doctor
662638```
663639
664640## Code Style Guidelines
665- - Shell scripts: 2-space indentation, POSIX compliance
666- - Markdown: Standard formatting with verblock headers
667641- Follow existing patterns in the codebase
642+ - See CLAUDE.md for project-specific guidelines
668643
669644## Intent-Specific Information
670645### Steel Thread Process
671646Work is organized into steel threads (ST####) under intent/st/
672647
673648### Available Commands
674649- `intent st list` - List all steel threads
675- - `intent agents init ` - Initialize AGENTS.md
650+ - `intent agents sync ` - Update this AGENTS.md
676651- `intent claude subagents list` - List Claude subagents
677652EOF
653+ echo " Generated basic AGENTS.md template"
654+ }
655+
656+ # Migrate v2.2.x to v2.3.0 - Plugin architecture and AGENTS.md support
657+ migrate_v2_2_to_v2_3_0 () {
658+ local project_root=$1
659+
660+ local target_version=" $( get_intent_version 2> /dev/null || echo " 2.3.0" ) "
661+ echo " Upgrading to Intent v$target_version with plugin architecture..."
662+
663+ # 1. Create plugin directory structure
664+ echo " Creating plugin architecture..."
665+ mkdir -p " $project_root /intent/plugins/claude/subagents"
666+ mkdir -p " $project_root /intent/plugins/agents/templates"
667+
668+ # 2. Migrate agents to plugin location
669+ if [ -d " $project_root /agents" ]; then
670+ echo " Migrating agents to plugin location..."
671+ if [ " $( ls -A " $project_root /agents" 2> /dev/null) " ]; then
672+ cp -r " $project_root /agents/" * " $project_root /intent/plugins/claude/subagents/" 2> /dev/null || true
673+ fi
674+ # Keep old agents directory for now, will be cleaned up later
675+ fi
676+
677+ # 3. Create AGENTS.md if it doesn't exist
678+ if [ ! -f " $project_root /AGENTS.md" ] && [ ! -f " $project_root /intent/llm/AGENTS.md" ]; then
679+ echo " Generating AGENTS.md..."
680+ mkdir -p " $project_root /intent/llm"
681+
682+ # Use the smart generator from intent_agents if available
683+ local agents_script=" $INTENT_HOME /intent/plugins/agents/bin/intent_agents"
684+ if [ -f " $agents_script " ]; then
685+ # Source the script to get the generator function
686+ PROJECT_ROOT=" $project_root " source " $agents_script " > /dev/null 2>&1
687+
688+ # Generate project-specific AGENTS.md
689+ if type intent_agents_generate_content > /dev/null 2>&1 ; then
690+ intent_agents_generate_content > " $project_root /intent/llm/AGENTS.md"
691+ echo " Generated project-specific AGENTS.md"
692+ else
693+ # Fallback to basic template if function not available
694+ _generate_basic_agents_md " $project_root "
695+ fi
696+ else
697+ # Fallback to basic template if script not found
698+ _generate_basic_agents_md " $project_root "
699+ fi
678700
679701 # Create symlink at project root
680702 ln -sf " intent/llm/AGENTS.md" " $project_root /AGENTS.md"
681703 echo " Created AGENTS.md with symlink at project root"
704+ elif [ -f " $project_root /AGENTS.md" ] || [ -f " $project_root /intent/llm/AGENTS.md" ]; then
705+ echo " AGENTS.md already exists, skipping generation"
682706 fi
683707
684708 # 4. Update .intent/config.json
0 commit comments