Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a3540d6
feat: enhance MistKit with query filtering and sorting support
leogdion Nov 4, 2025
e7de301
refactor: reorganize Examples directory structure
leogdion Nov 4, 2025
ef1677e
docs: add CloudKit schema management tool documentation
leogdion Nov 4, 2025
692d11a
feat: add automated CloudKit schema setup for Celestra
leogdion Nov 5, 2025
bfe7c88
docs: update Celestra documentation with BrightDigit branding and Clo…
leogdion Nov 5, 2025
4adc69b
fixing xcodegen project [skip ci]
leogdion Nov 7, 2025
7aa9195
fix: resolve build errors and consolidate record operation APIs
leogdion Nov 7, 2025
6c7383b
fixup! fix: resolve build errors and consolidate record operation APIs
leogdion Nov 7, 2025
bf12366
feat: extract protocol-oriented CloudKit patterns from Bushel into Mi…
leogdion Nov 7, 2025
1e7ff64
Linted and Fixed non-Apple platforms
leogdion Nov 7, 2025
e3f5323
fixup! Linted and Fixed non-Apple platforms
leogdion Nov 7, 2025
a4f9a61
removing nightly 6.1
leogdion Nov 7, 2025
f10a9ca
fixing crash in Swift 6.2
leogdion Nov 7, 2025
a18403f
feat: implement duplicate detection and schema improvements for Celestra
leogdion Nov 7, 2025
36a51cf
Fixing Linting Issues (#143)
leogdion Nov 7, 2025
28af35d
feat(celestra): implement comprehensive error handling, batch operati…
leogdion Nov 10, 2025
2d706fa
import schema script
leogdion Nov 10, 2025
bd148c9
removing Public* prefix
leogdion Nov 10, 2025
b26e98b
feat(celestra): update schema with proper permissions and feed refere…
leogdion Nov 10, 2025
fe6cd39
fix(celestra): change feed query sort to feedURL
leogdion Nov 10, 2025
7f7491e
feat(celestra): add queryable indexes for ___recordID and feed reference
leogdion Nov 11, 2025
5921fa2
docs: add comprehensive CloudKit Schema Language documentation for AI…
leogdion Nov 11, 2025
638642e
feat: add full RSS content storage and query optimization
leogdion Nov 11, 2025
2026a9d
fixing key paths
leogdion Nov 12, 2025
1b3af3f
fix: add NONE to ReferenceValue action enum and enhance error logging
leogdion Nov 12, 2025
0e895f0
feat: migrate from OSLog to swift-log for cross-platform support (#144)
leogdion Nov 12, 2025
53d9c23
test: add comprehensive test coverage for query filtering, sorting, a…
leogdion Nov 13, 2025
a68c751
test: add platform availability checks for iOS/tvOS compatibility
leogdion Nov 13, 2025
b88acd3
refactor: address PR #134 review feedback with enhanced error handlin…
leogdion Nov 13, 2025
5dfbf50
test: update FieldValueConversionTests for type-safe Reference.Action…
leogdion Nov 13, 2025
ff07f4c
chore: update Package.resolved for example projects
leogdion Nov 13, 2025
deb867f
refactor: complete PR #134 review items with configurable batch sizes…
leogdion Nov 13, 2025
d37d5a1
fixing tests
leogdion Nov 13, 2025
4e8644b
chore: standardize Swift settings across example packages
leogdion Nov 13, 2025
0be16fa
Remove Retry Policy and Implement Web Etiquette (#148)
leogdion Nov 13, 2025
cbd5dd8
Remove deprecated RecordBuilder and update docs to CloudKitRecord pro…
leogdion Nov 13, 2025
5ec9c80
refactor: standardize error handling in CloudKitResponseProcessor
leogdion Nov 13, 2025
2ccb15e
Fixing FieldValue
leogdion Nov 13, 2025
dd5ada4
refactor: delegate record name generation to CloudKit server (#153)
leogdion Nov 14, 2025
26518ac
refactor: replace toSomeType methods with initializer pattern
leogdion Nov 13, 2025
73901e7
refactor: convert from* methods to initializers and fix limit visibility
leogdion Nov 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 109 additions & 4 deletions .claude/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,73 @@ This directory contains Apple's official documentation for CloudKit Web Services

---

### cktool.md / cktool-full.md
**Source**: https://developer.apple.com/icloud/ck-tool/

**Primary Use**: CloudKit command-line tool for schema and data management

**Files**:
- `cktool.md` - Curated summary with command examples
- `cktool-full.md` - Complete Apple documentation

**Key Topics**:
- **Authentication**: Management tokens, user tokens, Keychain storage
- **Schema Management**:
- Reset development schema to production
- Export schema to `.ckdb` files
- Import schema from files to development
- **Data Commands**:
- Query records with filters
- Create records with JSON field definitions
- **Automation**: CI/CD integration, test data seeding
- **Token Management**: Saving and managing CloudKit tokens

**When to Consult**:
- Setting up development environments with CloudKit schemas
- Exporting/importing schemas for version control
- Automating schema deployment in CI/CD pipelines
- Seeding test data for MistKit integration tests
- Resetting development databases
- Understanding CloudKit Management API workflows

---

### cktooljs.md / cktooljs-full.md
**Source**: https://developer.apple.com/documentation/cktooljs/
**Version**: CKTool JS 1.2.15+

**Primary Use**: JavaScript library for CloudKit management operations

**Files**:
- `cktooljs.md` - Curated summary with key information
- `cktooljs-full.md` - Complete Apple documentation (41 pages)

**Key Topics**:
- **Core Modules**:
- `@apple/cktool.database` - CloudKit types and operations
- `@apple/cktool.target.nodejs` - Node.js configuration
- `@apple/cktool.target.browser` - Browser configuration
- **Capabilities**:
- Deploy schemas to Sandbox databases
- Seed databases with test data
- Restore Sandbox to production settings
- Create automated integration test scripts
- **API Components**:
- PromisesApi and CancellablePromise
- Configuration for server communication
- Container and ContainersResponse structures
- Error handling framework

**When to Consult**:
- Building JavaScript-based CloudKit automation tools
- Creating CI/CD pipelines with Node.js
- Understanding CloudKit Management API from JS perspective
- Automating schema deployment programmatically
- Building developer tooling for CloudKit workflows
- Comparing management API patterns across platforms

---

## Quick Reference: When to Use Each Doc

### Implementing Core API Functionality
Expand All @@ -134,6 +201,10 @@ This directory contains Apple's official documentation for CloudKit Web Services
### Writing Tests
→ **testing-enablinganddisabling.md**: Modern Swift Testing patterns

### Schema Management & Automation
→ **cktool.md**: Native command-line tool for schema and data operations
→ **cktooljs.md**: JavaScript library for programmatic management

---

## Integration with MistKit Development
Expand Down Expand Up @@ -162,24 +233,58 @@ When designing MistKit's API surface:
### Authentication Flow
1. **webservices.md** → Request signing, token formats
2. **cloudkitjs.md** → Authentication state management
3. **cktool.md** → Management token setup and storage

### Record Operations
1. **webservices.md** → `/records/modify` endpoint structure
2. **cloudkitjs.md** → `Database.saveRecords()` operation flow
3. **cktool.md** → Creating test records via CLI

### Query Operations
1. **webservices.md** → `/records/query` request format
2. **cloudkitjs.md** → Query filters, sort descriptors, pagination
3. **cktool.md** → Query filters via command-line

### Error Handling
1. **webservices.md** → HTTP status codes, error response format
2. **cloudkitjs.md** → `CKError` codes and retry logic
3. **cktooljs.md** → Error handling in management operations

### Development Workflows
1. **cktool.md** → Export/import schemas for version control
2. **cktooljs.md** → Programmatic schema deployment and automation
3. **webservices.md** → Understanding underlying API operations

---

## Documentation Ecosystem Map

```
CloudKit Development & Operations
├── Runtime APIs (Application Level)
│ ├── webservices.md ────────── REST API reference
│ ├── cloudkitjs.md ─────────── JS SDK for web apps
│ └── MistKit ───────────────── Swift implementation
├── Management APIs (Development Level)
│ ├── cktool.md ─────────────── Native CLI tool (Xcode)
│ └── cktooljs.md ───────────── JS library for automation
├── Code Generation
│ └── swift-openapi-generator.md ─ Generate Swift from OpenAPI
└── Testing
└── testing-enablinganddisabling.md ─ Swift Testing framework
```

## Notes

- These docs are from Apple's official documentation, downloaded via llm.codes
- Content is filtered for relevant information (URLs filtered, deduplicated)
- Last updated: October 20, 2025
- Corresponds to CloudKit Web Services (archived), CloudKit JS 1.0+, Swift Testing (Swift 6.0+)
- These docs are from Apple's official documentation and community sources
- Most content downloaded via llm.codes and filtered for relevance
- Last updated: November 4, 2025
- Corresponds to:
- CloudKit Web Services (archived)
- CloudKit JS 1.0+
- Swift Testing (Swift 6.0+)
- cktool (Xcode 13+)
- CKTool JS (latest)
113 changes: 113 additions & 0 deletions .claude/docs/cktool-full.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<!--
Downloaded via https://llm.codes by @steipete on November 4, 2025 at 03:26 PM
Source URL: https://developer.apple.com/icloud/ck-tool/
Total pages processed: 1
URLs filtered: Yes
Content de-duplicated: Yes
Availability strings filtered: Yes
Code blocks only: No
-->

# https://developer.apple.com/icloud/ck-tool/

View in English

# Using cktool

### Before you begin

- You'll need to be a current member of the Apple Developer Program or the Apple Developer Enterprise Program in order to use `cktool`.
- Understand the concepts of Authentication, as described in Automating CloudKit Development.
- Generate a CloudKit Management Token from the CloudKit Console by choosing the Settings section for your user account. Save this token, as it will not be visible again.

### Installing the application

By default, `cktool` is distributed with Xcode starting with Xcode 13, which is available on the Mac App Store.

### General usage

`cktool` is stateless and passes all operations to the CloudKit Management API in single operations. A full list of supported operations is available from the `help` command or the `man` pages:

xcrun cktool --help
OVERVIEW: CloudKit Command Line Tool

-h, --help Show help information.

SUBCOMMANDS: ...

### Authenticating `cktool` to CloudKit

`cktool` supports both management and user tokens, and will store them securely in Mac Keychain. You can add a token using the `save-token` command, which will launch CloudKit Console for copying of the appropriate token after prompting for information from the user:

xcrun cktool save-token \
--type [management | user]

#### Issuing Schema Management commands

Schema Management commands require the Management Token to be provided. Once provided, `cktool` can perform the following commands:

**Reset development schema.** This allows you to revert the development database to the current production definition.

xcrun cktool reset-schema \
--team-id [TEAM-ID] \
--container-id [CONTAINER]

**Export schema file.** This allows you to save an existing CloudKit Database schema definition to a file, which can be kept alongside the related source code:

xcrun cktool export-schema \
--team-id [TEAM-ID] \
--container-id [CONTAINER] \
--environment [development | production] \
[--output-file schema.ckdb]

**Import schema file.** This applies a file-based schema definition against the development database for testing.

xcrun cktool import-schema \
--team-id [TEAM-ID] \
--container-id [CONTAINER] \
--environment development \
--file schema.ckdb

### Issuing data commands

When a user token is available, `cktool` can access public and private databases on behalf of the user. This can be used for fetching data and inserting new records prior to integration tests. Note that due to the short lifespan of the user token, frequent interactive authentication may be required.

Querying records can be performed with the `query-records` command. Note that queries without filters require the `___recordID` to have a `Queryable` index applied, as do fields specified in the optional `--filters` argument:

xcrun cktool query-records \
--team-id [TEAMID] \
--container-id [CONTAINER] \
--zone-name [ZONE_NAME] \
--database-type [public | private] \
--environment [development | production] \
--record-type [RECORD_TYPE] \
[--filters [FILTER_1] [FILTER_2]]

Where `FILTER_1` is in the form `"[FIELD_NAME] [OPERATOR] [VALUE]"`, for example `"lastname == Appleseed"`.

Inserting data is accomplished with the `create-record` command:

xcrun cktool create-record \
--team-id [TEAM_ID] \
--container-id [CONTAINER] \
--zone-name [ZONE_NAME] \
--database-type [public | private] \
--environment [development | production] \
--record-type [RECORD_TYPE] \
[--fields-json [FIELDS_JSON]]

Where `FIELDS_JSON` is a JSON representation of the fields to set in the record. For example:

'{
"firstName": {
"type": "stringType",
"value": "Johnny"
},
"lastName": {
"type": "stringType",
"value": "Appleseed"
}
}'

---

Loading
Loading