> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tiro.ooo/llms.txt
> Use this file to discover all available pages before exploring further.

# Tiro CLI をエージェントにインストールする

> プロンプト 1 つで、エージェントが Tiro CLI をインストールし、ブラウザで OAuth を実行して、セッションが有効であることを確認します。

以下のブロックを Claude Code、Cursor のターミナルエージェント、またはシェルアクセスを持つ任意のコーディングエージェントに貼り付けてください。エージェントが `@theplato/tiro-cli` を npm からインストールし、ブラウザで OAuth を実行して、セッションを検証します。

**要件**  ·  Node.js 20+  ·  macOS、Linux、または Windows  ·  エージェントがコマンドを実行できるシェル

## このプロンプトをコピー

```text The Tiro CLI install prompt theme={"system"}
Install the Tiro CLI in this environment and sign me in.

  Package    :  @theplato/tiro-cli  (Node.js 20+)
  Platforms  :  macOS, Linux, Windows
  Auth       :  OAuth (Authorization Code + PKCE) — opens a browser
                and stores the token in the OS keychain.

Steps:
  1. Install globally with whichever package manager is already in
     use here. For npm, that is:
       npm install -g @theplato/tiro-cli
     (Use pnpm / yarn / bun equivalents if those are the active
     package manager — do not switch tooling.)
  2. Verify the install:
       tiro --version            # expect 0.3.1 or later
  3. Sign me in:
       tiro auth login           # opens a browser for OAuth
  4. Confirm the session:
       tiro auth status          # shows user + token prefix only

If this is a headless / CI / sandboxed environment without a browser,
do not run `tiro auth login`. Instead, ask me for a TIRO_TOKEN value
and export it for subsequent commands:

  export TIRO_TOKEN="<paste-token-here>"

When everything is connected, run:

  tiro notes list --limit 3 --json

and show me the output to prove the CLI is working. If any step
fails, show the exact command, the exit code, and the error — do
not retry silently.
```

<Tip>
  このプロンプトはエージェントに対し、ワークスペースで **すでに使用されているパッケージマネージャーを尊重する** よう指示します。インストール後に `npm` と `pnpm` の両方のロックファイルができてしまうことはありません。
</Tip>

## エージェントが行うこと

1. お使いのパッケージマネージャー（npm / pnpm / yarn / bun）を検出し、`@theplato/tiro-cli` をグローバルにインストールします。
2. `tiro --version` を実行して、バイナリが `PATH` 上にあることを確認します。
3. `tiro auth login` を実行します。ブラウザが開いて OAuth が始まります。ベアラートークンは OS ネイティブの keychain（Keychain / Secret Service / Credential Manager）に保存されます。
4. `tiro auth status` と `tiro notes list --limit 3 --json` を呼び出して、接続を確認します。

ヘッドレス環境では、エージェントはステップ 3 で一時停止し、代わりに `TIRO_TOKEN` を尋ねます。トークンの発行方法については [ヘッドレス、CI、エージェント環境](/ja/developers/cli/setup#headless-ci-and-agent-environments) をご覧ください。

## プライバシーとトークンの取り扱い

* OAuth トークンは OS ネイティブの認証情報ストアに保存されます。完全なベアラートークンが stdout に表示されることはなく、`tk__...***` のようなプレフィックスのみが表示されます。
* `TIRO_TOKEN` を設定した場合、keychain よりも優先されます。CI シークレットには便利ですが、シェル履歴に漏れると危険です。
* ローテーションするには、信頼できるマシンで `tiro auth logout && tiro auth login` を実行し、その後シークレットストアを更新してください。

***

ご自身でインストールしたい場合は  → [手動でのインストールと認証](/ja/developers/cli/setup)   ·   [クイックスタートのシナリオ](/ja/developers/cli/quickstart)   ·   [エージェントガイド](/ja/developers/cli/agent-guide)
