Skip to content

Add --json flag to various CLI commands for use in AI translate scripts - #1068

Open
ehoogerbeets wants to merge 1 commit into
box:upstream-patchedfrom
ehoogerbeets:betterCLIOutput
Open

Add --json flag to various CLI commands for use in AI translate scripts#1068
ehoogerbeets wants to merge 1 commit into
box:upstream-patchedfrom
ehoogerbeets:betterCLIOutput

Conversation

@ehoogerbeets

@ehoogerbeets ehoogerbeets commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a shared CLI --json convention so automation (especially AI-translate Jenkins jobs) can consume a stable machine-readable result instead of scraping ANSI console output.

  • Introduces a common JSON envelope on stdout: { successful, command, data, error? }, with human console progress suppressed when --json is set
  • Wires --json into: repo-create, repo-view, drop-export, drop-import, tm-export, tm-import, and repository-ai-translate
  • For repository-ai-translate, the AI translate service now detects remaining work at selection time (fetch sourceTextMaxCount + 1 per locale) and stores hasMore / hasMoreByLocale on the pollable job output; the CLI surfaces those fields in the --json result so schedulers can loop until a repo is drained

Test plan

  • mvn spotless:check
  • Unit: JsonOutputTest, AI translate config/auto-fix integrity tests
  • CLI integration: RepoCreateCommandTest (incl. --json), RepoViewCommandTest, DropExportCommandTest, DropImportCommandTest, TMExportCommandTest, TMImportCommandTest
  • Manually run repository-ai-translate --json -r <repo> -l hi-IN bn-IN against a repo with more than --source-text-max-count strings and confirm hasMore: true, then re-run until hasMore: false
  • Confirm failure paths still exit non-zero and emit { successful: false, error: "..." } with --json

Give automation a stable machine-readable envelope instead of parsing
ANSI console text, and let repository-ai-translate report when more
strings remain so jobs can loop until a repo is drained.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ehoogerbeets
ehoogerbeets requested a review from wadimw July 25, 2026 03:52
@ehoogerbeets ehoogerbeets self-assigned this Jul 25, 2026
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedmaven/​com.box/​box-java-sdk@​2.1.1 ⏵ 4.6.03610090100100
Addedmaven/​com.google.cloud/​google-cloud-storage@​2.38.04910094100100

View full report

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
Critical CVE: Deserialization of Untrusted Data in Bouncy castle in maven org.bouncycastle:bcprov-jdk15on

CVE: GHSA-4446-656p-f54g Deserialization of Untrusted Data in Bouncy castle (CRITICAL)

Affected versions: >= 1.57 < 1.60

Patched version: 1.60

From: pom.xmlmaven/com.box/box-java-sdk@4.6.0maven/org.bouncycastle/bcprov-jdk15on@1.57

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.bouncycastle/bcprov-jdk15on@1.57. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven com.google.protobuf:protobuf-java is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/com.google.cloud/google-cloud-storage@2.38.0maven/com.google.protobuf/protobuf-java@3.25.3

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/com.google.protobuf/protobuf-java@3.25.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven com.google.protobuf:protobuf-java is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/com.google.cloud/google-cloud-storage@2.38.0maven/com.google.protobuf/protobuf-java@3.25.3

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/com.google.protobuf/protobuf-java@3.25.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@ehoogerbeets
ehoogerbeets changed the base branch from master to upstream-patched July 25, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant