@musashishao/agent-kit 1.0.0

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 (220) hide show
  1. package/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
  2. package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
  3. package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
  4. package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
  5. package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
  6. package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
  7. package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
  8. package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  9. package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  10. package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  11. package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  12. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  13. package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  14. package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  15. package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
  16. package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  17. package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  18. package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  19. package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  20. package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
  21. package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
  22. package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  23. package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  24. package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
  25. package/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
  26. package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +487 -0
  27. package/.agent/.shared/ui-ux-pro-max/scripts/search.py +76 -0
  28. package/.agent/ARCHITECTURE.md +225 -0
  29. package/.agent/CONTEXT.md +229 -0
  30. package/.agent/FEATURE_ROADMAP.md +435 -0
  31. package/.agent/PROMPT_TEMPLATES.md +261 -0
  32. package/.agent/agents/backend-specialist.md +263 -0
  33. package/.agent/agents/database-architect.md +226 -0
  34. package/.agent/agents/debugger.md +225 -0
  35. package/.agent/agents/devops-engineer.md +242 -0
  36. package/.agent/agents/documentation-writer.md +104 -0
  37. package/.agent/agents/explorer-agent.md +73 -0
  38. package/.agent/agents/frontend-specialist.md +556 -0
  39. package/.agent/agents/game-developer.md +162 -0
  40. package/.agent/agents/mobile-developer.md +377 -0
  41. package/.agent/agents/orchestrator.md +416 -0
  42. package/.agent/agents/penetration-tester.md +188 -0
  43. package/.agent/agents/performance-optimizer.md +187 -0
  44. package/.agent/agents/project-planner.md +403 -0
  45. package/.agent/agents/security-auditor.md +170 -0
  46. package/.agent/agents/seo-specialist.md +111 -0
  47. package/.agent/agents/test-engineer.md +158 -0
  48. package/.agent/rules/GEMINI.md +251 -0
  49. package/.agent/skills/api-patterns/SKILL.md +81 -0
  50. package/.agent/skills/api-patterns/api-style.md +42 -0
  51. package/.agent/skills/api-patterns/auth.md +24 -0
  52. package/.agent/skills/api-patterns/documentation.md +26 -0
  53. package/.agent/skills/api-patterns/graphql.md +41 -0
  54. package/.agent/skills/api-patterns/rate-limiting.md +31 -0
  55. package/.agent/skills/api-patterns/response.md +37 -0
  56. package/.agent/skills/api-patterns/rest.md +40 -0
  57. package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
  58. package/.agent/skills/api-patterns/security-testing.md +122 -0
  59. package/.agent/skills/api-patterns/trpc.md +41 -0
  60. package/.agent/skills/api-patterns/versioning.md +22 -0
  61. package/.agent/skills/app-builder/SKILL.md +75 -0
  62. package/.agent/skills/app-builder/agent-coordination.md +71 -0
  63. package/.agent/skills/app-builder/feature-building.md +53 -0
  64. package/.agent/skills/app-builder/project-detection.md +34 -0
  65. package/.agent/skills/app-builder/scaffolding.md +118 -0
  66. package/.agent/skills/app-builder/tech-stack.md +40 -0
  67. package/.agent/skills/app-builder/templates/SKILL.md +39 -0
  68. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  69. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  70. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  71. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  72. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  73. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  74. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  75. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
  76. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
  77. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
  78. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
  79. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  80. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
  81. package/.agent/skills/architecture/SKILL.md +55 -0
  82. package/.agent/skills/architecture/context-discovery.md +43 -0
  83. package/.agent/skills/architecture/examples.md +94 -0
  84. package/.agent/skills/architecture/pattern-selection.md +68 -0
  85. package/.agent/skills/architecture/patterns-reference.md +50 -0
  86. package/.agent/skills/architecture/trade-off-analysis.md +77 -0
  87. package/.agent/skills/bash-linux/SKILL.md +199 -0
  88. package/.agent/skills/behavioral-modes/SKILL.md +242 -0
  89. package/.agent/skills/brainstorming/SKILL.md +163 -0
  90. package/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
  91. package/.agent/skills/clean-code/SKILL.md +201 -0
  92. package/.agent/skills/code-review-checklist/SKILL.md +109 -0
  93. package/.agent/skills/database-design/SKILL.md +52 -0
  94. package/.agent/skills/database-design/database-selection.md +43 -0
  95. package/.agent/skills/database-design/indexing.md +39 -0
  96. package/.agent/skills/database-design/migrations.md +48 -0
  97. package/.agent/skills/database-design/optimization.md +36 -0
  98. package/.agent/skills/database-design/orm-selection.md +30 -0
  99. package/.agent/skills/database-design/schema-design.md +56 -0
  100. package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
  101. package/.agent/skills/deployment-procedures/SKILL.md +241 -0
  102. package/.agent/skills/doc.md +177 -0
  103. package/.agent/skills/docker-expert/SKILL.md +409 -0
  104. package/.agent/skills/documentation-templates/SKILL.md +194 -0
  105. package/.agent/skills/frontend-design/SKILL.md +396 -0
  106. package/.agent/skills/frontend-design/animation-guide.md +331 -0
  107. package/.agent/skills/frontend-design/color-system.md +311 -0
  108. package/.agent/skills/frontend-design/decision-trees.md +418 -0
  109. package/.agent/skills/frontend-design/motion-graphics.md +306 -0
  110. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  111. package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
  112. package/.agent/skills/frontend-design/typography-system.md +345 -0
  113. package/.agent/skills/frontend-design/ux-psychology.md +541 -0
  114. package/.agent/skills/frontend-design/visual-effects.md +383 -0
  115. package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
  116. package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
  117. package/.agent/skills/game-development/SKILL.md +167 -0
  118. package/.agent/skills/game-development/game-art/SKILL.md +185 -0
  119. package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
  120. package/.agent/skills/game-development/game-design/SKILL.md +129 -0
  121. package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
  122. package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
  123. package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
  124. package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
  125. package/.agent/skills/game-development/web-games/SKILL.md +150 -0
  126. package/.agent/skills/geo-fundamentals/SKILL.md +156 -0
  127. package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  128. package/.agent/skills/i18n-localization/SKILL.md +154 -0
  129. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  130. package/.agent/skills/lint-and-validate/SKILL.md +45 -0
  131. package/.agent/skills/lint-and-validate/scripts/lint_runner.py +172 -0
  132. package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  133. package/.agent/skills/mcp-builder/SKILL.md +176 -0
  134. package/.agent/skills/mobile-design/SKILL.md +394 -0
  135. package/.agent/skills/mobile-design/decision-trees.md +516 -0
  136. package/.agent/skills/mobile-design/mobile-backend.md +491 -0
  137. package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
  138. package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
  139. package/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
  140. package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
  141. package/.agent/skills/mobile-design/mobile-performance.md +767 -0
  142. package/.agent/skills/mobile-design/mobile-testing.md +356 -0
  143. package/.agent/skills/mobile-design/mobile-typography.md +433 -0
  144. package/.agent/skills/mobile-design/platform-android.md +666 -0
  145. package/.agent/skills/mobile-design/platform-ios.md +561 -0
  146. package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
  147. package/.agent/skills/mobile-design/touch-psychology.md +537 -0
  148. package/.agent/skills/nestjs-expert/SKILL.md +552 -0
  149. package/.agent/skills/nextjs-best-practices/SKILL.md +203 -0
  150. package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
  151. package/.agent/skills/parallel-agents/SKILL.md +175 -0
  152. package/.agent/skills/performance-profiling/SKILL.md +143 -0
  153. package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  154. package/.agent/skills/plan-writing/SKILL.md +152 -0
  155. package/.agent/skills/powershell-windows/SKILL.md +167 -0
  156. package/.agent/skills/prisma-expert/SKILL.md +355 -0
  157. package/.agent/skills/python-patterns/SKILL.md +441 -0
  158. package/.agent/skills/react-patterns/SKILL.md +198 -0
  159. package/.agent/skills/red-team-tactics/SKILL.md +199 -0
  160. package/.agent/skills/seo-fundamentals/SKILL.md +129 -0
  161. package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  162. package/.agent/skills/server-management/SKILL.md +161 -0
  163. package/.agent/skills/systematic-debugging/SKILL.md +109 -0
  164. package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
  165. package/.agent/skills/tdd-workflow/SKILL.md +149 -0
  166. package/.agent/skills/testing-patterns/SKILL.md +178 -0
  167. package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
  168. package/.agent/skills/typescript-expert/SKILL.md +429 -0
  169. package/.agent/skills/typescript-expert/references/tsconfig-strict.json +92 -0
  170. package/.agent/skills/typescript-expert/references/typescript-cheatsheet.md +383 -0
  171. package/.agent/skills/typescript-expert/references/utility-types.ts +335 -0
  172. package/.agent/skills/typescript-expert/scripts/ts_diagnostic.py +203 -0
  173. package/.agent/skills/ui-ux-pro-max/SKILL.md +351 -0
  174. package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
  175. package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
  176. package/.agent/skills/ui-ux-pro-max/data/icons.csv +101 -0
  177. package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
  178. package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
  179. package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  180. package/.agent/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  181. package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  182. package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  183. package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  184. package/.agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  185. package/.agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  186. package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  187. package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  188. package/.agent/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  189. package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  190. package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  191. package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  192. package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
  193. package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
  194. package/.agent/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  195. package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  196. package/.agent/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  197. package/.agent/skills/ui-ux-pro-max/scripts/core.py +257 -0
  198. package/.agent/skills/ui-ux-pro-max/scripts/design_system.py +487 -0
  199. package/.agent/skills/ui-ux-pro-max/scripts/search.py +76 -0
  200. package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
  201. package/.agent/skills/vulnerability-scanner/checklists.md +121 -0
  202. package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  203. package/.agent/skills/webapp-testing/SKILL.md +187 -0
  204. package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  205. package/.agent/workflows/brainstorm.md +113 -0
  206. package/.agent/workflows/create.md +59 -0
  207. package/.agent/workflows/debug.md +103 -0
  208. package/.agent/workflows/deploy.md +176 -0
  209. package/.agent/workflows/enhance.md +63 -0
  210. package/.agent/workflows/orchestrate.md +237 -0
  211. package/.agent/workflows/plan.md +89 -0
  212. package/.agent/workflows/preview.md +80 -0
  213. package/.agent/workflows/status.md +86 -0
  214. package/.agent/workflows/test.md +144 -0
  215. package/.agent/workflows/ui-ux-pro-max.md +231 -0
  216. package/LICENSE +21 -0
  217. package/README.md +101 -0
  218. package/bin/cli.js +235 -0
  219. package/index.js +1 -0
  220. package/package.json +43 -0
