pilothub 0.0.1 → 0.0.2
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/LICENSE +1 -0
- package/README.md +36 -129
- package/dist/browserAuth.d.ts +20 -0
- package/dist/browserAuth.js +156 -0
- package/dist/browserAuth.js.map +1 -0
- package/dist/browserAuth.test.d.ts +1 -0
- package/dist/browserAuth.test.js +83 -0
- package/dist/browserAuth.test.js.map +1 -0
- package/dist/cli/buildInfo.d.ts +3 -0
- package/dist/cli/buildInfo.js +103 -0
- package/dist/cli/buildInfo.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +9 -0
- package/dist/cli/commands/auth.js +75 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/delete.d.ts +11 -0
- package/dist/cli/commands/delete.js +67 -0
- package/dist/cli/commands/delete.js.map +1 -0
- package/dist/cli/commands/delete.test.d.ts +1 -0
- package/dist/cli/commands/delete.test.js +52 -0
- package/dist/cli/commands/delete.test.js.map +1 -0
- package/dist/cli/commands/publish.d.ts +9 -0
- package/dist/cli/commands/publish.js +87 -0
- package/dist/cli/commands/publish.js.map +1 -0
- package/dist/cli/commands/publish.test.d.ts +1 -0
- package/dist/cli/commands/publish.test.js +104 -0
- package/dist/cli/commands/publish.test.js.map +1 -0
- package/dist/cli/commands/skills.d.ts +23 -0
- package/dist/cli/commands/skills.js +298 -0
- package/dist/cli/commands/skills.js.map +1 -0
- package/dist/cli/commands/skills.test.d.ts +1 -0
- package/dist/cli/commands/skills.test.js +156 -0
- package/dist/cli/commands/skills.test.js.map +1 -0
- package/dist/cli/commands/star.d.ts +8 -0
- package/dist/cli/commands/star.js +38 -0
- package/dist/cli/commands/star.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +3 -0
- package/dist/cli/commands/sync.js +160 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/commands/sync.test.d.ts +1 -0
- package/dist/cli/commands/sync.test.js +277 -0
- package/dist/cli/commands/sync.test.js.map +1 -0
- package/dist/cli/commands/syncHelpers.d.ts +76 -0
- package/dist/cli/commands/syncHelpers.js +349 -0
- package/dist/cli/commands/syncHelpers.js.map +1 -0
- package/dist/cli/commands/syncHelpers.test.d.ts +1 -0
- package/dist/cli/commands/syncHelpers.test.js +22 -0
- package/dist/cli/commands/syncHelpers.test.js.map +1 -0
- package/dist/cli/commands/syncTypes.d.ts +24 -0
- package/dist/cli/commands/syncTypes.js +2 -0
- package/dist/cli/commands/syncTypes.js.map +1 -0
- package/dist/cli/commands/unstar.d.ts +8 -0
- package/dist/cli/commands/unstar.js +38 -0
- package/dist/cli/commands/unstar.js.map +1 -0
- package/dist/cli/helpStyle.d.ts +13 -0
- package/dist/cli/helpStyle.js +38 -0
- package/dist/cli/helpStyle.js.map +1 -0
- package/dist/cli/pilotbotConfig.d.ts +6 -0
- package/dist/cli/pilotbotConfig.js +110 -0
- package/dist/cli/pilotbotConfig.js.map +1 -0
- package/dist/cli/pilotbotConfig.test.d.ts +1 -0
- package/dist/cli/pilotbotConfig.test.js +133 -0
- package/dist/cli/pilotbotConfig.test.js.map +1 -0
- package/dist/cli/registry.d.ts +7 -0
- package/dist/cli/registry.js +42 -0
- package/dist/cli/registry.js.map +1 -0
- package/dist/cli/registry.test.d.ts +1 -0
- package/dist/cli/registry.test.js +48 -0
- package/dist/cli/registry.test.js.map +1 -0
- package/dist/cli/scanSkills.d.ts +7 -0
- package/dist/cli/scanSkills.js +75 -0
- package/dist/cli/scanSkills.js.map +1 -0
- package/dist/cli/scanSkills.test.d.ts +1 -0
- package/dist/cli/scanSkills.test.js +60 -0
- package/dist/cli/scanSkills.test.js.map +1 -0
- package/dist/cli/slug.d.ts +2 -0
- package/dist/cli/slug.js +16 -0
- package/dist/cli/slug.js.map +1 -0
- package/dist/cli/types.d.ts +15 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/ui.d.ts +7 -0
- package/dist/cli/ui.js +72 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +268 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +38 -0
- package/dist/config.js.map +1 -0
- package/dist/discovery.d.ts +5 -0
- package/dist/discovery.js +21 -0
- package/dist/discovery.js.map +1 -0
- package/dist/discovery.test.d.ts +1 -0
- package/dist/discovery.test.js +46 -0
- package/dist/discovery.test.js.map +1 -0
- package/dist/http.d.ts +32 -0
- package/dist/http.js +261 -0
- package/dist/http.js.map +1 -0
- package/dist/http.test.d.ts +1 -0
- package/dist/http.test.js +135 -0
- package/dist/http.test.js.map +1 -0
- package/dist/schema/ark.js.map +1 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/routes.js.map +1 -0
- package/{packages/schema/dist → dist/schema}/schemas.d.ts +0 -39
- package/{packages/schema/dist → dist/schema}/schemas.js +0 -22
- package/dist/schema/schemas.js.map +1 -0
- package/dist/schema/textFiles.js.map +1 -0
- package/dist/schema/textFiles.test.d.ts +1 -0
- package/dist/schema/textFiles.test.js +20 -0
- package/dist/schema/textFiles.test.js.map +1 -0
- package/dist/skills.d.ts +43 -0
- package/dist/skills.js +163 -0
- package/dist/skills.js.map +1 -0
- package/dist/skills.test.d.ts +1 -0
- package/dist/skills.test.js +144 -0
- package/dist/skills.test.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +27 -70
- package/.env.local.example +0 -19
- package/.github/workflows/ci.yml +0 -40
- package/.oxlintrc.json +0 -3
- package/AGENTS.md +0 -45
- package/CHANGELOG.md +0 -138
- package/DEPRECATIONS.md +0 -7
- package/biome.json +0 -41
- package/convex/_generated/api.d.ts +0 -153
- package/convex/_generated/api.js +0 -23
- package/convex/_generated/dataModel.d.ts +0 -60
- package/convex/_generated/server.d.ts +0 -143
- package/convex/_generated/server.js +0 -93
- package/convex/auth.config.ts +0 -8
- package/convex/auth.ts +0 -19
- package/convex/comments.ts +0 -88
- package/convex/crons.ts +0 -34
- package/convex/devSeed.ts +0 -459
- package/convex/devSeedExtra.ts +0 -541
- package/convex/downloads.ts +0 -78
- package/convex/githubBackups.ts +0 -170
- package/convex/githubBackupsNode.ts +0 -183
- package/convex/githubImport.ts +0 -317
- package/convex/githubSoulBackups.ts +0 -170
- package/convex/githubSoulBackupsNode.ts +0 -186
- package/convex/http.ts +0 -194
- package/convex/httpApi.handlers.test.ts +0 -488
- package/convex/httpApi.test.ts +0 -70
- package/convex/httpApi.ts +0 -305
- package/convex/httpApiV1.handlers.test.ts +0 -584
- package/convex/httpApiV1.ts +0 -1172
- package/convex/leaderboards.ts +0 -39
- package/convex/lib/access.ts +0 -36
- package/convex/lib/apiTokenAuth.ts +0 -36
- package/convex/lib/badges.ts +0 -50
- package/convex/lib/changelog.test.ts +0 -34
- package/convex/lib/changelog.ts +0 -278
- package/convex/lib/embeddings.ts +0 -38
- package/convex/lib/githubBackup.ts +0 -443
- package/convex/lib/githubImport.test.ts +0 -247
- package/convex/lib/githubImport.ts +0 -425
- package/convex/lib/githubSoulBackup.ts +0 -443
- package/convex/lib/leaderboards.ts +0 -103
- package/convex/lib/moderation.ts +0 -42
- package/convex/lib/public.ts +0 -89
- package/convex/lib/searchText.test.ts +0 -46
- package/convex/lib/searchText.ts +0 -27
- package/convex/lib/skillBackfill.test.ts +0 -34
- package/convex/lib/skillBackfill.ts +0 -67
- package/convex/lib/skillPublish.test.ts +0 -28
- package/convex/lib/skillPublish.ts +0 -284
- package/convex/lib/skillStats.ts +0 -80
- package/convex/lib/skills.test.ts +0 -197
- package/convex/lib/skills.ts +0 -273
- package/convex/lib/soulChangelog.ts +0 -273
- package/convex/lib/soulPublish.ts +0 -236
- package/convex/lib/tokens.test.ts +0 -33
- package/convex/lib/tokens.ts +0 -51
- package/convex/lib/webhooks.test.ts +0 -91
- package/convex/lib/webhooks.ts +0 -112
- package/convex/maintenance.test.ts +0 -270
- package/convex/maintenance.ts +0 -840
- package/convex/rateLimits.ts +0 -50
- package/convex/schema.ts +0 -472
- package/convex/search.test.ts +0 -12
- package/convex/search.ts +0 -254
- package/convex/seed.test.ts +0 -37
- package/convex/seed.ts +0 -254
- package/convex/seedSouls.ts +0 -111
- package/convex/skillStatEvents.ts +0 -568
- package/convex/skills.ts +0 -1606
- package/convex/soulComments.ts +0 -88
- package/convex/soulDownloads.ts +0 -14
- package/convex/soulStars.ts +0 -71
- package/convex/souls.ts +0 -570
- package/convex/stars.ts +0 -108
- package/convex/statsMaintenance.ts +0 -205
- package/convex/telemetry.ts +0 -434
- package/convex/tokens.ts +0 -88
- package/convex/tsconfig.json +0 -7
- package/convex/uploads.ts +0 -20
- package/convex/users.ts +0 -122
- package/convex/webhooks.ts +0 -50
- package/convex.json +0 -3
- package/docs/README.md +0 -32
- package/docs/api.md +0 -51
- package/docs/architecture.md +0 -61
- package/docs/auth.md +0 -54
- package/docs/cli.md +0 -117
- package/docs/deploy.md +0 -78
- package/docs/diffing.md +0 -84
- package/docs/github-import.md +0 -171
- package/docs/http-api.md +0 -187
- package/docs/manual-testing.md +0 -64
- package/docs/mintlify.md +0 -43
- package/docs/quickstart.md +0 -120
- package/docs/skill-format.md +0 -58
- package/docs/soul-format.md +0 -37
- package/docs/spec.md +0 -177
- package/docs/telemetry.md +0 -91
- package/docs/troubleshooting.md +0 -49
- package/docs/webhook.md +0 -51
- package/e2e/menu-smoke.pw.test.ts +0 -49
- package/e2e/pilothub.e2e.test.ts +0 -494
- package/e2e/search-exact.pw.test.ts +0 -97
- package/packages/pilothub/LICENSE +0 -22
- package/packages/pilothub/README.md +0 -57
- package/packages/pilothub/package.json +0 -41
- package/packages/pilothub/src/browserAuth.test.ts +0 -96
- package/packages/pilothub/src/browserAuth.ts +0 -174
- package/packages/pilothub/src/cli/buildInfo.ts +0 -94
- package/packages/pilothub/src/cli/commands/auth.ts +0 -97
- package/packages/pilothub/src/cli/commands/delete.test.ts +0 -73
- package/packages/pilothub/src/cli/commands/delete.ts +0 -83
- package/packages/pilothub/src/cli/commands/publish.test.ts +0 -122
- package/packages/pilothub/src/cli/commands/publish.ts +0 -108
- package/packages/pilothub/src/cli/commands/skills.test.ts +0 -191
- package/packages/pilothub/src/cli/commands/skills.ts +0 -380
- package/packages/pilothub/src/cli/commands/star.ts +0 -46
- package/packages/pilothub/src/cli/commands/sync.test.ts +0 -310
- package/packages/pilothub/src/cli/commands/sync.ts +0 -200
- package/packages/pilothub/src/cli/commands/syncHelpers.test.ts +0 -26
- package/packages/pilothub/src/cli/commands/syncHelpers.ts +0 -427
- package/packages/pilothub/src/cli/commands/syncTypes.ts +0 -27
- package/packages/pilothub/src/cli/commands/unstar.ts +0 -48
- package/packages/pilothub/src/cli/helpStyle.ts +0 -45
- package/packages/pilothub/src/cli/pilotbotConfig.test.ts +0 -159
- package/packages/pilothub/src/cli/pilotbotConfig.ts +0 -147
- package/packages/pilothub/src/cli/registry.test.ts +0 -63
- package/packages/pilothub/src/cli/registry.ts +0 -43
- package/packages/pilothub/src/cli/scanSkills.test.ts +0 -64
- package/packages/pilothub/src/cli/scanSkills.ts +0 -84
- package/packages/pilothub/src/cli/slug.ts +0 -16
- package/packages/pilothub/src/cli/types.ts +0 -12
- package/packages/pilothub/src/cli/ui.ts +0 -75
- package/packages/pilothub/src/cli.ts +0 -311
- package/packages/pilothub/src/config.ts +0 -36
- package/packages/pilothub/src/discovery.test.ts +0 -75
- package/packages/pilothub/src/discovery.ts +0 -19
- package/packages/pilothub/src/http.test.ts +0 -156
- package/packages/pilothub/src/http.ts +0 -301
- package/packages/pilothub/src/schema/ark.ts +0 -29
- package/packages/pilothub/src/schema/index.ts +0 -5
- package/packages/pilothub/src/schema/routes.ts +0 -22
- package/packages/pilothub/src/schema/schemas.ts +0 -260
- package/packages/pilothub/src/schema/textFiles.test.ts +0 -23
- package/packages/pilothub/src/schema/textFiles.ts +0 -66
- package/packages/pilothub/src/skills.test.ts +0 -191
- package/packages/pilothub/src/skills.ts +0 -172
- package/packages/pilothub/src/types.ts +0 -10
- package/packages/pilothub/tsconfig.json +0 -14
- package/packages/schema/README.md +0 -3
- package/packages/schema/dist/ark.js.map +0 -1
- package/packages/schema/dist/index.js.map +0 -1
- package/packages/schema/dist/routes.js.map +0 -1
- package/packages/schema/dist/schemas.js.map +0 -1
- package/packages/schema/dist/textFiles.js.map +0 -1
- package/packages/schema/package.json +0 -26
- package/packages/schema/src/ark.ts +0 -29
- package/packages/schema/src/index.ts +0 -5
- package/packages/schema/src/routes.ts +0 -22
- package/packages/schema/src/schemas.test.ts +0 -123
- package/packages/schema/src/schemas.ts +0 -287
- package/packages/schema/src/textFiles.test.ts +0 -23
- package/packages/schema/src/textFiles.ts +0 -66
- package/packages/schema/tsconfig.json +0 -15
- package/pilothub +0 -46
- package/playwright.config.ts +0 -33
- package/public/.well-known/pilothub.json +0 -6
- package/public/api/v1/openapi.json +0 -379
- package/public/favicon.ico +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/og.png +0 -0
- package/public/og.svg +0 -98
- package/public/pilot-logo.png +0 -0
- package/public/pilot-mark.png +0 -0
- package/public/robots.txt +0 -3
- package/public/tanstack-circle-logo.png +0 -0
- package/public/tanstack-word-logo-white.svg +0 -1
- package/scripts/check-peer-deps.ts +0 -56
- package/scripts/docs-list.ts +0 -148
- package/scripts/run-playwright-local.sh +0 -14
- package/server/og/fetchSkillOgMeta.ts +0 -27
- package/server/og/fetchSoulOgMeta.ts +0 -27
- package/server/og/ogAssets.ts +0 -80
- package/server/og/skillOgSvg.test.ts +0 -59
- package/server/og/skillOgSvg.ts +0 -258
- package/server/og/soulOgSvg.ts +0 -209
- package/server/routes/og/skill.png.ts +0 -103
- package/server/routes/og/soul.png.ts +0 -111
- package/src/__tests__/skill-detail-page.test.tsx +0 -86
- package/src/__tests__/skills-index.test.tsx +0 -145
- package/src/__tests__/upload.route.test.tsx +0 -228
- package/src/components/AppProviders.tsx +0 -19
- package/src/components/ClientOnly.tsx +0 -18
- package/src/components/Footer.tsx +0 -29
- package/src/components/Header.tsx +0 -295
- package/src/components/InstallSwitcher.tsx +0 -53
- package/src/components/SkillCard.tsx +0 -36
- package/src/components/SkillDetailPage.tsx +0 -817
- package/src/components/SkillDiffCard.tsx +0 -485
- package/src/components/SoulCard.tsx +0 -19
- package/src/components/SoulDetailPage.tsx +0 -263
- package/src/components/UserBootstrap.tsx +0 -18
- package/src/components/ui/dropdown-menu.tsx +0 -67
- package/src/components/ui/toggle-group.tsx +0 -35
- package/src/convex/client.ts +0 -3
- package/src/lib/badges.ts +0 -29
- package/src/lib/diffing.test.ts +0 -163
- package/src/lib/diffing.ts +0 -106
- package/src/lib/gravatar.test.ts +0 -9
- package/src/lib/gravatar.ts +0 -158
- package/src/lib/og.test.ts +0 -142
- package/src/lib/og.ts +0 -156
- package/src/lib/publicUser.ts +0 -39
- package/src/lib/roles.ts +0 -19
- package/src/lib/site.test.ts +0 -130
- package/src/lib/site.ts +0 -84
- package/src/lib/theme-transition.test.ts +0 -134
- package/src/lib/theme-transition.ts +0 -134
- package/src/lib/theme.test.tsx +0 -88
- package/src/lib/theme.ts +0 -43
- package/src/lib/uploadFiles.jsdom.test.ts +0 -33
- package/src/lib/uploadFiles.test.ts +0 -123
- package/src/lib/uploadFiles.ts +0 -245
- package/src/lib/uploadUtils.test.ts +0 -78
- package/src/lib/uploadUtils.ts +0 -93
- package/src/lib/useAuthStatus.ts +0 -12
- package/src/lib/utils.test.ts +0 -9
- package/src/lib/utils.ts +0 -6
- package/src/logo.svg +0 -12
- package/src/routeTree.gen.ts +0 -345
- package/src/router.tsx +0 -17
- package/src/routes/$owner/$slug.tsx +0 -55
- package/src/routes/__root.tsx +0 -136
- package/src/routes/admin.tsx +0 -11
- package/src/routes/cli/auth.tsx +0 -168
- package/src/routes/dashboard.tsx +0 -97
- package/src/routes/import.tsx +0 -415
- package/src/routes/index.tsx +0 -252
- package/src/routes/management.tsx +0 -529
- package/src/routes/settings.tsx +0 -203
- package/src/routes/skills/index.tsx +0 -422
- package/src/routes/souls/$slug.tsx +0 -55
- package/src/routes/souls/index.tsx +0 -243
- package/src/routes/stars.tsx +0 -68
- package/src/routes/u/$handle.tsx +0 -307
- package/src/routes/upload/utils.ts +0 -81
- package/src/routes/upload.tsx +0 -499
- package/src/styles.css +0 -2718
- package/tsconfig.json +0 -24
- package/tsconfig.oxlint.json +0 -16
- package/vercel.json +0 -8
- package/vite.config.ts +0 -48
- package/vitest.config.ts +0 -47
- package/vitest.e2e.config.ts +0 -11
- package/vitest.setup.ts +0 -1
- /package/{packages/pilothub/bin → bin}/pilothub.js +0 -0
- /package/{packages/schema/dist → dist/schema}/ark.d.ts +0 -0
- /package/{packages/schema/dist → dist/schema}/ark.js +0 -0
- /package/{packages/schema/dist → dist/schema}/index.d.ts +0 -0
- /package/{packages/schema/dist → dist/schema}/index.js +0 -0
- /package/{packages/schema/dist → dist/schema}/routes.d.ts +0 -0
- /package/{packages/schema/dist → dist/schema}/routes.js +0 -0
- /package/{packages/schema/dist → dist/schema}/textFiles.d.ts +0 -0
- /package/{packages/schema/dist → dist/schema}/textFiles.js +0 -0
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const RAW_TEXT_FILE_EXTENSIONS = [
|
|
2
|
-
'md',
|
|
3
|
-
'mdx',
|
|
4
|
-
'txt',
|
|
5
|
-
'json',
|
|
6
|
-
'json5',
|
|
7
|
-
'yaml',
|
|
8
|
-
'yml',
|
|
9
|
-
'toml',
|
|
10
|
-
'js',
|
|
11
|
-
'cjs',
|
|
12
|
-
'mjs',
|
|
13
|
-
'ts',
|
|
14
|
-
'tsx',
|
|
15
|
-
'jsx',
|
|
16
|
-
'py',
|
|
17
|
-
'sh',
|
|
18
|
-
'rb',
|
|
19
|
-
'go',
|
|
20
|
-
'rs',
|
|
21
|
-
'swift',
|
|
22
|
-
'kt',
|
|
23
|
-
'java',
|
|
24
|
-
'cs',
|
|
25
|
-
'cpp',
|
|
26
|
-
'c',
|
|
27
|
-
'h',
|
|
28
|
-
'hpp',
|
|
29
|
-
'sql',
|
|
30
|
-
'csv',
|
|
31
|
-
'ini',
|
|
32
|
-
'cfg',
|
|
33
|
-
'env',
|
|
34
|
-
'xml',
|
|
35
|
-
'html',
|
|
36
|
-
'css',
|
|
37
|
-
'scss',
|
|
38
|
-
'sass',
|
|
39
|
-
'svg',
|
|
40
|
-
] as const
|
|
41
|
-
|
|
42
|
-
export const TEXT_FILE_EXTENSIONS = RAW_TEXT_FILE_EXTENSIONS
|
|
43
|
-
export const TEXT_FILE_EXTENSION_SET = new Set<string>(TEXT_FILE_EXTENSIONS)
|
|
44
|
-
|
|
45
|
-
const RAW_TEXT_CONTENT_TYPES = [
|
|
46
|
-
'application/json',
|
|
47
|
-
'application/xml',
|
|
48
|
-
'application/yaml',
|
|
49
|
-
'application/x-yaml',
|
|
50
|
-
'application/toml',
|
|
51
|
-
'application/javascript',
|
|
52
|
-
'application/typescript',
|
|
53
|
-
'application/markdown',
|
|
54
|
-
'image/svg+xml',
|
|
55
|
-
] as const
|
|
56
|
-
|
|
57
|
-
export const TEXT_CONTENT_TYPES = RAW_TEXT_CONTENT_TYPES
|
|
58
|
-
export const TEXT_CONTENT_TYPE_SET = new Set<string>(TEXT_CONTENT_TYPES)
|
|
59
|
-
|
|
60
|
-
export function isTextContentType(contentType: string) {
|
|
61
|
-
if (!contentType) return false
|
|
62
|
-
const normalized = contentType.split(';', 1)[0]?.trim().toLowerCase() ?? ''
|
|
63
|
-
if (!normalized) return false
|
|
64
|
-
if (normalized.startsWith('text/')) return true
|
|
65
|
-
return TEXT_CONTENT_TYPE_SET.has(normalized)
|
|
66
|
-
}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/* @vitest-environment node */
|
|
2
|
-
import { mkdir, mkdtemp, readFile, stat, writeFile } from 'node:fs/promises'
|
|
3
|
-
import { tmpdir } from 'node:os'
|
|
4
|
-
import { join } from 'node:path'
|
|
5
|
-
import { strToU8, zipSync } from 'fflate'
|
|
6
|
-
import { describe, expect, it } from 'vitest'
|
|
7
|
-
import type { SkillOrigin } from './skills'
|
|
8
|
-
import {
|
|
9
|
-
buildSkillFingerprint,
|
|
10
|
-
extractZipToDir,
|
|
11
|
-
hashSkillFiles,
|
|
12
|
-
hashSkillZip,
|
|
13
|
-
listTextFiles,
|
|
14
|
-
readLockfile,
|
|
15
|
-
readSkillOrigin,
|
|
16
|
-
sha256Hex,
|
|
17
|
-
writeLockfile,
|
|
18
|
-
writeSkillOrigin,
|
|
19
|
-
} from './skills'
|
|
20
|
-
|
|
21
|
-
describe('skills', () => {
|
|
22
|
-
it('extracts zip into directory and skips traversal', async () => {
|
|
23
|
-
const dir = await mkdtemp(join(tmpdir(), 'pilothub-'))
|
|
24
|
-
const zip = zipSync({
|
|
25
|
-
'SKILL.md': strToU8('hello'),
|
|
26
|
-
'../evil.txt': strToU8('nope'),
|
|
27
|
-
})
|
|
28
|
-
await extractZipToDir(new Uint8Array(zip), dir)
|
|
29
|
-
|
|
30
|
-
expect((await readFile(join(dir, 'SKILL.md'), 'utf8')).trim()).toBe('hello')
|
|
31
|
-
await expect(stat(join(dir, '..', 'evil.txt'))).rejects.toBeTruthy()
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('writes and reads lockfile', async () => {
|
|
35
|
-
const workdir = await mkdtemp(join(tmpdir(), 'pilothub-work-'))
|
|
36
|
-
await writeLockfile(workdir, {
|
|
37
|
-
version: 1,
|
|
38
|
-
skills: { demo: { version: '1.0.0', installedAt: 1 } },
|
|
39
|
-
})
|
|
40
|
-
const read = await readLockfile(workdir)
|
|
41
|
-
expect(read.skills.demo?.version).toBe('1.0.0')
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('returns empty lockfile on invalid json', async () => {
|
|
45
|
-
const workdir = await mkdtemp(join(tmpdir(), 'pilothub-work-bad-'))
|
|
46
|
-
await mkdir(join(workdir, '.pilothub'), { recursive: true })
|
|
47
|
-
await writeFile(join(workdir, '.pilothub', 'lock.json'), '{', 'utf8')
|
|
48
|
-
const read = await readLockfile(workdir)
|
|
49
|
-
expect(read).toEqual({ version: 1, skills: {} })
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('returns empty lockfile on schema mismatch', async () => {
|
|
53
|
-
const workdir = await mkdtemp(join(tmpdir(), 'pilothub-work-schema-'))
|
|
54
|
-
await mkdir(join(workdir, '.pilothub'), { recursive: true })
|
|
55
|
-
await writeFile(
|
|
56
|
-
join(workdir, '.pilothub', 'lock.json'),
|
|
57
|
-
JSON.stringify({ version: 1, skills: 'nope' }),
|
|
58
|
-
'utf8',
|
|
59
|
-
)
|
|
60
|
-
const read = await readLockfile(workdir)
|
|
61
|
-
expect(read).toEqual({ version: 1, skills: {} })
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
it('skips dotfiles and node_modules when listing text files', async () => {
|
|
65
|
-
const workdir = await mkdtemp(join(tmpdir(), 'pilothub-files-'))
|
|
66
|
-
await writeFile(join(workdir, 'SKILL.md'), 'hi', 'utf8')
|
|
67
|
-
await writeFile(join(workdir, '.secret.txt'), 'no', 'utf8')
|
|
68
|
-
await mkdir(join(workdir, 'node_modules'), { recursive: true })
|
|
69
|
-
await writeFile(join(workdir, 'node_modules', 'a.txt'), 'no', 'utf8')
|
|
70
|
-
const files = await listTextFiles(workdir)
|
|
71
|
-
expect(files.map((file) => file.relPath)).toEqual(['SKILL.md'])
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
it('respects .gitignore and .pilothubignore', async () => {
|
|
75
|
-
const workdir = await mkdtemp(join(tmpdir(), 'pilothub-ignore-'))
|
|
76
|
-
await writeFile(join(workdir, '.gitignore'), 'ignored.md\n', 'utf8')
|
|
77
|
-
await writeFile(join(workdir, '.pilothubignore'), 'private.md\n', 'utf8')
|
|
78
|
-
await writeFile(join(workdir, 'SKILL.md'), 'hi', 'utf8')
|
|
79
|
-
await writeFile(join(workdir, 'ignored.md'), 'no', 'utf8')
|
|
80
|
-
await writeFile(join(workdir, 'private.md'), 'no', 'utf8')
|
|
81
|
-
await writeFile(join(workdir, 'public.json'), '{}', 'utf8')
|
|
82
|
-
|
|
83
|
-
const files = await listTextFiles(workdir)
|
|
84
|
-
const paths = files.map((file) => file.relPath).sort()
|
|
85
|
-
expect(paths).toEqual(['SKILL.md', 'public.json'])
|
|
86
|
-
expect(files.find((file) => file.relPath === 'SKILL.md')?.contentType).toMatch(/^text\//)
|
|
87
|
-
expect(files.find((file) => file.relPath === 'public.json')?.contentType).toBe(
|
|
88
|
-
'application/json',
|
|
89
|
-
)
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
it('falls back to text/plain for unknown text extensions', async () => {
|
|
93
|
-
const workdir = await mkdtemp(join(tmpdir(), 'pilothub-env-'))
|
|
94
|
-
await writeFile(join(workdir, 'SKILL.md'), 'hi', 'utf8')
|
|
95
|
-
await writeFile(join(workdir, 'config.env'), 'TOKEN=demo', 'utf8')
|
|
96
|
-
const files = await listTextFiles(workdir)
|
|
97
|
-
expect(files.find((file) => file.relPath === 'config.env')?.contentType).toBe('text/plain')
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
it('hashes skill files deterministically', async () => {
|
|
101
|
-
const { fingerprint } = hashSkillFiles([
|
|
102
|
-
{ relPath: 'b.txt', bytes: strToU8('b') },
|
|
103
|
-
{ relPath: 'a.txt', bytes: strToU8('a') },
|
|
104
|
-
])
|
|
105
|
-
const expected = buildSkillFingerprint([
|
|
106
|
-
{ path: 'a.txt', sha256: sha256Hex(strToU8('a')) },
|
|
107
|
-
{ path: 'b.txt', sha256: sha256Hex(strToU8('b')) },
|
|
108
|
-
])
|
|
109
|
-
expect(fingerprint).toBe(expected)
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
it('hashes text files inside a downloaded zip deterministically', () => {
|
|
113
|
-
const zip = zipSync({
|
|
114
|
-
'SKILL.md': strToU8('hello'),
|
|
115
|
-
'notes.md': strToU8('world'),
|
|
116
|
-
'image.png': strToU8('nope'),
|
|
117
|
-
})
|
|
118
|
-
const { fingerprint } = hashSkillZip(new Uint8Array(zip))
|
|
119
|
-
const expected = buildSkillFingerprint([
|
|
120
|
-
{ path: 'SKILL.md', sha256: sha256Hex(strToU8('hello')) },
|
|
121
|
-
{ path: 'notes.md', sha256: sha256Hex(strToU8('world')) },
|
|
122
|
-
])
|
|
123
|
-
expect(fingerprint).toBe(expected)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
it('ignores unsafe or non-text entries when hashing zips', () => {
|
|
127
|
-
const zip = zipSync({
|
|
128
|
-
'SKILL.md': strToU8('hello'),
|
|
129
|
-
'folder/': strToU8(''),
|
|
130
|
-
'../evil.txt': strToU8('nope'),
|
|
131
|
-
'bad\\path.txt': strToU8('nope'),
|
|
132
|
-
'image.png': strToU8('nope'),
|
|
133
|
-
})
|
|
134
|
-
const { files } = hashSkillZip(new Uint8Array(zip))
|
|
135
|
-
expect(files).toEqual([{ path: 'SKILL.md', sha256: sha256Hex(strToU8('hello')), size: 5 }])
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
it('builds fingerprints from valid entries only', () => {
|
|
139
|
-
const fingerprint = buildSkillFingerprint([
|
|
140
|
-
{ path: '', sha256: '' },
|
|
141
|
-
{ path: 'valid.txt', sha256: sha256Hex(strToU8('ok')) },
|
|
142
|
-
])
|
|
143
|
-
const expected = buildSkillFingerprint([
|
|
144
|
-
{ path: 'valid.txt', sha256: sha256Hex(strToU8('ok')) },
|
|
145
|
-
])
|
|
146
|
-
expect(fingerprint).toBe(expected)
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
it('returns null for invalid skill origin metadata', async () => {
|
|
150
|
-
const workdir = await mkdtemp(join(tmpdir(), 'pilothub-origin-'))
|
|
151
|
-
expect(await readSkillOrigin(workdir)).toBeNull()
|
|
152
|
-
|
|
153
|
-
await mkdir(join(workdir, '.pilothub'), { recursive: true })
|
|
154
|
-
await writeFile(
|
|
155
|
-
join(workdir, '.pilothub', 'origin.json'),
|
|
156
|
-
JSON.stringify({ version: 2 }),
|
|
157
|
-
'utf8',
|
|
158
|
-
)
|
|
159
|
-
expect(await readSkillOrigin(workdir)).toBeNull()
|
|
160
|
-
|
|
161
|
-
await writeFile(
|
|
162
|
-
join(workdir, '.pilothub', 'origin.json'),
|
|
163
|
-
JSON.stringify({ version: 1, registry: 'demo', slug: 'x', installedAt: 1 }),
|
|
164
|
-
'utf8',
|
|
165
|
-
)
|
|
166
|
-
expect(await readSkillOrigin(workdir)).toBeNull()
|
|
167
|
-
|
|
168
|
-
await writeFile(
|
|
169
|
-
join(workdir, '.pilothub', 'origin.json'),
|
|
170
|
-
JSON.stringify({
|
|
171
|
-
version: 1,
|
|
172
|
-
registry: 'demo',
|
|
173
|
-
slug: 'x',
|
|
174
|
-
installedVersion: '0.1.0',
|
|
175
|
-
installedAt: 'nope',
|
|
176
|
-
}),
|
|
177
|
-
'utf8',
|
|
178
|
-
)
|
|
179
|
-
expect(await readSkillOrigin(workdir)).toBeNull()
|
|
180
|
-
|
|
181
|
-
const origin: SkillOrigin = {
|
|
182
|
-
version: 1,
|
|
183
|
-
registry: 'https://example.com',
|
|
184
|
-
slug: 'demo',
|
|
185
|
-
installedVersion: '1.2.3',
|
|
186
|
-
installedAt: 123,
|
|
187
|
-
}
|
|
188
|
-
await writeSkillOrigin(workdir, origin)
|
|
189
|
-
expect(await readSkillOrigin(workdir)).toEqual(origin)
|
|
190
|
-
})
|
|
191
|
-
})
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto'
|
|
2
|
-
import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'
|
|
3
|
-
import { dirname, join, relative, resolve, sep } from 'node:path'
|
|
4
|
-
import { unzipSync } from 'fflate'
|
|
5
|
-
import ignore from 'ignore'
|
|
6
|
-
import mime from 'mime'
|
|
7
|
-
import { type Lockfile, LockfileSchema, parseArk, TEXT_FILE_EXTENSION_SET } from './schema/index.js'
|
|
8
|
-
|
|
9
|
-
export type SkillOrigin = {
|
|
10
|
-
version: 1
|
|
11
|
-
registry: string
|
|
12
|
-
slug: string
|
|
13
|
-
installedVersion: string
|
|
14
|
-
installedAt: number
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function extractZipToDir(zipBytes: Uint8Array, targetDir: string) {
|
|
18
|
-
const entries = unzipSync(zipBytes)
|
|
19
|
-
await mkdir(targetDir, { recursive: true })
|
|
20
|
-
for (const [rawPath, data] of Object.entries(entries)) {
|
|
21
|
-
const safePath = sanitizeRelPath(rawPath)
|
|
22
|
-
if (!safePath) continue
|
|
23
|
-
const outPath = join(targetDir, safePath)
|
|
24
|
-
await mkdir(dirname(outPath), { recursive: true })
|
|
25
|
-
await writeFile(outPath, data)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function listTextFiles(root: string) {
|
|
30
|
-
const files: Array<{ relPath: string; bytes: Uint8Array; contentType?: string }> = []
|
|
31
|
-
const absRoot = resolve(root)
|
|
32
|
-
const ig = ignore()
|
|
33
|
-
ig.add(['.git/', 'node_modules/', '.pilothub/'])
|
|
34
|
-
await addIgnoreFile(ig, join(absRoot, '.gitignore'))
|
|
35
|
-
await addIgnoreFile(ig, join(absRoot, '.pilothubignore'))
|
|
36
|
-
|
|
37
|
-
await walk(absRoot, async (absPath) => {
|
|
38
|
-
const relPath = normalizePath(relative(absRoot, absPath))
|
|
39
|
-
if (!relPath) return
|
|
40
|
-
if (ig.ignores(relPath)) return
|
|
41
|
-
const ext = relPath.split('.').at(-1)?.toLowerCase() ?? ''
|
|
42
|
-
if (!ext || !TEXT_FILE_EXTENSION_SET.has(ext)) return
|
|
43
|
-
const buffer = await readFile(absPath)
|
|
44
|
-
const contentType = mime.getType(relPath) ?? 'text/plain'
|
|
45
|
-
files.push({ relPath, bytes: new Uint8Array(buffer), contentType })
|
|
46
|
-
})
|
|
47
|
-
return files
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export type SkillFileHash = { path: string; sha256: string; size: number }
|
|
51
|
-
|
|
52
|
-
export function sha256Hex(bytes: Uint8Array) {
|
|
53
|
-
return createHash('sha256').update(bytes).digest('hex')
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function buildSkillFingerprint(files: Array<{ path: string; sha256: string }>) {
|
|
57
|
-
const normalized = files
|
|
58
|
-
.filter((file) => Boolean(file.path) && Boolean(file.sha256))
|
|
59
|
-
.map((file) => ({ path: file.path, sha256: file.sha256 }))
|
|
60
|
-
.sort((a, b) => a.path.localeCompare(b.path))
|
|
61
|
-
const payload = normalized.map((file) => `${file.path}:${file.sha256}`).join('\n')
|
|
62
|
-
return createHash('sha256').update(payload).digest('hex')
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function hashSkillFiles(files: Array<{ relPath: string; bytes: Uint8Array }>) {
|
|
66
|
-
const hashed = files.map((file) => ({
|
|
67
|
-
path: file.relPath,
|
|
68
|
-
sha256: sha256Hex(file.bytes),
|
|
69
|
-
size: file.bytes.byteLength,
|
|
70
|
-
}))
|
|
71
|
-
return { files: hashed, fingerprint: buildSkillFingerprint(hashed) }
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function hashSkillZip(zipBytes: Uint8Array) {
|
|
75
|
-
const entries = unzipSync(zipBytes)
|
|
76
|
-
const hashed = Object.entries(entries)
|
|
77
|
-
.map(([rawPath, bytes]) => {
|
|
78
|
-
const safePath = sanitizeZipPath(rawPath)
|
|
79
|
-
if (!safePath) return null
|
|
80
|
-
const ext = safePath.split('.').at(-1)?.toLowerCase() ?? ''
|
|
81
|
-
if (!ext || !TEXT_FILE_EXTENSION_SET.has(ext)) return null
|
|
82
|
-
return { path: safePath, sha256: sha256Hex(bytes), size: bytes.byteLength }
|
|
83
|
-
})
|
|
84
|
-
.filter(Boolean) as SkillFileHash[]
|
|
85
|
-
|
|
86
|
-
return { files: hashed, fingerprint: buildSkillFingerprint(hashed) }
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export async function readLockfile(workdir: string): Promise<Lockfile> {
|
|
90
|
-
const path = join(workdir, '.pilothub', 'lock.json')
|
|
91
|
-
try {
|
|
92
|
-
const raw = await readFile(path, 'utf8')
|
|
93
|
-
const parsed = JSON.parse(raw) as unknown
|
|
94
|
-
return parseArk(LockfileSchema, parsed, 'Lockfile')
|
|
95
|
-
} catch {
|
|
96
|
-
return { version: 1, skills: {} }
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export async function writeLockfile(workdir: string, lock: Lockfile) {
|
|
101
|
-
const path = join(workdir, '.pilothub', 'lock.json')
|
|
102
|
-
await mkdir(dirname(path), { recursive: true })
|
|
103
|
-
await writeFile(path, `${JSON.stringify(lock, null, 2)}\n`, 'utf8')
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export async function readSkillOrigin(skillFolder: string): Promise<SkillOrigin | null> {
|
|
107
|
-
const path = join(skillFolder, '.pilothub', 'origin.json')
|
|
108
|
-
try {
|
|
109
|
-
const raw = await readFile(path, 'utf8')
|
|
110
|
-
const parsed = JSON.parse(raw) as Partial<SkillOrigin>
|
|
111
|
-
if (parsed.version !== 1) return null
|
|
112
|
-
if (!parsed.registry || !parsed.slug || !parsed.installedVersion) return null
|
|
113
|
-
if (typeof parsed.installedAt !== 'number' || !Number.isFinite(parsed.installedAt)) return null
|
|
114
|
-
return {
|
|
115
|
-
version: 1,
|
|
116
|
-
registry: String(parsed.registry),
|
|
117
|
-
slug: String(parsed.slug),
|
|
118
|
-
installedVersion: String(parsed.installedVersion),
|
|
119
|
-
installedAt: parsed.installedAt,
|
|
120
|
-
}
|
|
121
|
-
} catch {
|
|
122
|
-
return null
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export async function writeSkillOrigin(skillFolder: string, origin: SkillOrigin) {
|
|
127
|
-
const path = join(skillFolder, '.pilothub', 'origin.json')
|
|
128
|
-
await mkdir(dirname(path), { recursive: true })
|
|
129
|
-
await writeFile(path, `${JSON.stringify(origin, null, 2)}\n`, 'utf8')
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function normalizePath(path: string) {
|
|
133
|
-
return path
|
|
134
|
-
.split(sep)
|
|
135
|
-
.join('/')
|
|
136
|
-
.replace(/^\.\/+/, '')
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function sanitizeRelPath(path: string) {
|
|
140
|
-
const normalized = path.replace(/^\.\/+/, '').replace(/^\/+/, '')
|
|
141
|
-
if (!normalized || normalized.endsWith('/')) return null
|
|
142
|
-
if (normalized.includes('..') || normalized.includes('\\')) return null
|
|
143
|
-
return normalized
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function sanitizeZipPath(path: string) {
|
|
147
|
-
return sanitizeRelPath(path)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
async function walk(dir: string, onFile: (path: string) => Promise<void>) {
|
|
151
|
-
const entries = await readdir(dir, { withFileTypes: true })
|
|
152
|
-
for (const entry of entries) {
|
|
153
|
-
if (entry.name.startsWith('.')) continue
|
|
154
|
-
if (entry.name === 'node_modules') continue
|
|
155
|
-
const full = join(dir, entry.name)
|
|
156
|
-
if (entry.isDirectory()) {
|
|
157
|
-
await walk(full, onFile)
|
|
158
|
-
continue
|
|
159
|
-
}
|
|
160
|
-
if (!entry.isFile()) continue
|
|
161
|
-
await onFile(full)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
async function addIgnoreFile(ig: ReturnType<typeof ignore>, path: string) {
|
|
166
|
-
try {
|
|
167
|
-
const raw = await readFile(path, 'utf8')
|
|
168
|
-
ig.add(raw.split(/\r?\n/))
|
|
169
|
-
} catch {
|
|
170
|
-
// optional
|
|
171
|
-
}
|
|
172
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ES2022",
|
|
5
|
-
"moduleResolution": "Bundler",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": "src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"sourceMap": true,
|
|
11
|
-
"skipLibCheck": true
|
|
12
|
-
},
|
|
13
|
-
"include": ["src/**/*.ts"]
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ark.js","sourceRoot":"","sources":["../src/ark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAInC,MAAM,UAAU,QAAQ,CAAI,MAAuB,EAAE,IAAa,EAAE,KAAa;IAC/E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,MAAM,YAAY,SAAS,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;YAAE,MAAK;QAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAClE,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;QACxC,MAAM,WAAW,GACf,OAAQ,KAAmC,CAAC,WAAW,KAAK,QAAQ;YAClE,CAAC,CAAG,KAAiC,CAAC,WAAsB;YAC5D,CAAC,CAAC,eAAe,CAAA;QACrB,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,GAAG,WAAW,EAAE,CAAC,CAAA;IACzC,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,OAAO,CAAC,CAAA;IACpD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACxD,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ,EAAE,eAAe;IACzB,MAAM,EAAE,aAAa;IACrB,KAAK,EAAE,YAAY;IACnB,YAAY,EAAE,oBAAoB;IAClC,SAAS,EAAE,iBAAiB;IAC5B,YAAY,EAAE,qBAAqB;IACnC,UAAU,EAAE,kBAAkB;IAC9B,gBAAgB,EAAE,yBAAyB;IAC3C,cAAc,EAAE,uBAAuB;IACvC,gBAAgB,EAAE,yBAAyB;CACnC,CAAA;AAEV,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,gBAAgB;CAChB,CAAA"}
|
|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,GAAG,CAAC,UAAU,CAAC,CAAA;AAC9C,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pilothub-schema",
|
|
3
|
-
"version": "0.0.2",
|
|
4
|
-
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": {
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"default": "./dist/index.js"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"README.md"
|
|
15
|
-
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc -p tsconfig.json",
|
|
18
|
-
"prepublishOnly": "npm run build"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"arktype": "^2.1.29"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"typescript": "^5.9.3"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ArkErrors } from 'arktype'
|
|
2
|
-
|
|
3
|
-
export type ArkValidator<T> = (data: unknown) => T | ArkErrors
|
|
4
|
-
|
|
5
|
-
export function parseArk<T>(schema: ArkValidator<T>, data: unknown, label: string) {
|
|
6
|
-
const result = schema(data)
|
|
7
|
-
if (result instanceof ArkErrors) {
|
|
8
|
-
throw new Error(`${label}: ${formatArkErrors(result)}`)
|
|
9
|
-
}
|
|
10
|
-
return result
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function formatArkErrors(errors: ArkErrors) {
|
|
14
|
-
const parts: string[] = []
|
|
15
|
-
for (const error of errors) {
|
|
16
|
-
if (parts.length >= 3) break
|
|
17
|
-
const path = Array.isArray(error.path) ? error.path.join('.') : ''
|
|
18
|
-
const location = path ? `${path}: ` : ''
|
|
19
|
-
const description =
|
|
20
|
-
typeof (error as { description?: unknown }).description === 'string'
|
|
21
|
-
? ((error as { description: string }).description as string)
|
|
22
|
-
: 'invalid value'
|
|
23
|
-
parts.push(`${location}${description}`)
|
|
24
|
-
}
|
|
25
|
-
if (errors.count > parts.length) {
|
|
26
|
-
parts.push(`+${errors.count - parts.length} more`)
|
|
27
|
-
}
|
|
28
|
-
return parts.join('; ')
|
|
29
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const LegacyApiRoutes = {
|
|
2
|
-
download: '/api/download',
|
|
3
|
-
search: '/api/search',
|
|
4
|
-
skill: '/api/skill',
|
|
5
|
-
skillResolve: '/api/skill/resolve',
|
|
6
|
-
cliWhoami: '/api/cli/whoami',
|
|
7
|
-
cliUploadUrl: '/api/cli/upload-url',
|
|
8
|
-
cliPublish: '/api/cli/publish',
|
|
9
|
-
cliTelemetrySync: '/api/cli/telemetry/sync',
|
|
10
|
-
cliSkillDelete: '/api/cli/skill/delete',
|
|
11
|
-
cliSkillUndelete: '/api/cli/skill/undelete',
|
|
12
|
-
} as const
|
|
13
|
-
|
|
14
|
-
export const ApiRoutes = {
|
|
15
|
-
search: '/api/v1/search',
|
|
16
|
-
resolve: '/api/v1/resolve',
|
|
17
|
-
download: '/api/v1/download',
|
|
18
|
-
skills: '/api/v1/skills',
|
|
19
|
-
stars: '/api/v1/stars',
|
|
20
|
-
souls: '/api/v1/souls',
|
|
21
|
-
whoami: '/api/v1/whoami',
|
|
22
|
-
} as const
|