pilothub 0.0.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.
- package/.env.local.example +19 -0
- package/.github/workflows/ci.yml +40 -0
- package/.oxlintrc.json +3 -0
- package/AGENTS.md +45 -0
- package/CHANGELOG.md +138 -0
- package/DEPRECATIONS.md +7 -0
- package/LICENSE +21 -0
- package/README.md +150 -0
- package/biome.json +41 -0
- package/convex/_generated/api.d.ts +153 -0
- package/convex/_generated/api.js +23 -0
- package/convex/_generated/dataModel.d.ts +60 -0
- package/convex/_generated/server.d.ts +143 -0
- package/convex/_generated/server.js +93 -0
- package/convex/auth.config.ts +8 -0
- package/convex/auth.ts +19 -0
- package/convex/comments.ts +88 -0
- package/convex/crons.ts +34 -0
- package/convex/devSeed.ts +459 -0
- package/convex/devSeedExtra.ts +541 -0
- package/convex/downloads.ts +78 -0
- package/convex/githubBackups.ts +170 -0
- package/convex/githubBackupsNode.ts +183 -0
- package/convex/githubImport.ts +317 -0
- package/convex/githubSoulBackups.ts +170 -0
- package/convex/githubSoulBackupsNode.ts +186 -0
- package/convex/http.ts +194 -0
- package/convex/httpApi.handlers.test.ts +488 -0
- package/convex/httpApi.test.ts +70 -0
- package/convex/httpApi.ts +305 -0
- package/convex/httpApiV1.handlers.test.ts +584 -0
- package/convex/httpApiV1.ts +1172 -0
- package/convex/leaderboards.ts +39 -0
- package/convex/lib/access.ts +36 -0
- package/convex/lib/apiTokenAuth.ts +36 -0
- package/convex/lib/badges.ts +50 -0
- package/convex/lib/changelog.test.ts +34 -0
- package/convex/lib/changelog.ts +278 -0
- package/convex/lib/embeddings.ts +38 -0
- package/convex/lib/githubBackup.ts +443 -0
- package/convex/lib/githubImport.test.ts +247 -0
- package/convex/lib/githubImport.ts +425 -0
- package/convex/lib/githubSoulBackup.ts +443 -0
- package/convex/lib/leaderboards.ts +103 -0
- package/convex/lib/moderation.ts +42 -0
- package/convex/lib/public.ts +89 -0
- package/convex/lib/searchText.test.ts +46 -0
- package/convex/lib/searchText.ts +27 -0
- package/convex/lib/skillBackfill.test.ts +34 -0
- package/convex/lib/skillBackfill.ts +67 -0
- package/convex/lib/skillPublish.test.ts +28 -0
- package/convex/lib/skillPublish.ts +284 -0
- package/convex/lib/skillStats.ts +80 -0
- package/convex/lib/skills.test.ts +197 -0
- package/convex/lib/skills.ts +273 -0
- package/convex/lib/soulChangelog.ts +273 -0
- package/convex/lib/soulPublish.ts +236 -0
- package/convex/lib/tokens.test.ts +33 -0
- package/convex/lib/tokens.ts +51 -0
- package/convex/lib/webhooks.test.ts +91 -0
- package/convex/lib/webhooks.ts +112 -0
- package/convex/maintenance.test.ts +270 -0
- package/convex/maintenance.ts +840 -0
- package/convex/rateLimits.ts +50 -0
- package/convex/schema.ts +472 -0
- package/convex/search.test.ts +12 -0
- package/convex/search.ts +254 -0
- package/convex/seed.test.ts +37 -0
- package/convex/seed.ts +254 -0
- package/convex/seedSouls.ts +111 -0
- package/convex/skillStatEvents.ts +568 -0
- package/convex/skills.ts +1606 -0
- package/convex/soulComments.ts +88 -0
- package/convex/soulDownloads.ts +14 -0
- package/convex/soulStars.ts +71 -0
- package/convex/souls.ts +570 -0
- package/convex/stars.ts +108 -0
- package/convex/statsMaintenance.ts +205 -0
- package/convex/telemetry.ts +434 -0
- package/convex/tokens.ts +88 -0
- package/convex/tsconfig.json +7 -0
- package/convex/uploads.ts +20 -0
- package/convex/users.ts +122 -0
- package/convex/webhooks.ts +50 -0
- package/convex.json +3 -0
- package/docs/README.md +32 -0
- package/docs/api.md +51 -0
- package/docs/architecture.md +61 -0
- package/docs/auth.md +54 -0
- package/docs/cli.md +117 -0
- package/docs/deploy.md +78 -0
- package/docs/diffing.md +84 -0
- package/docs/github-import.md +171 -0
- package/docs/http-api.md +187 -0
- package/docs/manual-testing.md +64 -0
- package/docs/mintlify.md +43 -0
- package/docs/quickstart.md +120 -0
- package/docs/skill-format.md +58 -0
- package/docs/soul-format.md +37 -0
- package/docs/spec.md +177 -0
- package/docs/telemetry.md +91 -0
- package/docs/troubleshooting.md +49 -0
- package/docs/webhook.md +51 -0
- package/e2e/menu-smoke.pw.test.ts +49 -0
- package/e2e/pilothub.e2e.test.ts +494 -0
- package/e2e/search-exact.pw.test.ts +97 -0
- package/package.json +84 -0
- package/packages/pilothub/LICENSE +22 -0
- package/packages/pilothub/README.md +57 -0
- package/packages/pilothub/bin/pilothub.js +2 -0
- package/packages/pilothub/package.json +41 -0
- package/packages/pilothub/src/browserAuth.test.ts +96 -0
- package/packages/pilothub/src/browserAuth.ts +174 -0
- package/packages/pilothub/src/cli/buildInfo.ts +94 -0
- package/packages/pilothub/src/cli/commands/auth.ts +97 -0
- package/packages/pilothub/src/cli/commands/delete.test.ts +73 -0
- package/packages/pilothub/src/cli/commands/delete.ts +83 -0
- package/packages/pilothub/src/cli/commands/publish.test.ts +122 -0
- package/packages/pilothub/src/cli/commands/publish.ts +108 -0
- package/packages/pilothub/src/cli/commands/skills.test.ts +191 -0
- package/packages/pilothub/src/cli/commands/skills.ts +380 -0
- package/packages/pilothub/src/cli/commands/star.ts +46 -0
- package/packages/pilothub/src/cli/commands/sync.test.ts +310 -0
- package/packages/pilothub/src/cli/commands/sync.ts +200 -0
- package/packages/pilothub/src/cli/commands/syncHelpers.test.ts +26 -0
- package/packages/pilothub/src/cli/commands/syncHelpers.ts +427 -0
- package/packages/pilothub/src/cli/commands/syncTypes.ts +27 -0
- package/packages/pilothub/src/cli/commands/unstar.ts +48 -0
- package/packages/pilothub/src/cli/helpStyle.ts +45 -0
- package/packages/pilothub/src/cli/pilotbotConfig.test.ts +159 -0
- package/packages/pilothub/src/cli/pilotbotConfig.ts +147 -0
- package/packages/pilothub/src/cli/registry.test.ts +63 -0
- package/packages/pilothub/src/cli/registry.ts +43 -0
- package/packages/pilothub/src/cli/scanSkills.test.ts +64 -0
- package/packages/pilothub/src/cli/scanSkills.ts +84 -0
- package/packages/pilothub/src/cli/slug.ts +16 -0
- package/packages/pilothub/src/cli/types.ts +12 -0
- package/packages/pilothub/src/cli/ui.ts +75 -0
- package/packages/pilothub/src/cli.ts +311 -0
- package/packages/pilothub/src/config.ts +36 -0
- package/packages/pilothub/src/discovery.test.ts +75 -0
- package/packages/pilothub/src/discovery.ts +19 -0
- package/packages/pilothub/src/http.test.ts +156 -0
- package/packages/pilothub/src/http.ts +301 -0
- package/packages/pilothub/src/schema/ark.ts +29 -0
- package/packages/pilothub/src/schema/index.ts +5 -0
- package/packages/pilothub/src/schema/routes.ts +22 -0
- package/packages/pilothub/src/schema/schemas.ts +260 -0
- package/packages/pilothub/src/schema/textFiles.test.ts +23 -0
- package/packages/pilothub/src/schema/textFiles.ts +66 -0
- package/packages/pilothub/src/skills.test.ts +191 -0
- package/packages/pilothub/src/skills.ts +172 -0
- package/packages/pilothub/src/types.ts +10 -0
- package/packages/pilothub/tsconfig.json +14 -0
- package/packages/schema/README.md +3 -0
- package/packages/schema/dist/ark.d.ts +4 -0
- package/packages/schema/dist/ark.js +26 -0
- package/packages/schema/dist/ark.js.map +1 -0
- package/packages/schema/dist/index.d.ts +5 -0
- package/packages/schema/dist/index.js +5 -0
- package/packages/schema/dist/index.js.map +1 -0
- package/packages/schema/dist/routes.d.ts +21 -0
- package/packages/schema/dist/routes.js +22 -0
- package/packages/schema/dist/routes.js.map +1 -0
- package/packages/schema/dist/schemas.d.ts +297 -0
- package/packages/schema/dist/schemas.js +243 -0
- package/packages/schema/dist/schemas.js.map +1 -0
- package/packages/schema/dist/textFiles.d.ts +5 -0
- package/packages/schema/dist/textFiles.js +66 -0
- package/packages/schema/dist/textFiles.js.map +1 -0
- package/packages/schema/package.json +26 -0
- package/packages/schema/src/ark.ts +29 -0
- package/packages/schema/src/index.ts +5 -0
- package/packages/schema/src/routes.ts +22 -0
- package/packages/schema/src/schemas.test.ts +123 -0
- package/packages/schema/src/schemas.ts +287 -0
- package/packages/schema/src/textFiles.test.ts +23 -0
- package/packages/schema/src/textFiles.ts +66 -0
- package/packages/schema/tsconfig.json +15 -0
- package/pilothub +46 -0
- package/playwright.config.ts +33 -0
- package/public/.well-known/pilothub.json +6 -0
- package/public/api/v1/openapi.json +379 -0
- package/public/favicon.ico +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/og.png +0 -0
- package/public/og.svg +98 -0
- package/public/pilot-logo.png +0 -0
- package/public/pilot-mark.png +0 -0
- package/public/robots.txt +3 -0
- package/public/tanstack-circle-logo.png +0 -0
- package/public/tanstack-word-logo-white.svg +1 -0
- package/scripts/check-peer-deps.ts +56 -0
- package/scripts/docs-list.ts +148 -0
- package/scripts/run-playwright-local.sh +14 -0
- package/server/og/fetchSkillOgMeta.ts +27 -0
- package/server/og/fetchSoulOgMeta.ts +27 -0
- package/server/og/ogAssets.ts +80 -0
- package/server/og/skillOgSvg.test.ts +59 -0
- package/server/og/skillOgSvg.ts +258 -0
- package/server/og/soulOgSvg.ts +209 -0
- package/server/routes/og/skill.png.ts +103 -0
- package/server/routes/og/soul.png.ts +111 -0
- package/src/__tests__/skill-detail-page.test.tsx +86 -0
- package/src/__tests__/skills-index.test.tsx +145 -0
- package/src/__tests__/upload.route.test.tsx +228 -0
- package/src/components/AppProviders.tsx +19 -0
- package/src/components/ClientOnly.tsx +18 -0
- package/src/components/Footer.tsx +29 -0
- package/src/components/Header.tsx +295 -0
- package/src/components/InstallSwitcher.tsx +53 -0
- package/src/components/SkillCard.tsx +36 -0
- package/src/components/SkillDetailPage.tsx +817 -0
- package/src/components/SkillDiffCard.tsx +485 -0
- package/src/components/SoulCard.tsx +19 -0
- package/src/components/SoulDetailPage.tsx +263 -0
- package/src/components/UserBootstrap.tsx +18 -0
- package/src/components/ui/dropdown-menu.tsx +67 -0
- package/src/components/ui/toggle-group.tsx +35 -0
- package/src/convex/client.ts +3 -0
- package/src/lib/badges.ts +29 -0
- package/src/lib/diffing.test.ts +163 -0
- package/src/lib/diffing.ts +106 -0
- package/src/lib/gravatar.test.ts +9 -0
- package/src/lib/gravatar.ts +158 -0
- package/src/lib/og.test.ts +142 -0
- package/src/lib/og.ts +156 -0
- package/src/lib/publicUser.ts +39 -0
- package/src/lib/roles.ts +19 -0
- package/src/lib/site.test.ts +130 -0
- package/src/lib/site.ts +84 -0
- package/src/lib/theme-transition.test.ts +134 -0
- package/src/lib/theme-transition.ts +134 -0
- package/src/lib/theme.test.tsx +88 -0
- package/src/lib/theme.ts +43 -0
- package/src/lib/uploadFiles.jsdom.test.ts +33 -0
- package/src/lib/uploadFiles.test.ts +123 -0
- package/src/lib/uploadFiles.ts +245 -0
- package/src/lib/uploadUtils.test.ts +78 -0
- package/src/lib/uploadUtils.ts +93 -0
- package/src/lib/useAuthStatus.ts +12 -0
- package/src/lib/utils.test.ts +9 -0
- package/src/lib/utils.ts +6 -0
- package/src/logo.svg +12 -0
- package/src/routeTree.gen.ts +345 -0
- package/src/router.tsx +17 -0
- package/src/routes/$owner/$slug.tsx +55 -0
- package/src/routes/__root.tsx +136 -0
- package/src/routes/admin.tsx +11 -0
- package/src/routes/cli/auth.tsx +168 -0
- package/src/routes/dashboard.tsx +97 -0
- package/src/routes/import.tsx +415 -0
- package/src/routes/index.tsx +252 -0
- package/src/routes/management.tsx +529 -0
- package/src/routes/settings.tsx +203 -0
- package/src/routes/skills/index.tsx +422 -0
- package/src/routes/souls/$slug.tsx +55 -0
- package/src/routes/souls/index.tsx +243 -0
- package/src/routes/stars.tsx +68 -0
- package/src/routes/u/$handle.tsx +307 -0
- package/src/routes/upload/utils.ts +81 -0
- package/src/routes/upload.tsx +499 -0
- package/src/styles.css +2718 -0
- package/tsconfig.json +24 -0
- package/tsconfig.oxlint.json +16 -0
- package/vercel.json +8 -0
- package/vite.config.ts +48 -0
- package/vitest.config.ts +47 -0
- package/vitest.e2e.config.ts +11 -0
- package/vitest.setup.ts +1 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { v } from 'convex/values'
|
|
2
|
+
import type { Doc } from './_generated/dataModel'
|
|
3
|
+
import { mutation, query } from './_generated/server'
|
|
4
|
+
import { assertModerator, requireUser } from './lib/access'
|
|
5
|
+
import { type PublicUser, toPublicUser } from './lib/public'
|
|
6
|
+
|
|
7
|
+
export const listBySoul = query({
|
|
8
|
+
args: { soulId: v.id('souls'), limit: v.optional(v.number()) },
|
|
9
|
+
handler: async (ctx, args) => {
|
|
10
|
+
const limit = args.limit ?? 50
|
|
11
|
+
const comments = await ctx.db
|
|
12
|
+
.query('soulComments')
|
|
13
|
+
.withIndex('by_soul', (q) => q.eq('soulId', args.soulId))
|
|
14
|
+
.order('desc')
|
|
15
|
+
.take(limit)
|
|
16
|
+
|
|
17
|
+
const results: Array<{ comment: Doc<'soulComments'>; user: PublicUser | null }> = []
|
|
18
|
+
for (const comment of comments) {
|
|
19
|
+
if (comment.softDeletedAt) continue
|
|
20
|
+
const user = toPublicUser(await ctx.db.get(comment.userId))
|
|
21
|
+
results.push({ comment, user })
|
|
22
|
+
}
|
|
23
|
+
return results
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const add = mutation({
|
|
28
|
+
args: { soulId: v.id('souls'), body: v.string() },
|
|
29
|
+
handler: async (ctx, args) => {
|
|
30
|
+
const { userId } = await requireUser(ctx)
|
|
31
|
+
const body = args.body.trim()
|
|
32
|
+
if (!body) throw new Error('Comment body required')
|
|
33
|
+
|
|
34
|
+
const soul = await ctx.db.get(args.soulId)
|
|
35
|
+
if (!soul) throw new Error('Soul not found')
|
|
36
|
+
|
|
37
|
+
await ctx.db.insert('soulComments', {
|
|
38
|
+
soulId: args.soulId,
|
|
39
|
+
userId,
|
|
40
|
+
body,
|
|
41
|
+
createdAt: Date.now(),
|
|
42
|
+
softDeletedAt: undefined,
|
|
43
|
+
deletedBy: undefined,
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
await ctx.db.patch(soul._id, {
|
|
47
|
+
stats: { ...soul.stats, comments: soul.stats.comments + 1 },
|
|
48
|
+
updatedAt: Date.now(),
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export const remove = mutation({
|
|
54
|
+
args: { commentId: v.id('soulComments') },
|
|
55
|
+
handler: async (ctx, args) => {
|
|
56
|
+
const { user } = await requireUser(ctx)
|
|
57
|
+
const comment = await ctx.db.get(args.commentId)
|
|
58
|
+
if (!comment) throw new Error('Comment not found')
|
|
59
|
+
if (comment.softDeletedAt) return
|
|
60
|
+
|
|
61
|
+
const isOwner = comment.userId === user._id
|
|
62
|
+
if (!isOwner) {
|
|
63
|
+
assertModerator(user)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
await ctx.db.patch(comment._id, {
|
|
67
|
+
softDeletedAt: Date.now(),
|
|
68
|
+
deletedBy: user._id,
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const soul = await ctx.db.get(comment.soulId)
|
|
72
|
+
if (soul) {
|
|
73
|
+
await ctx.db.patch(soul._id, {
|
|
74
|
+
stats: { ...soul.stats, comments: Math.max(0, soul.stats.comments - 1) },
|
|
75
|
+
updatedAt: Date.now(),
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
await ctx.db.insert('auditLogs', {
|
|
80
|
+
actorUserId: user._id,
|
|
81
|
+
action: 'soul.comment.delete',
|
|
82
|
+
targetType: 'soulComment',
|
|
83
|
+
targetId: comment._id,
|
|
84
|
+
metadata: { soulId: comment.soulId },
|
|
85
|
+
createdAt: Date.now(),
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { v } from 'convex/values'
|
|
2
|
+
import { mutation } from './_generated/server'
|
|
3
|
+
|
|
4
|
+
export const increment = mutation({
|
|
5
|
+
args: { soulId: v.id('souls') },
|
|
6
|
+
handler: async (ctx, args) => {
|
|
7
|
+
const soul = await ctx.db.get(args.soulId)
|
|
8
|
+
if (!soul) return
|
|
9
|
+
await ctx.db.patch(soul._id, {
|
|
10
|
+
stats: { ...soul.stats, downloads: soul.stats.downloads + 1 },
|
|
11
|
+
updatedAt: Date.now(),
|
|
12
|
+
})
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { v } from 'convex/values'
|
|
2
|
+
import { mutation, query } from './_generated/server'
|
|
3
|
+
import { requireUser } from './lib/access'
|
|
4
|
+
import { toPublicSoul } from './lib/public'
|
|
5
|
+
|
|
6
|
+
export const isStarred = query({
|
|
7
|
+
args: { soulId: v.id('souls') },
|
|
8
|
+
handler: async (ctx, args) => {
|
|
9
|
+
const { userId } = await requireUser(ctx)
|
|
10
|
+
const existing = await ctx.db
|
|
11
|
+
.query('soulStars')
|
|
12
|
+
.withIndex('by_soul_user', (q) => q.eq('soulId', args.soulId).eq('userId', userId))
|
|
13
|
+
.unique()
|
|
14
|
+
return Boolean(existing)
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const toggle = mutation({
|
|
19
|
+
args: { soulId: v.id('souls') },
|
|
20
|
+
handler: async (ctx, args) => {
|
|
21
|
+
const { userId } = await requireUser(ctx)
|
|
22
|
+
const soul = await ctx.db.get(args.soulId)
|
|
23
|
+
if (!soul) throw new Error('Soul not found')
|
|
24
|
+
|
|
25
|
+
const existing = await ctx.db
|
|
26
|
+
.query('soulStars')
|
|
27
|
+
.withIndex('by_soul_user', (q) => q.eq('soulId', args.soulId).eq('userId', userId))
|
|
28
|
+
.unique()
|
|
29
|
+
|
|
30
|
+
if (existing) {
|
|
31
|
+
await ctx.db.delete(existing._id)
|
|
32
|
+
await ctx.db.patch(soul._id, {
|
|
33
|
+
stats: { ...soul.stats, stars: Math.max(0, soul.stats.stars - 1) },
|
|
34
|
+
updatedAt: Date.now(),
|
|
35
|
+
})
|
|
36
|
+
return { starred: false }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
await ctx.db.insert('soulStars', {
|
|
40
|
+
soulId: args.soulId,
|
|
41
|
+
userId,
|
|
42
|
+
createdAt: Date.now(),
|
|
43
|
+
})
|
|
44
|
+
await ctx.db.patch(soul._id, {
|
|
45
|
+
stats: { ...soul.stats, stars: soul.stats.stars + 1 },
|
|
46
|
+
updatedAt: Date.now(),
|
|
47
|
+
})
|
|
48
|
+
return { starred: true }
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
export const listByUser = query({
|
|
53
|
+
args: { userId: v.id('users'), limit: v.optional(v.number()) },
|
|
54
|
+
handler: async (ctx, args) => {
|
|
55
|
+
const limit = args.limit ?? 50
|
|
56
|
+
const stars = await ctx.db
|
|
57
|
+
.query('soulStars')
|
|
58
|
+
.withIndex('by_user', (q) => q.eq('userId', args.userId))
|
|
59
|
+
.order('desc')
|
|
60
|
+
.take(limit)
|
|
61
|
+
|
|
62
|
+
const souls: NonNullable<ReturnType<typeof toPublicSoul>>[] = []
|
|
63
|
+
for (const star of stars) {
|
|
64
|
+
const soul = await ctx.db.get(star.soulId)
|
|
65
|
+
const publicSoul = toPublicSoul(soul)
|
|
66
|
+
if (!publicSoul) continue
|
|
67
|
+
souls.push(publicSoul)
|
|
68
|
+
}
|
|
69
|
+
return souls
|
|
70
|
+
},
|
|
71
|
+
})
|