协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
apple-cktool【开发与工程】Operates Apple's Xcode-bundled `cktool` command-line utility for CloudKit development automation on macOS. Use when Codex needs to run, script, explain, or troubleshoot `xcrun cktool`; manage `.ckdb` schemas with export, validate, import, or reset; discover CloudKit teams; create, query, or delete test records; configure management or user tokens in …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
cktool command-line utility for CloudKit development automation on macOS. Use when Codex needs to run, script, explain, or troubleshoot xcrun cktool; manage .ckdb schemas with export, validate, import, or reset; discover CloudKit teams; create, query, or delete test records; configure management or user tokens in Keychain or CI; or prepare CloudKit-backed integration tests. For equivalent typed JavaScript or TypeScript automation, use apple-cktool-js with this skill.Use the stateless cktool CLI distributed with Xcode to manage CloudKit schemas and test data from macOS. Keep the target explicit and default all development automation to the development environment.
| Need | Use |
|---|---|
| Shell commands, Xcode schemes, or a macOS runner | This skill |
| TypeScript, Node.js, browser tooling, or non-macOS CI | apple-cktool-js |
| A shell wrapper around a few stable commands | This skill |
| Reusable branching logic, typed models, updates, or richer error handling | apple-cktool-js |
Use both skills when a repository exposes a simple local cktool path and a portable CKTool JS CI path. Keep the same team, container, environment, schema file, and safety policy across both implementations.
Inspect the local tool. Run:
xcode-select -p
xcrun --find cktool
xcrun cktool --version
xcrun cktool --help
xcrun cktool help <subcommand>
Treat local help as authoritative for the installed Xcode. Use man cktool for field formats, token precedence, and examples. Do not assume flags from a different Xcode release.
Resolve the complete target. Record the team ID, container ID, environment, database type, zone, record type, and schema path that apply. Do not infer a production target from an app bundle identifier. Use get-teams when the team ID is unknown.
Select the token class. Use a management token for team/container discovery and schema operations. Use a user token for record operations on behalf of an iCloud user. Read references/authentication-and-automation.md before configuring tokens or CI.
Prepare a reversible command. Export before schema changes, validate before import, query before a single-record deletion, and use the default dry run before bulk deletion. Treat reset, import, creation, and deletion as remote mutations.
Confirm destructive scope. Before a destructive operation, state the exact container, environment, database, zone, record type or record name, and expected effect. Require explicit user authorization for production writes, schema reset, or permanent deletion unless that exact operation is already the user's request.
Execute without exposing credentials. Prefer interactive Keychain storage for local work and environment injection from a secret manager for CI. Never print, paste into logs, commit, or pass a token in a command when a safer mechanism is available.
Verify the result. Check the exit status, capture structured JSON when the command returns it, re-export a changed schema, or re-query affected records. Report the resolved target and outcome, with tokens redacted.
development. Treat any production record mutation as high impact.reset-schema resets the development schema to production and deletes all development data.validate-schema before import-schema; use import-schema --validate only when one combined step is appropriate.delete-records with its default --dry-run true first. Use --dry-run false --yes only after reviewing the match count and filters.--fields-file or --fields-stdin over large inline JSON. This reduces quoting errors and accidental shell expansion.--token in shared shells, process listings, CI logs, or recorded terminal sessions.query-records returns continuationToken, continue until the requested scope is complete and stop on a repeated token.___recordID to be Queryable.xcrun cktool export-schema \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--output-file Schema.ckdb
Keep .ckdb schema files in version control when the repository uses declarative CloudKit schema management. Review the diff before importing.
xcrun cktool validate-schema \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--file Schema.ckdb
xcrun cktool import-schema \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--file Schema.ckdb
After import, export again and compare the effective schema when exact server state matters.
xcrun cktool reset-schema \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID"
Use this only when deleting all development data is intended. Reapply the tested schema and seed data in a deterministic order before integration tests.
xcrun cktool query-records \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--database-type public \
--zone-name _defaultZone \
--record-type Book \
--filters "pageCount >= int64Type:1000" \
--requested-fields title pageCount \
--limit 50
Read references/records-and-filters.md before composing field JSON, filters, sorts, assets, pagination, or deletions.
xcrun cktool create-record \
--team-id "$TEAM_ID" \
--container-id "$CONTAINER_ID" \
--environment development \
--database-type public \
--zone-name _defaultZone \
--record-type Book \
--fields-file fixtures/book.json
xcrun cktool delete-records \
--container-id "$CONTAINER_ID" \
--environment development \
--database-type public \
--zone-name _defaultZone \
--record-type Book \
--filters "fixtureRun == stringType:run-123" \
--dry-run true
Do not change the dry run to false until the returned count and target are verified.
xcrun cannot find cktool, inspect xcode-select -p, verify Xcode 13 or newer is installed, and select the intended Xcode developer directory.xcrun cktool help <subcommand> for the installed version.validate-schema, inspect the .ckdb diff, and verify the environment/container pair.references/command-reference.md for the complete command surface, required flags, exit codes, and examples.references/records-and-filters.md for field JSON, assets, filters, sorts, indexes, pagination, and safe deletion.references/authentication-and-automation.md for token precedence, Keychain, environment variables, Xcode test setup, and CI patterns.references/sources.md for Apple documentation, WWDC sessions, samples, and the verification snapshot.