88
99def handle_integration ():
1010 """Handle integration subcommands."""
11- import argparse
12-
1311 # Get the arguments after 'codeflash integrate'
1412 args = sys .argv [2 :] # Skip 'codeflash integrate'
15-
13+
1614 if not args or args [0 ] == "status" :
1715 show_integration_status ()
1816 elif args [0 ] == "claude" :
@@ -26,66 +24,63 @@ def handle_integration():
2624def handle_claude_integration (args ):
2725 """Handle Claude Code integration."""
2826 import argparse
29-
27+
3028 parser = argparse .ArgumentParser (prog = "codeflash integrate claude" )
31- parser .add_argument ("--project" , action = "store_true" ,
32- help = "Also create project-specific subagent" )
33- parser .add_argument ("--force" , action = "store_true" ,
34- help = "Force integration even if Claude Code not detected" )
35- parser .add_argument ("--remove" , action = "store_true" ,
36- help = "Remove Claude Code integration" )
37-
29+ parser .add_argument ("--project" , action = "store_true" , help = "Also create project-specific subagent" )
30+ parser .add_argument ("--force" , action = "store_true" , help = "Force integration even if Claude Code not detected" )
31+ parser .add_argument ("--remove" , action = "store_true" , help = "Remove Claude Code integration" )
32+
3833 parsed_args = parser .parse_args (args )
39-
34+
4035 integration = ClaudeCodeIntegration ()
41-
36+
4237 if parsed_args .remove :
4338 success , message = integration .remove_integration ()
4439 print (message )
4540 sys .exit (0 if success else 1 )
46-
41+
4742 # Perform integration
4843 project_path = str (Path .cwd ()) if parsed_args .project else None
4944 success = setup_claude_integration (
50- include_project = parsed_args .project ,
51- project_path = project_path ,
52- force = parsed_args .force
45+ include_project = parsed_args .project , project_path = project_path , force = parsed_args .force
5346 )
54-
47+
5548 sys .exit (0 if success else 1 )
5649
5750
5851def show_integration_status ():
5952 """Show current integration status."""
6053 print ("🔍 Codeflash Integration Status" )
6154 print ("=" * 40 )
62-
55+
6356 # Claude Code status
6457 integration = ClaudeCodeIntegration ()
6558 status = integration .get_integration_status ()
66-
59+
6760 print ("\n 📋 Claude Code Integration:" )
6861 print (f" Claude Available: { '✅' if status ['claude_available' ] else '❌' } " )
69-
70- if status [' config_path' ]:
62+
63+ if status [" config_path" ]:
7164 print (f" Config File: { status ['config_path' ]} " )
7265 else :
7366 print (" Config File: ❌ Not found" )
74-
67+
7568 print (f" Agents Directory: { status ['agents_directory' ]} " )
7669 print (f" Subagents Installed: { len (status ['installed_subagents' ])} /3" )
77- for subagent in status [' installed_subagents' ]:
70+ for subagent in status [" installed_subagents" ]:
7871 print (f" ✅ { subagent } " )
79-
80- missing_subagents = set (["codeflash-optimizer" , "codeflash-profiler" , "codeflash-reviewer" ]) - set (status ['installed_subagents' ])
72+
73+ missing_subagents = set (["codeflash-optimizer" , "codeflash-profiler" , "codeflash-reviewer" ]) - set (
74+ status ["installed_subagents" ]
75+ )
8176 for subagent in missing_subagents :
8277 print (f" ❌ { subagent } " )
83-
78+
8479 print (f" MCP Tools: { '✅' if status ['mcp_tools_configured' ] else '❌' } " )
8580 print (f" System: { status ['system' ]} " )
86-
81+
8782 # Overall status
88- if status [' claude_available' ] and status [' all_subagents_installed' ]:
83+ if status [" claude_available" ] and status [" all_subagents_installed" ]:
8984 print ("\n 🎉 Complete Claude Code integration is active!" )
9085 print ("\n Available subagents:" )
9186 print (" @codeflash-optimizer - AI-powered code optimization" )
@@ -95,17 +90,17 @@ def show_integration_status():
9590 print (" '@codeflash-optimizer optimize my slow function'" )
9691 print (" '@codeflash-profiler find bottlenecks in my script'" )
9792 print (" '@codeflash-reviewer review this code for performance'" )
98- elif status [' claude_available' ] and status [' installed_subagents' ]:
93+ elif status [" claude_available" ] and status [" installed_subagents" ]:
9994 print (f"\n ⚠️ Partial integration ({ len (status ['installed_subagents' ])} /3 subagents)" )
10095 print (" Run: codeflash integrate claude # to install all subagents" )
101- elif status [' claude_available' ]:
96+ elif status [" claude_available" ]:
10297 print ("\n ⚠️ Claude Code available but subagents not installed" )
10398 print (" Run: codeflash integrate claude" )
10499 else :
105100 print ("\n 📖 Install Claude Code to enable integration:" )
106101 print (" Visit: https://docs.anthropic.com/en/docs/claude-code" )
107102 print (" Then run: codeflash integrate claude" )
108-
103+
109104 # Check for project-specific integration
110105 project_agent = Path .cwd () / ".claude" / "agents" / "codeflash-optimizer.md"
111106 if project_agent .exists ():
@@ -116,4 +111,4 @@ def show_integration_status():
116111
117112
118113if __name__ == "__main__" :
119- handle_integration ()
114+ handle_integration ()
0 commit comments