# The command line

> Every command of songstress and of create-songstress-extension, with every option.

Page: https://songstress.app/docs/develop/cli/

## songstress [#songstress]

The SDK's command. It comes with the `songstress` package, so `npx songstress` runs it in a project.

```sh title="Terminal"
songstress <command> [folder]
```

The folder is your extension's, where `songstress.json` is: `.` unless you say. For `check`, a repository's root that
holds several extensions, one folder each, works too.

| Command | What it does |
| --- | --- |
| `build` | Builds each entry the manifest names under `dist/` from its source under `src/` (`dist/server.js` from `src/server.ts`, `.tsx`, `.mts`, `.js` or `.mjs`): one classic script with everything it imports inside it, an IIFE bundled by rolldown. An entry with no such source is left as your own build wrote it |
| `pack` | Builds, then writes the package's archive, `<id>-<version>.songstress`: the manifest, every file it names and the documents at the folder's root (README, LICENSE, NOTICE, CHANGELOG and the like), nothing else, in a ZIP that is the same byte for byte wherever it is made |
| `check` | Checks the manifest of each extension the folder holds, as a server does when it installs one, holds each theme to the apps' rules, and says what its release is called. Exits 1 when any fails: what a repository's CI runs |
| `dev` | Builds, packs and pushes it to your own server as a development install, switched on, granted what its manifest asks and seen by you alone; again whenever a file changes. Prints the extension's log. A build that fails, or a package the server refuses, is reported, and the last good one keeps running |

| Option | For | What it does |
| --- | --- | --- |
| `--out <file>` | `pack` | Where to write the archive. The current folder, under its release name, unless you say |
| `--profile <name>` | `check` | `install`, the default, or `listing`: what the Marketplace asks of a listing on top |
| `--server <url>` | `dev` | Your Songstress server, http or https. Or `SONGSTRESS_SERVER` |
| `--email <email>` | `dev` | An admin of it, with the password in `SONGSTRESS_PASSWORD`. Or `SONGSTRESS_EMAIL` |
| `-h`, `--help` | Any | The commands and options |

Instead of an email and a password, `dev` takes `SONGSTRESS_TOKEN`, an admin's session.

```sh title="Terminal"
SONGSTRESS_PASSWORD='your password' npx songstress dev --server http://music.local:8090 --email you@example.com
```

`songstress` exits 0 when it succeeds, 1 when a check fails or a command can't finish, and 2 for an option or a
command it doesn't know.

## create-songstress-extension [#create-songstress-extension]

Starts an extension, or adds one to a repository that already holds several.

```sh title="Terminal"
npm create songstress-extension@latest [folder] -- [options]
```

`pnpm create`, `bun create` and `yarn create` work too, and the files it writes speak of the package manager you
started it with. Every question has an option, and `--yes` takes the defaults for the rest, so it runs with no
terminal at all:

```sh title="Terminal"
npm create songstress-extension@latest night-radio -- --yes --id acme.night-radio --category discovery
```

| Option | What it sets |
| --- | --- |
| `[folder]` | Where the repository goes. `my-extension` unless you say |
| `--name <text>` | The name people see |
| `--id <publisher.name>` | The extension's identity, which never changes. The publisher is your GitHub user or organisation |
| `--description <text>` | One or two sentences, 160 characters at most |
| `--category <name>` | Where the Marketplace files it |
| `--layout <single\|multi>` | One extension a repository (the default), or several, each in a folder named by its id |
| `--license <spdx>` | `MIT` unless you say. `LICENSE` is written for MIT; for another licence, add its text yourself |
| `--author <name>` | Who holds the copyright. Your git `user.name` unless you say |
| `--repository <url>` | `https://github.com/owner/name`, once it exists |
| `--theme` | A theme in place of code: a dark and a light look, with nothing to build or test |
| `--pm <npm\|pnpm\|yarn\|bun>` | The package manager. Unless you say, the one a repository of several uses, else the one that started the command |
| `--no-install`, `--no-git` | Leave the dependencies, or git, for later |
| `--sdk <specifier>` | Where the `songstress` package comes from instead of its released version: a folder or a tarball |
| `-y`, `--yes` | Ask nothing |
| `--dry-run` | Say what would be written, and write nothing |
| `--json` | Print the outcome as JSON, and nothing else |
| `-h`, `--help` | The options |
| `-v`, `--version` | The command's version |

It never writes into a folder that holds something, and never over a file. When it can't do something (a write, git,
the install), it says what is on the disk and what to run next.

### One extension or several [#one-extension-or-several]

- **One** (`--layout single`): the repository is the extension, with `songstress.json` at its root. A release is a
  tag `v<version>`.
- **Several** (`--layout multi`): each extension is in a folder named by its id (`acme.play-count/`), with a version
  and releases of its own. A release is a tag `<id>@<version>`, and it releases that extension alone. Run in a
  repository that already holds several, the command adds one more.
