opencodekit 0.16.15 → 0.16.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +77 -242
  2. package/dist/index.js +19 -6
  3. package/dist/template/.opencode/AGENTS.md +72 -236
  4. package/dist/template/.opencode/README.md +49 -482
  5. package/dist/template/.opencode/agent/build.md +71 -345
  6. package/dist/template/.opencode/agent/explore.md +47 -139
  7. package/dist/template/.opencode/agent/general.md +61 -172
  8. package/dist/template/.opencode/agent/looker.md +65 -161
  9. package/dist/template/.opencode/agent/painter.md +46 -200
  10. package/dist/template/.opencode/agent/plan.md +37 -220
  11. package/dist/template/.opencode/agent/review.md +72 -153
  12. package/dist/template/.opencode/agent/scout.md +44 -486
  13. package/dist/template/.opencode/agent/vision.md +63 -178
  14. package/dist/template/.opencode/command/create.md +75 -307
  15. package/dist/template/.opencode/command/design.md +53 -589
  16. package/dist/template/.opencode/command/handoff.md +76 -180
  17. package/dist/template/.opencode/command/init.md +45 -211
  18. package/dist/template/.opencode/command/plan.md +62 -514
  19. package/dist/template/.opencode/command/pr.md +56 -226
  20. package/dist/template/.opencode/command/research.md +55 -266
  21. package/dist/template/.opencode/command/resume.md +33 -138
  22. package/dist/template/.opencode/command/review-codebase.md +54 -202
  23. package/dist/template/.opencode/command/ship.md +78 -127
  24. package/dist/template/.opencode/command/start.md +47 -577
  25. package/dist/template/.opencode/command/status.md +60 -353
  26. package/dist/template/.opencode/command/ui-review.md +52 -298
  27. package/dist/template/.opencode/command/verify.md +36 -250
  28. package/dist/template/.opencode/memory.db-shm +0 -0
  29. package/dist/template/.opencode/memory.db-wal +0 -0
  30. package/dist/template/.opencode/opencode.json +133 -35
  31. package/dist/template/.opencode/plugin/README.md +40 -166
  32. package/dist/template/.opencode/plugin/compaction.ts +162 -131
  33. package/dist/template/.opencode/plugin/lib/memory-db.ts +112 -0
  34. package/dist/template/.opencode/plugin/swarm-enforcer.ts +182 -27
  35. package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +112 -0
  36. package/dist/template/.opencode/skill/augment-context-engine/mcp.json +6 -0
  37. package/dist/template/.opencode/skill/core-data-expert/SKILL.md +82 -0
  38. package/dist/template/.opencode/skill/core-data-expert/references/batch-operations.md +543 -0
  39. package/dist/template/.opencode/skill/core-data-expert/references/cloudkit-integration.md +259 -0
  40. package/dist/template/.opencode/skill/core-data-expert/references/concurrency.md +522 -0
  41. package/dist/template/.opencode/skill/core-data-expert/references/fetch-requests.md +643 -0
  42. package/dist/template/.opencode/skill/core-data-expert/references/glossary.md +233 -0
  43. package/dist/template/.opencode/skill/core-data-expert/references/migration.md +393 -0
  44. package/dist/template/.opencode/skill/core-data-expert/references/model-configuration.md +597 -0
  45. package/dist/template/.opencode/skill/core-data-expert/references/performance.md +300 -0
  46. package/dist/template/.opencode/skill/core-data-expert/references/persistent-history.md +553 -0
  47. package/dist/template/.opencode/skill/core-data-expert/references/project-audit.md +60 -0
  48. package/dist/template/.opencode/skill/core-data-expert/references/saving.md +574 -0
  49. package/dist/template/.opencode/skill/core-data-expert/references/stack-setup.md +625 -0
  50. package/dist/template/.opencode/skill/core-data-expert/references/testing.md +300 -0
  51. package/dist/template/.opencode/skill/core-data-expert/references/threading.md +589 -0
  52. package/dist/template/.opencode/skill/swift-concurrency/SKILL.md +246 -0
  53. package/dist/template/.opencode/skill/swift-concurrency/references/actors.md +640 -0
  54. package/dist/template/.opencode/skill/swift-concurrency/references/async-algorithms.md +822 -0
  55. package/dist/template/.opencode/skill/swift-concurrency/references/async-await-basics.md +249 -0
  56. package/dist/template/.opencode/skill/swift-concurrency/references/async-sequences.md +670 -0
  57. package/dist/template/.opencode/skill/swift-concurrency/references/core-data.md +533 -0
  58. package/dist/template/.opencode/skill/swift-concurrency/references/glossary.md +128 -0
  59. package/dist/template/.opencode/skill/swift-concurrency/references/linting.md +142 -0
  60. package/dist/template/.opencode/skill/swift-concurrency/references/memory-management.md +542 -0
  61. package/dist/template/.opencode/skill/swift-concurrency/references/migration.md +1076 -0
  62. package/dist/template/.opencode/skill/swift-concurrency/references/performance.md +574 -0
  63. package/dist/template/.opencode/skill/swift-concurrency/references/sendable.md +578 -0
  64. package/dist/template/.opencode/skill/swift-concurrency/references/tasks.md +604 -0
  65. package/dist/template/.opencode/skill/swift-concurrency/references/testing.md +565 -0
  66. package/dist/template/.opencode/skill/swift-concurrency/references/threading.md +452 -0
  67. package/dist/template/.opencode/skill/swiftui-expert-skill/SKILL.md +290 -0
  68. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-advanced.md +351 -0
  69. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-basics.md +284 -0
  70. package/dist/template/.opencode/skill/swiftui-expert-skill/references/animation-transitions.md +326 -0
  71. package/dist/template/.opencode/skill/swiftui-expert-skill/references/image-optimization.md +286 -0
  72. package/dist/template/.opencode/skill/swiftui-expert-skill/references/layout-best-practices.md +312 -0
  73. package/dist/template/.opencode/skill/swiftui-expert-skill/references/liquid-glass.md +377 -0
  74. package/dist/template/.opencode/skill/swiftui-expert-skill/references/list-patterns.md +153 -0
  75. package/dist/template/.opencode/skill/swiftui-expert-skill/references/modern-apis.md +400 -0
  76. package/dist/template/.opencode/skill/swiftui-expert-skill/references/performance-patterns.md +377 -0
  77. package/dist/template/.opencode/skill/swiftui-expert-skill/references/scroll-patterns.md +305 -0
  78. package/dist/template/.opencode/skill/swiftui-expert-skill/references/sheet-navigation-patterns.md +292 -0
  79. package/dist/template/.opencode/skill/swiftui-expert-skill/references/state-management.md +447 -0
  80. package/dist/template/.opencode/skill/swiftui-expert-skill/references/text-formatting.md +285 -0
  81. package/dist/template/.opencode/skill/swiftui-expert-skill/references/view-structure.md +276 -0
  82. package/dist/template/.opencode/tool/action-queue.ts +308 -0
  83. package/dist/template/.opencode/tool/swarm.ts +65 -40
  84. package/package.json +16 -3
  85. package/dist/template/.opencode/.agents/skills/context7/SKILL.md +0 -88
