@haposoft/cafekit 0.15.1 → 0.16.0-rc.1

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 (99) hide show
  1. package/README.md +6 -2
  2. package/bin/__tests__/codex-hooks.test.js +140 -0
  3. package/bin/__tests__/codex-native.test.js +230 -2
  4. package/bin/__tests__/develop-contract.test.js +1120 -0
  5. package/bin/__tests__/installer-safety.test.js +553 -2
  6. package/bin/__tests__/package-inventory.test.js +258 -0
  7. package/bin/__tests__/secret-scanner.test.js +157 -0
  8. package/bin/__tests__/validator-grounding.test.js +713 -0
  9. package/bin/install.js +5 -1
  10. package/bin/lib/codex-install.js +21 -6
  11. package/bin/lib/context.js +17 -6
  12. package/bin/lib/copy-utils.js +31 -0
  13. package/bin/lib/i18n.js +12 -3
  14. package/bin/lib/instruction-blocks.js +85 -0
  15. package/bin/lib/managed-writer.js +4 -1
  16. package/bin/lib/opencode-install.js +75 -30
  17. package/bin/lib/skill-deps.js +45 -7
  18. package/bin/phases/claude-runtime.js +103 -4
  19. package/bin/phases/codex-runtime.js +41 -7
  20. package/bin/phases/post-install.js +29 -22
  21. package/bin/phases/root-config.js +89 -10
  22. package/bin/phases/select-platform.js +23 -0
  23. package/bin/phases/skills-setup.js +7 -3
  24. package/package.json +15 -5
  25. package/src/claude/CLAUDE.md +6 -122
  26. package/src/claude/agents/code-auditor.md +21 -22
  27. package/src/claude/agents/debugger.md +3 -3
  28. package/src/claude/agents/deployer.md +1 -1
  29. package/src/claude/agents/{god-developer.md → implementer.md} +2 -2
  30. package/src/claude/agents/project-manager.md +1 -1
  31. package/src/claude/agents/spec-maker.md +2 -2
  32. package/src/claude/hooks/__tests__/spec-gate.test.js +356 -5
  33. package/src/claude/hooks/agent.cjs +7 -14
  34. package/src/claude/hooks/rules.cjs +33 -53
  35. package/src/claude/hooks/spec-gate.cjs +66 -21
  36. package/src/claude/hooks/spec-state.cjs +5 -0
  37. package/src/claude/migration-manifest.json +9 -2
  38. package/src/claude/runtime.json +0 -3
  39. package/src/claude/scripts/generate-skill-catalog.cjs +1 -1
  40. package/src/claude/scripts/scan-staged-secrets.cjs +170 -0
  41. package/src/claude/scripts/spec-ground.cjs +189 -83
  42. package/src/claude/scripts/validate-spec-output.cjs +294 -30
  43. package/src/claude/scripts/workflow-policy.cjs +609 -0
  44. package/src/claude/skills/ai-multimodal/SKILL.md +2 -2
  45. package/src/claude/skills/ai-multimodal/references/audio-processing.md +6 -6
  46. package/src/claude/skills/ai-multimodal/references/video-analysis.md +1 -1
  47. package/src/claude/skills/backend-development/SKILL.md +4 -4
  48. package/src/claude/skills/backend-development/references/backend-architecture.md +1 -1
  49. package/src/claude/skills/backend-development/references/backend-devops.md +2 -2
  50. package/src/claude/skills/backend-development/references/backend-mindset.md +3 -3
  51. package/src/claude/skills/backend-development/references/backend-performance.md +5 -5
  52. package/src/claude/skills/backend-development/references/backend-security.md +3 -3
  53. package/src/claude/skills/backend-development/references/backend-technologies.md +5 -5
  54. package/src/claude/skills/backend-development/references/backend-testing.md +2 -2
  55. package/src/claude/skills/brainstorm/SKILL.md +2 -3
  56. package/src/claude/skills/chrome-devtools/scripts/package-lock.json +261 -150
  57. package/src/claude/skills/chrome-devtools/scripts/package.json +1 -1
  58. package/src/claude/skills/code-review/SKILL.md +12 -8
  59. package/src/claude/skills/code-review/references/verification-gate.md +4 -4
  60. package/src/claude/skills/debug/SKILL.md +2 -0
  61. package/src/claude/skills/develop/SKILL.md +100 -52
  62. package/src/claude/skills/develop/references/parallel-waves.md +105 -26
  63. package/src/claude/skills/develop/references/quality-gate.md +58 -38
  64. package/src/claude/skills/develop/references/subagent-patterns.md +2 -2
  65. package/src/claude/skills/git/SKILL.md +44 -50
  66. package/src/claude/skills/hotfix/SKILL.md +10 -8
  67. package/src/claude/skills/hotfix/references/parallel-patterns.md +2 -2
  68. package/src/claude/skills/hotfix/references/review-cycle.md +26 -21
  69. package/src/claude/skills/inspect/SKILL.md +12 -30
  70. package/src/claude/skills/mobile-development/SKILL.md +12 -12
  71. package/src/claude/skills/mobile-development/references/mobile-android.md +7 -7
  72. package/src/claude/skills/mobile-development/references/mobile-best-practices.md +22 -23
  73. package/src/claude/skills/mobile-development/references/mobile-frameworks.md +13 -13
  74. package/src/claude/skills/mobile-development/references/mobile-ios.md +1 -1
  75. package/src/claude/skills/mobile-development/references/mobile-mindset.md +17 -19
  76. package/src/claude/skills/pptx/scripts/package-lock.json +868 -0
  77. package/src/claude/skills/pptx/scripts/package.json +1 -1
  78. package/src/claude/skills/question/SKILL.md +13 -13
  79. package/src/claude/skills/research/SKILL.md +2 -2
  80. package/src/claude/skills/specs/SKILL.md +32 -15
  81. package/src/claude/skills/specs/references/review.md +3 -3
  82. package/src/claude/skills/specs/rules/tasks-generation.md +1 -1
  83. package/src/claude/skills/specs/templates/spec-state.json +7 -3
  84. package/src/claude/skills/sync/SKILL.md +26 -1
  85. package/src/claude/skills/sync/references/sync-protocols.md +3 -3
  86. package/src/claude/skills/test/SKILL.md +12 -4
  87. package/src/claude/skills/test/references/failure-triage.md +17 -17
  88. package/src/claude/skills/test/references/test-memory.md +2 -2
  89. package/src/codex/AGENTS.md +16 -24
  90. package/src/codex/hooks/lib/spec-receipt.cjs +57 -4
  91. package/src/codex/hooks/rules.cjs +27 -26
  92. package/src/codex/hooks/spec-gate.cjs +19 -8
  93. package/src/codex/hooks/spec-state.cjs +10 -1
  94. package/src/codex/hooks.json +14 -14
  95. package/src/common/AGENTS.md +43 -0
  96. package/src/opencode/AGENTS.md +21 -121
  97. package/src/opencode/plugins/rules.ts +26 -34
  98. package/src/opencode/plugins/spec-gate.ts +283 -0
  99. package/src/claude/skills/inspect/references/external-gemini-inspection.md +0 -169
