influxdata / influxdata/influx-cli

Add back the Flux REPL to the influx CLI

Open
#332 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
75
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Previously, we had a flux REPL in the CLI.

It was removed due to various concerns.

The following concerns we believe we can fix:
* The flux version in the CLI was out of date: https://github.com/influxdata/influxdb/issues/18676
* Startup time for the CLI was long and impacting other CLI commands negatively (hopefully this can be mitigated by not starting the flux engine unless we actually want the REPL).
* filter commands were broken for some use cases: https://github.com/influxdata/influxdb/issues/15974 , 
https://github.com/influxdata/influxdb/issues/18210

This concern is more difficult:
* multi-line execution didn't really work well (it should work like executing steps of a script, but e.g. if you import and then run a command in separate REPL executions it didn't work): https://github.com/influxdata/influxdb/issues/19014

This issue is for the MVP of authoring flux queries on the command line with good code completion.

## Open question: How do we handle multiline queries?

```
> import "prometheus"
> query1 = prometheus.scrape()
|> filter(...)
|> yield()
> query2 = query1 |> last()
```

Should the import affect query1? Should we keep the results of query1 in memory in order to run query2?

### Proposed answer (needs input from flux team!)

For the MVP, don't handle multi-line. Leave https://github.com/influxdata/influxdb/issues/19014 as an open issue for now (unless the flux team is willing to take this on) and focus on providing a way to author flux queries on the command line ergonomically (no awful shell quoting around flux quotes, nice completions potentially via an LSP).

* Potentially give a warning that this is under construction for users that were hoping for something more REPL-like.
* Potentially support imports as a special case

Prior art:

https://github.com/influxdata/flux/tree/master/cmd/flux

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing influx CLI structure and the Flux prior art at https://github.com/influxdata/flux/tree/master/cmd/flux. Define the MVP around ergonomic command-line Flux authoring and good completion, while leaving multiline execution as a separate concern unless the Flux team supports it. Done means the CLI provides the agreed authoring experience without regressing startup time or existing commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.