gsd-pi 2.35.0-dev.39eee32 → 2.35.0-dev.4bbf377

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 (71) hide show
  1. package/README.md +3 -1
  2. package/dist/resources/extensions/gsd/auto-loop.js +7 -2
  3. package/dist/resources/extensions/gsd/auto-model-selection.js +15 -3
  4. package/dist/resources/extensions/gsd/commands-rate.js +31 -0
  5. package/dist/resources/extensions/gsd/commands.js +43 -1
  6. package/dist/resources/extensions/gsd/guided-flow.js +7 -1
  7. package/dist/resources/extensions/gsd/index.js +16 -32
  8. package/dist/resources/extensions/gsd/preferences.js +12 -0
  9. package/dist/resources/extensions/gsd/session-lock.js +27 -0
  10. package/dist/resources/skills/core-web-vitals/SKILL.md +1 -1
  11. package/dist/resources/skills/create-gsd-extension/workflows/debug-extension.md +1 -1
  12. package/dist/resources/skills/github-workflows/SKILL.md +0 -2
  13. package/dist/resources/skills/web-quality-audit/SKILL.md +0 -2
  14. package/package.json +1 -1
  15. package/packages/pi-agent-core/dist/agent.d.ts +10 -2
  16. package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
  17. package/packages/pi-agent-core/dist/agent.js +19 -8
  18. package/packages/pi-agent-core/dist/agent.js.map +1 -1
  19. package/packages/pi-agent-core/src/agent.ts +31 -10
  20. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  21. package/packages/pi-coding-agent/dist/core/agent-session.js +20 -4
  22. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  23. package/packages/pi-coding-agent/src/core/agent-session.ts +36 -12
  24. package/src/resources/extensions/gsd/auto-loop.ts +11 -1
  25. package/src/resources/extensions/gsd/auto-model-selection.ts +23 -2
  26. package/src/resources/extensions/gsd/commands-rate.ts +55 -0
  27. package/src/resources/extensions/gsd/commands.ts +43 -1
  28. package/src/resources/extensions/gsd/guided-flow.ts +7 -1
  29. package/src/resources/extensions/gsd/index.ts +20 -32
  30. package/src/resources/extensions/gsd/preferences.ts +14 -1
  31. package/src/resources/extensions/gsd/session-lock.ts +30 -0
  32. package/src/resources/skills/core-web-vitals/SKILL.md +1 -1
  33. package/src/resources/skills/create-gsd-extension/workflows/debug-extension.md +1 -1
  34. package/src/resources/skills/github-workflows/SKILL.md +0 -2
  35. package/src/resources/skills/web-quality-audit/SKILL.md +0 -2
  36. package/dist/resources/skills/swiftui/SKILL.md +0 -208
  37. package/dist/resources/skills/swiftui/references/animations.md +0 -921
  38. package/dist/resources/skills/swiftui/references/architecture.md +0 -1561
  39. package/dist/resources/skills/swiftui/references/layout-system.md +0 -1186
  40. package/dist/resources/skills/swiftui/references/navigation.md +0 -1492
  41. package/dist/resources/skills/swiftui/references/networking-async.md +0 -214
  42. package/dist/resources/skills/swiftui/references/performance.md +0 -1706
  43. package/dist/resources/skills/swiftui/references/platform-integration.md +0 -204
  44. package/dist/resources/skills/swiftui/references/state-management.md +0 -1443
  45. package/dist/resources/skills/swiftui/references/swiftdata.md +0 -297
  46. package/dist/resources/skills/swiftui/references/testing-debugging.md +0 -247
  47. package/dist/resources/skills/swiftui/references/uikit-appkit-interop.md +0 -218
  48. package/dist/resources/skills/swiftui/workflows/add-feature.md +0 -191
  49. package/dist/resources/skills/swiftui/workflows/build-new-app.md +0 -311
  50. package/dist/resources/skills/swiftui/workflows/debug-swiftui.md +0 -192
  51. package/dist/resources/skills/swiftui/workflows/optimize-performance.md +0 -197
  52. package/dist/resources/skills/swiftui/workflows/ship-app.md +0 -203
  53. package/dist/resources/skills/swiftui/workflows/write-tests.md +0 -235
  54. package/src/resources/skills/swiftui/SKILL.md +0 -208
  55. package/src/resources/skills/swiftui/references/animations.md +0 -921
  56. package/src/resources/skills/swiftui/references/architecture.md +0 -1561
  57. package/src/resources/skills/swiftui/references/layout-system.md +0 -1186
  58. package/src/resources/skills/swiftui/references/navigation.md +0 -1492
  59. package/src/resources/skills/swiftui/references/networking-async.md +0 -214
  60. package/src/resources/skills/swiftui/references/performance.md +0 -1706
  61. package/src/resources/skills/swiftui/references/platform-integration.md +0 -204
  62. package/src/resources/skills/swiftui/references/state-management.md +0 -1443
  63. package/src/resources/skills/swiftui/references/swiftdata.md +0 -297
  64. package/src/resources/skills/swiftui/references/testing-debugging.md +0 -247
  65. package/src/resources/skills/swiftui/references/uikit-appkit-interop.md +0 -218
  66. package/src/resources/skills/swiftui/workflows/add-feature.md +0 -191
  67. package/src/resources/skills/swiftui/workflows/build-new-app.md +0 -311
  68. package/src/resources/skills/swiftui/workflows/debug-swiftui.md +0 -192
  69. package/src/resources/skills/swiftui/workflows/optimize-performance.md +0 -197
  70. package/src/resources/skills/swiftui/workflows/ship-app.md +0 -203
  71. package/src/resources/skills/swiftui/workflows/write-tests.md +0 -235
