🔍 Duplicate Code Detected: Gateway Config Entry Transformation Pattern
Analysis of commit 38aaae7
Summary
Three CommonJS converters in actions/setup/js repeat the same entry-cloning and URL-rewriting flow. Each file copies a gateway entry, conditionally rewrites url, then returns the transformed object with only a small provider-specific tweak.
Duplication Details
Pattern: provider-specific gateway entry normalization
Severity : Medium
Occurrences : 3
Locations :
actions/setup/js/convert_gateway_config_claude.cjs (lines 34-43)
actions/setup/js/convert_gateway_config_copilot.cjs (lines 55-66)
actions/setup/js/convert_gateway_config_gemini.cjs (lines 40-49)
Shared shape :
const transformed = { ...entry };
provider-specific field tweak
if (typeof transformed.url === "string") { transformed.url = rewriteUrl(...) }
return transformed;
Impact Analysis
Maintainability : any future URL/schema change must be repeated in three places.
Bug Risk : a fix to one converter can easily drift from the others.
Code Bloat : the same normalization logic is embedded in each provider file instead of being shared.
Refactoring Recommendations
Extract a shared helper for gateway entry normalization.
Keep provider-specific field mutations as a small callback or options object.
This should centralize the clone/rewrite logic.
Split the provider differences into tiny adapters.
Example: one helper for set type, one for drop type, one for ensure tools.
That keeps the shared transformation readable while removing copy-paste.
Implementation Checklist
Analysis Metadata
Analyzed Files : 3
Detection Method : Serena semantic code analysis
Commit : 38aaae7
Analysis Date : 2026-07-01
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network :
allowed :
- defaults
- " awmgmcpg"
See Network Configuration for more information.
Generated by 🔍 Duplicate Code Detector · 4.57 AIC · ⌖ 1.4 AIC · ⊞ 11.5K · ◷
🔍 Duplicate Code Detected: Gateway Config Entry Transformation Pattern
Analysis of commit
38aaae7Summary
Three CommonJS converters in
actions/setup/jsrepeat the same entry-cloning and URL-rewriting flow. Each file copies a gateway entry, conditionally rewritesurl, then returns the transformed object with only a small provider-specific tweak.Duplication Details
Pattern: provider-specific gateway entry normalization
actions/setup/js/convert_gateway_config_claude.cjs(lines 34-43)actions/setup/js/convert_gateway_config_copilot.cjs(lines 55-66)actions/setup/js/convert_gateway_config_gemini.cjs(lines 40-49)const transformed = { ...entry };if (typeof transformed.url === "string") { transformed.url = rewriteUrl(...) }return transformed;Impact Analysis
Refactoring Recommendations
Extract a shared helper for gateway entry normalization.
Split the provider differences into tiny adapters.
set type, one fordrop type, one forensure tools.Implementation Checklist
Analysis Metadata
38aaae7Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.