github nirvana-labs/nirvana-cli v0.41.0

13 hours ago

0.41.0 (2026-04-17)

Full Changelog: v0.40.1...v0.41.0

Features

  • cli: add --raw-output/-r option to print raw (non-JSON) strings (3c187b1)
  • cli: send filename and content type when reading input from files (fa4fbee)

Chores

  • ci: support manually triggering release workflow (f0401db)

This pull request is managed by Stainless's GitHub App.

The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.

For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.

🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions

Greptile Summary

This release adds two features: a --raw-output/-r root flag that strips JSON quotes from string results (modeled after jq -r), and fileUpload metadata (filename + content-type) attached to file readers in EmbedIOReader mode so multipart encoders can populate Content-Disposition and Content-Type headers correctly. Both features are propagated consistently across all ~35 command handlers and are backed by new unit tests.

Confidence Score: 5/5

Safe to merge; all findings are P2 style issues only.

Both new features (--raw-output and fileUpload metadata) are correctly implemented, consistently wired across all command handlers, and backed by solid unit tests. The only issues are two swapped require.Equal argument orders in the new test, which are cosmetic and do not affect test correctness.

pkg/cmd/flagoptions_test.go (lines 365, 379) — swapped require.Equal arguments, cosmetic only.

Important Files Changed

Filename Overview
pkg/cmd/cmdutil.go Adds RawOutput field to ShowJSONOpts and threads it through formatJSON; when true and the result type is gjson.String, returns the unquoted string value (modeled after jq -r). Logic is correct and well-tested.
pkg/cmd/flagoptions.go Introduces fileUpload struct wrapping io.Reader with filename and content-type metadata for multipart uploads; openFileUpload derives content-type via mime.TypeByExtension with application/octet-stream fallback. Both FilePathValue and @-prefixed paths in EmbedIOReader mode now return fileUpload instead of bare *os.File.
pkg/cmd/flagoptions_test.go New TestEmbedFilesUploadMetadata verifies fileUpload metadata for AtPrefix and FilePathValue paths; two require.Equal calls have (actual, expected) argument order reversed (lines 365, 379), which won't cause false passes but will produce misleading failure messages.
pkg/cmd/cmd.go Registers --raw-output/-r as a root-level BoolFlag; accessible to all subcommands via cmd.Root().Bool("raw-output").
pkg/cmd/cmdutil_test.go Updated existing formatJSON calls to pass rawOutput=false; added three new test cases covering string, non-string, and object values under --raw-output. All cases look correct.
.github/workflows/publish-release.yml Adds workflow_dispatch: {} trigger to allow manually kicking off the release workflow in addition to the existing tag-push trigger.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[CLI invocation] --> B{--raw-output set?}
    B -- Yes --> C[formatJSON called]
    B -- No --> C
    C --> D{transform != empty?}
    D -- Yes --> E[Apply GJSON transform to result]
    D -- No --> F{rawOutput && res.Type == String?}
    E --> F
    F -- Yes --> G[Return res.Str + newline\nunquoted raw string]
    F -- No --> H{format?}
    H -- auto --> I[Recurse with json format]
    H -- pretty --> J[Render colored pretty JSON]
    H -- json --> K[Return pretty-printed JSON]
    H -- jsonl --> L[Return one-line JSON]
    H -- raw --> M[Return res.Raw + newline]
    H -- yaml --> N[Convert and write YAML]

    subgraph FileUpload [EmbedIOReader File Upload]
        P[string value starting with @\nor FilePathValue] --> Q{stdin path?}
        Q -- Yes --> R[Return io.NopCloser wrapping stdin]
        Q -- No --> S[openFileUpload: open file]
        S --> T[mime.TypeByExtension\nor application/octet-stream]
        T --> U[Return fileUpload with\nReader + filename + contentType]
    end
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: pkg/cmd/flagoptions_test.go
Line: 365

Comment:
**Swapped `require.Equal` arguments (expected, actual)**

`require.Equal` expects `(t, expected, actual)`, but `upload.ContentType()` (the actual value) is passed as the first argument and `tc.wantContentType` (the expected value) as the second. The test will still pass/fail correctly, but failure messages will print the labels in reverse, making them misleading.

```suggestion
			require.Equal(t, tc.wantContentType, upload.ContentType())
```

How can I resolve this? If you propose a fix, please make it concise.

Don't miss a new nirvana-cli release

NewReleases is sending notifications on new releases.