@geenius/tools 0.1.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 (160) hide show
  1. package/.changeset/config.json +11 -0
  2. package/.env.example +2 -0
  3. package/.github/CODEOWNERS +1 -0
  4. package/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +11 -0
  6. package/.github/PULL_REQUEST_TEMPLATE.md +10 -0
  7. package/.github/dependabot.yml +11 -0
  8. package/.github/workflows/ci.yml +23 -0
  9. package/.github/workflows/release.yml +29 -0
  10. package/.node-version +1 -0
  11. package/.nvmrc +1 -0
  12. package/.prettierrc +7 -0
  13. package/.project/ACCOUNT.yaml +4 -0
  14. package/.project/IDEAS.yaml +7 -0
  15. package/.project/PROJECT.yaml +11 -0
  16. package/.project/ROADMAP.yaml +15 -0
  17. package/CHANGELOG.md +16 -0
  18. package/CODE_OF_CONDUCT.md +26 -0
  19. package/CONTRIBUTING.md +69 -0
  20. package/LICENSE +21 -0
  21. package/README.md +1 -0
  22. package/SECURITY.md +18 -0
  23. package/SUPPORT.md +14 -0
  24. package/package.json +75 -0
  25. package/packages/convex/shared/README.md +1 -0
  26. package/packages/convex/shared/package.json +42 -0
  27. package/packages/convex/shared/src/audit/index.ts +5 -0
  28. package/packages/convex/shared/src/audit/presets.ts +165 -0
  29. package/packages/convex/shared/src/audit/schema.ts +85 -0
  30. package/packages/convex/shared/src/audit/write.ts +102 -0
  31. package/packages/convex/shared/src/extract.ts +75 -0
  32. package/packages/convex/shared/src/index.ts +41 -0
  33. package/packages/convex/shared/src/messages.ts +45 -0
  34. package/packages/convex/shared/src/security.ts +112 -0
  35. package/packages/convex/shared/src/throw.ts +184 -0
  36. package/packages/convex/shared/src/types.ts +57 -0
  37. package/packages/convex/shared/src/utils.ts +58 -0
  38. package/packages/convex/shared/tsconfig.json +28 -0
  39. package/packages/convex/shared/tsup.config.ts +12 -0
  40. package/packages/devtools/package.json +27 -0
  41. package/packages/devtools/react/README.md +1 -0
  42. package/packages/devtools/react/package.json +53 -0
  43. package/packages/devtools/react/src/components/DesignPreview.tsx +59 -0
  44. package/packages/devtools/react/src/components/DesignSwitcherDropdown.tsx +99 -0
  45. package/packages/devtools/react/src/components/DevSidebar.tsx +247 -0
  46. package/packages/devtools/react/src/components/DevToolbar.tsx +242 -0
  47. package/packages/devtools/react/src/components/GitHubIssueDialog.tsx +402 -0
  48. package/packages/devtools/react/src/components/InspectorOverlay.tsx +312 -0
  49. package/packages/devtools/react/src/components/PageLoadWaterfall.tsx +144 -0
  50. package/packages/devtools/react/src/components/PerformancePanel.tsx +330 -0
  51. package/packages/devtools/react/src/context/DevModeContext.tsx +226 -0
  52. package/packages/devtools/react/src/context/PerformanceContext.tsx +143 -0
  53. package/packages/devtools/react/src/data/designs.ts +13 -0
  54. package/packages/devtools/react/src/hooks/useGitHubLabels.ts +47 -0
  55. package/packages/devtools/react/src/hooks/useVirtualList.ts +124 -0
  56. package/packages/devtools/react/src/index.ts +77 -0
  57. package/packages/devtools/react/src/panels/ConvexSpy.tsx +130 -0
  58. package/packages/devtools/react/src/panels/DatabaseSeeder.tsx +116 -0
  59. package/packages/devtools/react/src/panels/DevModePhase2.tsx +191 -0
  60. package/packages/devtools/react/src/panels/DevModePhase3.tsx +234 -0
  61. package/packages/devtools/react/src/panels/FeatureFlagsToggle.tsx +104 -0
  62. package/packages/devtools/react/src/panels/QuickRouteJump.tsx +152 -0
  63. package/packages/devtools/react/src/services/github-service.ts +247 -0
  64. package/packages/devtools/react/tsconfig.json +31 -0
  65. package/packages/devtools/react/tsup.config.ts +18 -0
  66. package/packages/devtools/solidjs/README.md +1 -0
  67. package/packages/devtools/solidjs/package.json +49 -0
  68. package/packages/devtools/solidjs/src/components/DesignPreview.tsx +51 -0
  69. package/packages/devtools/solidjs/src/components/DesignSwitcherDropdown.tsx +95 -0
  70. package/packages/devtools/solidjs/src/components/DevSidebar.tsx +247 -0
  71. package/packages/devtools/solidjs/src/components/DevToolbar.tsx +242 -0
  72. package/packages/devtools/solidjs/src/components/GitHubIssueDialog.tsx +400 -0
  73. package/packages/devtools/solidjs/src/components/InspectorOverlay.tsx +311 -0
  74. package/packages/devtools/solidjs/src/components/PageLoadWaterfall.tsx +144 -0
  75. package/packages/devtools/solidjs/src/components/PerformancePanel.tsx +330 -0
  76. package/packages/devtools/solidjs/src/context/DevModeContext.tsx +216 -0
  77. package/packages/devtools/solidjs/src/context/PerformanceContext.tsx +135 -0
  78. package/packages/devtools/solidjs/src/data/designs.ts +13 -0
  79. package/packages/devtools/solidjs/src/hooks/createGitHubLabels.ts +47 -0
  80. package/packages/devtools/solidjs/src/index.ts +64 -0
  81. package/packages/devtools/solidjs/src/services/github-service.ts +247 -0
  82. package/packages/devtools/solidjs/tsconfig.json +21 -0
  83. package/packages/devtools/src/index.ts +377 -0
  84. package/packages/devtools/tsup.config.ts +12 -0
  85. package/packages/env/package.json +30 -0
  86. package/packages/env/src/index.ts +264 -0
  87. package/packages/env/tsup.config.ts +12 -0
  88. package/packages/errors/package.json +27 -0
  89. package/packages/errors/react/README.md +1 -0
  90. package/packages/errors/react/package.json +72 -0
  91. package/packages/errors/react/src/analytics.ts +16 -0
  92. package/packages/errors/react/src/components/ErrorBoundary.tsx +248 -0
  93. package/packages/errors/react/src/components/ErrorDisplay.tsx +328 -0
  94. package/packages/errors/react/src/components/ValidationErrors.tsx +102 -0
  95. package/packages/errors/react/src/config.ts +199 -0
  96. package/packages/errors/react/src/constants.ts +74 -0
  97. package/packages/errors/react/src/hooks/useErrorBoundary.ts +92 -0
  98. package/packages/errors/react/src/hooks/useErrorHandler.ts +87 -0
  99. package/packages/errors/react/src/index.ts +96 -0
  100. package/packages/errors/react/src/types.ts +102 -0
  101. package/packages/errors/react/src/utils/errorMessages.ts +35 -0
  102. package/packages/errors/react/src/utils/errorPolicy.ts +139 -0
  103. package/packages/errors/react/src/utils/extractAppError.ts +174 -0
  104. package/packages/errors/react/src/utils/formatError.ts +112 -0
  105. package/packages/errors/react/tsconfig.json +25 -0
  106. package/packages/errors/react/tsup.config.ts +24 -0
  107. package/packages/errors/solidjs/README.md +1 -0
  108. package/packages/errors/solidjs/package.json +46 -0
  109. package/packages/errors/solidjs/src/components/ErrorDisplay.tsx +179 -0
  110. package/packages/errors/solidjs/src/config.ts +98 -0
  111. package/packages/errors/solidjs/src/hooks/createErrorHandler.ts +107 -0
  112. package/packages/errors/solidjs/src/index.ts +61 -0
  113. package/packages/errors/solidjs/src/types.ts +34 -0
  114. package/packages/errors/solidjs/src/utils/errorPolicy.ts +56 -0
  115. package/packages/errors/solidjs/src/utils/extractAppError.ts +94 -0
  116. package/packages/errors/solidjs/src/utils/formatError.ts +33 -0
  117. package/packages/errors/solidjs/tsconfig.json +26 -0
  118. package/packages/errors/solidjs/tsup.config.ts +21 -0
  119. package/packages/errors/src/index.ts +320 -0
  120. package/packages/errors/tsup.config.ts +12 -0
  121. package/packages/logger/package.json +27 -0
  122. package/packages/logger/react/README.md +1 -0
  123. package/packages/logger/react/package.json +46 -0
  124. package/packages/logger/react/src/index.ts +4 -0
  125. package/packages/logger/react/src/useMetrics.ts +42 -0
  126. package/packages/logger/react/src/usePerformanceLog.ts +61 -0
  127. package/packages/logger/react/tsconfig.json +31 -0
  128. package/packages/logger/react/tsup.config.ts +12 -0
  129. package/packages/logger/solidjs/README.md +1 -0
  130. package/packages/logger/solidjs/package.json +45 -0
  131. package/packages/logger/solidjs/src/createMetrics.ts +37 -0
  132. package/packages/logger/solidjs/src/createPerformanceLog.ts +58 -0
  133. package/packages/logger/solidjs/src/index.ts +4 -0
  134. package/packages/logger/solidjs/tsconfig.json +32 -0
  135. package/packages/logger/solidjs/tsup.config.ts +12 -0
  136. package/packages/logger/src/index.ts +363 -0
  137. package/packages/logger/tsup.config.ts +12 -0
  138. package/packages/perf/package.json +27 -0
  139. package/packages/perf/react/README.md +1 -0
  140. package/packages/perf/react/package.json +59 -0
  141. package/packages/perf/react/src/components/PerformanceDashboard.tsx +257 -0
  142. package/packages/perf/react/src/hooks/useMonitoredQuery.ts +89 -0
  143. package/packages/perf/react/src/hooks/usePerformanceMetrics.ts +78 -0
  144. package/packages/perf/react/src/index.ts +33 -0
  145. package/packages/perf/react/src/services/PerformanceMonitor.ts +313 -0
  146. package/packages/perf/react/src/types.ts +77 -0
  147. package/packages/perf/react/tsconfig.json +25 -0
  148. package/packages/perf/react/tsup.config.ts +19 -0
  149. package/packages/perf/solidjs/README.md +1 -0
  150. package/packages/perf/solidjs/package.json +41 -0
  151. package/packages/perf/solidjs/src/components/PerformanceDashboard.tsx +207 -0
  152. package/packages/perf/solidjs/src/hooks/createPerformanceMetrics.ts +73 -0
  153. package/packages/perf/solidjs/src/index.ts +31 -0
  154. package/packages/perf/solidjs/src/services/PerformanceMonitor.ts +134 -0
  155. package/packages/perf/solidjs/src/types.ts +78 -0
  156. package/packages/perf/solidjs/tsconfig.json +26 -0
  157. package/packages/perf/solidjs/tsup.config.ts +14 -0
  158. package/packages/perf/src/index.ts +410 -0
  159. package/packages/perf/tsup.config.ts +12 -0
  160. package/pnpm-workspace.yaml +2 -0
