Feature: Checks API integration for app compliance (checks/v1alpha)
Summary
Integrate the Google Checks API (checks/v1alpha) into the gplay CLI to provide automated app compliance analysis, privacy report generation, and AI safety content classification directly from the command line.
Why this is applicable to Google Play
Google Checks is Google's own compliance platform that analyzes Android (APK/AAB) and iOS app binaries for privacy violations, policy non-compliance, undisclosed data collection, SDK risks, and regulatory issues (GDPR, CCPA, COPPA). It is purpose-built for developers publishing to the Play Store and directly complements the existing gplay data-safety commands by providing automated verification of what an app actually does versus what is declared. Integrating Checks into gplay enables pre-submission compliance gating in CI/CD pipelines, catching policy violations before they reach Play Store review.
Problem
Currently, gplay data-safety update lets developers declare what data their app collects, but there is no way to verify those declarations against actual app behavior through the CLI. Developers must manually use the Checks web console or a separate CLI tool to:
- Upload app binaries for compliance analysis
- Review privacy reports for undisclosed endpoints, permissions, SDKs, and data types
- Monitor data collection behavior changes across releases
- Classify AI-generated content against safety policies
This creates a gap in the CLI's coverage: developers can manage their entire Play Store presence through gplay, but must leave the tool for the critical compliance verification step. The existing gplay-submission-checks skill validates metadata and screenshots, but cannot perform deep binary analysis for privacy and policy compliance.
Goals
- Add a
gplay checkscommand group for interacting with the Google Checks API - Support uploading app binaries (APK/AAB) for automated compliance analysis
- Enable retrieving and filtering privacy/compliance reports
- Support listing and managing Checks-connected apps
- Provide AI safety content classification for app content moderation
- Support long-running operation polling (upload analysis is async)
- Integrate with existing
--output json/table/markdownformatting - Enable CI/CD pipeline integration with exit codes based on check severity
- Complement the existing
gplay data-safetyandgplay-submission-checksworkflows
Proposed Commands
gplay checks (command group)
gplay checks <subcommand> [flags]
Parent command group for all Google Checks API interactions.
gplay checks apps list
List apps connected to the Checks account.
gplay checks apps list --account <account-id> [--page-size 10] [--paginate] [--output json]
| Flag | Required | Description |
|---|---|---|
--account |
Yes | Checks account ID |
--page-size |
No | Results per page (default: 10, max: 50) |
--paginate |
No | Fetch all pages automatically |
--output |
No | Output format: json (default), table, markdown |
--pretty |
No | Pretty-print JSON output |
gplay checks apps get
Get details for a specific Checks app.
gplay checks apps get --account <account-id> --app <app-id> [--output json]
| Flag | Required | Description |
|---|---|---|
--account |
Yes | Checks account ID |
--app |
Yes | Checks app ID |
--output |
No | Output format: json (default), table, markdown |
--pretty |
No | Pretty-print JSON output |
gplay checks analyze
Upload an app binary for compliance analysis. Returns a report when analysis completes.
gplay checks analyze --account <account-id> --app <app-id> --binary <path> [--binary-type APK] [--code-ref <git-sha>] [--wait] [--wait-timeout 10m] [--severity-threshold PRIORITY] [--output json]
| Flag | Required | Description |
|---|---|---|
--account |
Yes | Checks account ID |
--app |
Yes | Checks app ID |
--binary |
Yes | Path to APK or AAB file |
--binary-type |
No | File type: ANDROID_APK (default), ANDROID_AAB |
--code-ref |
No | Git commit SHA or changelist number to associate |
--wait |
No | Wait for analysis to complete and print report (default: true) |
--wait-timeout |
No | Max time to wait for analysis (default: 10m) |
--severity-threshold |
No | Fail (exit 1) if any check at or above this severity: PRIORITY, POTENTIAL, OPPORTUNITY |
--checks-filter |
No | AIP-160 filter for checks (e.g., state = FAILED) |
--output |
No | Output format: json (default), table, markdown |
--pretty |
No | Pretty-print JSON output |
When --wait is set (default), the command polls the long-running operation until the report is ready, then prints the full report. When --severity-threshold is set, the command exits with code 1 if any check meets or exceeds the threshold -- enabling CI/CD gating.
gplay checks reports list
List compliance reports for an app.
gplay checks reports list --account <account-id> --app <app-id> [--filter <aip-160>] [--checks-filter <aip-160>] [--page-size 10] [--paginate] [--output json]
| Flag | Required | Description |
|---|---|---|
--account |
Yes | Checks account ID |
--app |
Yes | Checks app ID |
--filter |
No | AIP-160 filter for reports (e.g., appBundle.releaseType = PRE_RELEASE) |
--checks-filter |
No | AIP-160 filter for checks within reports (e.g., state = FAILED) |
--page-size |
No | Results per page (default: 10, max: 50) |
--paginate |
No | Fetch all pages automatically |
--output |
No | Output format: json (default), table, markdown |
--pretty |
No | Pretty-print JSON output |
gplay checks reports get
Get a specific compliance report with full details.
gplay checks reports get --account <account-id> --app <app-id> --report <report-id> [--checks-filter <aip-160>] [--output json]
| Flag | Required | Description |
|---|---|---|
--account |
Yes | Checks account ID |
--app |
Yes | Checks app ID |
--report |
Yes | Report ID |
--checks-filter |
No | AIP-160 filter for checks (e.g., state = FAILED) |
--output |
No | Output format: json (default), table, markdown |
--pretty |
No | Pretty-print JSON output |
gplay checks operations get
Check the status of a long-running analysis operation.
gplay checks operations get --account <account-id> --app <app-id> --operation <operation-id> [--output json]
gplay checks operations wait
Wait for a long-running operation to complete.
gplay checks operations wait --account <account-id> --app <app-id> --operation <operation-id> [--timeout 10m] [--output json]
gplay checks operations cancel
Cancel a running analysis operation.
gplay checks operations cancel --account <account-id> --app <app-id> --operation <operation-id>
gplay checks classify
Classify text content against AI safety policies. Useful for validating user-generated content, AI outputs, or app content before release.
gplay checks classify --text <content> [--language <code>] [--policies DANGEROUS_CONTENT,HARASSMENT,...] [--context <prompt>] [--output json]
| Flag | Required | Description |
|---|---|---|
--text |
Yes | Text content to classify (or @file to read from file) |
--language |
No | BCP-47 language code of the content |
--policies |
No | Comma-separated policy types (default: all). Options: DANGEROUS_CONTENT, PII_SOLICITING_RECITING, HARASSMENT, SEXUALLY_EXPLICIT, HATE_SPEECH, MEDICAL_INFO, VIOLENCE_AND_GORE, OBSCENITY_AND_PROFANITY |
--context |
No | Additional context prompt for classification |
--severity-threshold |
No | Fail (exit 1) if any policy result is VIOLATIVE |
--output |
No | Output format: json (default), table, markdown |
--pretty |
No | Pretty-print JSON output |
Implementation Details
API Endpoints
All endpoints use base URL https://checks.googleapis.com/v1alpha:
| Command | Method | Endpoint |
|---|---|---|
checks apps list |
GET | /accounts/{id}/apps |
checks apps get |
GET | /accounts/{id}/apps/{appId} |
checks analyze |
POST | /upload/accounts/{id}/apps/{appId}/reports:analyzeUpload |
checks reports list |
GET | /accounts/{id}/apps/{appId}/reports |
checks reports get |
GET | /accounts/{id}/apps/{appId}/reports/{reportId} |
checks operations get |
GET | /accounts/{id}/apps/{appId}/operations/{opId} |
checks operations wait |
POST | /accounts/{id}/apps/{appId}/operations/{opId}:wait |
checks operations cancel |
POST | /accounts/{id}/apps/{appId}/operations/{opId}:cancel |
checks classify |
POST | /aisafety:classifyContent |
Authentication
- The Checks API requires OAuth scope
https://www.googleapis.com/auth/checks - This is a separate scope from the Android Publisher API scope used by the rest of gplay
- The existing service account can be used, but it must be granted the Checks API scope
- A new
checksclientpackage should create its ownchecks.Serviceusinggoogle.golang.org/api/checks/v1alphawith the existing credential resolution fromconfig.Config - Consider adding a
GPLAY_CHECKS_ACCOUNTenv var andchecks_accountconfig field to avoid passing--accounton every command
Go Client Library
- Package:
google.golang.org/api/checks/v1alpha(already available viagoogle.golang.org/api v0.272.0in go.mod) - No new dependency required -- the
checks/v1alphasub-package is part of the existinggoogle.golang.org/apimodule - Key service types:
AccountsAppsService,AccountsAppsReportsService,AccountsAppsOperationsService,AisafetyService,MediaService - Key struct types:
GoogleChecksReportV1alphaReport,GoogleChecksReportV1alphaCheck,GoogleChecksReportV1alphaAppBundle,GoogleChecksReportV1alphaDataMonitoring
New Packages/Files
internal/
├── checksclient/ # New: Checks API client wrapper
│ ├── client.go # Service initialization, auth with checks scope
│ └── client_test.go
├── cli/
│ └── checks/ # New: Command implementations
│ ├── checks.go # Parent command group
│ ├── apps.go # apps list, apps get
│ ├── analyze.go # Binary upload + operation polling
│ ├── reports.go # reports list, reports get
│ ├── operations.go # operations get, wait, cancel
│ ├── classify.go # AI safety classification
│ └── checks_test.go # CLI tests
Integration with Existing Features
gplay data-safety: Thechecks analyzecommand validates what the app actually does, whiledata-safety updatedeclares what it claims to do. Document this workflow: runchecks analyzefirst, review the report, then update data safety declarations accordingly.gplay-submission-checksskill: Extend the skill to optionally invokechecks analyzeas part of pre-submission validation when a binary path is available, adding Checks report results to the submission readiness assessment.gplay release: Document how to chainchecks analyze --severity-threshold PRIORITYbeforegplay releasein CI/CD pipelines to gate releases on compliance.
Output Format Considerations
- Default minified JSON output for agent/CI consumption (consistent with all other gplay commands)
- Table output for
reports listshould show: report name, app bundle version, check pass/fail counts, results URL - Table output for
reports getshould show: per-check type, state (PASSED/FAILED/UNCHECKED), severity, citations, affected regions - Table output for
classifyshould show: policy type, violation result, score - Markdown output useful for posting compliance summaries to PRs or Slack via
gplay notify send
Long-Running Operation Handling
The checks analyze command triggers an async analysis via media.upload, which returns a google.longrunning.Operation. The implementation should:
- Upload the binary and receive the operation resource name
- Poll
operations.getwith exponential backoff (start 5s, max 30s) - When
operation.done == true, deserialize the result as aReport - Apply
--severity-thresholdfiltering and set exit code accordingly - Respect
--wait-timeoutand exit with a clear error if exceeded - Print progress to stderr (e.g., "Analyzing... (elapsed: 45s)")
Acceptance Criteria
- [ ]
gplay checks --helpdisplays all subcommands with descriptions - [ ]
gplay checks apps listlists apps connected to the Checks account - [ ]
gplay checks apps getretrieves details for a specific app - [ ]
gplay checks analyzeuploads an APK/AAB and returns a compliance report - [ ]
gplay checks analyze --waitpolls until analysis completes (with progress on stderr) - [ ]
gplay checks analyze --severity-threshold PRIORITYexits with code 1 when critical checks fail - [ ]
gplay checks reports listlists reports with pagination support (--paginate) - [ ]
gplay checks reports getretrieves a full report with checks, evidence, and data monitoring - [ ]
gplay checks reports list --filterand--checks-filtercorrectly apply AIP-160 filters - [ ]
gplay checks operations get/wait/cancelmanage long-running operations - [ ]
gplay checks classifyclassifies text content against specified AI safety policies - [ ]
gplay checks classify --severity-thresholdexits with code 1 on violative content - [ ] All commands support
--output json/table/markdownand--prettyflags - [ ] All commands use
shared.ContextWithTimeout(orshared.ContextWithUploadTimeoutforanalyze) - [ ] All commands use
shared.DefaultUsageFunc - [ ] New
checksclientpackage authenticates withhttps://www.googleapis.com/auth/checksscope - [ ]
--accountis resolved from flag >GPLAY_CHECKS_ACCOUNTenv var >checks_accountconfig field - [ ]
--dry-runworks for write operations (analyze,operations cancel) - [ ] CLI-level tests cover flag validation, error messages, and output formatting
- [ ] Command is registered in
internal/cli/registry/registry.go - [ ]
gplay checks analyzedocumentation explains CI/CD gating workflow - [ ] No new dependencies required (uses existing
google.golang.org/apimodule)
References
Implementation Checklist
Command & Registration
- [ ] Command group
gplay checksininternal/cli/checks/ - [ ] Subcommands:
apps list,apps get,upload,reports list,reports get,content classify - [ ] Registered in
internal/cli/registry/registry.go - [ ]
UsageFunc: shared.DefaultUsageFuncset on all commands - [ ] Dedicated client wrapper for
checks/v1alphaAPI - [ ] Long-running operation polling for async upload analysis
- [ ] Exit codes based on check severity (for CI/CD gating)
- [ ] Required flags validated with stderr error messages
Tests
- [ ] CLI black-box tests in
internal/cmdtest/checks_test.go - [ ] Unit tests for severity-to-exit-code mapping
- [ ] Unit tests for operation polling logic
- [ ] Error paths: missing
--account, invalid binary path, timeout during polling
Docs & Help
- [ ]
--helpoutput follows existing conventions - [ ] Command docs regenerated:
gplay docs generate
Validation (before opening PR)
make format
make lint
make test
make build
/tmp/gplay checks --help
/tmp/gplay checks apps list --help
/tmp/gplay checks upload --help
/tmp/gplay checks upload # missing required flags → stderr error
/tmp/gplay checks upload --binary /bad # invalid path
Addendum to checklist above — docs CI gate:
The PR CI now runs make check-docs on every PR. This means:
- After implementing the command, run
make docsto regenerateGPLAY.md - Commit the updated
GPLAY.mdalongside your code changes - If you forget, the PR check will fail with: "GPLAY.md is out of date"
This ensures every user-facing command, flag, and help text is always reflected in the reference docs.