feat(searchconsole): add url inspection command - #1094
Conversation
Add `gog searchconsole inspect <siteUrl> <url>` wrapping the URL Inspection API (searchconsole/v1 urlInspection.index:inspect), which exposes per-page indexing detail (coverage state, page fetch state, robots.txt state, indexing state, last crawl time, canonical vs user canonical, sitemaps, referring URLs) not available through the existing sites/searchanalytics/sitemaps commands. Uses the already-granted `webmasters` OAuth scope, so no re-authorization is needed. Supports `--language` (BCP-47) for translated issue messages and `--json` for scripting. - httptest coverage for JSON and text output, empty-arg usage errors before service creation, and service errors. - Regenerate command reference (docs/commands), Search Console skill command table, and README product table; add Unreleased changelog note. Live-tested against a real Search Console property: not yet; regression coverage and account/scope expectations verified locally.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 11:15 PM ET / September 7, 2026, 03:15 UTC. ClawSweeper reviewWhat this changesAdds a Search Console URL inspection command with translated issue messages, JSON and table output, focused tests, and updated command documentation. Merge readiness✅ Ready for maintainer review This PR remains useful: current main lacks the inspection command, the supplied real-property output demonstrates the added behavior, and no blocking defect was found. The earlier release-note finding is resolved. Priority: P2 Review scores
Verification
How this fits togethergogcli's Search Console commands send authenticated requests to Google's API. The new command accepts a property and page URL, then returns Google's indexed-page status for scripts or terminal users. flowchart LR
A[Property and page URL] --> B[Inspection command]
C[Selected Google account] --> D[Existing authenticated client]
B --> D
D --> E[Google URL Inspection API]
E --> F[JSON or terminal table]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Expose indexed-page diagnostics through the existing Search Console command group while preserving established authentication, read-only enforcement, and output conventions. Do we have a high-confidence way to reproduce the issue? Not applicable to a new capability; the supplied real-property transcript demonstrates the added command's successful JSON and text behavior. Is this the best way to solve the issue? Yes. A thin wrapper around the existing authenticated client is consistent with neighboring commands and avoids new credentials, dependencies, or persistent state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 981ca4a163e8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Regenerate the README auth services block from its source of truth (internal/googleauth service note) so the freshness test stays green, and add the PR reference and contributor credit to the Unreleased entry per repository AGENTS.md.
|
🦞🧹 I asked ClawSweeper to review this item again. |
Scope
Adds
gog searchconsole inspect <siteUrl> <url>— a thin wrapper around the Search Console URL Inspection API (urlInspection.index:inspect) that exposes per-page indexing detail not currently available throughsearchconsole sites/searchanalytics/query/sitemaps:Implementation notes:
searchconsolegroup; no new OAuth scope — uses the already-grantedwebmastersscope via the existing service wrapper, so no re-authorization is needed.--language(BCP-47, defaulten-US) for translated issue messages;--jsonoutput for scripting.Changes
internal/cmd/searchconsole.go— newSearchConsoleInspectCmd+ registration in the command groupinternal/cmd/searchconsole_more_test.go— httptest coverage: JSON + text output (asserts request payload incl. default language), empty-arg usage errors before any service call, and service-error propagationinternal/googleauth/service.go— regenerate README auth-services table source of truth (Search Console note now includes URL Inspection)docs/commands/gog-searchconsole-inspect.md, index/generated pages), Search Console skill command table, README product tableTesting performed
go test ./internal/cmd/(incl. all SearchConsole tests),./internal/googleauth,./scripts(README freshness) passmake lint(0 issues),make deadcode,make docs-check(767 command pages),make agent-skills-checkall passgo build ./cmd/gogpassesLive verification (real Search Console property, 2026-09-07)
Ran against a verified property owned by the test account (siteOwner level). Account alias, property, and inspected URLs are redacted below for privacy; the output fields themselves are verbatim. Details can be shared privately with a maintainer on request.
gog --json --account <redacted-account> searchconsole inspect sc-domain:<redacted-property> https://<redacted-host>/{ "inspectionResult": { "indexStatusResult": { "coverageState": "Submitted and indexed", "crawledAs": "MOBILE", "googleCanonical": "https://<redacted-host>/", "indexingState": "INDEXING_ALLOWED", "lastCrawlTime": "2026-09-05T23:25:28Z", "pageFetchState": "SUCCESSFUL", "referringUrls": ["<redacted>", "…4 total"], "robotsTxtState": "ALLOWED", "userCanonical": "https://<redacted-host>/", "verdict": "PASS" }, "inspectionResultLink": "https://search.google.com/search-console/inspect?resource_id=…&id=<redacted>" }, "inspection_url": "https://<redacted-host>/", "site_url": "sc-domain:<redacted-property>" }Text output (same invocation, no
--json):