tapcart-blocks について
tapcart-blocksは、Tapcartプロジェクトでブロックとグローバルコンポーネントを扱うエージェント向けスキルです。作成、同期、バージョン管理、ローカル開発サーバーの操作を案内します。
主な機能
- 01ブロックとコンポーネントの作成
- 02ダッシュボードからの取得
- 03変更のプッシュとバージョン管理
- 04ローカル開発サーバーの起動
活用シーン
- 01Tapcartのブロックやコンポーネントの作成
- 02ダッシュボードとローカルファイルの同期
- 03変更のテストとリリース管理
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ tapcartinc/ tapcart-agent-skills --skill tapcart-blocksインストール後、Claude Code で/tapcart-blocksを入力して読み込まれたか確認します。
詳細
Tapcart ブロックとコンポーネント
Tapcart のブロックとグローバルコンポーネントを管理します。ブロックとコンポーネントの操作は同じです。このスキルでは両方を扱います。すべてのコマンドは Tapcart プロジェクトディレクトリのルートから実行します。
特に記載がない限り、エージェントがすべてのコマンドを直接実行します。
作成
作成コマンドを実行し、作成したものをユーザーに伝えます。
# Block
tapcart block create <BlockFolderName>
# Component
tapcart component create <ComponentFolderName>
作成後、開発サーバーの起動方法をユーザーに伝えます(下記の「開発サーバー」を参照)。
プル
プルコマンドを実行して、Tapcart ダッシュボードからローカルの ./blocks または ./components フォルダーに同期します。
# Pull all blocks
tapcart block pull -a
# Pull specific block(s)
tapcart block pull -b MyBlock
tapcart block pull -b BlockOne -b BlockTwo
# Pull a specific version of a block
tapcart block pull -b MyBlock -v 2
# Pull all components
tapcart component pull -a
# Pull specific component(s)
tapcart component pull -c ProductCard
tapcart component pull -c ProductCard -c Button
# Pull a specific version of a component
tapcart component pull -c ProductCard -v 3
制約:
-aと-b/-cは同時に指定できません-vは単一のブロック名またはコンポーネント名と組み合わせる場合にのみ使用できます
プッシュ
プッシュする前に、ローカルの code.jsx と config.json を読み、変更内容に問題がないことを確認してから、実行前にユーザーの確認を得ます。
# Push a specific block (creates new version, not live)
tapcart block push -b MyBlock
# Push and set the new version live immediately
tapcart block push -b MyBlock --live
# Push multiple blocks
tapcart block push -b BlockOne -b BlockTwo
# Push all blocks
tapcart block push -a
# Push a specific component
tapcart component push -c ProductCard
# Push and set live
tapcart component push -c ProductCard --live
# Push all components
tapcart component push -a
警告:
--liveを指定すると、新しいバージョンがすべてのアプリユーザーに直ちに表示されます。デフォルトでは--liveを指定せずにプッシュし、ユーザーが結果を確認した後にversions setを使用してください。
開発サーバー
開発サーバーをバックグラウンドで実行し、起動中であることをユーザーに伝えます。ユーザーから停止を求められるまで、実行を続けてください。
# Block dev server
tapcart block dev -b MyBlock
tapcart block dev -b MyBlock -p 4995 # custom port, default is 4995
# Component dev server
tapcart component dev -c ProductCard
tapcart component dev -c ProductCard -p 4996 # default is 4996
開発サーバーは http://localhost:<port> で起動します(ブロックのデフォルト:4995、コンポーネントのデフォルト:4996)。
ユーザーから開発サーバーの停止を求められたら、プロセスを終了します。
バージョン
バージョンの一覧表示
次のコマンドを実行し、出力をユーザーに表示します。
tapcart block versions list -b MyBlock
tapcart component versions list -c ProductCard
出力には各バージョン番号、そのバージョンがローカルにあるかどうか、ダッシュボードでライブになっているかどうかが表示されます。
バージョンをライブに設定
ライブにするバージョンをユーザーに確認してから、次を実行します。
tapcart block versions set -b MyBlock -v 2
tapcart component versions set -c ProductCard -v 3
バージョン番号は 1 から始まります(バージョン 1 は最初のプッシュです)。