Skip to content

コマンドリファレンス

space

コマンド説明
space infoスペース情報と API ベースURL を表示

space info

Terminal window
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

Terminal window
supacms api-key create --space <slug> --name <表示名>

レスポンスに key フィールドが含まれます。このキーは作成時にしか確認できません。安全な場所に保管してください。

api-key list

Terminal window
supacms api-key list --space <slug>

content-type

コマンド説明
content-type createContentType を新規作成
content-type listスペース内の ContentType を一覧取得
content-type updateContentType の名前・説明を更新

content-type create

Terminal window
supacms content-type create \
--space <slug> \
--name <表示名> \
--api-id <apiId> \
[--description <説明>]

apiId は英字で始まる英数字・アンダースコアの組み合わせ(例: blogPostproduct_detail)。

content-type list

Terminal window
supacms content-type list --space <slug>

content-type update

Terminal window
supacms content-type update \
--space <slug> \
--api-id <現在のapiId> \
--name <新しい表示名> \
[--description <新しい説明>]

field

コマンド説明
field addContentType にフィールドを追加
field listContentType のフィールド一覧を取得
field updateフィールドの名前・設定を更新

field add

Terminal window
supacms field add \
--space <slug> \
--content-type <contentTypeApiId> \
--name <表示名> \
--api-id <apiId> \
--type <フィールドタイプ> \
[--required] \
[--config '<JSON>']

--type に指定できる値とそれぞれの --configフィールドタイプ一覧を参照してください。

field list

Terminal window
supacms field list \
--space <slug> \
--content-type <contentTypeApiId>

field update

Terminal window
supacms field update \
--space <slug> \
--content-type <contentTypeApiId> \
--api-id <fieldApiId> \
--name <新しい表示名> \
--type <フィールドタイプ> \
[--required] \
[--config '<JSON>']

media

コマンド説明
media uploadファイルをスペースにアップロード
media listスペースのメディア一覧を取得

media upload

Terminal window
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

Terminal window
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

Terminal window
supacms entry create \
--space <slug> \
--content-type <contentTypeApiId> \
--data '<JSON>'

--data の代わりに --file <path> で JSON ファイルを指定することもできます。

Terminal window
supacms entry create \
--space myblog \
--content-type blogPost \
--file ./entry.json

entry list

Terminal window
supacms entry list \
--space <slug> \
--content-type <contentTypeApiId> \
[--status draft|published]

entry update

Terminal window
supacms entry update \
--space <slug> \
--content-type <contentTypeApiId> \
--id <entryId> \
--data '<JSON>'

--data--file は排他です。

entry publish / unpublish

Terminal window
supacms entry publish --space <slug> --content-type <contentTypeApiId> --id <entryId>
supacms entry unpublish --space <slug> --content-type <contentTypeApiId> --id <entryId>

entry delete

Terminal window
supacms entry delete \
--space <slug> \
--content-type <contentTypeApiId> \
--id <entryId>

init

カレントディレクトリに .env.example を生成します。

Terminal window
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.dev
SUPACMS_API_KEY=
SUPACMS_SPACE_SLUG=supa-media
SUPACMS_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)
jsonJSON オブジェクトなし
urlURLなし
media画像・メディアなし
Terminal window
# maxLength 付き short_text
supacms field add --type short_text --config '{"maxLength": 200}' ...
# 時刻なしの datetime
supacms field add --type datetime --config '{"includeTime": false}' ...
# config 不要な場合は省略可
supacms field add --type rich_text ...

出力フォーマット

デフォルトは JSON 形式(AI が parse しやすい)。--pretty で人間向けの整形表示になります。

Terminal window
supacms content-type list --space myspace --pretty

エラー時は JSON 形式でエラーを出力し、終了コード 1 で終了します。

{ "error": "apiId already exists: blogPost" }

実行例

スキーマ定義からエントリ公開まで

Terminal window
# 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>

画像付きコンテンツを公開する

Terminal window
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_KEY
supacms entry create \
--space myblog \
--content-type blogPost \
--data '{"title": "画像付き記事", "eyecatch": "01938f..."}' \
--pretty