@nimblebrain/mpak 0.0.2 → 0.2.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 (151) hide show
  1. package/LICENSE +10 -198
  2. package/README.md +50 -360
  3. package/dist/index.d.ts +0 -2
  4. package/dist/index.js +2113 -4
  5. package/dist/index.js.map +1 -1
  6. package/package.json +32 -29
  7. package/.claude/settings.local.json +0 -19
  8. package/.env.example +0 -13
  9. package/.github/workflows/ci.yml +0 -27
  10. package/CLAUDE.md +0 -271
  11. package/dist/commands/config.d.ts +0 -31
  12. package/dist/commands/config.d.ts.map +0 -1
  13. package/dist/commands/config.js +0 -129
  14. package/dist/commands/config.js.map +0 -1
  15. package/dist/commands/packages/pull.d.ts +0 -11
  16. package/dist/commands/packages/pull.d.ts.map +0 -1
  17. package/dist/commands/packages/pull.js +0 -72
  18. package/dist/commands/packages/pull.js.map +0 -1
  19. package/dist/commands/packages/run.d.ts +0 -36
  20. package/dist/commands/packages/run.d.ts.map +0 -1
  21. package/dist/commands/packages/run.js +0 -348
  22. package/dist/commands/packages/run.js.map +0 -1
  23. package/dist/commands/packages/search.d.ts +0 -12
  24. package/dist/commands/packages/search.d.ts.map +0 -1
  25. package/dist/commands/packages/search.js +0 -63
  26. package/dist/commands/packages/search.js.map +0 -1
  27. package/dist/commands/packages/show.d.ts +0 -8
  28. package/dist/commands/packages/show.d.ts.map +0 -1
  29. package/dist/commands/packages/show.js +0 -109
  30. package/dist/commands/packages/show.js.map +0 -1
  31. package/dist/commands/search.d.ts +0 -12
  32. package/dist/commands/search.d.ts.map +0 -1
  33. package/dist/commands/search.js +0 -144
  34. package/dist/commands/search.js.map +0 -1
  35. package/dist/commands/skills/index.d.ts +0 -8
  36. package/dist/commands/skills/index.d.ts.map +0 -1
  37. package/dist/commands/skills/index.js +0 -8
  38. package/dist/commands/skills/index.js.map +0 -1
  39. package/dist/commands/skills/install.d.ts +0 -9
  40. package/dist/commands/skills/install.d.ts.map +0 -1
  41. package/dist/commands/skills/install.js +0 -110
  42. package/dist/commands/skills/install.js.map +0 -1
  43. package/dist/commands/skills/list.d.ts +0 -8
  44. package/dist/commands/skills/list.d.ts.map +0 -1
  45. package/dist/commands/skills/list.js +0 -89
  46. package/dist/commands/skills/list.js.map +0 -1
  47. package/dist/commands/skills/pack.d.ts +0 -22
  48. package/dist/commands/skills/pack.d.ts.map +0 -1
  49. package/dist/commands/skills/pack.js +0 -116
  50. package/dist/commands/skills/pack.js.map +0 -1
  51. package/dist/commands/skills/pull.d.ts +0 -9
  52. package/dist/commands/skills/pull.d.ts.map +0 -1
  53. package/dist/commands/skills/pull.js +0 -68
  54. package/dist/commands/skills/pull.js.map +0 -1
  55. package/dist/commands/skills/search.d.ts +0 -14
  56. package/dist/commands/skills/search.d.ts.map +0 -1
  57. package/dist/commands/skills/search.js +0 -53
  58. package/dist/commands/skills/search.js.map +0 -1
  59. package/dist/commands/skills/show.d.ts +0 -8
  60. package/dist/commands/skills/show.d.ts.map +0 -1
  61. package/dist/commands/skills/show.js +0 -64
  62. package/dist/commands/skills/show.js.map +0 -1
  63. package/dist/commands/skills/validate.d.ts +0 -25
  64. package/dist/commands/skills/validate.d.ts.map +0 -1
  65. package/dist/commands/skills/validate.js +0 -191
  66. package/dist/commands/skills/validate.js.map +0 -1
  67. package/dist/index.d.ts.map +0 -1
  68. package/dist/lib/api/registry-client.d.ts +0 -63
  69. package/dist/lib/api/registry-client.d.ts.map +0 -1
  70. package/dist/lib/api/registry-client.js +0 -167
  71. package/dist/lib/api/registry-client.js.map +0 -1
  72. package/dist/lib/api/skills-client.d.ts +0 -30
  73. package/dist/lib/api/skills-client.d.ts.map +0 -1
  74. package/dist/lib/api/skills-client.js +0 -110
  75. package/dist/lib/api/skills-client.js.map +0 -1
  76. package/dist/program.d.ts +0 -12
  77. package/dist/program.d.ts.map +0 -1
  78. package/dist/program.js +0 -174
  79. package/dist/program.js.map +0 -1
  80. package/dist/schemas/generated/api-responses.d.ts +0 -541
  81. package/dist/schemas/generated/api-responses.d.ts.map +0 -1
  82. package/dist/schemas/generated/api-responses.js +0 -313
  83. package/dist/schemas/generated/api-responses.js.map +0 -1
  84. package/dist/schemas/generated/auth.d.ts +0 -18
  85. package/dist/schemas/generated/auth.d.ts.map +0 -1
  86. package/dist/schemas/generated/auth.js +0 -18
  87. package/dist/schemas/generated/auth.js.map +0 -1
  88. package/dist/schemas/generated/index.d.ts +0 -5
  89. package/dist/schemas/generated/index.d.ts.map +0 -1
  90. package/dist/schemas/generated/index.js +0 -6
  91. package/dist/schemas/generated/index.js.map +0 -1
  92. package/dist/schemas/generated/package.d.ts +0 -43
  93. package/dist/schemas/generated/package.d.ts.map +0 -1
  94. package/dist/schemas/generated/package.js +0 -20
  95. package/dist/schemas/generated/package.js.map +0 -1
  96. package/dist/schemas/generated/skill.d.ts +0 -381
  97. package/dist/schemas/generated/skill.d.ts.map +0 -1
  98. package/dist/schemas/generated/skill.js +0 -216
  99. package/dist/schemas/generated/skill.js.map +0 -1
  100. package/dist/utils/config-manager.d.ts +0 -66
  101. package/dist/utils/config-manager.d.ts.map +0 -1
  102. package/dist/utils/config-manager.js +0 -193
  103. package/dist/utils/config-manager.js.map +0 -1
  104. package/dist/utils/errors.d.ts +0 -12
  105. package/dist/utils/errors.d.ts.map +0 -1
  106. package/dist/utils/errors.js +0 -27
  107. package/dist/utils/errors.js.map +0 -1
  108. package/dist/utils/version.d.ts +0 -5
  109. package/dist/utils/version.d.ts.map +0 -1
  110. package/dist/utils/version.js +0 -19
  111. package/dist/utils/version.js.map +0 -1
  112. package/eslint.config.js +0 -63
  113. package/src/commands/config.ts +0 -162
  114. package/src/commands/packages/pull.ts +0 -96
  115. package/src/commands/packages/run.test.ts +0 -222
  116. package/src/commands/packages/run.ts +0 -451
  117. package/src/commands/packages/search.ts +0 -83
  118. package/src/commands/packages/show.ts +0 -128
  119. package/src/commands/search.ts +0 -191
  120. package/src/commands/skills/index.ts +0 -7
  121. package/src/commands/skills/install.ts +0 -129
  122. package/src/commands/skills/list.ts +0 -116
  123. package/src/commands/skills/pack.test.ts +0 -260
  124. package/src/commands/skills/pack.ts +0 -145
  125. package/src/commands/skills/pull.ts +0 -88
  126. package/src/commands/skills/search.ts +0 -73
  127. package/src/commands/skills/show.ts +0 -72
  128. package/src/commands/skills/validate.test.ts +0 -466
  129. package/src/commands/skills/validate.ts +0 -227
  130. package/src/index.ts +0 -11
  131. package/src/lib/api/registry-client.ts +0 -223
  132. package/src/lib/api/schema.d.ts +0 -520
  133. package/src/lib/api/skills-client.ts +0 -148
  134. package/src/program.test.ts +0 -22
  135. package/src/program.ts +0 -212
  136. package/src/schemas/config.v1.schema.json +0 -37
  137. package/src/schemas/generated/api-responses.ts +0 -386
  138. package/src/schemas/generated/auth.ts +0 -21
  139. package/src/schemas/generated/index.ts +0 -5
  140. package/src/schemas/generated/package.ts +0 -29
  141. package/src/schemas/generated/skill.ts +0 -271
  142. package/src/utils/config-manager.test.ts +0 -330
  143. package/src/utils/config-manager.ts +0 -272
  144. package/src/utils/errors.test.ts +0 -25
  145. package/src/utils/errors.ts +0 -33
  146. package/src/utils/version.test.ts +0 -16
  147. package/src/utils/version.ts +0 -18
  148. package/test/integration/registry-client.test.ts +0 -180
  149. package/tsconfig.check.json +0 -9
  150. package/tsconfig.json +0 -25
  151. package/vitest.config.ts +0 -14
