@@ -141,6 +141,7 @@ class CliConfig:
141141 max_purl_batch_size : int = 5000
142142 enable_commit_status : bool = False
143143 legal : bool = False
144+ legal_format : str = "socket"
144145 config_file : Optional [str ] = None
145146
146147 @classmethod
@@ -253,12 +254,13 @@ def from_args(cls, args_list: Optional[List[str]] = None) -> 'CliConfig':
253254 'reach_continue_on_no_source_files' : args .reach_continue_on_no_source_files ,
254255 'max_purl_batch_size' : args .max_purl_batch_size ,
255256 'enable_commit_status' : args .enable_commit_status ,
256- 'legal' : args .legal ,
257+ 'legal' : args .legal or args .legal_format == "fossa" ,
258+ 'legal_format' : args .legal_format ,
257259 'config_file' : args .config_file ,
258260 'version' : __version__
259261 }
260262
261- if args . legal :
263+ if config_args [ ' legal' ] :
262264 config_args ['generate_license' ] = True
263265 if not config_args ['json_file' ]:
264266 config_args ['json_file' ] = "socket-report.json"
@@ -270,6 +272,22 @@ def from_args(cls, args_list: Optional[List[str]] = None) -> 'CliConfig':
270272 config_args ['sbom_file' ] = "socket-sbom.json"
271273 if config_args ['license_file_name' ] == "license_output.json" :
272274 config_args ['license_file_name' ] = "socket-license.json"
275+
276+ if config_args ['legal_format' ] == "fossa" :
277+ if not args .json_file :
278+ config_args ['json_file' ] = "fossa-analyze.json"
279+ if not args .summary_file :
280+ config_args ['summary_file' ] = "fossa-test.txt"
281+ if not args .report_link_file :
282+ config_args ['report_link_file' ] = "fossa-link.txt"
283+ if not args .license_file_name :
284+ # argparse always provides a default, so this branch is defensive only
285+ config_args ['license_file_name' ] = "fossa-sbom.json"
286+ elif args .license_file_name == "license_output.json" :
287+ config_args ['license_file_name' ] = "fossa-sbom.json"
288+ if not args .sbom_file :
289+ # FOSSA's "SBOM" artifact is the attribution payload; suppress the extra Socket-only SBOM file by default.
290+ config_args ['sbom_file' ] = None
273291 excluded_ecosystems = config_args ["excluded_ecosystems" ]
274292 if isinstance (excluded_ecosystems , list ):
275293 config_args ["excluded_ecosystems" ] = excluded_ecosystems
@@ -791,6 +809,13 @@ def create_argument_parser() -> argparse.ArgumentParser:
791809 action = "store_true" ,
792810 help = "Enable legal/compliance-friendly defaults and file outputs"
793811 )
812+ advanced_group .add_argument (
813+ "--legal-format" ,
814+ dest = "legal_format" ,
815+ choices = ["socket" , "fossa" ],
816+ default = "socket" ,
817+ help = "Select the legal artifact format. 'socket' keeps Socket-native outputs; 'fossa' emits compatibility-shaped JSON artifacts."
818+ )
794819 config_group .add_argument (
795820 "--include-module-folders" ,
796821 dest = "include_module_folders" ,
0 commit comments