@nimblebrain/mpak 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -383
- package/dist/index.d.ts +0 -2
- package/dist/index.js +2117 -4
- package/dist/index.js.map +1 -1
- package/package.json +26 -23
- package/.claude/settings.local.json +0 -19
- package/.env.example +0 -13
- package/.github/workflows/ci.yml +0 -27
- package/CLAUDE.md +0 -283
- package/LICENSE +0 -201
- package/dist/commands/config.d.ts +0 -31
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -129
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/packages/pull.d.ts +0 -11
- package/dist/commands/packages/pull.d.ts.map +0 -1
- package/dist/commands/packages/pull.js +0 -72
- package/dist/commands/packages/pull.js.map +0 -1
- package/dist/commands/packages/run.d.ts +0 -47
- package/dist/commands/packages/run.d.ts.map +0 -1
- package/dist/commands/packages/run.js +0 -419
- package/dist/commands/packages/run.js.map +0 -1
- package/dist/commands/packages/search.d.ts +0 -12
- package/dist/commands/packages/search.d.ts.map +0 -1
- package/dist/commands/packages/search.js +0 -63
- package/dist/commands/packages/search.js.map +0 -1
- package/dist/commands/packages/show.d.ts +0 -8
- package/dist/commands/packages/show.d.ts.map +0 -1
- package/dist/commands/packages/show.js +0 -109
- package/dist/commands/packages/show.js.map +0 -1
- package/dist/commands/search.d.ts +0 -12
- package/dist/commands/search.d.ts.map +0 -1
- package/dist/commands/search.js +0 -144
- package/dist/commands/search.js.map +0 -1
- package/dist/commands/skills/index.d.ts +0 -8
- package/dist/commands/skills/index.d.ts.map +0 -1
- package/dist/commands/skills/index.js +0 -8
- package/dist/commands/skills/index.js.map +0 -1
- package/dist/commands/skills/install.d.ts +0 -9
- package/dist/commands/skills/install.d.ts.map +0 -1
- package/dist/commands/skills/install.js +0 -110
- package/dist/commands/skills/install.js.map +0 -1
- package/dist/commands/skills/list.d.ts +0 -8
- package/dist/commands/skills/list.d.ts.map +0 -1
- package/dist/commands/skills/list.js +0 -89
- package/dist/commands/skills/list.js.map +0 -1
- package/dist/commands/skills/pack.d.ts +0 -22
- package/dist/commands/skills/pack.d.ts.map +0 -1
- package/dist/commands/skills/pack.js +0 -116
- package/dist/commands/skills/pack.js.map +0 -1
- package/dist/commands/skills/pull.d.ts +0 -9
- package/dist/commands/skills/pull.d.ts.map +0 -1
- package/dist/commands/skills/pull.js +0 -68
- package/dist/commands/skills/pull.js.map +0 -1
- package/dist/commands/skills/search.d.ts +0 -14
- package/dist/commands/skills/search.d.ts.map +0 -1
- package/dist/commands/skills/search.js +0 -53
- package/dist/commands/skills/search.js.map +0 -1
- package/dist/commands/skills/show.d.ts +0 -8
- package/dist/commands/skills/show.d.ts.map +0 -1
- package/dist/commands/skills/show.js +0 -64
- package/dist/commands/skills/show.js.map +0 -1
- package/dist/commands/skills/validate.d.ts +0 -25
- package/dist/commands/skills/validate.d.ts.map +0 -1
- package/dist/commands/skills/validate.js +0 -191
- package/dist/commands/skills/validate.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/api/registry-client.d.ts +0 -63
- package/dist/lib/api/registry-client.d.ts.map +0 -1
- package/dist/lib/api/registry-client.js +0 -167
- package/dist/lib/api/registry-client.js.map +0 -1
- package/dist/lib/api/skills-client.d.ts +0 -30
- package/dist/lib/api/skills-client.d.ts.map +0 -1
- package/dist/lib/api/skills-client.js +0 -110
- package/dist/lib/api/skills-client.js.map +0 -1
- package/dist/program.d.ts +0 -12
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js +0 -186
- package/dist/program.js.map +0 -1
- package/dist/schemas/generated/api-responses.d.ts +0 -541
- package/dist/schemas/generated/api-responses.d.ts.map +0 -1
- package/dist/schemas/generated/api-responses.js +0 -313
- package/dist/schemas/generated/api-responses.js.map +0 -1
- package/dist/schemas/generated/auth.d.ts +0 -18
- package/dist/schemas/generated/auth.d.ts.map +0 -1
- package/dist/schemas/generated/auth.js +0 -18
- package/dist/schemas/generated/auth.js.map +0 -1
- package/dist/schemas/generated/index.d.ts +0 -5
- package/dist/schemas/generated/index.d.ts.map +0 -1
- package/dist/schemas/generated/index.js +0 -6
- package/dist/schemas/generated/index.js.map +0 -1
- package/dist/schemas/generated/package.d.ts +0 -43
- package/dist/schemas/generated/package.d.ts.map +0 -1
- package/dist/schemas/generated/package.js +0 -20
- package/dist/schemas/generated/package.js.map +0 -1
- package/dist/schemas/generated/skill.d.ts +0 -381
- package/dist/schemas/generated/skill.d.ts.map +0 -1
- package/dist/schemas/generated/skill.js +0 -216
- package/dist/schemas/generated/skill.js.map +0 -1
- package/dist/utils/config-manager.d.ts +0 -66
- package/dist/utils/config-manager.d.ts.map +0 -1
- package/dist/utils/config-manager.js +0 -193
- package/dist/utils/config-manager.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -12
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -27
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/version.d.ts +0 -5
- package/dist/utils/version.d.ts.map +0 -1
- package/dist/utils/version.js +0 -19
- package/dist/utils/version.js.map +0 -1
- package/eslint.config.js +0 -63
- package/src/commands/config.ts +0 -162
- package/src/commands/packages/pull.ts +0 -96
- package/src/commands/packages/run.test.ts +0 -261
- package/src/commands/packages/run.ts +0 -536
- package/src/commands/packages/search.ts +0 -83
- package/src/commands/packages/show.ts +0 -128
- package/src/commands/search.ts +0 -191
- package/src/commands/skills/index.ts +0 -7
- package/src/commands/skills/install.ts +0 -129
- package/src/commands/skills/list.ts +0 -116
- package/src/commands/skills/pack.test.ts +0 -260
- package/src/commands/skills/pack.ts +0 -145
- package/src/commands/skills/pull.ts +0 -88
- package/src/commands/skills/search.ts +0 -73
- package/src/commands/skills/show.ts +0 -72
- package/src/commands/skills/validate.test.ts +0 -466
- package/src/commands/skills/validate.ts +0 -227
- package/src/index.ts +0 -11
- package/src/lib/api/registry-client.ts +0 -223
- package/src/lib/api/schema.d.ts +0 -520
- package/src/lib/api/skills-client.ts +0 -148
- package/src/program.test.ts +0 -22
- package/src/program.ts +0 -226
- package/src/schemas/config.v1.schema.json +0 -37
- package/src/schemas/generated/api-responses.ts +0 -386
- package/src/schemas/generated/auth.ts +0 -21
- package/src/schemas/generated/index.ts +0 -5
- package/src/schemas/generated/package.ts +0 -29
- package/src/schemas/generated/skill.ts +0 -271
- package/src/utils/config-manager.test.ts +0 -330
- package/src/utils/config-manager.ts +0 -272
- package/src/utils/errors.test.ts +0 -25
- package/src/utils/errors.ts +0 -33
- package/src/utils/version.test.ts +0 -16
- package/src/utils/version.ts +0 -18
- package/test/integration/registry-client.test.ts +0 -180
- package/tsconfig.check.json +0 -9
- package/tsconfig.json +0 -25
- package/vitest.config.ts +0 -14
package/src/program.ts
DELETED
|
@@ -1,226 +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
|
-
// Top-level run alias (for Claude Code integration)
|
|
59
|
-
// ==========================================================================
|
|
60
|
-
|
|
61
|
-
program
|
|
62
|
-
.command('run [package]')
|
|
63
|
-
.description('Run an MCP server (alias for "bundle run")')
|
|
64
|
-
.option('--update', 'Force re-download even if cached')
|
|
65
|
-
.option('-l, --local <path>', 'Run a local .mcpb bundle file')
|
|
66
|
-
.action(async (packageSpec, options) => {
|
|
67
|
-
await handleRun(packageSpec || '', options);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// ==========================================================================
|
|
71
|
-
// Bundle namespace (MCP bundles)
|
|
72
|
-
// ==========================================================================
|
|
73
|
-
|
|
74
|
-
const bundle = program.command('bundle').description('MCP bundle commands');
|
|
75
|
-
|
|
76
|
-
bundle
|
|
77
|
-
.command('search <query>')
|
|
78
|
-
.description('Search public bundles')
|
|
79
|
-
.option('--type <type>', 'Filter by server type (node, python, binary)')
|
|
80
|
-
.option('--sort <field>', 'Sort by: downloads, recent, name')
|
|
81
|
-
.option('--limit <number>', 'Limit results', parseInt)
|
|
82
|
-
.option('--offset <number>', 'Pagination offset', parseInt)
|
|
83
|
-
.option('--json', 'Output as JSON')
|
|
84
|
-
.action(async (query, options) => {
|
|
85
|
-
await handleSearch(query, options);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
bundle
|
|
89
|
-
.command('show <package>')
|
|
90
|
-
.description('Show detailed information about a bundle')
|
|
91
|
-
.option('--json', 'Output as JSON')
|
|
92
|
-
.action(async (packageName, options) => {
|
|
93
|
-
await handleShow(packageName, options);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
bundle
|
|
97
|
-
.command('pull <package>')
|
|
98
|
-
.description('Download a bundle from the registry')
|
|
99
|
-
.option('-o, --output <path>', 'Output file path')
|
|
100
|
-
.option('--os <os>', 'Target OS (darwin, linux, win32)')
|
|
101
|
-
.option('--arch <arch>', 'Target architecture (x64, arm64)')
|
|
102
|
-
.option('--json', 'Output download info as JSON')
|
|
103
|
-
.action(async (packageSpec, options) => {
|
|
104
|
-
await handlePull(packageSpec, options);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
bundle
|
|
108
|
-
.command('run [package]')
|
|
109
|
-
.description('Run an MCP server from the registry')
|
|
110
|
-
.option('--update', 'Force re-download even if cached')
|
|
111
|
-
.option('-l, --local <path>', 'Run a local .mcpb bundle file')
|
|
112
|
-
.action(async (packageSpec, options) => {
|
|
113
|
-
await handleRun(packageSpec || '', options);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// ==========================================================================
|
|
117
|
-
// Skill namespace (Agent Skills)
|
|
118
|
-
// ==========================================================================
|
|
119
|
-
|
|
120
|
-
const skill = program.command('skill').description('Agent skill commands');
|
|
121
|
-
|
|
122
|
-
skill
|
|
123
|
-
.command('validate <path>')
|
|
124
|
-
.description('Validate a skill directory against the Agent Skills spec')
|
|
125
|
-
.option('--json', 'Output as JSON')
|
|
126
|
-
.action(async (path, options) => {
|
|
127
|
-
await handleSkillValidate(path, options);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
skill
|
|
131
|
-
.command('pack <path>')
|
|
132
|
-
.description('Create a .skill bundle from a skill directory')
|
|
133
|
-
.option('-o, --output <path>', 'Output file path')
|
|
134
|
-
.option('--json', 'Output as JSON')
|
|
135
|
-
.action(async (path, options) => {
|
|
136
|
-
await handleSkillPack(path, options);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
skill
|
|
140
|
-
.command('search <query>')
|
|
141
|
-
.description('Search skills in the registry')
|
|
142
|
-
.option('--tags <tags>', 'Filter by tags (comma-separated)')
|
|
143
|
-
.option('--category <category>', 'Filter by category')
|
|
144
|
-
.option('--surface <surface>', 'Filter by surface (claude-code, claude-api, claude-ai)')
|
|
145
|
-
.option('--sort <field>', 'Sort by: downloads, recent, name')
|
|
146
|
-
.option('--limit <number>', 'Limit results', parseInt)
|
|
147
|
-
.option('--offset <number>', 'Pagination offset', parseInt)
|
|
148
|
-
.option('--json', 'Output as JSON')
|
|
149
|
-
.action(async (query, options) => {
|
|
150
|
-
await handleSkillSearch(query, options);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
skill
|
|
154
|
-
.command('show <name>')
|
|
155
|
-
.description('Show detailed information about a skill')
|
|
156
|
-
.option('--json', 'Output as JSON')
|
|
157
|
-
.action(async (name, options) => {
|
|
158
|
-
await handleSkillShow(name, options);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
skill
|
|
162
|
-
.command('pull <name>')
|
|
163
|
-
.description('Download a .skill bundle from the registry')
|
|
164
|
-
.option('-o, --output <path>', 'Output file path')
|
|
165
|
-
.option('--json', 'Output as JSON')
|
|
166
|
-
.action(async (name, options) => {
|
|
167
|
-
await handleSkillPull(name, options);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
skill
|
|
171
|
-
.command('install <name>')
|
|
172
|
-
.description('Install a skill to ~/.claude/skills/')
|
|
173
|
-
.option('--force', 'Overwrite existing installation')
|
|
174
|
-
.option('--json', 'Output as JSON')
|
|
175
|
-
.action(async (name, options) => {
|
|
176
|
-
await handleSkillInstall(name, options);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
skill
|
|
180
|
-
.command('list')
|
|
181
|
-
.description('List installed skills')
|
|
182
|
-
.option('--json', 'Output as JSON')
|
|
183
|
-
.action(async (options) => {
|
|
184
|
-
await handleSkillList(options);
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
// ==========================================================================
|
|
188
|
-
// Config commands (shared for bundles and skills)
|
|
189
|
-
// ==========================================================================
|
|
190
|
-
|
|
191
|
-
const configCmd = program
|
|
192
|
-
.command('config')
|
|
193
|
-
.description('Manage per-package configuration values');
|
|
194
|
-
|
|
195
|
-
configCmd
|
|
196
|
-
.command('set <package> <key=value...>')
|
|
197
|
-
.description('Set config value(s) for a package')
|
|
198
|
-
.action(async (packageName, keyValuePairs) => {
|
|
199
|
-
await handleConfigSet(packageName, keyValuePairs);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
configCmd
|
|
203
|
-
.command('get <package>')
|
|
204
|
-
.description('Show stored config for a package (values are masked)')
|
|
205
|
-
.option('--json', 'Output as JSON')
|
|
206
|
-
.action(async (packageName, options) => {
|
|
207
|
-
await handleConfigGet(packageName, options);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
configCmd
|
|
211
|
-
.command('list')
|
|
212
|
-
.description('List all packages with stored config')
|
|
213
|
-
.option('--json', 'Output as JSON')
|
|
214
|
-
.action(async (options) => {
|
|
215
|
-
await handleConfigList(options);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
configCmd
|
|
219
|
-
.command('clear <package> [key]')
|
|
220
|
-
.description('Clear config for a package (all values or specific key)')
|
|
221
|
-
.action(async (packageName, key) => {
|
|
222
|
-
await handleConfigClear(packageName, key);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
return program;
|
|
226
|
-
}
|
|
@@ -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>;
|