コマンドリファレンス
space
| コマンド | 説明 |
|---|---|
space info | スペース情報と API ベースURL を表示 |
space info
supacms space info --space <slug> [--api-key <key>] [--pretty]スペースの名前・スラッグと、.env に設定すべき SUPACMS_API_URL の値を確認できます。
{ "id": "01abc...", "slug": "supa-media", "name": "Supa Media", "apiBaseUrl": "https://supacms-website-prod-xxxx.supacms.workers.dev"}api-key
| コマンド | 説明 |
|---|---|
api-key create | スペースの APIキーを新規作成 |
api-key list | スペースの APIキー一覧を取得 |
api-key create
supacms api-key create --space <slug> --name <表示名>レスポンスに key フィールドが含まれます。このキーは作成時にしか確認できません。安全な場所に保管してください。
api-key list
supacms api-key list --space <slug>content-type
| コマンド | 説明 |
|---|---|
content-type create | ContentType を新規作成 |
content-type list | スペース内の ContentType を一覧取得 |
content-type update | ContentType の名前・説明を更新 |
content-type create
supacms content-type create \ --space <slug> \ --name <表示名> \ --api-id <apiId> \ [--description <説明>]apiId は英字で始まる英数字・アンダースコアの組み合わせ(例: blogPost、product_detail)。
content-type list
supacms content-type list --space <slug>content-type update
supacms content-type update \ --space <slug> \ --api-id <現在のapiId> \ --name <新しい表示名> \ [--description <新しい説明>]field
| コマンド | 説明 |
|---|---|
field add | ContentType にフィールドを追加 |
field list | ContentType のフィールド一覧を取得 |
field update | フィールドの名前・設定を更新 |
field add
supacms field add \ --space <slug> \ --content-type <contentTypeApiId> \ --name <表示名> \ --api-id <apiId> \ --type <フィールドタイプ> \ [--required] \ [--config '<JSON>']--type に指定できる値とそれぞれの --config はフィールドタイプ一覧を参照してください。
field list
supacms field list \ --space <slug> \ --content-type <contentTypeApiId>field update
supacms field update \ --space <slug> \ --content-type <contentTypeApiId> \ --api-id <fieldApiId> \ --name <新しい表示名> \ --type <フィールドタイプ> \ [--required] \ [--config '<JSON>']media
| コマンド | 説明 |
|---|---|
media upload | ファイルをスペースにアップロード |
media list | スペースのメディア一覧を取得 |
media upload
supacms media upload \ --space <slug> \ --file <ファイルパス> \ [--alt <代替テキスト>] \ [--api-key <key>]対応フォーマット: JPEG / PNG / GIF / WebP / SVG(最大 10MB)
{ "id": "01938f...", "spaceId": "...", "filename": "hero.png", "mimeType": "image/png", "size": 204800, "url": "/api/media/myspace/01938f...", "alt": "ヒーロー画像", "createdAt": "2026-08-05T09:00:00.000Z"}media list
supacms media list --space <slug> [--api-key <key>]entry
エントリはコンテンツタイプのスキーマに基づいた実際のコンテンツデータです。作成は常に draft 状態になります。
| コマンド | 説明 |
|---|---|
entry create | エントリを新規作成(常に draft 状態) |
entry list | エントリ一覧を取得(status でフィルタ可能) |
entry update | エントリのデータを更新 |
entry publish | エントリを公開(draft → published) |
entry unpublish | エントリを非公開に戻す(published → draft) |
entry delete | エントリを削除 |
entry create
supacms entry create \ --space <slug> \ --content-type <contentTypeApiId> \ --data '<JSON>'--data の代わりに --file <path> で JSON ファイルを指定することもできます。
supacms entry create \ --space myblog \ --content-type blogPost \ --file ./entry.jsonentry list
supacms entry list \ --space <slug> \ --content-type <contentTypeApiId> \ [--status draft|published]entry update
supacms entry update \ --space <slug> \ --content-type <contentTypeApiId> \ --id <entryId> \ --data '<JSON>'--data と --file は排他です。
entry publish / unpublish
supacms entry publish --space <slug> --content-type <contentTypeApiId> --id <entryId>supacms entry unpublish --space <slug> --content-type <contentTypeApiId> --id <entryId>entry delete
supacms entry delete \ --space <slug> \ --content-type <contentTypeApiId> \ --id <entryId>init
カレントディレクトリに .env.example を生成します。
supacms init \ --space <slug> \ --content-type <contentTypeApiId> \ [--api-key <key>]SUPACMS_API_URL には space info で取得した実際のURLが自動で入ります。
SUPACMS_API_URL=https://supacms-website-prod-xxxx.supacms.workers.devSUPACMS_API_KEY=SUPACMS_SPACE_SLUG=supa-mediaSUPACMS_CONTENT_TYPE_API_ID=article.env にコピーして SUPACMS_API_KEY を埋めるとすぐに使えます。
フィールドタイプ一覧
| type | 説明 | config オプション |
|---|---|---|
short_text | 短いテキスト | maxLength (int) |
long_text | 長いテキスト | maxLength (int) |
rich_text | リッチテキスト | なし |
integer | 整数 | min (int), max (int) |
decimal | 小数 | min (number), max (number) |
boolean | 真偽値 | defaultValue (bool) |
datetime | 日時 | includeTime (bool) |
json | JSON オブジェクト | なし |
url | URL | なし |
media | 画像・メディア | なし |
# maxLength 付き short_textsupacms field add --type short_text --config '{"maxLength": 200}' ...
# 時刻なしの datetimesupacms field add --type datetime --config '{"includeTime": false}' ...
# config 不要な場合は省略可supacms field add --type rich_text ...出力フォーマット
デフォルトは JSON 形式(AI が parse しやすい)。--pretty で人間向けの整形表示になります。
supacms content-type list --space myspace --prettyエラー時は JSON 形式でエラーを出力し、終了コード 1 で終了します。
{ "error": "apiId already exists: blogPost" }実行例
スキーマ定義からエントリ公開まで
# 1. ContentType を作成supacms content-type create \ --space myblog \ --name "ブログ記事" \ --api-id blogPost
# 2. フィールドを追加supacms field add --space myblog --content-type blogPost \ --name "タイトル" --api-id title \ --type short_text --required --config '{"maxLength": 200}'
supacms field add --space myblog --content-type blogPost \ --name "本文" --api-id body \ --type rich_text --required
# 3. エントリを作成(draft)export SUPACMS_API_KEY=sk-...supacms entry create \ --space myblog \ --content-type blogPost \ --data '{"title": "はじめての記事", "body": "本文です。"}' \ --pretty
# 4. 公開するsupacms entry publish \ --space myblog \ --content-type blogPost \ --id <entryId>画像付きコンテンツを公開する
API_KEY=sk-...
supacms content-type create \ --space myblog --name "ブログ記事" --api-id blogPost \ --api-key $API_KEY
supacms field add --space myblog --content-type blogPost \ --name "タイトル" --api-id title --type short_text --required \ --api-key $API_KEY
supacms field add --space myblog --content-type blogPost \ --name "アイキャッチ" --api-id eyecatch --type media \ --api-key $API_KEY
# 画像をアップロードして ID を取得supacms media upload \ --space myblog \ --file ./hero.png \ --alt "ヒーロー画像" \ --api-key $API_KEY --pretty
# エントリを作成(media フィールドには取得した id を渡す)export SUPACMS_API_KEY=$API_KEYsupacms entry create \ --space myblog \ --content-type blogPost \ --data '{"title": "画像付き記事", "eyecatch": "01938f..."}' \ --pretty