# Does the Instagit CLI Support Standard Input (STDIN)?

> Learn if the Instagit CLI supports standard input (stdin). Discover how to pipe DESIGN.md content directly into Instagit commands using the hyphen argument.

- Repository: [Google Labs Code/design.md](https://github.com/google-labs-code/design.md)
- Tags: how-to-guide
- Published: 2026-06-30

---

**Yes, the Instagit CLI supports reading DESIGN.md documents from standard input by passing `-` (hyphen) as the file argument to any command.**

The Instagit CLI, part of the google-labs-code/design.md repository, provides robust support for Unix-style piping workflows. According to the source code, every command that processes DESIGN.md files can accept input from stdin instead of a file path, enabling seamless integration with shell pipelines and automated workflows.

## How STDIN Support Is Implemented

### The `readInput` Utility Function

The core stdin handling logic resides in the `readInput` function located in [`packages/cli/src/utils.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/utils.ts) at lines 18-28. This utility checks whether the supplied file path equals the string `"-"`, and when it detects this special character, it consumes the entire stream from `process.stdin` rather than reading from the filesystem.

According to the implementation in [`packages/cli/src/utils.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/utils.ts), the function treats the hyphen as a signal to switch input sources, making it possible to pipe content directly into the tool without writing temporary files.

## Command-Level STDIN Integration

All Instagit CLI commands that expect a DESIGN.md file explicitly document this behavior in their argument descriptions. For example:

- In [`packages/cli/src/commands/lint.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/commands/lint.ts) at line 27, the positional argument is described as "Path to DESIGN.md (use `-` for stdin)"
- In [`packages/cli/src/commands/export.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/commands/export.ts) at line 31, the same documentation pattern appears

The top-level README.md at line 219 confirms this capability, stating that "All commands accept a file path or `-` for stdin".

## Practical Usage Examples

### Standard File Input

```bash
instagit lint path/to/DESIGN.md

```

### Piping from STDIN

```bash
cat path/to/DESIGN.md | instagit lint -

```

### Git Integration Pipeline

```bash
git show HEAD:DESIGN.md | instagit export - --format=json

```

All examples work because the `readInput` function in [`packages/cli/src/utils.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/utils.ts) (lines 21-28) automatically detects the `-` argument and reads from `process.stdin`.

## Summary

- The `readInput` function in [`packages/cli/src/utils.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/utils.ts) provides centralized stdin handling when the file argument is `-`
- All Instagit CLI commands support stdin input for DESIGN.md files, as documented in the README.md at line 219
- The `lint` and `export` commands in `packages/cli/src/commands/` explicitly declare this capability in their argument descriptions
- Shell pipelines like `cat design.md | instagit lint -` work natively without additional flags

## Frequently Asked Questions

### How do I use stdin with the Instagit CLI?

Pass `-` (hyphen) as the file path argument. The `readInput` utility in [`packages/cli/src/utils.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/utils.ts) detects this character and reads the entire stream from `process.stdin` instead of the filesystem. For example: `cat design.md | instagit lint -`.

### Which commands support reading from stdin?

All commands that accept a DESIGN.md file path support stdin input, including `lint` and `export`. The argument descriptions in [`packages/cli/src/commands/lint.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/commands/lint.ts) and [`packages/cli/src/commands/export.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/commands/export.ts) explicitly document this behavior for users.

### Is there a specific flag required for stdin mode?

No special flag is needed. Simply use `-` as the file argument. The CLI automatically switches to stdin mode when it encounters this character, as implemented in the `readInput` function at lines 18-28 of [`packages/cli/src/utils.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/utils.ts).

### Where is the stdin handling logic implemented?

The logic resides in the `readInput` function within [`packages/cli/src/utils.ts`](https://github.com/google-labs-code/design.md/blob/main/packages/cli/src/utils.ts) (lines 18-28). This function checks if the input path equals `"-"` and conditionally reads from `process.stdin` rather than loading a file from disk.