@@ -743,6 +743,86 @@ def test_claude_code_agent_tools_injected(self, runner, tmp_path):
743743 assert "file_timeline" in agent_py
744744 assert "my_preferences" in agent_py
745745
746+ def test_claude_code_config_settings_fields (self , runner , tmp_path ):
747+ """Generated config.py should have claude_code_* Settings fields."""
748+ out = tmp_path / "cc-config"
749+ result = runner .invoke (main , [
750+ "cc-config" ,
751+ "--domain" , "software-engineering" ,
752+ "--framework" , "pydanticai" ,
753+ "--connector" , "claude-code" ,
754+ "--output-dir" , str (out ),
755+ ])
756+ assert result .exit_code == 0 , result .output
757+ config_py = (out / "backend" / "app" / "config.py" ).read_text ()
758+ assert "claude_code_scope" in config_py
759+ assert "claude_code_max_sessions" in config_py
760+ assert "claude_code_content_mode" in config_py
761+ assert "claude_code_base_path" in config_py
762+
763+ def test_claude_code_import_data_dict_access (self , runner , tmp_path ):
764+ """Generated import_data.py should use dict access, not attribute access."""
765+ out = tmp_path / "cc-dict"
766+ result = runner .invoke (main , [
767+ "cc-dict" ,
768+ "--domain" , "software-engineering" ,
769+ "--framework" , "pydanticai" ,
770+ "--connector" , "claude-code" ,
771+ "--output-dir" , str (out ),
772+ ])
773+ assert result .exit_code == 0 , result .output
774+ import_data = (out / "backend" / "scripts" / "import_data.py" ).read_text ()
775+ assert 'data["entities"]' in import_data
776+ assert "data.entities" not in import_data
777+
778+ def test_claude_code_connector_entity_types (self , runner , tmp_path ):
779+ """Generated connector should extract all entity types including Decision/Preference."""
780+ out = tmp_path / "cc-entities"
781+ result = runner .invoke (main , [
782+ "cc-entities" ,
783+ "--domain" , "software-engineering" ,
784+ "--framework" , "pydanticai" ,
785+ "--connector" , "claude-code" ,
786+ "--output-dir" , str (out ),
787+ ])
788+ assert result .exit_code == 0 , result .output
789+ connector = (out / "backend" / "app" / "connectors" / "claude_code_connector.py" ).read_text ()
790+ for entity in ["GitBranch" , "Error" , "Decision" , "Preference" , "Alternative" ]:
791+ assert entity in connector , f"Missing entity type: { entity } "
792+ for rel in ["ON_BRANCH" , "ENCOUNTERED_ERROR" , "MADE_DECISION" , "CHOSE" , "REJECTED" ,
793+ "NEXT" , "PRECEDED_BY" , "USED_TOOL" , "EXPRESSES_PREFERENCE" ]:
794+ assert rel in connector , f"Missing relationship type: { rel } "
795+
796+ def test_claude_code_connector_has_redaction (self , runner , tmp_path ):
797+ """Generated connector should include secret redaction."""
798+ out = tmp_path / "cc-redact"
799+ result = runner .invoke (main , [
800+ "cc-redact" ,
801+ "--domain" , "software-engineering" ,
802+ "--framework" , "pydanticai" ,
803+ "--connector" , "claude-code" ,
804+ "--output-dir" , str (out ),
805+ ])
806+ assert result .exit_code == 0 , result .output
807+ connector = (out / "backend" / "app" / "connectors" / "claude_code_connector.py" ).read_text ()
808+ assert "REDACTED" in connector
809+ assert "_SECRET_PATTERNS" in connector
810+
811+ def test_claude_code_scenarios_override (self , runner , tmp_path ):
812+ """Claude Code connector should replace generic SE scenarios with session-specific ones."""
813+ out = tmp_path / "cc-scenarios"
814+ result = runner .invoke (main , [
815+ "cc-scenarios" ,
816+ "--domain" , "software-engineering" ,
817+ "--framework" , "pydanticai" ,
818+ "--connector" , "claude-code" ,
819+ "--output-dir" , str (out ),
820+ ])
821+ assert result .exit_code == 0 , result .output
822+ frontend_config = (out / "frontend" / "lib" / "config.ts" ).read_text ()
823+ assert "Session Intelligence" in frontend_config
824+ assert "pull requests" not in frontend_config .lower ()
825+
746826 def test_with_mcp_flag (self , runner , tmp_path ):
747827 """Verify --with-mcp generates MCP config files."""
748828 out = tmp_path / "my-app"
0 commit comments