Skip to content

Add support for one-shot stdin via .input() - #1178

Closed
felipecrs wants to merge 1 commit into
steveukx:mainfrom
felipecrs:feat/input-stdin
Closed

felipecrs wants to merge 1 commit into
steveukx:mainfrom
felipecrs:feat/input-stdin

Conversation

@felipecrs

@felipecrs felipecrs commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

This allows passing stdin for git commands like:

const trailers = await simpleGit()
   .input(commitMessage)
   .raw(['interpret-trailers', '--parse']);

Useful for commands like interpret-trailers --parse and hash-object --stdin.

Related:

I realized this limitation when working on renovatebot/renovate#44651, where I needed to call echo "commit message" | git interpret-trailers --parse.

So I thought this would be a nice and simple way to fix it, while still having room for future improvements like support for Streams.

Allow passing a string or Buffer to the next spawned git command's
stdin, e.g. for interpret-trailers --parse and hash-object --stdin.
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 65039ca

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
simple-git Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@felipecrs felipecrs changed the title Add .input() for one-shot stdin Support stdin via .input() Jul 17, 2026
@felipecrs felipecrs changed the title Support stdin via .input() Add support for stdin via .input() Jul 17, 2026
@felipecrs
felipecrs marked this pull request as ready for review July 17, 2026 02:06
@felipecrs felipecrs changed the title Add support for stdin via .input() Add support for one-shot stdin via .input() Jul 17, 2026
steveukx added a commit that referenced this pull request Sep 22, 2026
@steveukx

Copy link
Copy Markdown
Owner

Hello, thank you for the PR.

I'm going to roll this into the #1193 v4 release - this will initially be an input plugin, with next iteration after the main v4 release to allow for any command to pass the stdin through the SimpleGitTask.

https://github.com/steveukx/git-js/blob/3b3168ef57dd6b1e178bd0ae3efa8190c0638cd8/docs/PLUGIN-INPUT.md

https://github.com/steveukx/git-js/blob/3b3168ef57dd6b1e178bd0ae3efa8190c0638cd8/simple-git/test/integration/plugins/plugin.input.spec.ts

@felipecrs

Copy link
Copy Markdown
Contributor Author

Looks great! Thanks a lot.

@felipecrs felipecrs closed this Sep 22, 2026
@felipecrs
felipecrs deleted the feat/input-stdin branch September 22, 2026 11:26
steveukx added a commit that referenced this pull request Sep 23, 2026
steveukx added a commit that referenced this pull request Sep 23, 2026
* - remove `simple-git/promise` and associated `gitP` export

* - switch from yarn to pnpm

* - convert jest to vitest

* - upgrade biome
- apply formatting to "new" code

* - migrate types into `src`
- add vite build script

* - vite build for mjs / cjs outputs, reusing the `baseConfig` helper from the `@simple-git/` sub-packages.
- apply the `node:` schema for node specific imports
- generate types with `tsc`

* - apply lint across tests

* - apply import ordering and type import settings to more packages

* - update package scripts to use pnpm from yarn

* - add declaration maps

* - enforce the use of `GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS` environment variable to disable abbreviations in `git` commands

* - enforce the use of `GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS` environment variable to disable abbreviations in `git` commands

* - split unit and integration tests as `projects` in vitest, apply module mocks only in unit tests.

* - use pnpm in the github actions

* - use `pnpm/setup` action in favour of `actions/setup-node`

* - use `pnpm/setup` action in favour of `actions/setup-node`

* - use `pnpm/setup` action in favour of `actions/setup-node`
- upgrade `actions/checkout`

* - update self-referential tests to import from root barrel file (argv-parser)

* - update self-referential tests to import from root barrel file (argv-parser)

* - update unit tests to be aware of the constant environment variable, and remove test asserting ability to use a default export on `simple-git`

* Lint

* Update unsafe spec - no longer viable to pwn with `--u`

* Use pnpm in build scripts

* - use `.ts` rather than `.d.ts` in source files

* - CI runs consumer tests outside of main test flow
- Remove duplication in consumer tests
- Remove babel configuration, obsolete following move to vitest

* - examples directory uses the named import

* - docs content uses the named import

* - add debug logging to the custom-binary plugin
- remove `console.warn` when permitting unsafe (configured through `unsafe.allowUnsafeCustomBinary`)

* - remove duplication in exported types

* - remove deprecated build tools

* - remove deprecated interfaces

* Update lock file

* - lint

* - path to windows test file

* - path to windows test file

* - path to windows test file

* - path to windows test file

* - path to windows test file

* - path to windows test file

* - path to windows test file

* - consumer tests allow rewriting lockfile before running

* - consumer tests allow rewriting lockfile before running

* - support `build:pkg` only modifying the `export` publish block, rather than full removal of `scripts` and `devDependencies`.
- `typescript-esm-consumer` package updated to build ESM JavaScript (includes type check) then run directly with node (includes validation of exported functionality).

* - add consumer tests asserting both TypeScript compilation and test running (directly via node to avoid any inline TS transpilation by TSX)
- removed obsolete block from biome config

* - apply config-only `build:pkg` switch to the github actions setup

* - Include `tar.command` to vulnerable config list
- `simple-git` depends on current workspace version rather than `^` version of arv-parser, avoids inconsistency in vulnerability detection expectations, noting an upgrade to argv-parser will require a new release of `simple-git`.

* - Add vulnerability test for use of `include.path`

* - Add option to `unsafe.allowAbbreviatedOptions`

* - Documentation for v4 release

* - Lint

* - Add `includeIf.<condition>.path` to the vulnerabilities list

* Add support for `input` plugin.

Closes #1178

* Create the `git.interpretTrailers` interface

Closes #1178
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants