{"id":31925195,"url":"https://github.com/ipedro/swift-url-finder","last_synced_at":"2025-10-14T00:47:39.868Z","repository":{"id":318502766,"uuid":"1071534175","full_name":"ipedro/swift-url-finder","owner":"ipedro","description":"Finds URLs in a project's IndexStore","archived":false,"fork":false,"pushed_at":"2025-10-07T14:22:20.000Z","size":135,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-07T16:23:22.965Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ipedro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-07T13:30:42.000Z","updated_at":"2025-10-07T14:22:25.000Z","dependencies_parsed_at":"2025-10-07T16:25:47.147Z","dependency_job_id":null,"html_url":"https://github.com/ipedro/swift-url-finder","commit_stats":null,"previous_names":["ipedro/swift-url-finder"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ipedro/swift-url-finder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswift-url-finder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswift-url-finder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswift-url-finder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswift-url-finder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipedro","download_url":"https://codeload.github.com/ipedro/swift-url-finder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipedro%2Fswift-url-finder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017351,"owners_count":26086052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-14T00:47:37.825Z","updated_at":"2025-10-14T00:47:39.863Z","avatar_url":"https://github.com/ipedro.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swift-url-finder\n\nA command-line tool that analyzes Xcode projects to find and track URL endpoint constructions using Swift's IndexStoreDB.\n\n## Overview\n\nThis tool helps you:\n1. **Find specific endpoints**: Search for where a specific URL path is used in your codebase\n2. **Generate reports**: Create comprehensive reports of all URL endpoints in your project\n\nIt uses Apple's IndexStoreDB to query the symbol index database that Xcode builds, allowing it to track how URLs are constructed through property declarations and `appendingPathComponent()` calls.\n\n## Building\n\n```bash\nswift build -c release\n```\n\nThe executable will be at `.build/release/swift-url-finder`.\n\n## Prerequisites\n\nBefore using this tool, you need:\n\n1. **An Xcode project with an up-to-date index**\n   - Build your project in Xcode to ensure the index is current\n   - The index is stored in DerivedData at `~/Library/Developer/Xcode/DerivedData/\u003cProjectName-ID\u003e/Index.noindex/DataStore`\n\n**That's it!** The tool automatically discovers the index store from your project directory—simply point it to your Xcode project folder.\n\n## Usage\n\n### List Available Index Stores\n\nThe easiest way to start is by listing all available index stores:\n\n```bash\nswift-url-finder list\n```\n\nThis will show all Xcode projects that have been indexed:\n\n```\n🔍 Scanning for index stores in DerivedData...\n\n📇 Found 3 index store(s):\n\n[1] MyApp\n    Last built: Jan 2, 2024 at 3:45 PM\n    (2 hours ago)\n    Index files: 15234\n\n[2] TestProject\n    Last built: Dec 28, 2023 at 10:30 AM\n    (5 days ago)\n    Index files: 892\n\n💡 Tip: Use --verbose to see full paths\n```\n\n### Find a Specific Endpoint\n\nSearch for all references to a specific endpoint path:\n\n**Interactive mode** (recommended - will prompt you to select a project):\n\n```bash\nswift-url-finder find --endpoint \"resources/enable\"\n```\n\n**Explicit mode** (specify your project path):\n\n```bash\nswift-url-finder find \\\n  --project /path/to/YourProject \\\n  --endpoint \"resources/enable\"\n```\n\n**Advanced: Override index store location** (usually not needed):\n\n```bash\nswift-url-finder find \\\n  --project /path/to/YourProject \\\n  --index-store ~/Library/Developer/Xcode/DerivedData/YourProject-abc123/Index.noindex/DataStore \\\n  --endpoint \"resources/enable\"\n```\n\nOutput:\n```\n🔍 Searching for endpoint: resources/enable\n� Project: /path/to/YourProject\n\n✅ Found 2 reference(s):\n\n/path/to/ActivationService.swift:15\n/path/to/ActivationService.swift:19\n```\n\nWith verbose output:\n```bash\nswift-url-finder find \\\n  --project /path/to/YourProject \\\n  --endpoint \"resources/enable\" \\\n  --verbose\n```\n\n### Generate a Comprehensive Report\n\nGenerate a report of all endpoints in the project:\n\n**Interactive mode** (recommended):\n\n```bash\nswift-url-finder report\n```\n\nThe tool will show you a list of available projects to choose from:\n\n```\n📇 Available Index Stores:\n\n[1] MyApp\n    Last built: 2 hours ago\n    Index files: 15234\n    Path: ~/Library/Developer/Xcode/DerivedData/MyApp-abc123/Index.noindex/DataStore\n\n[2] TestProject\n    Last built: 5 days ago\n    Index files: 892\n    Path: ~/Library/Developer/Xcode/DerivedData/TestProject-def456/Index.noindex/DataStore\n\nSelect an index store (1-2) or 'q' to quit: \n```\n\n**Explicit mode** (specify your project path):\n\n```bash\nswift-url-finder report \\\n  --project /path/to/YourProject\n```\n\n**Advanced: Override index store location** (usually not needed):\n\n```bash\nswift-url-finder report \\\n  --project /path/to/YourProject \\\n  --index-store ~/Library/Developer/Xcode/DerivedData/YourProject-abc123/Index.noindex/DataStore\n```\n\n#### Output Formats\n\n**Text (default):**\n```bash\nswift-url-finder report \\\n  --project /path/to/YourProject \\\n  --format text\n```\n\n**JSON:**\n```bash\nswift-url-finder report \\\n  --project /path/to/YourProject \\\n  --format json \\\n  --output endpoints.json\n```\n\n**Markdown:**\n```bash\nswift-url-finder report \\\n  --project /path/to/YourProject \\\n  --format markdown \\\n  --output ENDPOINTS.md\n```\n\n## How It Works\n\n### 1. Index Store Analysis\n\nThe tool uses `IndexStoreDB` to query the symbol database that Xcode maintains. This gives access to:\n- Symbol definitions (properties, variables)\n- Symbol references\n- Symbol USRs (Unified Symbol Resolutions)\n\n### 2. URL Pattern Detection\n\nThe tool identifies URL-related symbols by looking for:\n- Property/variable names containing \"url\" or \"endpoint\"\n- Properties of type `URL`\n\n### 3. Construction Tracing\n\nFor each URL symbol found, the tool:\n1. Parses the source file using `SwiftSyntax`\n2. Identifies the base URL reference\n3. Tracks all `appendingPathComponent()` calls\n4. Maps the full endpoint path construction\n\n### 4. Reference Tracking\n\nThe tool tracks:\n- Where each URL is declared\n- What base URL it references\n- All path components added via `appendingPathComponent()`\n- The full constructed path\n\n## Example Output\n\nGiven code like:\n\n```swift\npublic class ActivationService {\n    private lazy var baseURL = backendService.apiV1BaseURL\n        .appendingPathComponent(\"api/v1/services/\")\n    \n    private lazy var enableResourceURL = baseURL\n        .appendingPathComponent(\"accounts\")\n        .appendingPathComponent(\"activate\")\n}\n```\n\nThe tool will identify:\n- Symbol: `enableResourceURL`\n- Base URL: `baseURL`\n- Path components: `[\"accounts\", \"activate\"]`\n- Full path: `resources/enable`\n- Location: `ActivationService.swift:5`\n\n## Tips\n\n1. **Keep your index up-to-date**: Build your project in Xcode before running the tool\n2. **Use verbose mode**: Add `--verbose` to see detailed progress information\n3. **Save reports**: Use `--output` to save reports for later reference\n4. **Search patterns**: The endpoint search matches partial paths, so \"accounts\" will match \"resources/enable\"\n\n## Troubleshooting\n\n### \"Cannot find index store\"\n\nEnsure the path points to the `DataStore` directory:\n```\n~/Library/Developer/Xcode/DerivedData/\u003cProject-ID\u003e/Index.noindex/DataStore\n```\n\n### \"No symbols found\"\n\n- Build your project in Xcode to generate the index\n- Ensure you're pointing to the correct DerivedData directory\n- Check that your project has been indexed by Xcode\n\n### \"No endpoints found\"\n\n- The tool looks for properties/variables with \"url\" or \"endpoint\" in the name\n- Ensure your URL properties follow this naming convention\n- Use `--verbose` to see what symbols are being analyzed\n\n## License\n\nThis tool uses:\n- [swift-argument-parser](https://github.com/apple/swift-argument-parser) for CLI parsing\n- [indexstore-db](https://github.com/swiftlang/indexstore-db) for index querying\n- [swift-syntax](https://github.com/apple/swift-syntax) for source parsing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipedro%2Fswift-url-finder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipedro%2Fswift-url-finder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipedro%2Fswift-url-finder/lists"}