* Writes the collected redacted URL domains to a log file. * Only creates the file if there are redacted domains. * @param {string} [filePath] - Path to write the log file. Defaults to /tmp/gh-aw/redacted-urls.log * @returns {string|null} The file path if written, null if no domains to write
(filePath)
| 50 | * @returns {string|null} The file path if written, null if no domains to write |
| 51 | */ |
| 52 | function writeRedactedDomainsLog(filePath) { |
| 53 | if (redactedDomains.length === 0) { |
| 54 | return null; |
| 55 | } |
| 56 | |
| 57 | const fs = require("fs"); |
| 58 | const path = require("path"); |
| 59 | const targetPath = filePath || "/tmp/gh-aw/redacted-urls.log"; |
| 60 | |
| 61 | // Ensure directory exists |
| 62 | const dir = path.dirname(targetPath); |
| 63 | if (!fs.existsSync(dir)) { |
| 64 | fs.mkdirSync(dir, { recursive: true }); |
| 65 | } |
| 66 | |
| 67 | // Write domains to file, one per line |
| 68 | fs.writeFileSync(targetPath, redactedDomains.join("\n") + "\n"); |
| 69 | |
| 70 | return targetPath; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Extract domains from a URL and return an array of domain variations |
no outgoing calls
no test coverage detected