@@ -0,0 +1,259 @@
1
+ # CloudKit Integration
2
+
3
+ `NSPersistentCloudKitContainer` syncs Core Data with CloudKit, enabling seamless data synchronization across devices.
4
+
5
+ ## Setup
6
+
7
+ ### Basic Setup
8
+
9
+ ```swift
10
+ import CoreData
11
+ import CloudKit
12
+
13
+ let container = NSPersistentCloudKitContainer(name: "Model")
14
+
15
+ container.loadPersistentStores { description, error in
16
+ if let error = error {
17
+ fatalError("Failed to load store: \(error)")
18
+ }
19
+ }
20
+ ```
21
+
22
+ ### Configure CloudKit Container
23
+
24
+ In Xcode:
25
+ 1. Add CloudKit capability
26
+ 2. Select or create CloudKit container
27
+ 3. Enable "Use CloudKit" in Core Data model
28
+
29
+ ### Schema Design Limitations
30
+
31
+ CloudKit has restrictions Core Data doesn't:
32
+
33
+ **Not Supported:**
34
+ - Unique constraints on entities
35
+ - `Undefined` attribute type
36
+ - `ObjectID` attribute type
37
+ - Non-optional relationships (must be optional)
38
+ - Relationships without inverse
39
+ - Deny deletion rule
40
+
41
+ **Supported:**
42
+ - Adding new fields to record types
43
+ - Adding new record types
44
+
45
+ **Important:** Production schema is **immutable**. Plan carefully!
46
+
47
+ ## Schema Initialization
48
+
49
+ ### Development Environment
50
+
51
+ ```swift
52
+ // First run initializes schema in Development
53
+ container.loadPersistentStores { description, error in
54
+ // Schema created automatically
55
+ }
56
+ ```
57
+
58
+ ### Promoting to Production
59
+
60
+ 1. Test thoroughly in Development
61
+ 2. Open CloudKit Dashboard
62
+ 3. Deploy schema to Production
63
+ 4. **Cannot modify after deployment!**
64
+
65
+ ## Monitoring Sync
66
+
67
+ ### Observe Events
68
+
69
+ ```swift
70
+ NotificationCenter.default.addObserver(
71
+ self,
72
+ selector: #selector(storeDidChange),
73
+ name: NSPersistentCloudKitContainer.eventChangedNotification,
74
+ object: container
75
+ )
76
+
77
+ @objc func storeDidChange(_ notification: Notification) {
78
+ guard let event = notification.userInfo?[NSPersistentCloudKitContainer.eventNotificationUserInfoKey]
79
+ as? NSPersistentCloudKitContainer.Event else {
80
+ return
81
+ }
82
+
83
+ switch event.type {
84
+ case .setup:
85
+ print("Setup: \(event.succeeded ? "succeeded" : "failed")")
86
+ case .import:
87
+ print("Import: \(event.succeeded ? "succeeded" : "failed")")
88
+ case .export:
89
+ print("Export: \(event.succeeded ? "succeeded" : "failed")")
90
+ @unknown default:
91
+ break
92
+ }
93
+
94
+ if let error = event.error {
95
+ print("Error: \(error)")
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### Testing Sync
101
+
102
+ ```swift
103
+ func testSync() {
104
+ let expectation = XCTestExpectation(description: "Export")
105
+
106
+ // Create expectation for export
107
+ let observer = NotificationCenter.default.addObserver(
108
+ forName: NSPersistentCloudKitContainer.eventChangedNotification,
109
+ object: container,
110
+ queue: nil
111
+ ) { notification in
112
+ guard let event = notification.userInfo?[NSPersistentCloudKitContainer.eventNotificationUserInfoKey]
113
+ as? NSPersistentCloudKitContainer.Event else {
114
+ return
115
+ }
116
+
117
+ if event.type == .export && event.endDate != nil {
118
+ expectation.fulfill()
119
+ }
120
+ }
121
+
122
+ // Make changes
123
+ let article = Article(context: container.viewContext)
124
+ article.name = "Test"
125
+ try? container.viewContext.save()
126
+
127
+ wait(for: [expectation], timeout: 60)
128
+ NotificationCenter.default.removeObserver(observer)
129
+ }
130
+ ```
131
+
132
+ ## Cross-Version Compatibility
133
+
134
+ ### Strategy 1: Incremental Fields
135
+
136
+ Add new fields, keep old ones:
137
+
138
+ ```swift
139
+ // V1: name
140
+ // V2: name, subtitle (new)
141
+ // Old versions see records but not subtitle
142
+ ```
143
+
144
+ ### Strategy 2: Version Attribute
145
+
146
+ ```swift
147
+ // Add version attribute
148
+ article.schemaVersion = 2
149
+
150
+ // Filter in fetch requests
151
+ fetchRequest.predicate = NSPredicate(format: "schemaVersion <= %d", currentVersion)
152
+ ```
153
+
154
+ ### Strategy 3: New Container
155
+
156
+ ```swift
157
+ let options = NSPersistentCloudKitContainerOptions(
158
+ containerIdentifier: "iCloud.com.example.app.v2"
159
+ )
160
+
161
+ let description = NSPersistentStoreDescription(url: storeURL)
162
+ description.cloudKitContainerOptions = options
163
+ ```
164
+
165
+ **Caution:** Large datasets take time to upload.
166
+
167
+ ## Debugging
168
+
169
+ ### System Logs
170
+
171
+ Monitor these processes:
172
+ - **Application** - Core Data activity
173
+ - **dasd** - Scheduling decisions
174
+ - **cloudd** - CloudKit operations
175
+ - **apsd** - Push notifications
176
+
177
+ ### Using log stream
178
+
179
+ ```bash
180
+ # Application logs
181
+ log stream --predicate 'process == "YourApp"'
182
+
183
+ # CloudKit logs
184
+ log stream --predicate 'process == "cloudd" AND message CONTAINS "your.container.id"'
185
+
186
+ # Push notifications
187
+ log stream --predicate 'process == "apsd"'
188
+
189
+ # Scheduling
190
+ log stream --predicate 'process == "dasd" AND message CONTAINS "YourApp"'
191
+ ```
192
+
193
+ ### CloudKit Logging Profile
194
+
195
+ 1. Download from [Apple Developer Portal](https://developer.apple.com/bug-reporting/profiles-and-logs/)
196
+ 2. Install on device
197
+ 3. Reboot device
198
+ 4. Reproduce issue
199
+ 5. Collect sysdiagnose
200
+
201
+ ### Collecting Diagnostics
202
+
203
+ **sysdiagnose:**
204
+ - iOS: Volume Up + Volume Down + Power (hold)
205
+ - macOS: Shift + Control + Option + Command + Period
206
+
207
+ ## Common Issues
208
+
209
+ ### Schema Mismatch
210
+
211
+ **Problem:** Local schema doesn't match CloudKit schema.
212
+
213
+ **Solution:**
214
+ 1. Delete app
215
+ 2. Reinstall
216
+ 3. Let schema reinitialize
217
+
218
+ ### Sync Not Working
219
+
220
+ **Checklist:**
221
+ - [ ] CloudKit capability enabled
222
+ - [ ] Signed in to iCloud
223
+ - [ ] Network connection available
224
+ - [ ] CloudKit container configured
225
+ - [ ] Schema initialized in Development
226
+ - [ ] Schema promoted to Production
227
+
228
+ ### Large Initial Sync
229
+
230
+ **Problem:** First sync takes too long.
231
+
232
+ **Solutions:**
233
+ - Use background fetch
234
+ - Show progress indicator
235
+ - Implement data generators for testing
236
+
237
+ ## Best Practices
238
+
239
+ 1. **Test in Development first** - Schema is mutable
240
+ 2. **Plan schema carefully** - Production is immutable
241
+ 3. **Make relationships optional** - Required by CloudKit
242
+ 4. **Add inverse relationships** - Required by CloudKit
243
+ 5. **Version your data** - For cross-version compatibility
244
+ 6. **Monitor sync events** - Detect and handle errors
245
+ 7. **Test with multiple devices** - Verify sync behavior
246
+ 8. **Handle conflicts** - Use appropriate merge policy
247
+ 9. **Collect diagnostics** - For debugging sync issues
248
+ 10. **Consider data size** - Large datasets take time to sync
249
+
250
+ ## Summary
251
+
252
+ - Use `NSPersistentCloudKitContainer` for CloudKit sync
253
+ - Schema has limitations (optional relationships, no constraints)
254
+ - Production schema is immutable
255
+ - Monitor sync with event notifications
256
+ - Test thoroughly in Development before promoting
257
+ - Plan for cross-version compatibility
258
+ - Use system logs for debugging
259
+ - Collect sysdiagnose for complex issues