@geenius/tools 0.1.0 → 0.3.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.
- package/package.json +62 -3
- package/packages/convex/shared/README.md +1 -1
- package/packages/devtools/dist/index.d.ts +204 -0
- package/packages/devtools/dist/index.js +186 -0
- package/packages/devtools/dist/index.js.map +1 -0
- package/packages/devtools/react/README.md +1 -1
- package/packages/devtools/solidjs/README.md +1 -1
- package/packages/devtools/solidjs/dist/index.js +1830 -0
- package/packages/devtools/solidjs/dist/index.js.map +1 -0
- package/packages/env/dist/index.d.ts +151 -0
- package/packages/env/dist/index.js +93 -0
- package/packages/env/dist/index.js.map +1 -0
- package/packages/errors/dist/index.d.ts +177 -0
- package/packages/errors/dist/index.js +187 -0
- package/packages/errors/dist/index.js.map +1 -0
- package/packages/errors/react/README.md +1 -1
- package/packages/errors/solidjs/README.md +1 -1
- package/packages/logger/dist/index.d.ts +171 -0
- package/packages/logger/dist/index.js +216 -0
- package/packages/logger/dist/index.js.map +1 -0
- package/packages/logger/react/README.md +1 -1
- package/packages/logger/solidjs/README.md +1 -1
- package/packages/perf/dist/index.d.ts +168 -0
- package/packages/perf/dist/index.js +265 -0
- package/packages/perf/dist/index.js.map +1 -0
- package/packages/perf/react/README.md +1 -1
- package/packages/perf/solidjs/README.md +1 -1
- package/packages/shared/dist/index.d.ts +253 -0
- package/packages/shared/dist/index.js +278 -0
- package/packages/shared/dist/index.js.map +1 -0
- package/.changeset/config.json +0 -11
- package/.env.example +0 -2
- package/.github/CODEOWNERS +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -16
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -11
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -10
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/ci.yml +0 -23
- package/.github/workflows/release.yml +0 -29
- package/.node-version +0 -1
- package/.nvmrc +0 -1
- package/.prettierrc +0 -7
- package/.project/ACCOUNT.yaml +0 -4
- package/.project/IDEAS.yaml +0 -7
- package/.project/PROJECT.yaml +0 -11
- package/.project/ROADMAP.yaml +0 -15
- package/CODE_OF_CONDUCT.md +0 -26
- package/CONTRIBUTING.md +0 -69
- package/SECURITY.md +0 -18
- package/SUPPORT.md +0 -14
- package/packages/convex/shared/package.json +0 -42
- package/packages/convex/shared/src/audit/index.ts +0 -5
- package/packages/convex/shared/src/audit/presets.ts +0 -165
- package/packages/convex/shared/src/audit/schema.ts +0 -85
- package/packages/convex/shared/src/audit/write.ts +0 -102
- package/packages/convex/shared/src/extract.ts +0 -75
- package/packages/convex/shared/src/index.ts +0 -41
- package/packages/convex/shared/src/messages.ts +0 -45
- package/packages/convex/shared/src/security.ts +0 -112
- package/packages/convex/shared/src/throw.ts +0 -184
- package/packages/convex/shared/src/types.ts +0 -57
- package/packages/convex/shared/src/utils.ts +0 -58
- package/packages/convex/shared/tsconfig.json +0 -28
- package/packages/convex/shared/tsup.config.ts +0 -12
- package/packages/devtools/package.json +0 -27
- package/packages/devtools/react/package.json +0 -53
- package/packages/devtools/react/src/components/DesignPreview.tsx +0 -59
- package/packages/devtools/react/src/components/DesignSwitcherDropdown.tsx +0 -99
- package/packages/devtools/react/src/components/DevSidebar.tsx +0 -247
- package/packages/devtools/react/src/components/DevToolbar.tsx +0 -242
- package/packages/devtools/react/src/components/GitHubIssueDialog.tsx +0 -402
- package/packages/devtools/react/src/components/InspectorOverlay.tsx +0 -312
- package/packages/devtools/react/src/components/PageLoadWaterfall.tsx +0 -144
- package/packages/devtools/react/src/components/PerformancePanel.tsx +0 -330
- package/packages/devtools/react/src/context/DevModeContext.tsx +0 -226
- package/packages/devtools/react/src/context/PerformanceContext.tsx +0 -143
- package/packages/devtools/react/src/data/designs.ts +0 -13
- package/packages/devtools/react/src/hooks/useGitHubLabels.ts +0 -47
- package/packages/devtools/react/src/hooks/useVirtualList.ts +0 -124
- package/packages/devtools/react/src/index.ts +0 -77
- package/packages/devtools/react/src/panels/ConvexSpy.tsx +0 -130
- package/packages/devtools/react/src/panels/DatabaseSeeder.tsx +0 -116
- package/packages/devtools/react/src/panels/DevModePhase2.tsx +0 -191
- package/packages/devtools/react/src/panels/DevModePhase3.tsx +0 -234
- package/packages/devtools/react/src/panels/FeatureFlagsToggle.tsx +0 -104
- package/packages/devtools/react/src/panels/QuickRouteJump.tsx +0 -152
- package/packages/devtools/react/src/services/github-service.ts +0 -247
- package/packages/devtools/react/tsconfig.json +0 -31
- package/packages/devtools/react/tsup.config.ts +0 -18
- package/packages/devtools/solidjs/package.json +0 -49
- package/packages/devtools/solidjs/src/components/DesignPreview.tsx +0 -51
- package/packages/devtools/solidjs/src/components/DesignSwitcherDropdown.tsx +0 -95
- package/packages/devtools/solidjs/src/components/DevSidebar.tsx +0 -247
- package/packages/devtools/solidjs/src/components/DevToolbar.tsx +0 -242
- package/packages/devtools/solidjs/src/components/GitHubIssueDialog.tsx +0 -400
- package/packages/devtools/solidjs/src/components/InspectorOverlay.tsx +0 -311
- package/packages/devtools/solidjs/src/components/PageLoadWaterfall.tsx +0 -144
- package/packages/devtools/solidjs/src/components/PerformancePanel.tsx +0 -330
- package/packages/devtools/solidjs/src/context/DevModeContext.tsx +0 -216
- package/packages/devtools/solidjs/src/context/PerformanceContext.tsx +0 -135
- package/packages/devtools/solidjs/src/data/designs.ts +0 -13
- package/packages/devtools/solidjs/src/hooks/createGitHubLabels.ts +0 -47
- package/packages/devtools/solidjs/src/index.ts +0 -64
- package/packages/devtools/solidjs/src/services/github-service.ts +0 -247
- package/packages/devtools/solidjs/tsconfig.json +0 -21
- package/packages/devtools/src/index.ts +0 -377
- package/packages/devtools/tsup.config.ts +0 -12
- package/packages/env/package.json +0 -30
- package/packages/env/src/index.ts +0 -264
- package/packages/env/tsup.config.ts +0 -12
- package/packages/errors/package.json +0 -27
- package/packages/errors/react/package.json +0 -72
- package/packages/errors/react/src/analytics.ts +0 -16
- package/packages/errors/react/src/components/ErrorBoundary.tsx +0 -248
- package/packages/errors/react/src/components/ErrorDisplay.tsx +0 -328
- package/packages/errors/react/src/components/ValidationErrors.tsx +0 -102
- package/packages/errors/react/src/config.ts +0 -199
- package/packages/errors/react/src/constants.ts +0 -74
- package/packages/errors/react/src/hooks/useErrorBoundary.ts +0 -92
- package/packages/errors/react/src/hooks/useErrorHandler.ts +0 -87
- package/packages/errors/react/src/index.ts +0 -96
- package/packages/errors/react/src/types.ts +0 -102
- package/packages/errors/react/src/utils/errorMessages.ts +0 -35
- package/packages/errors/react/src/utils/errorPolicy.ts +0 -139
- package/packages/errors/react/src/utils/extractAppError.ts +0 -174
- package/packages/errors/react/src/utils/formatError.ts +0 -112
- package/packages/errors/react/tsconfig.json +0 -25
- package/packages/errors/react/tsup.config.ts +0 -24
- package/packages/errors/solidjs/package.json +0 -46
- package/packages/errors/solidjs/src/components/ErrorDisplay.tsx +0 -179
- package/packages/errors/solidjs/src/config.ts +0 -98
- package/packages/errors/solidjs/src/hooks/createErrorHandler.ts +0 -107
- package/packages/errors/solidjs/src/index.ts +0 -61
- package/packages/errors/solidjs/src/types.ts +0 -34
- package/packages/errors/solidjs/src/utils/errorPolicy.ts +0 -56
- package/packages/errors/solidjs/src/utils/extractAppError.ts +0 -94
- package/packages/errors/solidjs/src/utils/formatError.ts +0 -33
- package/packages/errors/solidjs/tsconfig.json +0 -26
- package/packages/errors/solidjs/tsup.config.ts +0 -21
- package/packages/errors/src/index.ts +0 -320
- package/packages/errors/tsup.config.ts +0 -12
- package/packages/logger/package.json +0 -27
- package/packages/logger/react/package.json +0 -46
- package/packages/logger/react/src/index.ts +0 -4
- package/packages/logger/react/src/useMetrics.ts +0 -42
- package/packages/logger/react/src/usePerformanceLog.ts +0 -61
- package/packages/logger/react/tsconfig.json +0 -31
- package/packages/logger/react/tsup.config.ts +0 -12
- package/packages/logger/solidjs/package.json +0 -45
- package/packages/logger/solidjs/src/createMetrics.ts +0 -37
- package/packages/logger/solidjs/src/createPerformanceLog.ts +0 -58
- package/packages/logger/solidjs/src/index.ts +0 -4
- package/packages/logger/solidjs/tsconfig.json +0 -32
- package/packages/logger/solidjs/tsup.config.ts +0 -12
- package/packages/logger/src/index.ts +0 -363
- package/packages/logger/tsup.config.ts +0 -12
- package/packages/perf/package.json +0 -27
- package/packages/perf/react/package.json +0 -59
- package/packages/perf/react/src/components/PerformanceDashboard.tsx +0 -257
- package/packages/perf/react/src/hooks/useMonitoredQuery.ts +0 -89
- package/packages/perf/react/src/hooks/usePerformanceMetrics.ts +0 -78
- package/packages/perf/react/src/index.ts +0 -33
- package/packages/perf/react/src/services/PerformanceMonitor.ts +0 -313
- package/packages/perf/react/src/types.ts +0 -77
- package/packages/perf/react/tsconfig.json +0 -25
- package/packages/perf/react/tsup.config.ts +0 -19
- package/packages/perf/solidjs/package.json +0 -41
- package/packages/perf/solidjs/src/components/PerformanceDashboard.tsx +0 -207
- package/packages/perf/solidjs/src/hooks/createPerformanceMetrics.ts +0 -73
- package/packages/perf/solidjs/src/index.ts +0 -31
- package/packages/perf/solidjs/src/services/PerformanceMonitor.ts +0 -134
- package/packages/perf/solidjs/src/types.ts +0 -78
- package/packages/perf/solidjs/tsconfig.json +0 -26
- package/packages/perf/solidjs/tsup.config.ts +0 -14
- package/packages/perf/src/index.ts +0 -410
- package/packages/perf/tsup.config.ts +0 -12
- package/pnpm-workspace.yaml +0 -2
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
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'
|
|
@@ -1,247 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|