Skip to content

Commit 27fc7e1

Browse files
committed
update README hero example with CLI comments and cross-tool chaining
1 parent 49a8678 commit 27fc7e1

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@ import { convertCliToJs } from "cli-to-js";
99

1010
const git = await convertCliToJs("git");
1111

12+
// git commit --message "initial commit" --all
1213
await git.commit({ message: "initial commit", all: true });
14+
15+
// git push --force
1316
await git.push({ force: true });
14-
await git.log({ oneline: true, _: ["main..HEAD"] });
17+
18+
// git log --oneline main..HEAD
19+
const { stdout } = await git.log({ oneline: true, _: ["main..HEAD"] });
20+
const commits = stdout.trim().split("\n");
21+
22+
const docker = await convertCliToJs("docker");
23+
24+
// docker build --tag my-app:latest --file Dockerfile .
25+
await docker.build({ tag: `my-app:${commits[0].slice(0, 7)}`, file: "Dockerfile", _: ["."] });
1526
```
1627

17-
No manual wrappers. No codegen step. No config. One function call turns `git`, `docker`, `kubectl`, `ffmpeg` — anything with `--help` — into a typed, callable API.
28+
No manual wrappers. No codegen step. No config. One function call turns `git`, `docker`, `kubectl`, `ffmpeg` — anything with `--help` — into a typed, callable API. Compose them together with plain JavaScript.
1829

1930
**Built for AI agents.** Agents call CLIs dynamically but hallucinate flag names and forget required args. `$validate` catches mistakes before spawning a process, with did-you-mean suggestions an agent can self-correct from. `$spawn` returns a standard async iterator, so piping and streaming is just a `for await` loop — the most in-distribution JS pattern for any model.
2031

packages/cli-to-js/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@ import { convertCliToJs } from "cli-to-js";
99

1010
const git = await convertCliToJs("git");
1111

12+
// git commit --message "initial commit" --all
1213
await git.commit({ message: "initial commit", all: true });
14+
15+
// git push --force
1316
await git.push({ force: true });
14-
await git.log({ oneline: true, _: ["main..HEAD"] });
17+
18+
// git log --oneline main..HEAD
19+
const { stdout } = await git.log({ oneline: true, _: ["main..HEAD"] });
20+
const commits = stdout.trim().split("\n");
21+
22+
const docker = await convertCliToJs("docker");
23+
24+
// docker build --tag my-app:latest --file Dockerfile .
25+
await docker.build({ tag: `my-app:${commits[0].slice(0, 7)}`, file: "Dockerfile", _: ["."] });
1526
```
1627

17-
No manual wrappers. No codegen step. No config. One function call turns `git`, `docker`, `kubectl`, `ffmpeg` — anything with `--help` — into a typed, callable API.
28+
No manual wrappers. No codegen step. No config. One function call turns `git`, `docker`, `kubectl`, `ffmpeg` — anything with `--help` — into a typed, callable API. Compose them together with plain JavaScript.
1829

1930
**Built for AI agents.** Agents call CLIs dynamically but hallucinate flag names and forget required args. `$validate` catches mistakes before spawning a process, with did-you-mean suggestions an agent can self-correct from. `$spawn` returns a standard async iterator, so piping and streaming is just a `for await` loop — the most in-distribution JS pattern for any model.
2031

0 commit comments

Comments
 (0)