Commit Graph
10883 Commits
Author SHA1 Message Date
Wind 3abe388791 fix rm -f when some files not found (#17249)
Fix CI failure after #17237
I don't know how can it happened, but it seems that `rm -f` inside tests
should fix the problem.

## Release notes summary - What our users need to know
NaN

## Tasks after submitting
2025-12-28 08:29:07 +08:00
Wind ba5f920af2 rm: returns Error when it failed to remove a file (#17237)
Fixes: #14900
The solution is suggested by @sgvictorino 

## Release notes summary - What our users need to know
rm command will return error when there is one file is failed to remove.

## Tasks after submitting
2025-12-27 07:59:01 +08:00
Ecorous c4a87bfce4 Bump rmp(-serde) to 0.8.15/1.3.1 (#17242) 2025-12-26 18:51:24 +01:00
Darren Schroeder 754ac46da6 Stream explore nu output (#17208)
This is an attempt to get explore's `:nu` command to stream the output
back to explore without blocking the UI. You can test with this command:
```nushell
:nu seq 1 100 | each { |x| sleep 100ms; $x }
```
The `:nu:` command is pretty heavily modified to use channels to
communicate now while spawning a background thread for processing.

This ups the complexit quite a bit so I won't be offended if we decide
_not_ to land this command.

closes https://github.com/nushell/nushell/issues/17206

## Release notes summary - What our users need to know
Within the `explore` command the `:nu` command will now stream content
by spawning the command issues without blocking.

## Tasks after submitting
N/A
2025-12-26 08:46:04 -06:00
dependabot[bot] adbcac331b build(deps): bump mach2 from 0.4.3 to 0.6.0 (#17227) 2025-12-24 01:45:53 +00:00
dependabot[bot] 42cf35e4ec build(deps): bump toml from 0.8.19 to 0.9.10+spec-1.1.0 (#17225) 2025-12-24 01:44:30 +00:00
dependabot[bot] f54be65af5 build(deps): bump rmcp from 0.8.1 to 0.8.5 (#17224) 2025-12-24 01:44:05 +00:00
Darren Schroeder dd04d2297b Increase help menu description rows from 10 to 15 (#17223)
A bug was reported that "save" didn't show all the parameters from
within the help menu. I tracked it down to this setting.

Closes #17220

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-23 15:08:35 -06:00
Darren Schroeder 303f0b98b0 use graphemes instead of byte indexes in explore regegx (#17219)
This PR fixes a reported bug when pasting "12345abcde項目" into the Test
String widget in the `explore regex` command. It employes more use of
graphemes instead of byte indexes here to work around this problem.

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-23 07:35:44 -06:00
Jack WrightandJack Wright 419ceed8d5 Polars: Add google cloud support (#17135)
## Release notes summary - What our users need to know
Provides the ability to use `polars open` and `polars save` with Google
Cloud Storage:

```nu
$env.GOOGLE_SERVICE_ACCOUNT = "/path/to/service_account.json"
$env.GOOGLE_BUCKET = "your_bucket"
ps | polars into-df | polars save gs://nushell_testing/ps.parquet
polars open gs://nushell_testing/ps.parquet | polars first 5 | polars collect
```

---------

Co-authored-by: Jack Wright <jack.wright@nike.com>
2025-12-22 16:58:50 -08:00
f8effe4a21 feat(bytes length): make available at const-time (#17204)
<!--
Thank you for improving Nushell!
Please, read our contributing guide:
https://github.com/nushell/nushell/blob/main/CONTRIBUTING.md
-->
* [x] `cargo clippy -- -D warnings -D clippy::unwrap_used`
* [x] `cargo test`
* [x] `cargo test --package nu-cli --test main --
commands::bytes_length`
* [x] `cargo fmt --all -- --check`

was surprised this did not work since `str length` works at const-time.
now it works.
not entirely sure if what i did with `Signals::EMPTY` is ok tho.

## Release notes summary - What our users need to know
<!--
This section will be included as part of our release notes. See the
contributing guide for more details.
Please include only details relevant for users here. Motivation and
technical details can be added above or below this section.

You may leave this section blank until your PR is finalized. Ask a core
team member if you need help filling this section.
-->
`bytes length` can now be used at const-time

## Tasks after submitting
<!-- Remove any tasks which aren't relevant for your PR, or add your own
-->

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
Co-authored-by: Tyarel8 <98483313+Tyarel8@users.noreply.github.com>
2025-12-20 12:41:14 -06:00
Andrew Gazelka 8c13a302cb docs(mcp): add par-each preference to instructions (#17171)
## Summary
- Add guidance to prefer `par-each` over `each` for parallel processing
in MCP instructions
- Includes examples showing sequential vs parallel iteration
- Documents when `each` is still appropriate (order preservation,
sequential side effects, small lists)

## Test plan
- [x] Documentation change only, no code changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-12-20 07:47:42 -06:00
Tyarel8 acdd9b45a5 feat(timeit): add --output flag (#17202)
https://discord.com/channels/601130461678272522/614593951969574961/1451198793394557039

## Release notes summary - What our users need to know
Added a flag called `--output` to the `timeit` command that will make
the command return a record with both the execution time and the output
of the closure.

## Tasks after submitting
<!-- Remove any tasks which aren't relevant for your PR, or add your own
-->
- [x] Added test
2025-12-20 07:45:14 -06:00
Wind e5f3b2947a mv/cp/du *: don't match dotfiles by default. (#17185)
Closes: #14858 
This pr changes default glob_options while running `nu_glob` function,
by default it makes `require_literal_leading_dot` to be true.

And I added `-a` flag to make * matches dotfiles, so they are consistent
with `ls`. Although the wildcard are different with POSIX shell, but I
think it's fine.

## Release notes summary - What our users need to know
### `*` no longer matches dotfiles in mv/cp/du by default
```nushell
> touch .a
> cp * /tmp
> "/tmp/.a" | path exists
false
```
But users can make it matches dotfiles by `--all(-a)` flag.

## Tasks after submitting
2025-12-19 07:23:07 +08:00
reuben olinsky d01226ea32 update reedline to the latest commit (#17203)
Update reedline to the latest commit
(https://github.com/nushell/reedline/commit/07fe597169ca7a96910161f42bf8d52d8cb3ef5c)

## Release notes summary - What our users need to know
Includes https://github.com/nushell/reedline/pull/988, which reverses a
behavioral change introduced in `reedline` 0.44 that resulted in
more-eager-than-expected kitty protocol checks.

## Tasks after submitting
n/a
2025-12-18 10:34:49 -06:00
dependabot[bot] 64b27f2e10 build(deps): bump http from 1.3.1 to 1.4.0 (#17191) 2025-12-18 13:57:37 +00:00
Kai Sforza ddf80f3107 error_make: Another rewrite of error make (#17070)
## User-facing Changes

* New arguments! (`error make "hello"`)
* New parts for `error_struct`! (`error make {inner: [] labels: []
...}`)
* Pipeline inputs for chained errors! (`try {error make foo} catch
{error make bar}`)
* Pipeline inputs for normal errors! (`"help" | error make`)
* External errors! (`error make {src: {path: $nu.cofig-path} ...}`)
* Backwards compatibility!

### Arguments and Inputs

The main changes are in how the arguments are passed. Everything is
still backwards compatible with the old `error make` commands, there's
just a nice extra layer we get from the pipeline and a few new args
(that were already added in #17037). There are some new ways to
(hopefully intentionally) cause an error, such as using a naked `error
make`, pipelines from records and simple string input!

#### Inputs

Because `error make` will just make an error anyway, it can technically
take any input to make an error, but only properly formatted record
input will create a chain. the `x | f $in` pattern can be used for
string input, if that is more comfortable.

#### With no arguments

This is a completely new way to do this, with no arguments the `error
make` invocation is highlighted, along with a simple `originates from
here` message. This makes normal errors very easy to create without any
special message setup.

```
> error make
Error: nu::shell::error

  × originates from here
   ╭─[entry #4:1:1]
 1 │ error make
   · ──────────
   ╰────
```

#### Create a single argument

* With pipeline input: `{msg: foo} | error make`
* With an argument: `error make {msg: foo}`
* With a string argument: `error make foo`
```
Error: nu::shell::error

  × foo
   ╭─[entry #2:1:12]
 1 │ error make {msg: foo}
   ·            ──────────
   ╰────
```
#### Chaining errors together

These will automatically create a chain of errors, placing the pipeline
as an `inner` to the argument. This can very easily be used to get a bit
more detail in a try loop using the naked `error make`:

```
Error: nu::shell::error

  × originates from here
   ╭─[source:1:31]
 1 │ try {error make "foo"} catch {error make}
   ·                               ──────────
   ╰────

Error: nu::shell::error

  × foo
   ╭─[source:1:6]
 1 │ try {error make "foo"} catch {error make}
   ·      ──────────
   ╰────
```

Or with more complex errors:

* With both, combining the errors: `{msg: foo} | error make bar`
* With the raw error from try: `try {error make foo} catch {error make
bar}`

Both are equivalent to:
* `error make {msg: bar inner: [{msg: foo}]}`

```
Error: nu::shell::error

  × bar
   ╭─[entry #1:1:29]
 1 │ try {error make foo} catch {error make bar}
   ·                             ──────────
   ╰────

Error: nu::shell::error

  × foo
   ╭─[entry #1:1:6]
 1 │ try {error make foo} catch {error make bar}
   ·      ──────────
   ╰────
```

### Labels

As is noticeable in the examples above, simple errors no longer use an
extra line for the label. If no label is present, `error make` will
place a bar under the span of itself or the argument to `error make`.
Labels have also gotten a bit of a rewrite, but they're pretty much the
same as those in #17037, except for `label`, which is now only a single
label (not `oneof<list, label>`).
#### Simple Labels

`label.text` and `labels.*.text` is no longer required for a span to
show up, an empty text will simply underline. This example can either
use `label: $record` or be written as `labels: [$record]`:

```
> def f [x] {
  error make {msg: here label: {span: (metadata $x).span}}
}
f abcd
Error: nu::shell::error

  × here
   ╭─[entry #7:4:3]
 3 │ }
 4 │ f abcd
   ·   ────
   ╰────
```

#### Multiple labels
Any number of labels can be added in the `labels` column, allowing for
more detailed error messages, especially for functions:

```
> def f [x y z] {
  error make {msg: here labels: [
    {text: "there" span: (metadata $x).span}
    {text: "everywhere" span: (metadata $y).span}
    {text: "somewhere" span: (metadata $z).span}
  ]
  }
}
f abcd [x y z] {d: a}

Error: nu::shell::error

  × here
   ╭─[entry #11:9:3]
 8 │ }
 9 │ f abcd [x y z] {d: a}
   ·   ──┬─ ───┬─── ───┬──
   ·     │     │       ╰── somewhere
   ·     │     ╰── everywhere
   ·     ╰── there
   ╰────
```

#### External sources

There is a `ShellError::OutsideSpannedLabeledError` that can be used to
refer to external sources, not just the internal nushell spanns. This
has been expanded to allow the multi-label stuff to work using the new
`src` column:

```
> "foo\nbar\nbaz" | save -f /tmp/foo.bar
error make {
  msg: 'error here'
  src: {path: /tmp/foo.bar}
  labels: [
    {text: "this" span: {start: 4 end: 7}}
  ]
}
Error: nu::shell::outside

  × error here
   ╭─[/tmp/foo.bar:2:1]
 1 │ foo
 2 │ bar
   · ─┬─
   ·  ╰── this
 3 │ baz
   ╰────
```

### Errors That Can't be Caught

These will not work since `try` will never get parsed:

- `try {1 + ""} catch {error make badmath}`
- (TODO: Add more examples)

## Internal Changes

Most of the parsing from an error record to an actual error is now moved
into `nu-protocol`, using `FromValue` to turn it into a useful internal
type.

### `nu-protocol::LabeledError`

This struct has a few changes, the main one being the type of
`LabeledError.inner`. It is now a `ShellError`, not another
`LabeledError`. It should be trivial to do a `.into()` for things that
already use `LabeledError.with_inner(x)`.

### `nu-protocol::ShellError::into_value`

I renamed the old `into_value` to `into_full_value` to better say what
it is, since it doesn't just do the `IntoValue::into_value` method, it
also requires some context to create the `Value`. Now `ShellError` has
an `IntoValue` implementation matching other types.

### `nu-protocol::ShellError::{OutsideSource, OutsideSourceNoUrl}`

Miette's derived types don't have a nice way to maybe include a url, so
there are now two types! These allow using multiple labels on outside
sources. They are used internally for the new `{src: {}}` part of the
`error_struct`, and they look a lot more like the `LabeledError`, but
without the need for a separate type and all the fun `impl`s that would
require for the `Diagnostic::source_code` method.

### Misc

* Spelling fix: `into_chainned` => `into_chained`

## Current bugs:
- [x] `OutsideSpannedLabeledError`  
The inner most error of `try {']' from nuon} catch {error make}` will
reference `span: {start: 0, end: 1}`, which in `']' from nuon` will
point to the `]` character, but when it does this in `error make` as an
input it will point to the very first character (probably the `n` in
`nu`).

## Release notes summary - What our users need to know

### New `error make` functionality!
* New arguments! (`error make "hello"`)
* New parts for `error_struct`! (`error make {inner: [] labels: []
...}`)
* Pipeline inputs for chained errors! (`try {error make foo} catch
{error make bar}`)
* Pipeline inputs for normal errors! (`"help" | error make`)
* External errors! (`error make {src: {path: $nu.cofig-path} ...}`)
* Backwards compatibility!


## Tasks after submitting
<!-- Remove any tasks which aren't relevant for your PR, or add your own
-->
- [ ] Update the
[documentation](https://github.com/nushell/nushell.github.io)
2025-12-18 07:34:08 -06:00
dependabot[bot] 477cac5d88 build(deps): bump winreg from 0.52.0 to 0.55.0 (#17193) 2025-12-18 13:29:34 +00:00
dependabot[bot] 6ae8772df3 build(deps): bump actions/upload-artifact from 5 to 6 (#17190) 2025-12-18 13:29:18 +00:00
dependabot[bot] b59aff4adb build(deps): bump bytes from 1.10.0 to 1.11.0 (#17192) 2025-12-18 13:29:04 +00:00
dependabot[bot] 5375e53332 build(deps): bump strum from 0.26.3 to 0.27.2 (#17194) 2025-12-18 13:28:49 +00:00
dependabot[bot] 9a373b53d0 build(deps): bump procfs from 0.17.0 to 0.18.0 (#17195) 2025-12-18 13:28:30 +00:00
Solomon 0a723acf29 make MCP server interruptible (#17200)
This is a follow-up to #17199.

## Release notes summary - What our users need to know
N/A
2025-12-17 22:24:49 -05:00
Darren Schroeder c320de5971 fix the mcp ctrl-c bug (#17199)
This PR fixes the ctrl-c bug @NotTheDr01ds discovered.

closes #17196

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-17 08:06:39 -05:00
Darren Schroeder 2a58f40db4 update reedline to the latest commit (#17197)
Update reedline to the latest commit 32a33663

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-16 19:35:27 -06:00
Darren Schroeder 63ad641de9 Add quick reference panel to explore regex command (#17187)
This PR adds a quick reference panel to `explore regex` with the F1
keybinding and dismisses it with the ESC keybinding. If you click on any
of the items in the quick reference panel, it puts them in the Regex
Pattern edit box. I also refactored a bit to make it eassier to
maintain.

<img width="3234" height="2070" alt="image"
src="https://github.com/user-attachments/assets/502a6566-715f-4ce0-b787-6012fc5b9942"
/>


## Release notes summary - What our users need to know
Add a quick reference panel to `explore regex` with the F1 keybinding
and dismiss it with the ESC keybinding.

## Tasks after submitting
N/A
2025-12-16 10:18:19 -06:00
Douglas d959aaef52 Added CARGO_ and RUSTUP_ environment variables back to test environment (#17186)
#17185 # Release notes summary - What our users need to know

Fixes an issue caused by #17085. In that PR, the environment is reset
before running tests. That's a good thing, but it breaks tests entirely
if your Cargo environment is customized using environment variables.
This adds back in `CARGO_*` and `RUSTUP_*` environment variables to help
ensure a proper test run.

## Tasks after submitting

N/A
2025-12-15 21:20:45 -06:00
Darren SchroederandCopilot 67952a46ad add agents.md to help LLMs (#17148)
This PR adds an Agents.md file to help with LLMs

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-15 17:09:04 -06:00
Wind d628c7e84e add http pool cmd (#17177)
I forgot adding `http pool` cmd in #17157. Which is reported by @Tyarel8
.

## Release notes summary - What our users need to know
NaN

## Tasks after submitting
2025-12-15 16:32:14 -06:00
Darren Schroeder ec0e8f71a1 update uutils to 0.5.0 (#17183)
This PR updates the uutils crates to the latest version 0.5.0

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-15 15:40:30 -06:00
Darren Schroeder a75d81079f refactor explore family of commands so that it's easier to understand and maintain (#17181)
This PR refactors the nu-explore crate so that things are easier to
understand and maintain.

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-15 11:20:54 -06:00
Darren Schroeder 6593d45d0b Add syntax higlighting to explore config (#17176)
Some tweaks to `explore config`
- Make Description a little smaller
- Add syntax highlighting of Value widget
- Fix Ctrl-Enter (remove it) because it didn't work on MacOS

<img width="3234" height="2070" alt="image"
src="https://github.com/user-attachments/assets/eb2740e0-37c5-4d14-94b2-5bb1bf848083"
/>

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-14 18:34:26 -06:00
Wind 7666a15623 http commands can use builtin connection pool (#17157)
Close #14810
This is done by creating a global `ureq::Agent` in http::client module.
Yeah using global variable may be not good, but it's worse to introduce
such cache in `EngineState`, because it requires `nu-protocol` depends
on `ureq`.

When `--pool` flag is provided, a global `ureq::Agent` will be used, or
else nushell will create a new http connection.

This pr also introduce a new `http pool` command to customize the global
`ureq::Agent` properties.

## Release notes summary - What our users need to know
A new flag `--pool` is added to http relative commands, so users can
reuse the connection:
```nu
http get https://www.google.com --pool
```
Users can also use `http pool` command to reset and customize http pool.

## Tasks after submitting
NaN
2025-12-14 20:31:05 +08:00
Darren Schroeder d63d0a2606 clean up explore a bit (#17172)
## Release notes summary - What our users need to know

This cleans up the `explore` TUI a bit and makes it look a little more
professional. The focus was just on the UI. Functionality should remain
the same.
2025-12-13 22:51:37 -05:00
Darren Schroeder a2bacf96dd add search capability to explore config command (#17170)
Add the ability to search `explore config` with `/` or `CTRL-F`.
closes #17167

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-13 15:42:54 -06:00
Darren Schroeder fb17296d47 update match count when test text changes (#17169)
This PR closes #17165 so that when you type in the test string area, the
match count updates.

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-13 12:30:34 -06:00
Darren Schroeder 5f6c6fde61 Update doc config (#17168)
This PR is a follow up to the `explore config` PR
https://github.com/nushell/nushell/pull/17147 to clean some things up.

1. I rewrote the doc_config.nu to make it better work with the TUI
2. I updated the parsing of the doc_config.nu so it would exclude
section headers
3. I fixed a rendering glitch where \n's weren't being escaped right and
were leaking onto the screen
4. I added PgUp/PgDown when just +10/-10 items in the tree widget
5. I disallowed the documentation warning triangle on keybindings and
menus to declutter a bit (probably still some work to do here)

closes https://github.com/nushell/nushell/issues/17166

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-13 11:16:58 -06:00
Andrew Gazelka 048d9bdc77 docs(mcp): add stderr redirection BAD/GOOD examples to instructions (#17163)
## Summary
- Adds explicit BAD/GOOD examples for stderr redirection syntax to MCP
instructions
## Motivation
Claude Opus 4.5 frequently uses bash-style `2>&1` syntax when running
commands via MCP, despite the command equivalents table in
`evaluate_tool.md`. Explicit BAD/GOOD code blocks (like the string
interpolation section already has) help the model avoid this common
mistake.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-12-13 06:39:13 -06:00
Splinter Suidman 20ea827fbb Add configuration option for whether to show hints (#17156)
Fixes #7245.

I added a configuration option `show_hints` that can be used to disable
hints.

## Release notes summary - What our users need to know
### New Configuration Option: `$env.config.show_hints`

You can now disable hints for completions and the history by setting
`$env.config.show_hints = false`.
2025-12-13 17:05:26 +08:00
blackhat-hemsworth 7c83fe21a0 fix--propagate more descriptive error message for rm Os errors (#17134)
## Release notes summary - What our users need to know
This makes a descriptive error message for particular IO / OS errors on
the "rm" command. This would be helpful in the associated issue, where
MacOS will silently deny access in some circumstances, and it can appear
to users as an inconsistency within Nushell

related to #17057

## Tasks after submitting
2025-12-13 12:18:25 +08:00
Darren Schroeder cf9a96d399 new command: explore config TUI (#17147)
## Release notes summary - What our users need to know
Introducing the `explore config` command.

Functionality:
- When launched with no parameters it loads your config settings into a
tree and editor to allow you to traverse, explore, and change settings.
- When launched with the `--tree` parameter, it draws a tree view of
your piped in input into the terminal
- When launched with the `--use-example-data` parameter, it shows you a
customized configuration (my config actually). May be removed later.
- When JSON is piped into it e.g `'{"abc": 1, "xyz": 2}' | explore
config --output foo.json` it allows you to explore and edit the JSON
data and save it out to the provided filename.
- When in "config mode" it shows you the nushell datatypes as you
traverse the tree. When in "json" mode it shows you the json datatypes
as you traverse the tree.
- When in "config mode" it shows you a description of the config setting
_assuming proper documentation in doc_config.nu_. This file will need to
be updated a bit in a separate PR. If there is no documentation it shows
you a warning triangle by the tree item.
- As you make changes to your config, you can save those changes and
they're immediately applied.
- If you hit Enter on any node leaf, you immediately jump into editing
that value. If you hit Enter on tree nodes, the tree expands or
collapses.


![explore-config2](https://github.com/user-attachments/assets/10f4407e-28a0-4aac-8baa-88f7b95229e2)

Help
```nushell
❯ explore config --help
Launch a TUI to view and edit the nushell configuration interactively.

By default, opens the current nushell configuration ($env.config) in the TUI.
Changes made in config mode are applied to the running session when you quit.

You can also pipe JSON data to explore arbitrary data structures, or use
--use-example-data to see sample configuration data.

TUI Keybindings:
  Tab           Switch between tree and editor panes
  ↑↓            Navigate tree / scroll editor
  ←→            Collapse/Expand tree nodes
  Enter/Space   Toggle tree node expansion
  Enter/Space   On leaf nodes, open editor pane
  Enter/e       Start editing (in editor pane)
  Ctrl+Enter    Apply edit
  Esc           Cancel edit
  Ctrl+S        Save/Apply changes
  q             Quit (applies config changes if modified)
  Ctrl+C        Force quit without saving

Usage:
  > explore config {flags}

Flags:
  -h, --help: Display the help message for this command
  -e, --use-example-data: Show the nushell configuration TUI using example data
  -t, --tree: Do not show the TUI, just show a tree structure of the data
  -o, --output <string>: Optional output file to save changes to (default: output.json)

Input/output types:
  ╭─#─┬──input──┬─output─╮
  │ 0 │ nothing │ string │
  │ 1 │ string  │ string │
  ╰───┴─────────┴────────╯

Examples:
  Open the nushell configuration in an interactive TUI editor
  > explore config

  Explore JSON data interactively
  > open --raw data.json | explore config

  Explore with example data to see TUI features
  > explore config --use-example-data
```
## Potential TODOs
- Would be nice to add a searching capability
- Update doc_config.nu as mentioned
- Maybe add scrolling to Description if needed
- Open json files without needing --raw option
- Make status bar more colorful and helpful
- Add syntax highlighting to the Value widget


## Tasks after submitting
<!-- Remove any tasks which aren't relevant for your PR, or add your own
-->
- [ ] Update the
[documentation](https://github.com/nushell/nushell.github.io)
2025-12-13 11:00:27 +08:00
Jack WrightandJack Wright c63e03234c Added mcp to default and all features (#17151)
## Release notes summary - What our users need to know
The MCP server support is now included as a default feature.

---------

Co-authored-by: Jack Wright <jack.wright@nike.com>
2025-12-13 10:35:35 +08:00
Andrew Gazelka a2c0e67699 docs(mcp): add string interpolation syntax to instructions (#17153)
## Summary

Adds documentation about nushell's string interpolation syntax to the
MCP server instructions.

## Problem: LLM Model Behavior

When using Claude Opus 4.5 with the nu-mcp server, the model
consistently attempted bash-style string interpolation which fails
silently or produces errors:

```nu
# What Opus 4.5 tried (bash muscle memory)
mysql -u $env.USER -p$env.PASSWORD dbname    # Fails: -p and $env.PASSWORD are separate args
echo "hello $name"                            # Fails: prints literal "$name"
```

The model would hit cryptic errors like `non_zero_exit_code` without
understanding why, then retry with the same pattern multiple times
before eventually stumbling onto the correct syntax.

## Solution

Add explicit documentation showing the correct `$"...(expr)..."` syntax
with practical examples:

```nu
# Correct nushell interpolation
let name = "world"; echo $"hello ($name)"       # Prints: hello world
ls $"($env.HOME)/Documents"                     # Expands path correctly  
cargo build $"--jobs=(sys cpu | length)"        # Dynamic flag value
```

## Why This Matters

MCP instructions are injected into the model's context and directly
influence tool usage patterns. Without this documentation, models waste
tokens on failed attempts and may give up or produce incorrect results.
This is a high-leverage fix since it affects every LLM interaction with
the nu-mcp server.
2025-12-12 13:00:00 +08:00
zc he 13067f13ce fix(parser): use checked_sub in parse_range to avoid overflow (#17152)
Fixes #17146 

## Release notes summary - What our users need to know

None

## Tasks after submitting
2025-12-11 19:42:13 -06:00
Darren Schroeder 5302b2eb40 update explore regex command to look more helpful and professional (#17149)
## Release notes summary - What our users need to know

This PR just makes the UI look a little more professional, abstracts the
coloring, and tries to make the code a little more idiomatic.
<img width="1222" height="676" alt="image"
src="https://github.com/user-attachments/assets/15e64dcf-96f7-4c6c-87da-b52c1f78d986"
/>


## Tasks after submitting
<!-- Remove any tasks which aren't relevant for your PR, or add your own
-->
- [ ] Update the
[documentation](https://github.com/nushell/nushell.github.io)
2025-12-11 15:30:23 -06:00
Andrew GazelkaandClaude Opus 4.5 11d71fe3c7 feat(mcp): add $history variable and structured response format (#17132)
<img width="1582" height="686" alt="image"
src="https://github.com/user-attachments/assets/538326ec-7ec8-45c0-a59f-f170ea88f5f8"
/>


- Add `$history` variable that stores all previous command outputs
- Access by index: `$history.0`, `$history.1`, etc.
- Wrap all responses in structured record with:
  - `history_index`: 0-based index of result in history
  - `cwd`: current working directory after command
  - `output`: command output (possibly truncated)
- Truncate large outputs (>10k chars by default) and reference history
- Configurable threshold via `NU_MCP_OUTPUT_TRUNCATE` env var
- Remove moka caching (incompatible with history tracking)
- Update instructions.md with history documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 09:33:38 -08:00
dependabot[bot] bfc594ebf3 build(deps): bump bytesize from 2.1.0 to 2.3.1 (#17139)
Bumps [bytesize](https://github.com/bytesize-rs/bytesize) from 2.1.0 to
2.3.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/bytesize-rs/bytesize/releases">bytesize's
releases</a>.</em></p>
<blockquote>
<h2>bytesize: v2.3.1</h2>
<ul>
<li>Fix unit truncation in error strings.</li>
</ul>
<h2>bytesize: v2.3.0</h2>
<ul>
<li>Add <code>Unit</code> enum.</li>
<li>Add <code>UnitParseError</code> type.</li>
</ul>
<h2>bytesize: v2.2.0</h2>
<ul>
<li>Add <code>ByteSize::as_*()</code> methods to return equivalent sizes
in KB, GiB, etc.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/bytesize-rs/bytesize/blob/master/CHANGELOG.md">bytesize's
changelog</a>.</em></p>
<blockquote>
<h2>2.3.1</h2>
<ul>
<li>Fix unit truncation in error strings.</li>
</ul>
<h2>2.3.0</h2>
<ul>
<li>Add <code>Unit</code> enum.</li>
<li>Add <code>UnitParseError</code> type.</li>
</ul>
<h2>2.2.0</h2>
<ul>
<li>Add <code>ByteSize::as_*()</code> methods to return equivalent sizes
in KB, GiB, etc.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/01217417db306cf1bc7635fe036e21590e0e3eef"><code>0121741</code></a>
chore: release v2.3.1 (<a
href="https://redirect.github.com/bytesize-rs/bytesize/issues/126">#126</a>)</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/fb35f2d88a0b882abf8c5f5507b7819e2367a29d"><code>fb35f2d</code></a>
fix: error string when unit is too long (<a
href="https://redirect.github.com/bytesize-rs/bytesize/issues/125">#125</a>)</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/f626cc828debb9042f913a4001b2421eb8fc7e49"><code>f626cc8</code></a>
chore: release v2.3.0 (<a
href="https://redirect.github.com/bytesize-rs/bytesize/issues/124">#124</a>)</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/6630c550fd0f4bf984e23fa77c12e39ab7201292"><code>6630c55</code></a>
feat: expose Unit (<a
href="https://redirect.github.com/bytesize-rs/bytesize/issues/123">#123</a>)</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/7fec8021dc364e1ee4105344a203fadcf65aaf7b"><code>7fec802</code></a>
chore: release v2.2.0 (<a
href="https://redirect.github.com/bytesize-rs/bytesize/issues/122">#122</a>)</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/9f00812af3d63ecf031ded42be353bef134a51d6"><code>9f00812</code></a>
ci: fix other run case</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/d951a2522faf5960b765a3c5752dc12d369f2ee5"><code>d951a25</code></a>
ci: fix MR run case</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/4052afe8942cc14dfe76538b21e8782c3f6cc49c"><code>4052afe</code></a>
ci: ensure release-plz tag format</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/a34fe2d8c66d47d0a0ab9e91962233904c723d36"><code>a34fe2d</code></a>
chore: add release-plz config</li>
<li><a
href="https://github.com/bytesize-rs/bytesize/commit/6f06e3315d5ab3dc0f966b3be7efaf3e0b855840"><code>6f06e33</code></a>
ci: fix release scripts</li>
<li>Additional commits viewable in <a
href="https://github.com/bytesize-rs/bytesize/compare/bytesize-v2.1.0...bytesize-v2.3.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=bytesize&package-manager=cargo&previous-version=2.1.0&new-version=2.3.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-10 14:44:19 +08:00
Wind ec4063ce19 merge_predecl don't move all predecls to overlay (#17130)
Fixes: #14739

Given the example:
```nushell
#!/usr/bin/env nu

def something [] { "example" }

module spam {}
overlay use spam
def bar [] { "bar" }
overlay hide spam
bar # Returns bar
```

The issue is happened when:
1. nushell parses a scripts, it makes a `preparse` to all custom
commands.
2. When parse `def something`, it calls `parse_def` then calls
`merge_predecl`
3. All custom commands in the current scope are moved to overlay `zero`.
But `bar` should not be moved at that time.

So I think it's good to move just the command `something` to overlay
`zero`.

Also we don't need to move predecls to overlay when adding overlays, it
can move some functions to wrong overlay.

## Release notes summary - What our users need to know
### Overlay works more reliable inside script.
```nushell
#!/usr/bin/env nu

def something [] { "example" }

module spam {}
overlay use spam
def bar [] { "bar" }
overlay hide spam
bar
```
`bar` won't be available to use after `overlay hide spam`.

## Tasks after submitting
NaN
2025-12-09 07:14:50 +08:00
Darren Schroeder 97a789fb66 bump the rust-toolchain to 1.90.0 (#17133)
This PR bumps the rust-toolchain to 1.90.0. The newest toolchain will be
released in 3 days. However, I've seen that vscode on Windows will not
run with 1.89.0 anymore and requires at least 1.90.0.

## Release notes summary - What our users need to know
N/A

## Tasks after submitting
N/A
2025-12-08 12:30:43 -06:00
Jack WrightandJack Wright 3d62b8ecba Azure blob storage support for polars (#17116)
## Release notes summary - What our users need to know

Introduces Azure support to the polars plugin. 

The following environment variables will are supported:
- AZURE_STORAGE_ACCOUNT_NAME: storage account name
- AZURE_STORAGE_ACCOUNT_KEY: storage account master key
- AZURE_STORAGE_ACCESS_KEY: alias for AZURE_STORAGE_ACCOUNT_KEY
- AZURE_STORAGE_CLIENT_ID: client id for service principal authorization
- AZURE_STORAGE_CLIENT_SECRET: client secret for service principal
authorization
- AZURE_STORAGE_TENANT_ID: tenant id used in oauth flows

Example Usage:
```nu
$env.AZURE_STORAGE_ACCOUNT_KEY = "<your access key value>"
$env.AZURE_STORAGE_ACCOUNT_NAME = "<your account name>"
ps | polars into-df | polars save azure://<your account name>/ps.parquet
polars open azure://<your account name>/ps.parquet | polars first 5 | polars collect
```

Co-authored-by: Jack Wright <jack.wright@nike.com>
2025-12-08 10:00:40 -08:00