@@ -0,0 +1,47 @@
1
+ // @geenius-tools/devtools-solidjs — src/hooks/createGitHubLabels.ts
2
+
3
+ import { createSignal, createEffect } from 'solid-js'
4
+ import {
5
+ getRepositoryLabels,
6
+ isGitHubConfigured,
7
+ type GitHubLabel,
8
+ } from '../services/github-service'
9
+
10
+ /**
11
+ * Hook to fetch GitHub repository labels.
12
+ * Fetches once on mount if GitHub is configured.
13
+ * No external dependencies (no react-query).
14
+ */
15
+ export function createGitHubLabels() {
16
+ const [data, setData] = createSignal<GitHubLabel[] | undefined>(undefined)
17
+ const [isLoading, setIsLoading] = createSignal(false)
18
+ const [error, setError] = createSignal<Error | null>(null)
19
+ const isConfigured = isGitHubConfigured()
20
+
21
+ createEffect(() => {
22
+ if (!isConfigured) return
23
+
24
+ let cancelled = false
25
+ setIsLoading(true)
26
+
27
+ getRepositoryLabels()
28
+ .then((labels) => {
29
+ if (!cancelled) {
30
+ setData(labels)
31
+ setIsLoading(false)
32
+ }
33
+ })
34
+ .catch((err) => {
35
+ if (!cancelled) {
36
+ setError(err)
37
+ setIsLoading(false)
38
+ }
39
+ })
40
+
41
+ return () => {
42
+ cancelled = true
43
+ }
44
+ })
45
+
46
+ return { data, isLoading, error, isConfigured }
47
+ }
@@ -0,0 +1,64 @@
1
+ // @geenius-tools/devtools-solidjs — src/index.ts
2
+
3
+ // Components
4
+ export { DevToolbar } from './components/DevToolbar'
5
+ export type { DevToolbarProps } from './components/DevToolbar'
6
+ export { DevSidebar } from './components/DevSidebar'
7
+ export { PerformancePanel } from './components/PerformancePanel'
8
+ export { InspectorOverlay } from './components/InspectorOverlay'
9
+ export { GitHubIssueDialog } from './components/GitHubIssueDialog'
10
+ export type { GitHubIssueDialogProps } from './components/GitHubIssueDialog'
11
+ export { DesignPreview } from './components/DesignPreview'
12
+ export type { DesignPreviewProps } from './components/DesignPreview'
13
+ export { DesignSwitcherDropdown } from './components/DesignSwitcherDropdown'
14
+ export type { DesignSwitcherDropdownProps } from './components/DesignSwitcherDropdown'
15
+ export { PageLoadWaterfall, logWaterfall } from './components/PageLoadWaterfall'
16
+ export type { SsrTiming } from './components/PageLoadWaterfall'
17
+
18
+ // Data
19
+ export { designs } from './data/designs'
20
+ export type { Design } from './data/designs'
21
+
22
+ // Context
23
+ export {
24
+ DevModeProvider,
25
+ createDevMode,
26
+ createDevModeOptional,
27
+ createIsDevToolsVisible,
28
+ createIsDevAllowed,
29
+ } from './context/DevModeContext'
30
+ export type {
31
+ DevModeProviderProps,
32
+ DevModeContextValue,
33
+ ComponentDetails,
34
+ } from './context/DevModeContext'
35
+
36
+ export {
37
+ PerformanceProvider,
38
+ createPerformanceContext,
39
+ createPerformanceContextOptional,
40
+ } from './context/PerformanceContext'
41
+
42
+ // Services
43
+ export {
44
+ configureGitHub,
45
+ isGitHubConfigured,
46
+ getGitHubConfig,
47
+ createGitHubIssue,
48
+ getRepositoryLabels,
49
+ getGitHubIssues,
50
+ generateContextInfo,
51
+ getIssueType,
52
+ formatRelativeTime,
53
+ } from './services/github-service'
54
+ export type {
55
+ GitHubConfig,
56
+ GitHubIssue,
57
+ GitHubLabel,
58
+ GitHubIssueListItem,
59
+ CreateIssueResponse,
60
+ IssueFilter,
61
+ } from './services/github-service'
62
+
63
+ // Hooks
64
+ export { createGitHubLabels } from './hooks/createGitHubLabels'
@@ -0,0 +1,247 @@
1
+ // @geenius-tools/devtools-react — src/services/github-service.ts
2
+ // GitHub API service for creating issues — adapted from geenius-react
3
+
4
+ export interface GitHubIssue {
5
+ title: string
6
+ body: string
7
+ labels?: string[]
8
+ }
9
+
10
+ export interface GitHubLabel {
11
+ id: number
12
+ name: string
13
+ color: string
14
+ description: string | null
15
+ }
16
+
17
+ export interface CreateIssueResponse {
18
+ id: number
19
+ number: number
20
+ html_url: string
21
+ title: string
22
+ }
23
+
24
+ export interface GitHubIssueListItem {
25
+ id: number
26
+ number: number
27
+ title: string
28
+ body: string | null
29
+ html_url: string
30
+ state: 'open' | 'closed'
31
+ created_at: string
32
+ updated_at: string
33
+ labels: GitHubLabel[]
34
+ user: {
35
+ login: string
36
+ avatar_url: string
37
+ } | null
38
+ }
39
+
40
+ export type IssueFilter = 'all' | 'bug' | 'enhancement'
41
+
42
+ /**
43
+ * GitHub configuration. Provide via `configureGitHub()` or env vars.
44
+ */
45
+ export interface GitHubConfig {
46
+ owner: string
47
+ repo: string
48
+ branch?: string
49
+ token: string
50
+ }
51
+
52
+ let _config: GitHubConfig | null = null
53
+
54
+ /**
55
+ * Configure GitHub integration.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * configureGitHub({
60
+ * owner: 'my-org',
61
+ * repo: 'my-app',
62
+ * token: import.meta.env.VITE_GITHUB_TOKEN,
63
+ * })
64
+ * ```
65
+ */
66
+ export function configureGitHub(config: GitHubConfig): void {
67
+ _config = config
68
+ }
69
+
70
+ export function getGitHubConfig(): GitHubConfig {
71
+ if (_config) return _config
72
+
73
+ // Fallback: try env vars (Vite convention)
74
+ let owner = ''
75
+ let repo = ''
76
+ let branch = 'main'
77
+ let token = ''
78
+ try {
79
+ // @ts-expect-error — Vite env
80
+ owner = import.meta?.env?.VITE_GITHUB_OWNER ?? ''
81
+ // @ts-expect-error — Vite env
82
+ repo = import.meta?.env?.VITE_GITHUB_REPO ?? ''
83
+ // @ts-expect-error — Vite env
84
+ branch = import.meta?.env?.VITE_GITHUB_BRANCH ?? 'main'
85
+ // @ts-expect-error — Vite env
86
+ token = import.meta?.env?.VITE_GITHUB_TOKEN ?? ''
87
+ } catch {
88
+ // Not in Vite
89
+ }
90
+
91
+ return { owner, repo, branch, token }
92
+ }
93
+
94
+ export function isGitHubConfigured(): boolean {
95
+ const { owner, repo, token } = getGitHubConfig()
96
+ const isPlaceholder =
97
+ !token || token === 'ghp_your_personal_access_token_here'
98
+ return Boolean(owner && repo && token && !isPlaceholder)
99
+ }
100
+
101
+ export async function createGitHubIssue(
102
+ issue: GitHubIssue,
103
+ ): Promise<CreateIssueResponse> {
104
+ const { owner, repo, token } = getGitHubConfig()
105
+
106
+ if (!owner || !repo || !token) {
107
+ throw new Error(
108
+ 'GitHub configuration is incomplete. Call configureGitHub() or set VITE_GITHUB_* env vars.',
109
+ )
110
+ }
111
+
112
+ const response = await fetch(
113
+ `https://api.github.com/repos/${owner}/${repo}/issues`,
114
+ {
115
+ method: 'POST',
116
+ headers: {
117
+ Accept: 'application/vnd.github+json',
118
+ Authorization: `Bearer ${token}`,
119
+ 'X-GitHub-Api-Version': '2022-11-28',
120
+ 'Content-Type': 'application/json',
121
+ },
122
+ body: JSON.stringify({
123
+ title: issue.title,
124
+ body: issue.body,
125
+ labels: issue.labels || [],
126
+ }),
127
+ },
128
+ )
129
+
130
+ if (!response.ok) {
131
+ const error = await response
132
+ .json()
133
+ .catch(() => ({ message: 'Unknown error' }))
134
+ throw new Error(
135
+ `Failed to create issue: ${error.message || response.statusText}`,
136
+ )
137
+ }
138
+
139
+ return response.json()
140
+ }
141
+
142
+ export async function getRepositoryLabels(): Promise<GitHubLabel[]> {
143
+ const { owner, repo, token } = getGitHubConfig()
144
+
145
+ if (!owner || !repo || !token) return []
146
+
147
+ try {
148
+ const response = await fetch(
149
+ `https://api.github.com/repos/${owner}/${repo}/labels`,
150
+ {
151
+ headers: {
152
+ Accept: 'application/vnd.github+json',
153
+ Authorization: `Bearer ${token}`,
154
+ 'X-GitHub-Api-Version': '2022-11-28',
155
+ },
156
+ },
157
+ )
158
+
159
+ if (!response.ok) return []
160
+ return response.json()
161
+ } catch {
162
+ return []
163
+ }
164
+ }
165
+
166
+ export async function getGitHubIssues(
167
+ filter: IssueFilter = 'all',
168
+ state: 'open' | 'closed' | 'all' = 'open',
169
+ ): Promise<GitHubIssueListItem[]> {
170
+ const { owner, repo, token } = getGitHubConfig()
171
+
172
+ if (!owner || !repo || !token) return []
173
+
174
+ try {
175
+ const params = new URLSearchParams({
176
+ state,
177
+ per_page: '50',
178
+ sort: 'updated',
179
+ direction: 'desc',
180
+ })
181
+
182
+ if (filter !== 'all') {
183
+ params.set('labels', filter)
184
+ }
185
+
186
+ const response = await fetch(
187
+ `https://api.github.com/repos/${owner}/${repo}/issues?${params.toString()}`,
188
+ {
189
+ headers: {
190
+ Accept: 'application/vnd.github+json',
191
+ Authorization: `Bearer ${token}`,
192
+ 'X-GitHub-Api-Version': '2022-11-28',
193
+ },
194
+ },
195
+ )
196
+
197
+ if (!response.ok) return []
198
+
199
+ const issues: GitHubIssueListItem[] = await response.json()
200
+ return issues.filter((issue) => !('pull_request' in issue))
201
+ } catch {
202
+ return []
203
+ }
204
+ }
205
+
206
+ export function generateContextInfo(): string {
207
+ const lines: string[] = [
208
+ '---',
209
+ '### Context',
210
+ '',
211
+ `**Page URL:** ${window.location.href}`,
212
+ `**Timestamp:** ${new Date().toISOString()}`,
213
+ `**User Agent:** ${navigator.userAgent}`,
214
+ `**Branch:** ${getGitHubConfig().branch ?? 'main'}`,
215
+ ]
216
+
217
+ if (typeof window !== 'undefined') {
218
+ lines.push(`**Screen:** ${window.innerWidth}x${window.innerHeight}`)
219
+ }
220
+
221
+ return lines.join('\n')
222
+ }
223
+
224
+ export function getIssueType(
225
+ issue: GitHubIssueListItem,
226
+ ): 'bug' | 'feature' | 'other' {
227
+ const labelNames = issue.labels.map((l) => l.name.toLowerCase())
228
+ if (labelNames.includes('bug')) return 'bug'
229
+ if (labelNames.includes('enhancement') || labelNames.includes('feature'))
230
+ return 'feature'
231
+ return 'other'
232
+ }
233
+
234
+ export function formatRelativeTime(dateString: string): string {
235
+ const date = new Date(dateString)
236
+ const now = new Date()
237
+ const diffMs = now.getTime() - date.getTime()
238
+ const diffMins = Math.floor(diffMs / 60000)
239
+ const diffHours = Math.floor(diffMs / 3600000)
240
+ const diffDays = Math.floor(diffMs / 86400000)
241
+
242
+ if (diffMins < 1) return 'just now'
243
+ if (diffMins < 60) return `${diffMins}m ago`
244
+ if (diffHours < 24) return `${diffHours}h ago`
245
+ if (diffDays < 7) return `${diffDays}d ago`
246
+ return date.toLocaleDateString()
247
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "jsx": "preserve",
7
+ "jsxImportSource": "solid-js",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "declaration": true,
11
+ "outDir": "./dist",
12
+ "rootDir": "./src",
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "isolatedModules": true
17
+ },
18
+ "include": [
19
+ "src/**/*"
20
+ ]
21
+ }