Enable first-class non-interactive mode for the CLI
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
I'm a fan of `dnx` but have found that there are some usability issues with LLMs. The basic problem is that it requires an interative response, which causes a non-interactive user to just hang. I have noticed this a couple times recently. However, I was writing a skill that uses a tool and wanted to use `dnx`. However, using `dnx` is challenging. We need good guidance for this and to consider product changes. For now I'm saying, always use `dnx -y dotnet-inspect -- [args]`.
There are two cases where an LLM might hit an interactive prompt:
- First install
- New version available
The second point is the most challenging. A session could be moving forward using a tool and then a new version is published to nuget.org, `dnx` notices this, and then blocks the LLM (or other tool) with an interactive prompt. This also means that `dnx` isn't a great choice for scripts, as-is.
Here's what I see.
DNX:
NPM:
This is from `npm exec help`:
> If any requested packages are not present in the local project
> dependencies, then a prompt is printed, which can be suppressed by
> providing either --yes or --no. When standard input is not a TTY or a CI
> environment is detected, --yes is assumed. The requested packages are
> installed to a folder in the npm cache, which is added to the PATH
> environment variable in the executed process.
I asked Copilot to thoroughly test this:
I don't think that stdin is excellent solution. It's a pattern to enable. I'd like to see the dnx offer the same model as npx and also offer an ENV variable to make a whole session safe. That would mean install the package if not available and DON'T install a new package if one is available unless asked to.
Side note: We should make it easy to clear the dnx cache. This made testing a bit awkward.
I sometimes see the first-run experience in CP-CLI/CC. This is harmful, in the sense that it is wasted tokens and the person we wanted to see the first-run experience doesn't. Assuming we a `DOTNET_INTERACTIVE=false`, then I'd skip the first-run message as well. There may be other experiences we need to consider. That's why the title is about the scenario not dnx in particular.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.