Jan Høydahl created SOLR-18509:
----------------------------------

             Summary: Port ApiTool to PicoCli
                 Key: SOLR-18509
                 URL: https://issues.apache.org/jira/browse/SOLR-18509
             Project: Solr
          Issue Type: Improvement
          Components: cli
            Reporter: Jan Høydahl


Port {{ApiTool}} to picocli, adding the picocli code path alongside the 
existing commons-cli one.

*Covers:* {{bin/solr api}}

The command issues a single HTTP(S) GET against an arbitrary Solr API endpoint 
given by {{-s}} / {{--solr-url}} and pretty-prints the JSON response, honouring 
{{-u}} / {{--credentials}}. There are no sub-commands, and the tool already 
holds its inputs in an {{ApiParams}} record, so this is one of the smaller 
ports.

SOLR-17316 recently made this tool fail on non-2xx responses; the picocli path 
must preserve that exit-code behaviour.

*Acceptance criteria*
* {{bin/solr api}} and all its options work with {{SOLR_PICOCLI=true}}, and the 
commons-cli path is left behaviourally unchanged.
* {{ApiTool}} is registered in {{SolrCLI}}'s picocli {{subcommands}} list and 
{{ToolBase.callTool()}} is implemented, replacing the 
{{UnsupportedOperationException}} stub.
* Shared options reuse the existing mixins ({{ConnectionOptions}}, 
{{CredentialsOptions}}, {{HelpMixin}}) rather than redeclaring them.
* An {{ApiToolPicocliTest}} subclasses the existing test and overrides only the 
{{runTool}} hook, so the inherited assertions run through both parsers.
* {{./gradlew :solr:solr-ref-guide:generateCliDocs}} is re-run and the 
generated {{cli/solr-api.adoc}} page is committed, so {{checkCliDocsUpToDate}} 
passes.

*AI assistance:* a coding-agent prompt template encoding the patterns already 
established by the ported tools is available at 
[https://gist.github.com/janhoy/a3fe0dbcaadf24b3493558946cc549d9] — name 
{{ApiTool}} in its Assignment line up front and the rest of the prompt adapts. 
Please review agent output as carefully as hand-written code.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to