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,235 +0,0 @@
1
- <required_reading>
2
- **Read these reference files NOW before starting:**
3
- 1. `../macos-apps/references/cli-workflow.md` - Test commands from CLI
4
- 2. `../macos-apps/references/testing-tdd.md` - TDD patterns, avoiding @main hangs
5
- 3. `references/testing-debugging.md` - SwiftUI-specific testing and debugging
6
- </required_reading>
7
-
8
- <process>
9
- ## Step 1: Identify Testing Scope
10
-
11
- **Test business logic in view models, not views:**
12
- ```swift
13
- // Testable view model
14
- @Observable
15
- final class LoginViewModel {
16
- var email = ""
17
- var password = ""
18
- var isLoading = false
19
-
20
- var isValidInput: Bool {
21
- !email.isEmpty && password.count >= 8
22
- }
23
- }
24
-
25
- // View is just presentation
26
- struct LoginView: View {
27
- let viewModel: LoginViewModel
28
- var body: some View {
29
- Form {
30
- TextField("Email", text: $viewModel.email)
31
- Button("Login") { }
32
- .disabled(!viewModel.isValidInput)
33
- }
34
- }
35
- }
36
- ```
37
-
38
- ## Step 2: Write Unit Tests
39
-
40
- **Using Swift Testing (@Test):**
41
- ```swift
42
- import Testing
43
- @testable import MyApp
44
-
45
- @Test("Email validation")
46
- func emailValidation() {
47
- let viewModel = LoginViewModel()
48
-
49
- viewModel.email = ""
50
- viewModel.password = "password123"
51
- #expect(!viewModel.isValidInput)
52
-
53
- viewModel.email = "user@example.com"
54
- #expect(viewModel.isValidInput)
55
- }
56
-
57
- @Test("Async loading")
58
- func asyncLoading() async {
59
- let mockService = MockService()
60
- let viewModel = TaskViewModel(service: mockService)
61
-
62
- await viewModel.load()
63
-
64
- #expect(!viewModel.tasks.isEmpty)
65
- }
66
- ```
67
-
68
- ## Step 3: Add Accessibility Identifiers
69
-
70
- ```swift
71
- TextField("Email", text: $email)
72
- .accessibilityIdentifier("emailField")
73
-
74
- SecureField("Password", text: $password)
75
- .accessibilityIdentifier("passwordField")
76
-
77
- Button("Login") { }
78
- .accessibilityIdentifier("loginButton")
79
- ```
80
-
81
- ## Step 4: Write UI Tests
82
-
83
- ```swift
84
- import XCTest
85
-
86
- final class LoginUITests: XCTestCase {
87
- var app: XCUIApplication!
88
-
89
- override func setUp() {
90
- continueAfterFailure = false
91
- app = XCUIApplication()
92
- app.launch()
93
- }
94
-
95
- func testLoginFlow() {
96
- let emailField = app.textFields["emailField"]
97
- let passwordField = app.secureTextFields["passwordField"]
98
- let loginButton = app.buttons["loginButton"]
99
-
100
- XCTAssertTrue(emailField.waitForExistence(timeout: 5))
101
-
102
- emailField.tap()
103
- emailField.typeText("user@example.com")
104
-
105
- passwordField.tap()
106
- passwordField.typeText("password123")
107
-
108
- XCTAssertTrue(loginButton.isEnabled)
109
- loginButton.tap()
110
-
111
- let welcomeText = app.staticTexts["welcomeMessage"]
112
- XCTAssertTrue(welcomeText.waitForExistence(timeout: 5))
113
- }
114
- }
115
- ```
116
-
117
- ## Step 5: Create Previews for Visual Testing
118
-
119
- ```swift
120
- #Preview("Empty") { LoginView(viewModel: LoginViewModel()) }
121
-
122
- #Preview("Filled") {
123
- let viewModel = LoginViewModel()
124
- viewModel.email = "user@example.com"
125
- viewModel.password = "password123"
126
- return LoginView(viewModel: viewModel)
127
- }
128
-
129
- #Preview("Error") {
130
- let viewModel = LoginViewModel()
131
- viewModel.errorMessage = "Invalid credentials"
132
- return LoginView(viewModel: viewModel)
133
- }
134
-
135
- #Preview("Dark Mode") {
136
- LoginView(viewModel: LoginViewModel())
137
- .preferredColorScheme(.dark)
138
- }
139
- ```
140
-
141
- ## Step 6: Run Tests from CLI
142
-
143
- ```bash
144
- # Run all tests with parsed output
145
- xcodebuild test -scheme AppName -destination 'platform=iOS Simulator,name=iPhone 15 Pro' 2>&1 | xcsift
146
-
147
- # Run only unit tests
148
- xcodebuild test -scheme AppName -only-testing:AppNameTests 2>&1 | xcsift
149
-
150
- # Run only UI tests
151
- xcodebuild test -scheme AppName -only-testing:AppNameUITests 2>&1 | xcsift
152
-
153
- # Run specific test class
154
- xcodebuild test -scheme AppName -only-testing:AppNameTests/LoginViewModelTests 2>&1 | xcsift
155
-
156
- # Run specific test method
157
- xcodebuild test -scheme AppName -only-testing:AppNameTests/LoginViewModelTests/testEmailValidation 2>&1 | xcsift
158
-
159
- # Generate test coverage
160
- xcodebuild test -scheme AppName -enableCodeCoverage YES -resultBundlePath TestResults.xcresult 2>&1 | xcsift
161
- xcrun xccov view --report TestResults.xcresult
162
- ```
163
-
164
- **If tests hang:** The test target likely depends on the app target with `@main`. Extract testable code to a Core framework target. See `../macos-apps/references/testing-tdd.md`.
165
-
166
- Report to user:
167
- - "Tests: X pass, Y fail"
168
- - "Coverage: Z% of lines"
169
- - If failures: "Failed tests: [list]. Investigating..."
170
- </process>
171
-
172
- <anti_patterns>
173
- ## Avoid These Mistakes
174
-
175
- **Testing view bodies:**
176
- ```swift
177
- // Wrong: can't test views directly
178
- func testView() {
179
- let view = LoginView()
180
- // Can't inspect SwiftUI view
181
- }
182
-
183
- // Right: test view model
184
- @Test func emailInput() {
185
- let viewModel = LoginViewModel()
186
- viewModel.email = "test@example.com"
187
- #expect(viewModel.email == "test@example.com")
188
- }
189
- ```
190
-
191
- **Missing accessibility identifiers:**
192
- ```swift
193
- // Wrong: using text
194
- let button = app.buttons["Login"]
195
-
196
- // Right: stable identifier
197
- let button = app.buttons["loginButton"]
198
- ```
199
-
200
- **No dependency injection:**
201
- ```swift
202
- // Wrong: can't mock
203
- @Observable
204
- class ViewModel {
205
- private let service = RealService()
206
- }
207
-
208
- // Right: injectable
209
- @Observable
210
- class ViewModel {
211
- private let service: ServiceProtocol
212
- init(service: ServiceProtocol) {
213
- self.service = service
214
- }
215
- }
216
- ```
217
-
218
- **No edge case testing:**
219
- ```swift
220
- // Test empty, invalid, error states
221
- @Test func emptyEmail() { }
222
- @Test func shortPassword() { }
223
- @Test func networkError() { }
224
- ```
225
- </anti_patterns>
226
-
227
- <success_criteria>
228
- This workflow is complete when:
229
- - [ ] Unit tests verify view model business logic
230
- - [ ] UI tests verify user flows using accessibility identifiers
231
- - [ ] All tests pass: `xcodebuild test -scheme YourApp`
232
- - [ ] Edge cases and error states have coverage
233
- - [ ] Dependencies use protocols for testability
234
- - [ ] Previews exist for major UI states
235
- </success_criteria>
@@ -1,208 +0,0 @@
1
- ---
2
- name: swiftui
3
- description: SwiftUI apps from scratch through App Store. Full lifecycle - create, debug, test, optimize, ship.
4
- ---
5
-
6
- <essential_principles>
7
- ## How We Work
8
-
9
- **The user is the product owner. Claude is the developer.**
10
-
11
- The user does not write code. The user does not read code. The user describes what they want and judges whether the result is acceptable. Claude implements, verifies, and reports outcomes.
12
-
13
- ### 1. Prove, Don't Promise
14
-
15
- Never say "this should work." Prove it:
16
- ```bash
17
- xcodebuild build 2>&1 | xcsift # Build passes
18
- xcodebuild test # Tests pass
19
- open .../App.app # App launches
20
- ```
21
- If you didn't run it, you don't know it works.
22
-
23
- ### 2. Tests for Correctness, Eyes for Quality
24
-
25
- | Question | How to Answer |
26
- |----------|---------------|
27
- | Does the logic work? | Write test, see it pass |
28
- | Does it look right? | Launch app, user looks at it |
29
- | Does it feel right? | User uses it |
30
- | Does it crash? | Test + launch |
31
- | Is it fast enough? | Profiler |
32
-
33
- Tests verify *correctness*. The user verifies *desirability*.
34
-
35
- ### 3. Report Outcomes, Not Code
36
-
37
- **Bad:** "I refactored the view model to use @Observable with environment injection"
38
- **Good:** "Fixed the state bug. App now updates correctly when you add items. Ready for you to verify."
39
-
40
- The user doesn't care what you changed. The user cares what's different.
41
-
42
- ### 4. Small Steps, Always Verified
43
-
44
- ```
45
- Change → Verify → Report → Next change
46
- ```
47
-
48
- Never batch up work. Never say "I made several changes." Each change is verified before the next. If something breaks, you know exactly what caused it.
49
-
50
- ### 5. Ask Before, Not After
51
-
52
- Unclear requirement? Ask now.
53
- Multiple valid approaches? Ask which.
54
- Scope creep? Ask if wanted.
55
- Big refactor needed? Ask permission.
56
-
57
- Wrong: Build for 30 minutes, then "is this what you wanted?"
58
- Right: "Before I start, does X mean Y or Z?"
59
-
60
- ### 6. Always Leave It Working
61
-
62
- Every stopping point = working state. Tests pass, app launches, changes committed. The user can walk away anytime and come back to something that works.
63
- </essential_principles>
64
-
65
- <swiftui_principles>
66
- ## SwiftUI Framework Principles
67
-
68
- ### Declarative Mindset
69
- Describe what the UI should look like for a given state, not how to mutate it. Let SwiftUI manage the rendering. Never force updates - change the state and let the framework react.
70
-
71
- ### Single Source of Truth
72
- Every piece of data has one authoritative location. Use the right property wrapper: @State for view-local, @Observable for shared objects, @Environment for app-wide. Derived data should be computed, not stored.
73
-
74
- ### Composition Over Inheritance
75
- Build complex UIs by composing small, focused views. Extract reusable components when patterns emerge. Prefer many small views over few large ones.
76
-
77
- ### Platform-Adaptive Design
78
- Write once but respect platform idioms. Use native navigation patterns, respect safe areas, adapt to screen sizes. Test on all target platforms.
79
- </swiftui_principles>
80
-
81
- <intake>
82
- **What would you like to do?**
83
-
84
- 1. Build a new SwiftUI app
85
- 2. Debug an existing SwiftUI app
86
- 3. Add a feature to an existing app
87
- 4. Write/run tests
88
- 5. Optimize performance
89
- 6. Ship/release to App Store
90
- 7. Something else
91
-
92
- **Then read the matching workflow from `workflows/` and follow it.**
93
- </intake>
94
-
95
- <routing>
96
- | Response | Workflow |
97
- |----------|----------|
98
- | 1, "new", "create", "build", "start" | `workflows/build-new-app.md` |
99
- | 2, "broken", "fix", "debug", "crash", "bug" | `workflows/debug-swiftui.md` |
100
- | 3, "add", "feature", "implement", "change" | `workflows/add-feature.md` |
101
- | 4, "test", "tests", "TDD", "coverage" | `workflows/write-tests.md` |
102
- | 5, "slow", "optimize", "performance", "fast" | `workflows/optimize-performance.md` |
103
- | 6, "ship", "release", "deploy", "publish", "app store" | `workflows/ship-app.md` |
104
- | 7, other | Clarify, then select workflow or references |
105
- </routing>
106
-
107
- <verification_loop>
108
- ## After Every Change
109
-
110
- ```bash
111
- # 1. Does it build?
112
- xcodebuild -scheme AppName build 2>&1 | xcsift
113
-
114
- # 2. Do tests pass? (use Core scheme for SwiftUI apps to avoid @main hang)
115
- xcodebuild -scheme AppNameCore test
116
-
117
- # 3. Does it launch?
118
- # macOS:
119
- open ./build/Build/Products/Debug/AppName.app
120
-
121
- # iOS Simulator:
122
- xcrun simctl boot "iPhone 15 Pro" 2>/dev/null || true
123
- xcrun simctl install booted ./build/Build/Products/Debug-iphonesimulator/AppName.app
124
- xcrun simctl launch booted com.yourcompany.appname
125
- ```
126
-
127
- Note: If tests hang, the test target likely depends on the app target which has `@main`. Extract testable code to a framework target. See `../macos-apps/references/testing-tdd.md` for the pattern.
128
-
129
- Report to the user:
130
- - "Build: ✓"
131
- - "Tests: 12 pass, 0 fail"
132
- - "App launches, ready for you to check [specific thing]"
133
- </verification_loop>
134
-
135
- <cli_infrastructure>
136
- ## CLI Workflow References
137
-
138
- For building, debugging, testing, and shipping from CLI without opening Xcode, read these from `../macos-apps/references/`:
139
-
140
- | Reference | Use For |
141
- |-----------|---------|
142
- | `cli-workflow.md` | Build, run, test commands; xcodebuild usage; code signing |
143
- | `cli-observability.md` | Log streaming, crash analysis, memory debugging, LLDB |
144
- | `project-scaffolding.md` | XcodeGen project.yml templates, file structure, entitlements |
145
- | `testing-tdd.md` | Test patterns that work from CLI, avoiding @main hangs |
146
-
147
- These docs are platform-agnostic. For iOS, change destinations:
148
- ```bash
149
- # iOS Simulator
150
- xcodebuild -scheme AppName -destination 'platform=iOS Simulator,name=iPhone 15 Pro' build
151
-
152
- # macOS
153
- xcodebuild -scheme AppName build
154
- ```
155
- </cli_infrastructure>
156
-
157
- <reference_index>
158
- ## Domain Knowledge
159
-
160
- All in `references/`:
161
-
162
- **Core:**
163
- - architecture.md - MVVM patterns, project structure, dependency injection
164
- - state-management.md - Property wrappers, @Observable, data flow
165
- - layout-system.md - Stacks, grids, GeometryReader, custom layouts
166
-
167
- **Navigation & Animation:**
168
- - navigation.md - NavigationStack, sheets, tabs, deep linking
169
- - animations.md - Built-in animations, transitions, matchedGeometryEffect
170
-
171
- **Data & Platform:**
172
- - swiftdata.md - Persistence, @Model, @Query, CloudKit sync
173
- - platform-integration.md - iOS/macOS/watchOS/visionOS specifics
174
- - uikit-appkit-interop.md - UIViewRepresentable, hosting controllers
175
-
176
- **Support:**
177
- - networking-async.md - async/await, .task modifier, API clients
178
- - testing-debugging.md - Previews, unit tests, UI tests, debugging
179
- - performance.md - Profiling, lazy loading, view identity
180
- </reference_index>
181
-
182
- <workflows_index>
183
- ## Workflows
184
-
185
- All in `workflows/`:
186
-
187
- | Workflow | Purpose |
188
- |----------|---------|
189
- | build-new-app.md | Create new SwiftUI app from scratch |
190
- | debug-swiftui.md | Find and fix SwiftUI bugs |
191
- | add-feature.md | Add functionality to existing app |
192
- | write-tests.md | Write UI and unit tests |
193
- | optimize-performance.md | Profile and improve performance |
194
- | ship-app.md | App Store submission, TestFlight, distribution |
195
- </workflows_index>
196
-
197
- <canonical_terminology>
198
- ## Terminology
199
-
200
- Use these terms consistently:
201
- - **view** (not: widget, component, element)
202
- - **@Observable** (not: ObservableObject, @Published for new iOS 17+ code)
203
- - **NavigationStack** (not: NavigationView - deprecated)
204
- - **SwiftData** (not: Core Data for new projects)
205
- - **@Environment** (not: @EnvironmentObject for new code)
206
- - **modifier** (not: method/function when describing view modifiers)
207
- - **body** (not: render/build when describing view body)
208
- </canonical_terminology>