# CLI commands
URL: https://lsd.tools/docs/api-cli
Updated: 2026-07-17

> The lsd CLI drives packages from the terminal — scaffold a new one, lint it against the two-layer rule, run any @tool.command you defined, and dump the API as JSON or markdown for an AI editor. LSD_PROFILE picks the backend.

The `lsd` command-line tool scaffolds and lints packages, runs the commands your tools define, and
describes the API for editors and AI. It ships with the installed product (`LSDCli.exe`; see
[Runtime](/docs/api-runtime)).

## Usage

```bash
lsd package new mypkg # scaffold a package
lsd package lint # check it stays on lsdtools
lsd mypkg count --path a.csv # run a @tool.command
```

## Where to start

- Develop: [Develop a package](/docs/pkg-develop)
- Commands: [Commands & actions](/docs/tools-commands-actions)
- AI: 

## Package commands

### lsd package new
Scaffold a new package folder — an `lsd_package.json`, a starter `tool.py`, and dev config.

```bash
lsd package new mypkg
```

### lsd package lint
Check a package stays on the supported surface (imports only `lsdtools`, valid manifest, node
signatures). Run it in CI.

```bash
lsd package lint
```

## Tool commands

### lsd &lt;tool&gt; &lt;cmd&gt;
Run a command defined with [`@tool.command`](/docs/api-tool#command-name-help). The function's typed
parameters become CLI options.

```bash
# @tool.command("count") def count(ctx, path: str): ...
lsd mypkg count --path data.csv
```

## API introspection

### lsd api describe
Print the machine-readable JSON from [`describe_api()`](/docs/api-describe) — every registered step
and the public surface.

```bash
lsd api describe > api.json
```

### lsd api context
Print the API as markdown (`describe_markdown()`) — paste it into an AI editor as context.

```bash
lsd api context
```

## Profiles

`LSD_PROFILE` selects a backend from `~/.lsd/profiles.json` (e.g. a `dev` profile pointing at
localhost).

```bash
LSD_PROFILE=local lsd api describe
```

## Related

**Learn** — [Develop a package](/docs/pkg-develop)

**API** — [describe_api](/docs/api-describe) · [Runtime](/docs/api-runtime) · [PackageManager](/docs/api-package-manager)

**Examples** — [A CLI command](/docs/ex-cli-command)