@@ -0,0 +1,335 @@
1
+ /**
2
+ * TypeScript Utility Types Library
3
+ *
4
+ * A collection of commonly used utility types for TypeScript projects.
5
+ * Copy and use as needed in your projects.
6
+ */
7
+
8
+ // =============================================================================
9
+ // BRANDED TYPES
10
+ // =============================================================================
11
+
12
+ /**
13
+ * Create nominal/branded types to prevent primitive obsession.
14
+ *
15
+ * @example
16
+ * type UserId = Brand<string, 'UserId'>
17
+ * type OrderId = Brand<string, 'OrderId'>
18
+ */
19
+ export type Brand<K, T> = K & { readonly __brand: T }
20
+
21
+ // Branded type constructors
22
+ export type UserId = Brand<string, 'UserId'>
23
+ export type Email = Brand<string, 'Email'>
24
+ export type UUID = Brand<string, 'UUID'>
25
+ export type Timestamp = Brand<number, 'Timestamp'>
26
+ export type PositiveNumber = Brand<number, 'PositiveNumber'>
27
+
28
+ // =============================================================================
29
+ // RESULT TYPE (Error Handling)
30
+ // =============================================================================
31
+
32
+ /**
33
+ * Type-safe error handling without exceptions.
34
+ */
35
+ export type Result<T, E = Error> =
36
+ | { success: true; data: T }
37
+ | { success: false; error: E }
38
+
39
+ export const ok = <T>(data: T): Result<T, never> => ({
40
+ success: true,
41
+ data
42
+ })
43
+
44
+ export const err = <E>(error: E): Result<never, E> => ({
45
+ success: false,
46
+ error
47
+ })
48
+
49
+ // =============================================================================
50
+ // OPTION TYPE (Nullable Handling)
51
+ // =============================================================================
52
+
53
+ /**
54
+ * Explicit optional value handling.
55
+ */
56
+ export type Option<T> = Some<T> | None
57
+
58
+ export type Some<T> = { type: 'some'; value: T }
59
+ export type None = { type: 'none' }
60
+
61
+ export const some = <T>(value: T): Some<T> => ({ type: 'some', value })
62
+ export const none: None = { type: 'none' }
63
+
64
+ // =============================================================================
65
+ // DEEP UTILITIES
66
+ // =============================================================================
67
+
68
+ /**
69
+ * Make all properties deeply readonly.
70
+ */
71
+ export type DeepReadonly<T> = T extends (...args: any[]) => any
72
+ ? T
73
+ : T extends object
74
+ ? { readonly [K in keyof T]: DeepReadonly<T[K]> }
75
+ : T
76
+
77
+ /**
78
+ * Make all properties deeply optional.
79
+ */
80
+ export type DeepPartial<T> = T extends object
81
+ ? { [K in keyof T]?: DeepPartial<T[K]> }
82
+ : T
83
+
84
+ /**
85
+ * Make all properties deeply required.
86
+ */
87
+ export type DeepRequired<T> = T extends object
88
+ ? { [K in keyof T]-?: DeepRequired<T[K]> }
89
+ : T
90
+
91
+ /**
92
+ * Make all properties deeply mutable (remove readonly).
93
+ */
94
+ export type DeepMutable<T> = T extends object
95
+ ? { -readonly [K in keyof T]: DeepMutable<T[K]> }
96
+ : T
97
+
98
+ // =============================================================================
99
+ // OBJECT UTILITIES
100
+ // =============================================================================
101
+
102
+ /**
103
+ * Get keys of object where value matches type.
104
+ */
105
+ export type KeysOfType<T, V> = {
106
+ [K in keyof T]: T[K] extends V ? K : never
107
+ }[keyof T]
108
+
109
+ /**
110
+ * Pick properties by value type.
111
+ */
112
+ export type PickByType<T, V> = Pick<T, KeysOfType<T, V>>
113
+
114
+ /**
115
+ * Omit properties by value type.
116
+ */
117
+ export type OmitByType<T, V> = Omit<T, KeysOfType<T, V>>
118
+
119
+ /**
120
+ * Make specific keys optional.
121
+ */
122
+ export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
123
+
124
+ /**
125
+ * Make specific keys required.
126
+ */
127
+ export type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>
128
+
129
+ /**
130
+ * Make specific keys readonly.
131
+ */
132
+ export type ReadonlyBy<T, K extends keyof T> = Omit<T, K> & Readonly<Pick<T, K>>
133
+
134
+ /**
135
+ * Merge two types (second overrides first).
136
+ */
137
+ export type Merge<T, U> = Omit<T, keyof U> & U
138
+
139
+ // =============================================================================
140
+ // ARRAY UTILITIES
141
+ // =============================================================================
142
+
143
+ /**
144
+ * Get element type from array.
145
+ */
146
+ export type ElementOf<T> = T extends (infer E)[] ? E : never
147
+
148
+ /**
149
+ * Tuple of specific length.
150
+ */
151
+ export type Tuple<T, N extends number> = N extends N
152
+ ? number extends N
153
+ ? T[]
154
+ : _TupleOf<T, N, []>
155
+ : never
156
+
157
+ type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N
158
+ ? R
159
+ : _TupleOf<T, N, [T, ...R]>
160
+
161
+ /**
162
+ * Non-empty array.
163
+ */
164
+ export type NonEmptyArray<T> = [T, ...T[]]
165
+
166
+ /**
167
+ * At least N elements.
168
+ */
169
+ export type AtLeast<T, N extends number> = [...Tuple<T, N>, ...T[]]
170
+
171
+ // =============================================================================
172
+ // FUNCTION UTILITIES
173
+ // =============================================================================
174
+
175
+ /**
176
+ * Get function arguments as tuple.
177
+ */
178
+ export type Arguments<T> = T extends (...args: infer A) => any ? A : never
179
+
180
+ /**
181
+ * Get first argument of function.
182
+ */
183
+ export type FirstArgument<T> = T extends (first: infer F, ...args: any[]) => any
184
+ ? F
185
+ : never
186
+
187
+ /**
188
+ * Async version of function.
189
+ */
190
+ export type AsyncFunction<T extends (...args: any[]) => any> = (
191
+ ...args: Parameters<T>
192
+ ) => Promise<Awaited<ReturnType<T>>>
193
+
194
+ /**
195
+ * Promisify return type.
196
+ */
197
+ export type Promisify<T> = T extends (...args: infer A) => infer R
198
+ ? (...args: A) => Promise<Awaited<R>>
199
+ : never
200
+
201
+ // =============================================================================
202
+ // STRING UTILITIES
203
+ // =============================================================================
204
+
205
+ /**
206
+ * Split string by delimiter.
207
+ */
208
+ export type Split<S extends string, D extends string> =
209
+ S extends `${infer T}${D}${infer U}`
210
+ ? [T, ...Split<U, D>]
211
+ : [S]
212
+
213
+ /**
214
+ * Join tuple to string.
215
+ */
216
+ export type Join<T extends string[], D extends string> =
217
+ T extends []
218
+ ? ''
219
+ : T extends [infer F extends string]
220
+ ? F
221
+ : T extends [infer F extends string, ...infer R extends string[]]
222
+ ? `${F}${D}${Join<R, D>}`
223
+ : never
224
+
225
+ /**
226
+ * Path to nested object.
227
+ */
228
+ export type PathOf<T, K extends keyof T = keyof T> = K extends string
229
+ ? T[K] extends object
230
+ ? K | `${K}.${PathOf<T[K]>}`
231
+ : K
232
+ : never
233
+
234
+ // =============================================================================
235
+ // UNION UTILITIES
236
+ // =============================================================================
237
+
238
+ /**
239
+ * Last element of union.
240
+ */
241
+ export type UnionLast<T> = UnionToIntersection<
242
+ T extends any ? () => T : never
243
+ > extends () => infer R
244
+ ? R
245
+ : never
246
+
247
+ /**
248
+ * Union to intersection.
249
+ */
250
+ export type UnionToIntersection<U> = (
251
+ U extends any ? (k: U) => void : never
252
+ ) extends (k: infer I) => void
253
+ ? I
254
+ : never
255
+
256
+ /**
257
+ * Union to tuple.
258
+ */
259
+ export type UnionToTuple<T, L = UnionLast<T>> = [T] extends [never]
260
+ ? []
261
+ : [...UnionToTuple<Exclude<T, L>>, L]
262
+
263
+ // =============================================================================
264
+ // VALIDATION UTILITIES
265
+ // =============================================================================
266
+
267
+ /**
268
+ * Assert type at compile time.
269
+ */
270
+ export type AssertEqual<T, U> =
271
+ (<V>() => V extends T ? 1 : 2) extends (<V>() => V extends U ? 1 : 2)
272
+ ? true
273
+ : false
274
+
275
+ /**
276
+ * Ensure type is not never.
277
+ */
278
+ export type IsNever<T> = [T] extends [never] ? true : false
279
+
280
+ /**
281
+ * Ensure type is any.
282
+ */
283
+ export type IsAny<T> = 0 extends 1 & T ? true : false
284
+
285
+ /**
286
+ * Ensure type is unknown.
287
+ */
288
+ export type IsUnknown<T> = IsAny<T> extends true
289
+ ? false
290
+ : unknown extends T
291
+ ? true
292
+ : false
293
+
294
+ // =============================================================================
295
+ // JSON UTILITIES
296
+ // =============================================================================
297
+
298
+ /**
299
+ * JSON-safe types.
300
+ */
301
+ export type JsonPrimitive = string | number | boolean | null
302
+ export type JsonArray = JsonValue[]
303
+ export type JsonObject = { [key: string]: JsonValue }
304
+ export type JsonValue = JsonPrimitive | JsonArray | JsonObject
305
+
306
+ /**
307
+ * Make type JSON-serializable.
308
+ */
309
+ export type Jsonify<T> = T extends JsonPrimitive
310
+ ? T
311
+ : T extends undefined | ((...args: any[]) => any) | symbol
312
+ ? never
313
+ : T extends { toJSON(): infer R }
314
+ ? R
315
+ : T extends object
316
+ ? { [K in keyof T]: Jsonify<T[K]> }
317
+ : never
318
+
319
+ // =============================================================================
320
+ // EXHAUSTIVE CHECK
321
+ // =============================================================================
322
+
323
+ /**
324
+ * Ensure all cases are handled in switch/if.
325
+ */
326
+ export function assertNever(value: never, message?: string): never {
327
+ throw new Error(message ?? `Unexpected value: ${value}`)
328
+ }
329
+
330
+ /**
331
+ * Exhaustive check without throwing.
332
+ */
333
+ export function exhaustiveCheck(_value: never): void {
334
+ // This function should never be called
335
+ }
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ TypeScript Project Diagnostic Script
4
+ Analyzes TypeScript projects for configuration, performance, and common issues.
5
+ """
6
+
7
+ import subprocess
8
+ import sys
9
+ import os
10
+ import json
11
+ from pathlib import Path
12
+
13
+ def run_cmd(cmd: str) -> str:
14
+ """Run shell command and return output."""
15
+ try:
16
+ result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
17
+ return result.stdout + result.stderr
18
+ except Exception as e:
19
+ return str(e)
20
+
21
+ def check_versions():
22
+ """Check TypeScript and Node versions."""
23
+ print("\n📦 Versions:")
24
+ print("-" * 40)
25
+
26
+ ts_version = run_cmd("npx tsc --version 2>/dev/null").strip()
27
+ node_version = run_cmd("node -v 2>/dev/null").strip()
28
+
29
+ print(f" TypeScript: {ts_version or 'Not found'}")
30
+ print(f" Node.js: {node_version or 'Not found'}")
31
+
32
+ def check_tsconfig():
33
+ """Analyze tsconfig.json settings."""
34
+ print("\n⚙️ TSConfig Analysis:")
35
+ print("-" * 40)
36
+
37
+ tsconfig_path = Path("tsconfig.json")
38
+ if not tsconfig_path.exists():
39
+ print("⚠️ tsconfig.json not found")
40
+ return
41
+
42
+ try:
43
+ with open(tsconfig_path) as f:
44
+ config = json.load(f)
45
+
46
+ compiler_opts = config.get("compilerOptions", {})
47
+
48
+ # Check strict mode
49
+ if compiler_opts.get("strict"):
50
+ print("✅ Strict mode enabled")
51
+ else:
52
+ print("⚠️ Strict mode NOT enabled")
53
+
54
+ # Check important flags
55
+ flags = {
56
+ "noUncheckedIndexedAccess": "Unchecked index access protection",
57
+ "noImplicitOverride": "Implicit override protection",
58
+ "skipLibCheck": "Skip lib check (performance)",
59
+ "incremental": "Incremental compilation"
60
+ }
61
+
62
+ for flag, desc in flags.items():
63
+ status = "✅" if compiler_opts.get(flag) else "⚪"
64
+ print(f" {status} {desc}: {compiler_opts.get(flag, 'not set')}")
65
+
66
+ # Check module settings
67
+ print(f"\n Module: {compiler_opts.get('module', 'not set')}")
68
+ print(f" Module Resolution: {compiler_opts.get('moduleResolution', 'not set')}")
69
+ print(f" Target: {compiler_opts.get('target', 'not set')}")
70
+
71
+ except json.JSONDecodeError:
72
+ print("❌ Invalid JSON in tsconfig.json")
73
+
74
+ def check_tooling():
75
+ """Detect TypeScript tooling ecosystem."""
76
+ print("\n🛠️ Tooling Detection:")
77
+ print("-" * 40)
78
+
79
+ pkg_path = Path("package.json")
80
+ if not pkg_path.exists():
81
+ print("⚠️ package.json not found")
82
+ return
83
+
84
+ try:
85
+ with open(pkg_path) as f:
86
+ pkg = json.load(f)
87
+
88
+ all_deps = {**pkg.get("dependencies", {}), **pkg.get("devDependencies", {})}
89
+
90
+ tools = {
91
+ "biome": "Biome (linter/formatter)",
92
+ "eslint": "ESLint",
93
+ "prettier": "Prettier",
94
+ "vitest": "Vitest (testing)",
95
+ "jest": "Jest (testing)",
96
+ "turborepo": "Turborepo (monorepo)",
97
+ "turbo": "Turbo (monorepo)",
98
+ "nx": "Nx (monorepo)",
99
+ "lerna": "Lerna (monorepo)"
100
+ }
101
+
102
+ for tool, desc in tools.items():
103
+ for dep in all_deps:
104
+ if tool in dep.lower():
105
+ print(f" ✅ {desc}")
106
+ break
107
+
108
+ except json.JSONDecodeError:
109
+ print("❌ Invalid JSON in package.json")
110
+
111
+ def check_monorepo():
112
+ """Check for monorepo configuration."""
113
+ print("\n📦 Monorepo Check:")
114
+ print("-" * 40)
115
+
116
+ indicators = [
117
+ ("pnpm-workspace.yaml", "PNPM Workspace"),
118
+ ("lerna.json", "Lerna"),
119
+ ("nx.json", "Nx"),
120
+ ("turbo.json", "Turborepo")
121
+ ]
122
+
123
+ found = False
124
+ for file, name in indicators:
125
+ if Path(file).exists():
126
+ print(f" ✅ {name} detected")
127
+ found = True
128
+
129
+ if not found:
130
+ print(" ⚪ No monorepo configuration detected")
131
+
132
+ def check_type_errors():
133
+ """Run quick type check."""
134
+ print("\n🔍 Type Check:")
135
+ print("-" * 40)
136
+
137
+ result = run_cmd("npx tsc --noEmit 2>&1 | head -20")
138
+ if "error TS" in result:
139
+ errors = result.count("error TS")
140
+ print(f" ❌ {errors}+ type errors found")
141
+ print(result[:500])
142
+ else:
143
+ print(" ✅ No type errors")
144
+
145
+ def check_any_usage():
146
+ """Check for any type usage."""
147
+ print("\n⚠️ 'any' Type Usage:")
148
+ print("-" * 40)
149
+
150
+ result = run_cmd("grep -r ': any' --include='*.ts' --include='*.tsx' src/ 2>/dev/null | wc -l")
151
+ count = result.strip()
152
+ if count and count != "0":
153
+ print(f" ⚠️ Found {count} occurrences of ': any'")
154
+ sample = run_cmd("grep -rn ': any' --include='*.ts' --include='*.tsx' src/ 2>/dev/null | head -5")
155
+ if sample:
156
+ print(sample)
157
+ else:
158
+ print(" ✅ No explicit 'any' types found")
159
+
160
+ def check_type_assertions():
161
+ """Check for type assertions."""
162
+ print("\n⚠️ Type Assertions (as):")
163
+ print("-" * 40)
164
+
165
+ result = run_cmd("grep -r ' as ' --include='*.ts' --include='*.tsx' src/ 2>/dev/null | grep -v 'import' | wc -l")
166
+ count = result.strip()
167
+ if count and count != "0":
168
+ print(f" ⚠️ Found {count} type assertions")
169
+ else:
170
+ print(" ✅ No type assertions found")
171
+
172
+ def check_performance():
173
+ """Check type checking performance."""
174
+ print("\n⏱️ Type Check Performance:")
175
+ print("-" * 40)
176
+
177
+ result = run_cmd("npx tsc --extendedDiagnostics --noEmit 2>&1 | grep -E 'Check time|Files:|Lines:|Nodes:'")
178
+ if result.strip():
179
+ for line in result.strip().split('\n'):
180
+ print(f" {line}")
181
+ else:
182
+ print(" ⚠️ Could not measure performance")
183
+
184
+ def main():
185
+ print("=" * 50)
186
+ print("🔍 TypeScript Project Diagnostic Report")
187
+ print("=" * 50)
188
+
189
+ check_versions()
190
+ check_tsconfig()
191
+ check_tooling()
192
+ check_monorepo()
193
+ check_any_usage()
194
+ check_type_assertions()
195
+ check_type_errors()
196
+ check_performance()
197
+
198
+ print("\n" + "=" * 50)
199
+ print("✅ Diagnostic Complete")
200
+ print("=" * 50)
201
+
202
+ if __name__ == "__main__":
203
+ main()