@@ -1,214 +0,0 @@
1
- <overview>
2
- SwiftUI networking in 2025 is built around Swift's structured concurrency (async/await) with the @Observable macro for state management. Combine is primarily used for specialized reactive scenarios.
3
-
4
- **When to use async/await:**
5
- - Loading data when views appear (.task modifier)
6
- - Sequential API calls with dependencies
7
- - Error handling with do-catch
8
- - Any new code requiring async operations
9
-
10
- **When Combine is still useful:**
11
- - Complex reactive pipelines (debouncing, throttling)
12
- - Form validation with multiple interdependent fields
13
- - Real-time data streams (websockets, timers)
14
-
15
- **Core principle:** Use async/await by default. Add Combine only when reactive operators provide clear value.
16
- </overview>
17
-
18
- <task_modifier>
19
- ## The .task Modifier
20
-
21
- **Basic usage:**
22
- ```swift
23
- struct ArticleView: View {
24
- @State private var article: Article?
25
- let articleID: String
26
-
27
- var body: some View {
28
- content
29
- .task {
30
- article = try? await fetchArticle(id: articleID)
31
- }
32
- }
33
- }
34
- ```
35
-
36
- **With dependency (.task(id:)):**
37
- ```swift
38
- struct SearchView: View {
39
- @State private var query = ""
40
- @State private var results: [Result] = []
41
-
42
- var body: some View {
43
- List(results) { result in Text(result.name) }
44
- .searchable(text: $query)
45
- .task(id: query) {
46
- guard !query.isEmpty else { return }
47
- try? await Task.sleep(for: .milliseconds(300))
48
- guard !Task.isCancelled else { return }
49
- results = (try? await search(query: query)) ?? []
50
- }
51
- }
52
- }
53
- ```
54
-
55
- **Key behaviors:**
56
- - Runs when view appears
57
- - Auto-cancels on view disappear
58
- - .task(id:) restarts when dependency changes
59
- </task_modifier>
60
-
61
- <async_await_patterns>
62
- ## Async/Await Patterns
63
-
64
- **Loading with @Observable:**
65
- ```swift
66
- @Observable
67
- @MainActor
68
- class ArticleViewModel {
69
- private(set) var state: LoadingState<Article> = .idle
70
-
71
- func load(id: String) async {
72
- state = .loading
73
- do {
74
- let article = try await apiClient.fetchArticle(id: id)
75
- state = .loaded(article)
76
- } catch is CancellationError {
77
- // Don't update state
78
- } catch {
79
- state = .failed(error)
80
- }
81
- }
82
- }
83
- ```
84
-
85
- **Parallel calls:**
86
- ```swift
87
- func loadProfile(id: String) async throws -> Profile {
88
- let user = try await fetchUser(id: id)
89
- async let posts = fetchPosts(userID: user.id)
90
- async let followers = fetchFollowers(userID: user.id)
91
- return Profile(user: user, posts: try await posts, followers: try await followers)
92
- }
93
- ```
94
- </async_await_patterns>
95
-
96
- <api_client_design>
97
- ## API Client Architecture
98
-
99
- ```swift
100
- protocol APIClient {
101
- func request<T: Decodable>(_ endpoint: Endpoint) async throws -> T
102
- }
103
-
104
- @MainActor
105
- final class ProductionAPIClient: APIClient {
106
- private let baseURL: URL
107
- private let session: URLSession
108
-
109
- func request<T: Decodable>(_ endpoint: Endpoint) async throws -> T {
110
- let request = try buildRequest(endpoint)
111
- let (data, response) = try await session.data(for: request)
112
-
113
- guard let httpResponse = response as? HTTPURLResponse,
114
- (200...299).contains(httpResponse.statusCode) else {
115
- throw APIError.httpError((response as? HTTPURLResponse)?.statusCode ?? 0)
116
- }
117
-
118
- return try JSONDecoder().decode(T.self, from: data)
119
- }
120
- }
121
- ```
122
- </api_client_design>
123
-
124
- <loading_states>
125
- ## Loading States
126
-
127
- ```swift
128
- enum LoadingState<Value> {
129
- case idle
130
- case loading
131
- case loaded(Value)
132
- case failed(Error)
133
-
134
- var isLoading: Bool {
135
- if case .loading = self { return true }
136
- return false
137
- }
138
- }
139
-
140
- struct AsyncContentView<Value, Content: View>: View {
141
- let state: LoadingState<Value>
142
- let retry: () async -> Void
143
- @ViewBuilder let content: (Value) -> Content
144
-
145
- var body: some View {
146
- switch state {
147
- case .idle: Color.clear
148
- case .loading: ProgressView()
149
- case .loaded(let value): content(value)
150
- case .failed(let error):
151
- ContentUnavailableView("Error", systemImage: "exclamationmark.triangle", description: Text(error.localizedDescription))
152
- }
153
- }
154
- }
155
- ```
156
- </loading_states>
157
-
158
- <error_handling>
159
- ## Error Handling & Retry
160
-
161
- **Basic retry:**
162
- ```swift
163
- func fetchWithRetry<T>(maxRetries: Int = 3, operation: () async throws -> T) async throws -> T {
164
- var lastError: Error?
165
- for attempt in 0..<maxRetries {
166
- do {
167
- return try await operation()
168
- } catch {
169
- lastError = error
170
- if error is CancellationError { throw error }
171
- if attempt < maxRetries - 1 {
172
- try await Task.sleep(for: .seconds(pow(2, Double(attempt))))
173
- }
174
- }
175
- }
176
- throw lastError!
177
- }
178
- ```
179
- </error_handling>
180
-
181
- <decision_tree>
182
- ## Choosing the Right Approach
183
-
184
- **Tied to view lifecycle?** → .task or .task(id:)
185
- **User-triggered?** → Wrap in explicit Task {}
186
- **Need reactive operators?** → Combine
187
- **Loading data?** → Use LoadingState enum
188
- **Sequential calls?** → async/await naturally
189
- **Parallel calls?** → async let or TaskGroup
190
- </decision_tree>
191
-
192
- <anti_patterns>
193
- ## What NOT to Do
194
-
195
- <anti_pattern name="Ignoring CancellationError">
196
- **Problem:** Showing error UI when task is cancelled
197
- **Instead:** Catch CancellationError separately, don't update state
198
- </anti_pattern>
199
-
200
- <anti_pattern name="Task in .task">
201
- **Problem:** Task { await loadData() } inside .task
202
- **Instead:** .task already creates a Task
203
- </anti_pattern>
204
-
205
- <anti_pattern name="Missing @MainActor">
206
- **Problem:** View model updates from background thread
207
- **Instead:** Mark @Observable view models with @MainActor
208
- </anti_pattern>
209
-
210
- <anti_pattern name="ObservableObject for new code">
211
- **Problem:** Using ObservableObject/@Published
212
- **Instead:** Use @Observable macro (iOS 17+)
213
- </anti_pattern>
214
- </anti_patterns>