feat(cli): add plugin invocation protocol
Stacked on #154
Summary
- Adds
Request,Response, andIssueJSON envelope types for the plugin stdin/stdout protocol - Adds
Invoke(ctx, pluginDir, invoke, req, pluginStderr)— runs a plugin subprocess, pipes the request JSON to stdin, captures stdout as the response, and enforces a context timeout - A non-empty
Issuesslice in the response is not a Go error; the caller (defined in a later segment of work) will decide whether error-severity issues produce a non-zero exit code
This is a stacked PR
- https://github.com/open-semantic-interchange/OSI/pull/151
- https://github.com/open-semantic-interchange/OSI/pull/154
- https://github.com/open-semantic-interchange/OSI/pull/155 (👈🏻 you are here)
- https://github.com/open-semantic-interchange/OSI/pull/156
- https://github.com/open-semantic-interchange/OSI/pull/158
- https://github.com/open-semantic-interchange/OSI/pull/156
- https://github.com/open-semantic-interchange/OSI/pull/155 (👈🏻 you are here)
- https://github.com/open-semantic-interchange/OSI/pull/154
LGTM, but some good follow ups for future for anyone interested:
- It will be great to support plugins directly reading the semantic model files.
- The execution contract for these plugins is something we should continue to evolve as support for query API lands.
Should be we track these as Issues ?
LGTM, but some good follow ups for future for anyone interested:
1. It will be great to support plugins directly reading the semantic model files. 2. The execution contract for these plugins is something we should continue to evolve as support for query API lands.Should be we track these as Issues ?
I definitely think we should track (1) as an issue. I'm not sure exactly how we want to do this long term. Having the CLI handle read/write means that each plugin doesn't need to implement handing that with the OS, and ensures that glob based file lookup is always handled the same regardless of plugin used. However for sufficiently large semantic layers, it will probably be meaningfully impactful if the plugins handle file system read/write themselves.
For item (2), if we have specific areas (like protocol spec for query API), those would probably be good to create issues to track 🙂