{"id":31917136,"url":"https://github.com/msafdev/pagespeed","last_synced_at":"2025-10-13T20:25:57.789Z","repository":{"id":305732466,"uuid":"1023770763","full_name":"msafdev/pagespeed","owner":"msafdev","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-25T02:22:58.000Z","size":190,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-26T03:04:52.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/msafdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2025-07-21T17:04:35.000Z","updated_at":"2025-08-08T22:22:12.000Z","dependencies_parsed_at":"2025-07-21T19:41:13.840Z","dependency_job_id":null,"html_url":"https://github.com/msafdev/pagespeed","commit_stats":null,"previous_names":["msafdev/pagespeed"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/msafdev/pagespeed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msafdev%2Fpagespeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msafdev%2Fpagespeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msafdev%2Fpagespeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msafdev%2Fpagespeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msafdev","download_url":"https://codeload.github.com/msafdev/pagespeed/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msafdev%2Fpagespeed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016946,"owners_count":26085907,"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-13T20:25:56.185Z","updated_at":"2025-10-13T20:25:57.779Z","avatar_url":"https://github.com/msafdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg width=\"100%\" src=\"https://github.com/msafdev/pagespeed/blob/main/assets/screenshot.png\" alt=\"screenshot\" /\u003e\n\n# PageSpeed Insights Checker\n\nA simple command-line tool for analyzing website performance using Google PageSpeed Insights API.\n\n## NEW: Github Action\n\n\u003c!-- PAGESPEED_START --\u003e\n\n```typescript\nconst pagespeed = {\n  \"https://example.com\": {\n    strategy: \"mobile\",\n    language: \"en\",\n    scores: {\n      \"Performance\"     : 100, // ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰\n      \"Accessibility\"   :  88, // ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▱▱▱\n      \"Best Practices\"  : 100, // ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰\n      \"SEO\"             :  90, // ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▱▱\n      \"PWA\"             :   0, // ▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱\n    }\n  }\n};\n```\n\n\u003c!-- PAGESPEED_END --\u003e\n\n## Installation\n\n```bash\nnpm install @msafdev/pagespeed\n```\n\n## CLI Usage\n\nThe tool supports both yargs and commander parsers and offers multiple ways to analyze your websites.\n\n### Basic Commands\n\n#### Analyze a single URL\n\n```bash\nnpx @msafdev/pagespeed analyze https://example.com\nnpx @msafdev/pagespeed analyze example.com --strategy desktop\n```\n\n#### Analyze multiple URLs from a file\n\nTo analyze multiple pages under the same domain, provide a .txt file containing one slug (path) per line.\n\n- The file must be plain text (`.txt` extension).\n- Each line should contain a single path, relative to the base URL.\n- Do not include the domain or protocol.\n- Make sure each slug starts with `/`.\n\nExample: `urls.txt`\n\n```text\n/\n/about\n/contact\n/lab/toolbar\n```\n\n```bash\nnpx @msafdev/pagespeed analyze https://example.com --slugs ./urls.txt\nnpx @msafdev/pagespeed analyze example.com -s ./pages.txt -t mobile\n```\n\n#### Interactive Mode\n\n```bash\nnpx @msafdev/pagespeed interactive\n# or\nnpx @msafdev/pagespeed i\n```\n\n### Command Options\n\n#### `analyze [url]`\n\nAnalyze PageSpeed for given URL(s)\n\n**Options:**\n\n- `-s, --slugs \u003cfile\u003e`: Path to file containing URL slugs\n- `-t, --strategy \u003cstrategy\u003e`: Testing strategy (`mobile` | `desktop`) [default: mobile]\n- `-e, --export \u003cformats...\u003e`: Export formats (`data` | `markdown`)\n- `-f, --filename \u003cdir\u003e`: Output directory for exports\n- `--open`: Open markdown report after generation\n- `--silent`: Suppress progress output\n\n**Examples:**\n\n```bash\n# Basic analysis\nnpx @msafdev/pagespeed analyze https://example.com\n\n# Desktop strategy with exports (\"csv | json | md\")\nnpx @msafdev/pagespeed analyze https://example.com -t desktop -e data markdown\n\n# Multiple URLs with custom output (./custom.md)\nnpx @msafdev/pagespeed analyze https://example.com -s ./slugs.txt -f custom --open\n\n# Silent mode for scripting\nnpx @msafdev/pagespeed analyze https://example.com --silent -e data\n```\n\n#### `interactive`\n\nRun the tool in interactive mode with guided prompts\n\n```bash\nnpx @msafdev/pagespeed interactive\nnpx @msafdev/pagespeed i\n```\n\n#### `sessions`\n\nManage saved analysis sessions\n\n**Subcommands:**\n\n- `list`: List all saved sessions\n- `run \u003cname\u003e`: Run a saved session\n\n**Examples:**\n\n```bash\n# List saved sessions\nnpx @msafdev/pagespeed sessions list\n\n# Run a specific session (by number or URL fragment)\nnpx @msafdev/pagespeed sessions run 1\nnpx @msafdev/pagespeed sessions run example.com\n\n# Run session with custom exports\nnpx @msafdev/pagespeed sessions run 1 -e markdown -f custom-name\n```\n\n### Export Formats\n\n#### Data Export (JSON)\n\n```bash\nnpx @msafdev/pagespeed analyze https://example.com -e data\n```\n\nGenerates: `./results/TIMESTAMP/results.[\"json | csv\"]`\n\n#### Markdown Report\n\n```bash\npagespeed analyze https://example.com -e markdown --open\n```\n\nGenerates: `./results/TIMESTAMP/results.md`\n\n### Advanced Usage\n\n#### Environment Variables\n\n```bash\n# Set default API key\nPAGESPEED_API_KEY=your-api-key @msafdev/pagespeed analyze https://example.com\n```\n\n#### Scripting Examples\n\n**Batch processing with different strategies:**\n\n```bash\n#!/bin/bash\nsites=(\"example-1.com\" \"example-2.com\" \"example-3.com\")\n\nfor site in \"${sites[@]}\"; do\n  echo \"Analyzing $site...\"\n  npx @msafdev/pagespeed analyze \"$site\" -s ./common-pages.txt -e data --silent\ndone\n```\n\n#### TODO: Configuration File Support\n\nCreate `.pagespeedrc.json` in your project root:\n\n```json\n{\n  \"baseUrl\": \"https://my-site.com\",\n  \"strategy\": \"mobile\",\n  \"slugs\": \"./pages.txt\",\n  \"export\": [\"data\", \"markdown\"],\n  \"filename\": \"custom-report\"\n}\n```\n\n### CLI Development Scripts\n\n```bash\n# Development with TypeScript\nnpm run dev analyze https://example.com\n\n# Interactive mode\nnpm run interactive\n```\n\n### Error Handling\n\nThe CLI provides detailed error messages and exits with appropriate codes:\n\n- `0`: Success\n- `1`: General error (invalid URL, API failure, etc.)\n- `130`: User cancellation (Ctrl+C)\n\n### Performance Tips\n\n1. **Use slug files** for testing multiple pages efficiently\n2. **Enable silent mode** for automated scripts\n3. **Save sessions** for repeated analysis\n4. **Use appropriate strategies** (mobile for mobile-first, desktop for desktop analysis)\n5. **Export data** for further processing and historical tracking\n\n### Troubleshooting\n\n**Common Issues:**\n\n1. **API Key Issues:**\n\n   ```bash\n   # Set API key in config or environment\n   export PAGESPEED_API_KEY=your-api-key\n   ```\n\n2. **Invalid URLs:**\n\n   ```bash\n   # Ensure URLs are properly formatted\n   pagespeed analyze https://example.com  # ✓ Good\n   pagespeed analyze example.com          # ✓ Also works\n   pagespeed analyze /invalid/path        # ✗ Bad\n   ```\n\n3. **File Not Found:**\n\n   ```bash\n   # Check slug file path\n   pagespeed analyze https://example.com -s ./slugs.txt\n   ```\n\n4. **Network Issues:**\n   ```bash\n   # Use --silent to reduce output and check logs\n   pagespeed analyze https://example.com --silent\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsafdev%2Fpagespeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsafdev%2Fpagespeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsafdev%2Fpagespeed/lists"}