# CLI (https://mosoo.ai/docs/ja/cli/overview/)



`mosoo` CLI は Public Thread API、Console GraphQL operation、console REST operation、machine-readable command catalog を提供します。

## インストール [#インストール]

```bash
curl -fsSL https://install.mosoo.ai/install.sh | bash
```

installer は CLI を `~/.local/bin` に配置し、`@mosoo` coding-agent Skill をインストールし、[cloud.mosoo.ai](https://cloud.mosoo.ai) にサインインして `doctor` を実行します。system を変更せずに option を確認するには次を実行します。

```bash
curl -fsSL https://install.mosoo.ai/install.sh | bash -s -- --dry-run
```

## 認証と確認 [#認証と確認]

interactive browser login:

```bash
mosoo auth login --hostname cloud.mosoo.ai
mosoo auth status --hostname cloud.mosoo.ai
mosoo doctor --json
```

Project key（`msp_`）は account 管理を認可しません。account 全体の Console 操作にはブラウザーログインを使用し、キー移行後は再ログインして旧 credential を `mcli_` credential に置き換えてください。[認証とアクセス](https://mosoo.ai/docs/ja/auth-and-access/)を参照してください。

non-interactive login では、token を shell history に残す引数ではなく standard input から渡します。

```bash
printf '%s' "$MOSOO_API_TOKEN" | \
  mosoo auth login --hostname cloud.mosoo.ai --with-token
```

## Command を探す [#command-を探す]

```bash
mosoo --help
mosoo commands --json
mosoo commands show console environments create-environment
mosoo search "create environment"
```

`commands --json` は tool と coding Agent 向けです。`commands show` は一つの generated command の正確な schema を表示します。

## 一般的な操作 [#一般的な操作]

```bash
mosoo ls -o json
mosoo run --help
mosoo console environments create-environment --help
```

CLI command は契約から生成されます。CLI を更新して command help を確認してください。旧版の `--input-app-id` は現在の Project 契約には使えません。実行例は [API quickstart](https://mosoo.ai/docs/ja/quickstart/) を参照してください。

endpoint resolution は `--target local|cloud|custom`、`--base-url`、`--hostname` で制御します。output format は `table`、`json`、`yaml`、`raw` です。

<Callout type="warning">
  token を command argument、source file、Agent prompt に貼り付けないでください。interactive login を使うか、`--with-token` に pipe してください。
</Callout>
