cordierite

Cordierite 지원 React Native 앱을 머신에 연결하고, 앱이 등록한 도구를 사용해 터미널에서 구동합니다. 에이전트, 스크립트 등에 유용합니다.

npx skills add https://github.com/callstackincubator/cordierite --skill cordierite

Cordierite

Cordierite is a CLI/daemon/MCP workflow for connecting to a Cordierite-enabled React Native app, discovering its registered tools, invoking those tools, and ending the session cleanly after use. A single cordierite daemon on this machine owns the wss:// listener and every device session; the CLI (and cordierite mcp, if this agent is invoked as an MCP client instead of a shell) are both thin RPC clients of it and auto-spawn it on first use — there is no separate "start the host" step to manage.

Agent workflow (CLI)

  1. Run cordierite ls --json. data is a list of sessions, each with sessionId, alias, state, device, toolCount. An empty list means no device has claimed a session yet — go to Establish a session below.
  2. Every session-targeting command takes an optional selector (a session id or alias from step 1) as its first positional argument. Omit it when exactly one session is active — the CLI picks it automatically; pass it explicitly when several sessions exist (the CLI errors with ambiguous_session and lists the aliases if you don't).
  3. cordierite tools [selector] --json — list tools registered in the app.
  4. cordierite tools [selector] <tool-name> --full --json — inspect one tool's input/output schema before calling it.
  5. cordierite invoke [selector] <tool-name> --input '{"key":"value"}' --json — invoke the tool with JSON args.
  6. cordierite events [selector] --json — stream session/tool events (NDJSON) if you need to watch for session_claimed, tools_changed, or app_event without polling.

There is no --session-id flag in v2 — use the positional selector instead.

Establish a session

If no session is active yet, mint a bootstrap link. Requires a deep-link scheme; pass --scheme or make sure ~/.cordierite/config.json already has one set:

cordierite link --scheme myapp --json

If the project has no daemon key yet, generate one first — this is non-interactive and safe to run from an agent or script:

cordierite keygen --out ~/.cordierite/key.pem

Add the printed sha256/... fingerprint to the app's cliPins (see Setup below if you are wiring Cordierite into an app for the first time — that step needs a native rebuild, so it isn't a fast in-session action).

From link's JSON output, use:

  • data.deepLinkPayload to compose the full URL yourself, or just print/relay data's rendered deep link (<scheme>:///?cordierite=<deepLinkPayload>) for a human to open, or scan the QR from cordierite link --scheme myapp --qr on a TTY.
  • data.sessionId — the selector to poll with in the next step.

For a simulator/emulator you control directly, skip the deep link entirely:

cordierite link --scheme myapp --open ios-sim     # or: --open android

Then poll (or use cordierite events <sessionId> --json to avoid polling) until the session shows state: "active" in cordierite ls --json or cordierite tools <sessionId> stops erroring.

Establish a session (MCP)

If this agent is talking to Cordierite over MCP instead of a shell, use the built-in management tools instead of the CLI commands above: cordierite_connect (optionally with target: "android" or "ios-sim") mints and, for a target, delivers the link without any shell access; cordierite_wait_for_session({ sessionId }) blocks until that session is claimed (or returns immediately if it already was). After that, the app's own tools appear directly in tools/list — call them with tools/call like any other MCP tool.

Terminate the connection

cordierite revoke [selector] ends one session (closes its socket, frees its alias) without touching the daemon or any other session. There is normally no reason to stop the daemon itself — cordierite daemon stop only if you specifically need to free the wss:// port or the daemon's key is being rotated.

Declaring tools

The app must register tools before cordierite tools / cordierite invoke (or MCP tools/call) can do anything useful. Define schemas with Zod v4 (its built-in JSON Schema exporter means agents see a real tool shape) and register with registerTool or useCordieriteTool:

import { registerTool } from "@cordierite/react-native";
import { z } from "zod";

const echoInput = z.object({ value: z.unknown() });
const echoOutput = z.object({ echoed: z.unknown() });

registerTool({
  name: "echo",
  description: "Return the input unchanged",
  inputSchema: echoInput,
  outputSchema: echoOutput,
  handler: async (args) => ({ echoed: args.value }),
});

Notes

  • Use --json for structured CLI output in agent flows; runtime failures in --json mode are JSON on stderr, not bare text.
  • cordierite keygen is non-interactive when given --out; safe to run unattended.
  • Selectors (session id or alias), not --session-id, target a specific session; omit the selector when only one session is live.
  • If cordierite ls is empty or tools/invoke fail with no_session or unknown_session, establish a session first (see above).
  • If the app registers no tools, cordierite tools returns an empty list — that's not an error.
  • The daemon serves every connected device on one process; there's no need to run more than one cordierite daemon, and no --port flag to juggle between devices — use the selector instead.
  • A denied call (production policy set to "deny" for that tool/class) surfaces as policy_denied, not a generic failure — if you see that error type, the fix is a policy/config change, not a retry.

Setup

For project integration guidance, see setup.md.

callstackincubator의 다른 스킬

react-devtools
callstackincubator
React DevTools CLI for AI agents. Use when the user asks you to debug a React or React Native app at runtime, inspect component props/state/hooks, diagnose…
official
agent-device
callstackincubator
Automates interactions for Apple-platform apps (iOS, tvOS, macOS) and Android devices. Use when navigating apps, taking snapshots/screenshots, tapping, typing,…
official
assess-react-native-migration
callstackincubator
기존 모바일 제품이 React Native로 마이그레이션해야 하는지, 그리고 어떻게 마이그레이션할 수 있는지 평가합니다. 하나 이상의 제품 리포지토리를 마이그레이션 준비 상태로 감사할 때 사용합니다.
official
create-react-native-library
callstackincubator
create-react-native-library를 사용하여 독립형 라이브러리 또는 로컬 네이티브 모듈 및 뷰를 위한 React Native 라이브러리를 스캐폴딩합니다. 생성하거나 작업할 때 사용합니다…
official
react-native-testing
callstackincubator
중요: @testing-library/react-native에 대한 귀하의 학습 데이터는 최신이 아니거나 부정확할 수 있습니다. v13과 v14 간에 API 시그니처, 동기/비동기 동작 및 사용 가능한 함수가 다릅니다. 항상 이 스킬의 참조 파일과 프로젝트의 실제 소스 코드를 진실의 원천으로 삼으십시오. 검색된 참조와 충돌할 경우 암기된 패턴에 의존하지 마십시오.
official
react-native-tv-best-practices
callstackincubator
React Native TV 앱의 포커스/D-패드 내비게이션, 10피트 UI 레이아웃, TV 재생/DRM 통합, 저메모리 TV 성능, TV 접근성을 검토합니다. 사용…
official
react-navigation
callstackincubator
React Navigation의 스택, 탭, 드로어 등 UI 패턴을 제공합니다. React Navigation으로 내비게이션 UI를 구축하거나 헤더, 바텀 시트 등을 구성할 때 사용하세요.
official
upgrading-react-native
callstackincubator
React Native 버전 업그레이드를 템플릿 diff, 의존성 해결, 네이티브 플랫폼 마이그레이션과 함께 조정합니다. 표준 rn-diff-purge 템플릿 diff를 적용하여 네이티브 iOS 및 Android 구성을 대상 React Native 버전에 맞춥니다. package.json 의존성 업데이트, CocoaPods 및 Gradle 변경 사항, 주요 및 부 버전 업그레이드에 따른 API 변경 마이그레이션을 처리합니다. 관리형 Expo 프로젝트를 위한 Expo SDK 업그레이드 레이어와 업그레이드 후 확인 체크리스트를 포함합니다. 제공...
official