@@ -74,8 +74,8 @@ when (uiState) {
74
74
 
75
75
  ### Why Compose?
76
76
  - **Declarative**: Describe UI state, not imperative commands
77
- - **60% adoption**: In top 1,000 apps (2024)
78
- - **Less code**: 40% reduction vs Views
77
+ - **Adoption**: Used in many top 1,000 apps
78
+ - **Less code**: Reduction vs Views
79
79
  - **Modern**: Built for Kotlin and coroutines
80
80
  - **Material 3**: First-class support
81
81
 
@@ -310,7 +310,7 @@ class UserViewModel(
310
310
 
311
311
  **Hilt vs Koin:**
312
312
  - **Hilt**: Compile-time, type-safe, Google-backed, complex setup
313
- - **Koin**: Runtime, simple DSL, 50% faster setup, reflection-based
313
+ - **Koin**: Runtime, simple DSL, faster setup, reflection-based
314
314
 
315
315
  ## Performance Optimization
316
316
 
@@ -335,14 +335,14 @@ android {
335
335
  ```
336
336
 
337
337
  **Impact:**
338
- - 10-20% app size reduction
339
- - 20% faster startup
338
+ - Smaller app size
339
+ - Faster startup
340
340
  - Harder to reverse engineer
341
341
 
342
342
  ### Baseline Profiles
343
343
 
344
344
  **Performance boost:**
345
- - 10-20% faster startup
345
+ - Faster startup
346
346
  - Reduced jank in critical paths
347
347
  - AOT compilation of hot code
348
348
 
@@ -572,7 +572,7 @@ android {
572
572
  ```
573
573
 
574
574
  **Benefits:**
575
- - 15-30% smaller downloads
575
+ - Smaller downloads
576
576
  - Dynamic feature modules
577
577
  - Instant apps support
578
578
 
@@ -86,8 +86,8 @@ User opens screen
86
86
  - Background App Refresh (iOS)
87
87
 
88
88
  **Targets:**
89
- - Active use: <5% per hour
90
- - Background: <1% per hour
89
+ - Active use: minimize foreground energy use
90
+ - Background: minimize background energy use
91
91
 
92
92
  ## Offline-First Architecture
93
93
 
@@ -315,8 +315,8 @@ messaging().onNotificationOpenedApp(remoteMessage => {
315
315
  ```
316
316
 
317
317
  **Impact:**
318
- - 25% revenue increase with proper personalization
319
- - 88% opt-in rate with pre-permission modal (vs 40% without)
318
+ - Personalization can increase revenue
319
+ - Pre-permission modal can improve opt-in rate
320
320
 
321
321
  ## Authentication & Authorization
322
322
 
@@ -443,10 +443,10 @@ const token = credentials.password;
443
443
  - Expedited: 1-2 hours (emergencies only)
444
444
 
445
445
  **Rejection Reasons:**
446
- - Crashes (50%)
447
- - Privacy violations (25%)
448
- - Incomplete information (15%)
449
- - Guideline violations (10%)
446
+ - Crashes
447
+ - Privacy violations
448
+ - Incomplete information
449
+ - Guideline violations
450
450
 
451
451
  ### Google Play (Android)
452
452
 
@@ -460,7 +460,7 @@ const token = credentials.password;
460
460
  1. Build signed AAB (Android App Bundle)
461
461
  2. Upload to Play Console
462
462
  3. Submit to production track
463
- 4. Staged rollout (10% → 50% → 100%)
463
+ 4. Staged rollout (pilot → partial → full)
464
464
 
465
465
  **Review Time:**
466
466
  - Average: 1-3 days
@@ -468,22 +468,21 @@ const token = credentials.password;
468
468
 
469
469
  ### Staged Rollout Strategy
470
470
 
471
- **Week 1:**
472
- - 10% of users
471
+ **Pilot:**
472
+ - Release to a small audience
473
473
  - Monitor crash-free rate
474
474
  - Watch for critical bugs
475
475
 
476
- **Week 2:**
477
- - 50% of users
476
+ **Partial rollout:**
477
+ - Expand audience after pilot
478
478
  - Validate performance metrics
479
479
  - Check user feedback
480
480
 
481
- **Week 3:**
482
- - 100% of users
483
- - Full release if metrics healthy
481
+ **Full rollout:**
482
+ - Release to all users when metrics are healthy
484
483
 
485
484
  **Rollback Triggers:**
486
- - Crash-free rate drops >5%
485
+ - Crash-free rate shows a material drop
487
486
  - Critical bug discovered
488
487
  - Major user complaints
489
488
 
@@ -493,12 +492,12 @@ const token = credentials.password;
493
492
 
494
493
  | Metric | React Native | Flutter |
495
494
  |--------|--------------|---------|
496
- | **Adoption** | 35% | 46% |
497
- | **Performance** | 80-90% | 85-95% |
498
- | **App Size** | 40-50MB | 15-20MB |
499
- | **Dev Speed** | Fast | Very Fast |
500
- | **Commercial** | 12.57% | 5.24% |
501
- | **Developers** | 20:1 ratio | 1 ratio |
495
+ | **Adoption** | Established | Established |
496
+ | **Performance** | Near-native when profiled | Near-native when profiled |
497
+ | **App Size** | Moderate | Moderate |
498
+ | **Dev Speed** | Fast | Very fast |
499
+ | **Commercial footprint** | Established | Established |
500
+ | **Developers** | Broad ecosystem | Broad ecosystem |
502
501
  | **Best For** | JS teams | Performance |
503
502
 
504
503
  ### Architecture Comparison
@@ -7,8 +7,8 @@ Comprehensive guide to mobile development frameworks: React Native, Flutter, and
7
7
  ### React Native
8
8
  - **Language**: JavaScript/TypeScript
9
9
  - **Stars**: 121,000+ on GitHub
10
- - **Adoption**: 35% of mobile developers, 67% familiarity
11
- - **Performance**: 80-90% native performance
10
+ - **Adoption**: Broad adoption and familiarity among mobile developers
11
+ - **Performance**: Near-native performance
12
12
  - **Architecture**: Bridge-based (legacy) → New Architecture (JSI, Fabric, Codegen)
13
13
  - **Rendering**: Native components
14
14
  - **Hot Reload**: Yes
@@ -17,8 +17,8 @@ Comprehensive guide to mobile development frameworks: React Native, Flutter, and
17
17
  ### Flutter
18
18
  - **Language**: Dart
19
19
  - **Stars**: 170,000+ on GitHub (fastest-growing)
20
- - **Adoption**: 46% of mobile developers
21
- - **Performance**: 85-95% native performance
20
+ - **Adoption**: Broad adoption among mobile developers
21
+ - **Performance**: Near-native performance
22
22
  - **Architecture**: "Everything is a widget"
23
23
  - **Rendering**: Custom Impeller rendering engine (eliminates jank)
24
24
  - **Hot Reload**: Yes (fastest in industry)
@@ -26,7 +26,7 @@ Comprehensive guide to mobile development frameworks: React Native, Flutter, and
26
26
 
27
27
  ### Native iOS (Swift/SwiftUI)
28
28
  - **Language**: Swift
29
- - **Performance**: 100% native
29
+ - **Performance**: Native performance
30
30
  - **UI Framework**: SwiftUI (declarative) or UIKit (imperative)
31
31
  - **Latest**: Swift 6 with compile-time data race detection
32
32
  - **Tooling**: Xcode 16, Swift Package Manager
@@ -34,7 +34,7 @@ Comprehensive guide to mobile development frameworks: React Native, Flutter, and
34
34
 
35
35
  ### Native Android (Kotlin/Jetpack Compose)
36
36
  - **Language**: Kotlin
37
- - **Performance**: 100% native
37
+ - **Performance**: Native performance
38
38
  - **UI Framework**: Jetpack Compose (declarative) or Views (imperative)
39
39
  - **Latest**: Kotlin 2.1, Compose 1.7
40
40
  - **Tooling**: Android Studio Hedgehog+
@@ -51,7 +51,7 @@ Comprehensive guide to mobile development frameworks: React Native, Flutter, and
51
51
  - **Turbo Modules**: Lazy-loaded native modules
52
52
 
53
53
  **Performance Optimizations**
54
- - **Hermes Engine**: 30-40% faster startup, reduced memory
54
+ - **Hermes Engine**: Faster startup, reduced memory
55
55
  - **Native Driver Animations**: Offloaded to UI thread (60 FPS)
56
56
  - **FlatList Virtualization**: Renders only visible items
57
57
  - **Image Optimization**: FastImage library, progressive loading
@@ -81,14 +81,14 @@ src/
81
81
  4. **Context API**: Simple apps, avoid prop drilling
82
82
 
83
83
  **Navigation**
84
- - **React Navigation**: Industry standard, 80%+ adoption
84
+ - **React Navigation**: Industry standard
85
85
  - Type-safe navigation with TypeScript
86
86
  - Deep linking configuration
87
87
  - Tab, stack, drawer navigators
88
88
 
89
89
  **TypeScript Adoption**
90
- - 85%+ of new React Native projects use TypeScript
91
- - Type safety prevents 15% of runtime errors
90
+ - TypeScript is common in new React Native projects
91
+ - Type safety helps prevent runtime errors
92
92
  - Better IDE support and autocomplete
93
93
 
94
94
  ### Testing Strategy
@@ -130,7 +130,7 @@ test('login button should be enabled when form is valid', async () => {
130
130
  - Rapid prototyping and MVPs
131
131
  - Strong community support needed
132
132
  - npm ecosystem integration
133
- - Commercial apps (12.57% market share)
133
+ - Commercial apps
134
134
 
135
135
  **❌ Not Ideal For:**
136
136
  - Heavy graphics/gaming (use native or Unity)
@@ -254,7 +254,7 @@ testWidgets('Counter increments', (WidgetTester test-runner) async {
254
254
  - Move semantics for performance
255
255
 
256
256
  **SwiftUI vs UIKit**
257
- - **SwiftUI**: Declarative, 40% less code, iOS 13+, modern approach
257
+ - **SwiftUI**: Declarative, less code, iOS 13+, modern approach
258
258
  - **UIKit**: Imperative, fine-grained control, legacy support, complex customizations
259
259
  - Both work together in same project
260
260
 
@@ -318,7 +318,7 @@ struct LoginView: View {
318
318
 
319
319
  **Jetpack Compose**
320
320
  - Declarative UI (like SwiftUI/React)
321
- - 60% adoption in top 1,000 apps
321
+ - Widely adopted in top 1,000 apps
322
322
  - Material Design 3 integration
323
323
  - Compose compiler with Kotlin 2.0+
324
324
 
@@ -53,7 +53,7 @@ actor UserCache {
53
53
  ✅ Declarative UI preferred
54
54
  ✅ Fast iteration needed
55
55
  ✅ Cross-platform (macOS, watchOS, tvOS)
56
- ✅ 40% less code vs UIKit
56
+ ✅ Less code vs UIKit
57
57
 
58
58
  ### When to Use UIKit
59
59
  ✅ Legacy app maintenance
@@ -5,7 +5,7 @@ Essential thinking patterns and decision-making frameworks for successful mobile
5
5
  ## The 10 Commandments of Mobile Development
6
6
 
7
7
  ### 1. Performance is Foundation, Not Feature
8
- - **Reality**: 70% users abandon apps >3s load time
8
+ - **Reality**: Users may abandon apps when load time exceeds 3s
9
9
  - **Mindset**: Optimize from day one, not "later"
10
10
  - **Action**: Set performance budgets before writing code
11
11
 
@@ -50,7 +50,7 @@ Essential thinking patterns and decision-making frameworks for successful mobile
50
50
  - **Action**: MVVM for small apps, Clean Architecture when complexity demands
51
51
 
52
52
  ### 10. Continuous Learning is Survival
53
- - **Reality**: 85% developers use AI tools (2024), frameworks evolve constantly
53
+ - **Reality**: AI tools are widely used by developers (2024), frameworks evolve constantly
54
54
  - **Mindset**: Embrace change, allocate learning time
55
55
  - **Action**: 1+ hour weekly for new tech/patterns
56
56
 
@@ -131,7 +131,7 @@ Essential thinking patterns and decision-making frameworks for successful mobile
131
131
  - "It just works" expectation = zero tolerance for crashes
132
132
 
133
133
  **Fragmentation**: LOW
134
- - 90%+ on iOS 16+ (2024)
134
+ - Most users on iOS 16+ (2024)
135
135
  - Only ~50 device models to test
136
136
  - Predictable hardware specs
137
137
 
@@ -165,7 +165,7 @@ Essential thinking patterns and decision-making frameworks for successful mobile
165
165
  - Handle back button properly
166
166
 
167
167
  **When to Go Native Android:**
168
- - Global market focus (72% market share)
168
+ - Global market focus (Android dominates)
169
169
  - Emerging markets (Android dominates)
170
170
  - Enterprise/B2B (customization needs)
171
171
 
@@ -177,7 +177,7 @@ Essential thinking patterns and decision-making frameworks for successful mobile
177
177
  |--------|-----------|-----------------|
178
178
  | **Launch time** | <2s | Acceptable |
179
179
  | **Launch time** | 2-3s | Noticeable delay |
180
- | **Launch time** | >3s | 70% abandon |
180
+ | **Launch time** | >3s | Users may abandon |
181
181
  | **Screen load** | <1s | Instant (cached) |
182
182
  | **Screen load** | 1-3s | Acceptable (network) |
183
183
  | **Screen load** | >3s | Frustrating |
@@ -259,46 +259,44 @@ Week 2: Polish + Ship
259
259
  8. Merge to develop
260
260
 
261
261
  **CI/CD Impact:**
262
- - 20% reduction in development time
263
- - 50% fewer production bugs
264
- - 3x faster deployment
262
+ - Faster development and deployment with fewer production bugs
265
263
 
266
264
  ### Common Pitfalls & Avoidance
267
265
 
268
266
  #### 1. Testing Only on Simulators
269
267
  **Problem**: Simulators don't show real performance (battery, memory, network)
270
268
  **Solution**: Real device testing mandatory before every release
271
- **Impact**: 40% of bugs only appear on real devices
269
+ **Impact**: Some bugs only appear on real devices
272
270
 
273
271
  #### 2. Ignoring Platform Conventions
274
272
  **Problem**: Custom navigation confuses users
275
273
  **Solution**: Follow iOS HIG and Material Design
276
- **Impact**: 30% lower engagement with non-standard UIs
274
+ **Impact**: Non-standard UIs can lower engagement
277
275
 
278
276
  #### 3. No Offline Handling
279
277
  **Problem**: Network failures = blank screens, errors
280
278
  **Solution**: Offline-first architecture, cached data
281
- **Impact**: 50% of users experience network issues daily
279
+ **Impact**: Users can experience network issues daily
282
280
 
283
281
  #### 4. Poor Memory Management
284
282
  **Problem**: Memory leaks → crashes, poor performance
285
283
  **Solution**: ARC/GC understanding, profile regularly
286
- **Impact**: Memory issues = #1 crash cause (35%)
284
+ **Impact**: Memory issues are a leading crash cause
287
285
 
288
286
  #### 5. Hardcoded Credentials
289
287
  **Problem**: Security vulnerability, API key exposure
290
288
  **Solution**: Environment variables, secure storage
291
- **Impact**: 23% of apps leak sensitive data (OWASP)
289
+ **Impact**: Apps can leak sensitive data; follow OWASP guidance.
292
290
 
293
291
  #### 6. No Accessibility
294
- **Problem**: Excludes 15%+ of users (disability, situational)
292
+ **Problem**: Excludes users with disabilities or situational needs
295
293
  **Solution**: VoiceOver/TalkBack testing, semantic labels
296
294
  **Impact**: Accessibility = 1.3B global market
297
295
 
298
296
  #### 7. Premature Optimization
299
297
  **Problem**: Wasted time optimizing non-bottlenecks
300
298
  **Solution**: Measure first, optimize biggest impact
301
- **Impact**: 80% of performance issues = 20% of code
299
+ **Impact**: Many performance issues come from a small part of the code
302
300
 
303
301
  #### 8. Over-Engineering
304
302
  **Problem**: Complex architecture for simple apps
@@ -308,7 +306,7 @@ Week 2: Polish + Ship
308
306
  #### 9. Skipping Real Device Testing
309
307
  **Problem**: Missed battery drain, thermal issues
310
308
  **Solution**: Device farm in CI/CD, manual testing
311
- **Impact**: 25% of performance issues device-specific
309
+ **Impact**: Some performance issues are device-specific
312
310
 
313
311
  #### 10. Not Respecting Battery
314
312
  **Problem**: Background processing drains battery
@@ -460,12 +458,12 @@ if (isLowEndDevice) {
460
458
 
461
459
  **Example Architecture:**
462
460
  ```
463
- React Native / Flutter (90%)
461
+ React Native / Flutter
464
462
  ├─ UI and business logic
465
463
  ├─ Standard features
466
464
  └─ API integration
467
465
 
468
- Native Modules (10%)
466
+ Native Modules
469
467
  ├─ Performance-critical (video processing)
470
468
  ├─ Platform-specific (HealthKit, Android Auto)
471
469
  └─ Third-party SDKs (payment, analytics)
@@ -535,7 +533,7 @@ v4.0: Extract microservices if justified
535
533
  - Discord (React Native, Flutter official)
536
534
  - Twitter: Follow framework creators and contributors
537
535
 
538
- **AI Tools (85% adoption in 2024):**
536
+ **AI Tools (widely adopted in 2024):**
539
537
  - GitHub Copilot: Code completion, boilerplate
540
538
  - ChatGPT/Claude: Architecture questions, debugging
541
539
  - Tabnine: Context-aware suggestions