package/src/program.ts DELETED
@@ -1,212 +0,0 @@
1
- import { Command } from 'commander';
2
- import { getVersion } from './utils/version.js';
3
- import { handleUnifiedSearch } from './commands/search.js';
4
- import { handleSearch } from './commands/packages/search.js';
5
- import { handleShow } from './commands/packages/show.js';
6
- import { handlePull } from './commands/packages/pull.js';
7
- import { handleRun } from './commands/packages/run.js';
8
- import {
9
- handleConfigSet,
10
- handleConfigGet,
11
- handleConfigList,
12
- handleConfigClear,
13
- } from './commands/config.js';
14
- import {
15
- handleSkillValidate,
16
- handleSkillPack,
17
- handleSkillSearch,
18
- handleSkillShow,
19
- handleSkillPull,
20
- handleSkillInstall,
21
- handleSkillList,
22
- } from './commands/skills/index.js';
23
-
24
- /**
25
- * Creates and configures the CLI program
26
- *
27
- * Command structure:
28
- * - mpak search <query> - Unified search (bundles + skills)
29
- * - mpak bundle <command> - MCP bundle commands
30
- * - mpak skill <command> - Agent skill commands
31
- * - mpak config <command> - Configuration commands
32
- */
33
- export function createProgram(): Command {
34
- const program = new Command();
35
-
36
- program
37
- .name('mpak')
38
- .description('CLI for MCP bundles and Agent Skills')
39
- .version(getVersion(), '-v, --version', 'Output the current version');
40
-
41
- // ==========================================================================
42
- // Unified search (bundles + skills)
43
- // ==========================================================================
44
-
45
- program
46
- .command('search <query>')
47
- .description('Search bundles and skills')
48
- .option('--type <type>', 'Filter by type (bundle, skill)')
49
- .option('--sort <field>', 'Sort by: downloads, recent, name')
50
- .option('--limit <number>', 'Limit results', parseInt)
51
- .option('--offset <number>', 'Pagination offset', parseInt)
52
- .option('--json', 'Output as JSON')
53
- .action(async (query, options) => {
54
- await handleUnifiedSearch(query, options);
55
- });
56
-
57
- // ==========================================================================
58
- // Bundle namespace (MCP bundles)
59
- // ==========================================================================
60
-
61
- const bundle = program.command('bundle').description('MCP bundle commands');
62
-
63
- bundle
64
- .command('search <query>')
65
- .description('Search public bundles')
66
- .option('--type <type>', 'Filter by server type (node, python, binary)')
67
- .option('--sort <field>', 'Sort by: downloads, recent, name')
68
- .option('--limit <number>', 'Limit results', parseInt)
69
- .option('--offset <number>', 'Pagination offset', parseInt)
70
- .option('--json', 'Output as JSON')
71
- .action(async (query, options) => {
72
- await handleSearch(query, options);
73
- });
74
-
75
- bundle
76
- .command('show <package>')
77
- .description('Show detailed information about a bundle')
78
- .option('--json', 'Output as JSON')
79
- .action(async (packageName, options) => {
80
- await handleShow(packageName, options);
81
- });
82
-
83
- bundle
84
- .command('pull <package>')
85
- .description('Download a bundle from the registry')
86
- .option('-o, --output <path>', 'Output file path')
87
- .option('--os <os>', 'Target OS (darwin, linux, win32)')
88
- .option('--arch <arch>', 'Target architecture (x64, arm64)')
89
- .option('--json', 'Output download info as JSON')
90
- .action(async (packageSpec, options) => {
91
- await handlePull(packageSpec, options);
92
- });
93
-
94
- bundle
95
- .command('run <package>')
96
- .description('Run an MCP server from the registry')
97
- .option('--update', 'Force re-download even if cached')
98
- .action(async (packageSpec, options) => {
99
- await handleRun(packageSpec, options);
100
- });
101
-
102
- // ==========================================================================
103
- // Skill namespace (Agent Skills)
104
- // ==========================================================================
105
-
106
- const skill = program.command('skill').description('Agent skill commands');
107
-
108
- skill
109
- .command('validate <path>')
110
- .description('Validate a skill directory against the Agent Skills spec')
111
- .option('--json', 'Output as JSON')
112
- .action(async (path, options) => {
113
- await handleSkillValidate(path, options);
114
- });
115
-
116
- skill
117
- .command('pack <path>')
118
- .description('Create a .skill bundle from a skill directory')
119
- .option('-o, --output <path>', 'Output file path')
120
- .option('--json', 'Output as JSON')
121
- .action(async (path, options) => {
122
- await handleSkillPack(path, options);
123
- });
124
-
125
- skill
126
- .command('search <query>')
127
- .description('Search skills in the registry')
128
- .option('--tags <tags>', 'Filter by tags (comma-separated)')
129
- .option('--category <category>', 'Filter by category')
130
- .option('--surface <surface>', 'Filter by surface (claude-code, claude-api, claude-ai)')
131
- .option('--sort <field>', 'Sort by: downloads, recent, name')
132
- .option('--limit <number>', 'Limit results', parseInt)
133
- .option('--offset <number>', 'Pagination offset', parseInt)
134
- .option('--json', 'Output as JSON')
135
- .action(async (query, options) => {
136
- await handleSkillSearch(query, options);
137
- });
138
-
139
- skill
140
- .command('show <name>')
141
- .description('Show detailed information about a skill')
142
- .option('--json', 'Output as JSON')
143
- .action(async (name, options) => {
144
- await handleSkillShow(name, options);
145
- });
146
-
147
- skill
148
- .command('pull <name>')
149
- .description('Download a .skill bundle from the registry')
150
- .option('-o, --output <path>', 'Output file path')
151
- .option('--json', 'Output as JSON')
152
- .action(async (name, options) => {
153
- await handleSkillPull(name, options);
154
- });
155
-
156
- skill
157
- .command('install <name>')
158
- .description('Install a skill to ~/.claude/skills/')
159
- .option('--force', 'Overwrite existing installation')
160
- .option('--json', 'Output as JSON')
161
- .action(async (name, options) => {
162
- await handleSkillInstall(name, options);
163
- });
164
-
165
- skill
166
- .command('list')
167
- .description('List installed skills')
168
- .option('--json', 'Output as JSON')
169
- .action(async (options) => {
170
- await handleSkillList(options);
171
- });
172
-
173
- // ==========================================================================
174
- // Config commands (shared for bundles and skills)
175
- // ==========================================================================
176
-
177
- const configCmd = program
178
- .command('config')
179
- .description('Manage per-package configuration values');
180
-
181
- configCmd
182
- .command('set <package> <key=value...>')
183
- .description('Set config value(s) for a package')
184
- .action(async (packageName, keyValuePairs) => {
185
- await handleConfigSet(packageName, keyValuePairs);
186
- });
187
-
188
- configCmd
189
- .command('get <package>')
190
- .description('Show stored config for a package (values are masked)')
191
- .option('--json', 'Output as JSON')
192
- .action(async (packageName, options) => {
193
- await handleConfigGet(packageName, options);
194
- });
195
-
196
- configCmd
197
- .command('list')
198
- .description('List all packages with stored config')
199
- .option('--json', 'Output as JSON')
200
- .action(async (options) => {
201
- await handleConfigList(options);
202
- });
203
-
204
- configCmd
205
- .command('clear <package> [key]')
206
- .description('Clear config for a package (all values or specific key)')
207
- .action(async (packageName, key) => {
208
- await handleConfigClear(packageName, key);
209
- });
210
-
211
- return program;
212
- }
@@ -1,37 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://mpak.dev/schemas/config.v1.json",
4
- "title": "mpak CLI Configuration v1",
5
- "description": "Configuration file for the mpak CLI stored at ~/.mpak/config.json",
6
- "type": "object",
7
- "required": ["version", "lastUpdated"],
8
- "additionalProperties": false,
9
- "properties": {
10
- "version": {
11
- "type": "string",
12
- "const": "1.0.0",
13
- "description": "Configuration schema version"
14
- },
15
- "lastUpdated": {
16
- "type": "string",
17
- "format": "date-time",
18
- "description": "ISO 8601 timestamp of last configuration update"
19
- },
20
- "registryUrl": {
21
- "type": "string",
22
- "format": "uri",
23
- "description": "Custom registry URL (overrides default https://api.mpak.dev)"
24
- },
25
- "packages": {
26
- "type": "object",
27
- "description": "Per-package configuration values (user_config)",
28
- "additionalProperties": {
29
- "type": "object",
30
- "description": "Configuration key-value pairs for a specific package",
31
- "additionalProperties": {
32
- "type": "string"
33
- }
34
- }
35
- }
36
- }
37
- }
@@ -1,386 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- // Author schema
4
- export const PackageAuthorSchema = z.object({
5
- name: z.string(),
6
- });
7
-
8
- // Tool schema
9
- export const PackageToolSchema = z.object({
10
- name: z.string(),
11
- description: z.string().optional(),
12
- });
13
-
14
- // GitHub info schema
15
- export const PackageGitHubSchema = z.object({
16
- repo: z.string(),
17
- stars: z.number().nullable(),
18
- forks: z.number().nullable(),
19
- watchers: z.number().nullable(),
20
- updated_at: z.string().nullable().optional(),
21
- });
22
-
23
- // Package list item schema (what comes back from search/list endpoints)
24
- export const PackageSchema = z.object({
25
- name: z.string(), // Full name: 'react' or '@meta/react'
26
- display_name: z.string().nullable(),
27
- description: z.string().nullable(),
28
- author: PackageAuthorSchema.nullable(),
29
- latest_version: z.string(),
30
- icon: z.string().nullable(),
31
- server_type: z.string(),
32
- tools: z.array(PackageToolSchema),
33
- downloads: z.number(),
34
- published_at: z.union([z.string(), z.date()]),
35
- verified: z.boolean(),
36
- claimable: z.boolean().optional(),
37
- claimed: z.boolean().optional(),
38
- github: PackageGitHubSchema.nullable().optional(),
39
- });
40
-
41
- // Artifact schema (platform-specific bundles)
42
- export const ArtifactSchema = z.object({
43
- os: z.string(), // darwin, win32, linux, any
44
- arch: z.string(), // x64, arm64, any
45
- size_bytes: z.number(),
46
- digest: z.string(), // sha256:xxxx format
47
- downloads: z.number(),
48
- });
49
-
50
- // Provenance schema (build/publish attestation)
51
- export const ProvenanceSchema = z.object({
52
- publish_method: z.string().nullable(), // 'oidc' | 'upload' | 'cli'
53
- repository: z.string().nullable(), // GitHub repo (owner/repo)
54
- sha: z.string().nullable(), // Git commit SHA
55
- });
56
-
57
- // Package version schema
58
- export const PackageVersionSchema = z.object({
59
- version: z.string(),
60
- published_at: z.union([z.string(), z.date()]),
61
- downloads: z.number(),
62
- artifacts: z.array(ArtifactSchema).optional(),
63
- readme: z.string().nullable().optional(),
64
- provenance: ProvenanceSchema.nullable().optional(),
65
- release_url: z.string().nullable().optional(),
66
- prerelease: z.boolean().optional(),
67
- manifest: z.record(z.string(), z.unknown()).nullable().optional(),
68
- });
69
-
70
- // Claiming info schema
71
- export const PackageClaimingSchema = z.object({
72
- claimable: z.boolean(),
73
- claimed: z.boolean(),
74
- claimed_by: z.string().nullable(),
75
- claimed_at: z.union([z.string(), z.date()]).nullable(),
76
- github_repo: z.string().nullable(),
77
- });
78
-
79
- // Package detail schema (what comes back from package detail endpoint)
80
- export const PackageDetailSchema = PackageSchema.extend({
81
- homepage: z.string().nullable(),
82
- license: z.string().nullable(),
83
- claiming: PackageClaimingSchema,
84
- versions: z.array(PackageVersionSchema),
85
- });
86
-
87
- // Package search response schema
88
- export const PackageSearchResponseSchema = z.object({
89
- packages: z.array(PackageSchema),
90
- total: z.number(),
91
- });
92
-
93
- // =============================================================================
94
- // V1 Bundle API Schemas
95
- // =============================================================================
96
-
97
- // Platform info schema (os + arch combo)
98
- export const PlatformInfoSchema = z.object({
99
- os: z.string(), // darwin, win32, linux, any
100
- arch: z.string(), // x64, arm64, any
101
- });
102
-
103
- // Full provenance schema (returned by v1 API)
104
- export const FullProvenanceSchema = z.object({
105
- schema_version: z.string(),
106
- provider: z.string(),
107
- repository: z.string(),
108
- sha: z.string(),
109
- });
110
-
111
- // Bundle schema (v1 API - similar to Package but with provenance)
112
- export const BundleSchema = z.object({
113
- name: z.string(),
114
- display_name: z.string().nullable().optional(),
115
- description: z.string().nullable().optional(),
116
- author: PackageAuthorSchema.nullable().optional(),
117
- latest_version: z.string(),
118
- icon: z.string().nullable().optional(),
119
- server_type: z.string().nullable().optional(),
120
- tools: z.array(PackageToolSchema).optional(),
121
- downloads: z.number(),
122
- published_at: z.union([z.string(), z.date()]),
123
- verified: z.boolean(),
124
- provenance: FullProvenanceSchema.nullable().optional(),
125
- });
126
-
127
- // Bundle detail schema (v1 API)
128
- export const BundleDetailSchema = BundleSchema.extend({
129
- homepage: z.string().nullable().optional(),
130
- license: z.string().nullable().optional(),
131
- versions: z.array(z.object({
132
- version: z.string(),
133
- published_at: z.union([z.string(), z.date()]),
134
- downloads: z.number(),
135
- })),
136
- });
137
-
138
- // Bundle search response schema (v1 API)
139
- export const BundleSearchResponseSchema = z.object({
140
- bundles: z.array(BundleSchema),
141
- total: z.number(),
142
- pagination: z.object({
143
- limit: z.number(),
144
- offset: z.number(),
145
- has_more: z.boolean(),
146
- }),
147
- });
148
-
149
- // Version info with platforms (from /v1/bundles/@scope/pkg/versions)
150
- export const VersionInfoSchema = z.object({
151
- version: z.string(),
152
- artifacts_count: z.number(),
153
- platforms: z.array(PlatformInfoSchema),
154
- published_at: z.union([z.string(), z.date()]),
155
- downloads: z.number(),
156
- publish_method: z.string().nullable(),
157
- provenance: FullProvenanceSchema.nullable().optional(),
158
- });
159
-
160
- // Versions response schema (v1 API)
161
- export const VersionsResponseSchema = z.object({
162
- name: z.string(),
163
- latest: z.string(),
164
- versions: z.array(VersionInfoSchema),
165
- });
166
-
167
- // Download info schema (v1 API)
168
- export const DownloadInfoSchema = z.object({
169
- url: z.string(),
170
- bundle: z.object({
171
- name: z.string(),
172
- version: z.string(),
173
- platform: PlatformInfoSchema,
174
- sha256: z.string(),
175
- size: z.number(),
176
- }),
177
- expires_at: z.string().optional(),
178
- });
179
-
180
- // =============================================================================
181
- // Internal API Schemas (used by web UI, not exposed publicly)
182
- // =============================================================================
183
-
184
- // Pagination schema (reusable)
185
- export const PaginationSchema = z.object({
186
- limit: z.number(),
187
- offset: z.number(),
188
- has_more: z.boolean(),
189
- });
190
-
191
- // Publish response schema
192
- export const PublishResponseSchema = z.object({
193
- success: z.boolean(),
194
- package: z.object({
195
- name: z.string(),
196
- version: z.string(),
197
- manifest: z.record(z.string(), z.unknown()),
198
- }),
199
- sha256: z.string(),
200
- size: z.number(),
201
- url: z.string(),
202
- auto_claimed: z.boolean().optional(),
203
- message: z.string().optional(),
204
- });
205
-
206
- // Internal download response schema (different from v1 API)
207
- export const InternalDownloadResponseSchema = z.object({
208
- url: z.string(),
209
- package: z.object({
210
- name: z.string(),
211
- version: z.string(),
212
- sha256: z.string(),
213
- size: z.number(),
214
- }),
215
- expires_at: z.string(),
216
- });
217
-
218
- // Claim status response schema
219
- export const ClaimStatusResponseSchema = z.object({
220
- claimable: z.boolean(),
221
- reason: z.string().optional(),
222
- claimed_by: z.string().nullable().optional(),
223
- claimed_at: z.union([z.string(), z.date()]).nullable().optional(),
224
- package_name: z.string().optional(),
225
- github_repo: z.string().nullable().optional(),
226
- instructions: z.object({
227
- steps: z.array(z.string()),
228
- mpak_json_example: z.string(),
229
- verification_url: z.string().nullable(),
230
- }).optional(),
231
- });
232
-
233
- // Claim response schema
234
- export const ClaimResponseSchema = z.object({
235
- success: z.boolean(),
236
- message: z.string(),
237
- package: z.object({
238
- name: z.string(),
239
- claimed_by: z.string().nullable(),
240
- claimed_at: z.union([z.string(), z.date()]).nullable(),
241
- github_repo: z.string().nullable(),
242
- }),
243
- verification: z.object({
244
- mpak_json_url: z.string().nullable().optional(),
245
- verified_at: z.string(),
246
- }),
247
- });
248
-
249
- // My packages response schema
250
- export const MyPackagesResponseSchema = z.object({
251
- packages: z.array(PackageSchema),
252
- total: z.number(),
253
- pagination: PaginationSchema,
254
- });
255
-
256
- // Unclaimed package schema
257
- export const UnclaimedPackageSchema = z.object({
258
- name: z.string(),
259
- display_name: z.string().nullable(),
260
- description: z.string().nullable(),
261
- server_type: z.string().nullable(),
262
- latest_version: z.string(),
263
- downloads: z.number(),
264
- github_repo: z.string().nullable(),
265
- created_at: z.union([z.string(), z.date()]),
266
- });
267
-
268
- // Unclaimed packages response schema
269
- export const UnclaimedPackagesResponseSchema = z.object({
270
- packages: z.array(UnclaimedPackageSchema),
271
- total: z.number(),
272
- pagination: PaginationSchema,
273
- });
274
-
275
-
276
- // =============================================================================
277
- // V1 API Additional Schemas
278
- // =============================================================================
279
-
280
- // Version detail response schema (specific version with artifacts)
281
- export const VersionDetailSchema = z.object({
282
- name: z.string(),
283
- version: z.string(),
284
- published_at: z.union([z.string(), z.date()]),
285
- downloads: z.number(),
286
- artifacts: z.array(z.object({
287
- platform: PlatformInfoSchema,
288
- digest: z.string(),
289
- size: z.number(),
290
- download_url: z.string(),
291
- source_url: z.string().optional(),
292
- })),
293
- manifest: z.record(z.string(), z.unknown()),
294
- release: z.object({
295
- tag: z.string().nullable(),
296
- url: z.string().nullable(),
297
- }).optional(),
298
- publish_method: z.string().nullable(),
299
- provenance: FullProvenanceSchema.nullable(),
300
- });
301
-
302
- // MCPB Index response schema
303
- export const MCPBIndexSchema = z.object({
304
- index_version: z.string(),
305
- mimeType: z.string(),
306
- name: z.string(),
307
- version: z.string(),
308
- description: z.string().nullable(),
309
- bundles: z.array(z.object({
310
- mimeType: z.string().nullable(),
311
- digest: z.string(),
312
- size: z.number(),
313
- platform: PlatformInfoSchema,
314
- urls: z.array(z.string()),
315
- })),
316
- annotations: z.record(z.string(), z.string()).optional(),
317
- });
318
-
319
- // Announce request schema (per-artifact announcement from GitHub Actions)
320
- export const AnnounceRequestSchema = z.object({
321
- name: z.string(),
322
- version: z.string(),
323
- manifest: z.record(z.string(), z.unknown()),
324
- release_tag: z.string(),
325
- prerelease: z.boolean().optional().default(false),
326
- artifact: z.object({
327
- filename: z.string(),
328
- os: z.string(),
329
- arch: z.string(),
330
- sha256: z.string(),
331
- size: z.number(),
332
- }),
333
- });
334
-
335
- // Announce response schema (per-artifact, idempotent)
336
- export const AnnounceResponseSchema = z.object({
337
- package: z.string(),
338
- version: z.string(),
339
- artifact: z.object({
340
- os: z.string(),
341
- arch: z.string(),
342
- filename: z.string(),
343
- }),
344
- total_artifacts: z.number(),
345
- status: z.enum(['created', 'updated']),
346
- });
347
-
348
- // =============================================================================
349
- // Export TypeScript types
350
- // =============================================================================
351
-
352
- // Core types
353
- export type PackageAuthor = z.infer<typeof PackageAuthorSchema>;
354
- export type PackageTool = z.infer<typeof PackageToolSchema>;
355
- export type PackageGitHub = z.infer<typeof PackageGitHubSchema>;
356
- export type Package = z.infer<typeof PackageSchema>;
357
- export type Artifact = z.infer<typeof ArtifactSchema>;
358
- export type Provenance = z.infer<typeof ProvenanceSchema>;
359
- export type PackageVersion = z.infer<typeof PackageVersionSchema>;
360
- export type PackageClaiming = z.infer<typeof PackageClaimingSchema>;
361
- export type PackageDetail = z.infer<typeof PackageDetailSchema>;
362
- export type PackageSearchResponse = z.infer<typeof PackageSearchResponseSchema>;
363
-
364
- // V1 API types
365
- export type PlatformInfo = z.infer<typeof PlatformInfoSchema>;
366
- export type FullProvenance = z.infer<typeof FullProvenanceSchema>;
367
- export type Bundle = z.infer<typeof BundleSchema>;
368
- export type BundleDetail = z.infer<typeof BundleDetailSchema>;
369
- export type BundleSearchResponse = z.infer<typeof BundleSearchResponseSchema>;
370
- export type VersionInfo = z.infer<typeof VersionInfoSchema>;
371
- export type VersionsResponse = z.infer<typeof VersionsResponseSchema>;
372
- export type DownloadInfo = z.infer<typeof DownloadInfoSchema>;
373
- export type VersionDetail = z.infer<typeof VersionDetailSchema>;
374
- export type MCPBIndex = z.infer<typeof MCPBIndexSchema>;
375
- export type AnnounceRequest = z.infer<typeof AnnounceRequestSchema>;
376
- export type AnnounceResponse = z.infer<typeof AnnounceResponseSchema>;
377
-
378
- // Internal API types
379
- export type Pagination = z.infer<typeof PaginationSchema>;
380
- export type PublishResponse = z.infer<typeof PublishResponseSchema>;
381
- export type InternalDownloadResponse = z.infer<typeof InternalDownloadResponseSchema>;
382
- export type ClaimStatusResponse = z.infer<typeof ClaimStatusResponseSchema>;
383
- export type ClaimResponse = z.infer<typeof ClaimResponseSchema>;
384
- export type MyPackagesResponse = z.infer<typeof MyPackagesResponseSchema>;
385
- export type UnclaimedPackage = z.infer<typeof UnclaimedPackageSchema>;
386
- export type UnclaimedPackagesResponse = z.infer<typeof UnclaimedPackagesResponseSchema>;
@@ -1,21 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- // User profile response from /internal/auth/me
4
- export const UserProfileSchema = z.object({
5
- id: z.string(),
6
- email: z.string().email(),
7
- emailVerified: z.boolean(),
8
- username: z.string().nullable(),
9
- name: z.string().nullable(),
10
- avatarUrl: z.string().nullable(),
11
- githubUsername: z.string().nullable(),
12
- githubLinked: z.boolean(),
13
- verified: z.boolean(),
14
- publishedBundles: z.number(),
15
- totalDownloads: z.number(),
16
- createdAt: z.union([z.string(), z.date()]).nullable(),
17
- lastLoginAt: z.union([z.string(), z.date()]).nullable(),
18
- });
19
-
20
- // Export TypeScript type
21
- export type UserProfile = z.infer<typeof UserProfileSchema>;
@@ -1,5 +0,0 @@
1
- // Export all schemas and types
2
- export * from './package';
3
- export * from './api-responses';
4
- export * from './auth';
5
- export * from './skill';
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- // Server type enum
4
- export const ServerTypeSchema = z.enum(['node', 'python', 'binary']);
5
-
6
- // Platform enum
7
- export const PlatformSchema = z.enum(['darwin', 'win32', 'linux']);
8
-
9
- // Sort options
10
- export const PackageSortSchema = z.enum(['downloads', 'recent', 'name']);
11
-
12
- // Package search params schema
13
- // Query params from HTTP are always strings, but we parse them to proper types
14
- export const PackageSearchParamsSchema = z.object({
15
- q: z.string().optional(),
16
- type: ServerTypeSchema.optional(),
17
- tool: z.string().optional(),
18
- prompt: z.string().optional(),
19
- platform: PlatformSchema.optional(),
20
- sort: PackageSortSchema.optional(),
21
- limit: z.union([z.string(), z.number()]).optional(),
22
- offset: z.union([z.string(), z.number()]).optional(),
23
- });
24
-
25
- // Export TypeScript types
26
- export type ServerType = z.infer<typeof ServerTypeSchema>;
27
- export type Platform = z.infer<typeof PlatformSchema>;
28
- export type PackageSort = z.infer<typeof PackageSortSchema>;
29
- export type PackageSearchParams = z.infer<typeof PackageSearchParamsSchema>;