@nimblebrain/mpak-sdk 0.1.0 → 0.1.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/README.md +93 -45
- package/dist/index.cjs +519 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +292 -0
- package/dist/index.d.ts +288 -35
- package/dist/index.js +477 -35
- package/dist/index.js.map +1 -1
- package/package.json +46 -41
- package/LICENSE +0 -190
- package/dist/client.d.ts +0 -138
- package/dist/client.d.ts.map +0 -1
- package/dist/client.integration.test.d.ts +0 -11
- package/dist/client.integration.test.d.ts.map +0 -1
- package/dist/client.integration.test.js +0 -121
- package/dist/client.integration.test.js.map +0 -1
- package/dist/client.js +0 -430
- package/dist/client.js.map +0 -1
- package/dist/client.test.d.ts +0 -2
- package/dist/client.test.d.ts.map +0 -1
- package/dist/client.test.js +0 -344
- package/dist/client.test.js.map +0 -1
- package/dist/errors.d.ts +0 -30
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -46
- package/dist/errors.js.map +0 -1
- package/dist/errors.test.d.ts +0 -2
- package/dist/errors.test.d.ts.map +0 -1
- package/dist/errors.test.js +0 -136
- package/dist/errors.test.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -146
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -7
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
# @nimblebrain/mpak-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/NimbleBrainInc/mpak/actions/workflows/sdk-typescript-ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@nimblebrain/mpak-sdk)
|
|
5
|
+
[](https://www.npmjs.com/package/@nimblebrain/mpak-sdk)
|
|
6
|
+
[](https://github.com/NimbleBrainInc/mpak/blob/main/packages/sdk-typescript/LICENSE)
|
|
7
|
+
[](https://mpak.dev)
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- Zero runtime dependencies (native `fetch` and `crypto` only)
|
|
8
|
-
- Requires Node.js 18+
|
|
9
|
-
- Type-safe API (types generated from OpenAPI spec)
|
|
10
|
-
- Fail-closed integrity verification
|
|
9
|
+
TypeScript SDK for the mpak registry - search, download, and resolve MCPB bundles and Agent Skills.
|
|
11
10
|
|
|
12
11
|
## Installation
|
|
13
12
|
|
|
14
13
|
```bash
|
|
15
|
-
|
|
14
|
+
pnpm add @nimblebrain/mpak-sdk
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
### Search Bundles
|
|
17
|
+
## Quick Start
|
|
21
18
|
|
|
22
19
|
```typescript
|
|
23
20
|
import { MpakClient } from '@nimblebrain/mpak-sdk';
|
|
@@ -26,12 +23,18 @@ const client = new MpakClient();
|
|
|
26
23
|
|
|
27
24
|
// Search for bundles
|
|
28
25
|
const results = await client.searchBundles({ q: 'mcp', limit: 10 });
|
|
29
|
-
|
|
30
26
|
for (const bundle of results.bundles) {
|
|
31
27
|
console.log(`${bundle.name}@${bundle.latest_version}`);
|
|
32
28
|
}
|
|
29
|
+
|
|
30
|
+
// Get download info
|
|
31
|
+
const download = await client.getBundleDownload('@nimblebraininc/echo', 'latest');
|
|
32
|
+
console.log(`Download URL: ${download.url}`);
|
|
33
|
+
console.log(`SHA256: ${download.bundle.sha256}`);
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
35
38
|
### Get Bundle Details
|
|
36
39
|
|
|
37
40
|
```typescript
|
|
@@ -41,20 +44,6 @@ console.log(bundle.description);
|
|
|
41
44
|
console.log(`Versions: ${bundle.versions.map(v => v.version).join(', ')}`);
|
|
42
45
|
```
|
|
43
46
|
|
|
44
|
-
### Download a Bundle
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
// Get download info for the latest version
|
|
48
|
-
const versions = await client.getBundleVersions('@nimblebraininc/echo');
|
|
49
|
-
const download = await client.getBundleDownload(
|
|
50
|
-
'@nimblebraininc/echo',
|
|
51
|
-
versions.latest
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
console.log(`Download URL: ${download.url}`);
|
|
55
|
-
console.log(`SHA256: ${download.bundle.sha256}`);
|
|
56
|
-
```
|
|
57
|
-
|
|
58
47
|
### Platform-Specific Downloads
|
|
59
48
|
|
|
60
49
|
```typescript
|
|
@@ -99,6 +88,39 @@ console.log(`Verified: ${verified}`);
|
|
|
99
88
|
console.log(content);
|
|
100
89
|
```
|
|
101
90
|
|
|
91
|
+
### Resolve Skill References
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { MpakClient, SkillReference } from '@nimblebrain/mpak-sdk';
|
|
95
|
+
|
|
96
|
+
const client = new MpakClient();
|
|
97
|
+
|
|
98
|
+
// Resolve from mpak registry
|
|
99
|
+
const skill = await client.resolveSkillRef({
|
|
100
|
+
source: 'mpak',
|
|
101
|
+
name: '@nimblebraininc/folk-crm',
|
|
102
|
+
version: '1.3.0',
|
|
103
|
+
});
|
|
104
|
+
console.log(skill.content);
|
|
105
|
+
|
|
106
|
+
// Resolve from GitHub
|
|
107
|
+
const ghSkill = await client.resolveSkillRef({
|
|
108
|
+
source: 'github',
|
|
109
|
+
name: '@example/my-skill',
|
|
110
|
+
version: 'v1.0.0',
|
|
111
|
+
repo: 'owner/repo',
|
|
112
|
+
path: 'skills/my-skill/SKILL.md',
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Resolve from URL
|
|
116
|
+
const urlSkill = await client.resolveSkillRef({
|
|
117
|
+
source: 'url',
|
|
118
|
+
name: '@example/custom',
|
|
119
|
+
version: '1.0.0',
|
|
120
|
+
url: 'https://example.com/skill.md',
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
102
124
|
## Error Handling
|
|
103
125
|
|
|
104
126
|
```typescript
|
|
@@ -131,7 +153,7 @@ try {
|
|
|
131
153
|
|
|
132
154
|
```typescript
|
|
133
155
|
const client = new MpakClient({
|
|
134
|
-
registryUrl: 'https://
|
|
156
|
+
registryUrl: 'https://registry.mpak.dev', // Custom registry URL
|
|
135
157
|
timeout: 30000, // Request timeout in ms
|
|
136
158
|
});
|
|
137
159
|
```
|
|
@@ -155,6 +177,7 @@ const client = new MpakClient({
|
|
|
155
177
|
- `getSkillDownload(name)` - Get latest version download
|
|
156
178
|
- `getSkillVersionDownload(name, version)` - Get specific version download
|
|
157
179
|
- `downloadSkillContent(url, expectedSha256?)` - Download with optional integrity check
|
|
180
|
+
- `resolveSkillRef(ref)` - Resolve a skill reference to content
|
|
158
181
|
|
|
159
182
|
#### Static Methods
|
|
160
183
|
|
|
@@ -171,39 +194,64 @@ const client = new MpakClient({
|
|
|
171
194
|
|
|
172
195
|
```bash
|
|
173
196
|
# Install dependencies
|
|
174
|
-
|
|
197
|
+
pnpm install
|
|
175
198
|
|
|
176
199
|
# Run unit tests
|
|
177
|
-
|
|
200
|
+
pnpm test
|
|
178
201
|
|
|
179
202
|
# Run integration tests (hits real API)
|
|
180
|
-
|
|
203
|
+
pnpm test:integration
|
|
181
204
|
|
|
182
205
|
# Type check
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
# Lint
|
|
186
|
-
npm run lint
|
|
187
|
-
|
|
188
|
-
# Full verification
|
|
189
|
-
npm run verify
|
|
190
|
-
|
|
191
|
-
# Generate types from OpenAPI spec
|
|
192
|
-
npm run generate:types
|
|
206
|
+
pnpm typecheck
|
|
193
207
|
|
|
194
208
|
# Build
|
|
195
|
-
|
|
209
|
+
pnpm build
|
|
196
210
|
```
|
|
197
211
|
|
|
198
|
-
|
|
212
|
+
### Verification
|
|
199
213
|
|
|
200
|
-
|
|
214
|
+
Run all checks before submitting changes:
|
|
201
215
|
|
|
202
216
|
```bash
|
|
203
|
-
|
|
217
|
+
pnpm --filter @nimblebrain/mpak-sdk lint # lint
|
|
218
|
+
pnpm --filter @nimblebrain/mpak-sdk exec prettier --check "src/**/*.ts" "tests/**/*.ts" # format
|
|
219
|
+
pnpm --filter @nimblebrain/mpak-sdk typecheck # type check
|
|
220
|
+
pnpm --filter @nimblebrain/mpak-sdk test # unit tests
|
|
221
|
+
pnpm --filter @nimblebrain/mpak-sdk test:integration # integration tests (hits live registry)
|
|
204
222
|
```
|
|
205
223
|
|
|
206
|
-
|
|
224
|
+
CI runs lint, format check, typecheck, and unit tests on every PR via [`sdk-typescript-ci.yml`](../../.github/workflows/sdk-typescript-ci.yml).
|
|
225
|
+
|
|
226
|
+
## Releasing
|
|
227
|
+
|
|
228
|
+
Releases are automated via GitHub Actions. The publish workflow is triggered by git tags.
|
|
229
|
+
|
|
230
|
+
**Version is defined in one place:** `package.json`.
|
|
231
|
+
|
|
232
|
+
### Steps
|
|
233
|
+
|
|
234
|
+
1. **Bump version** in `package.json`:
|
|
235
|
+
```bash
|
|
236
|
+
cd packages/sdk-typescript
|
|
237
|
+
npm version patch # 0.1.0 -> 0.1.1
|
|
238
|
+
npm version minor # 0.1.0 -> 0.2.0
|
|
239
|
+
npm version major # 0.1.0 -> 1.0.0
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
2. **Commit and push:**
|
|
243
|
+
```bash
|
|
244
|
+
git commit -am "sdk-typescript: bump to X.Y.Z"
|
|
245
|
+
git push
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
3. **Tag and push** (this triggers the publish):
|
|
249
|
+
```bash
|
|
250
|
+
git tag sdk-typescript-vX.Y.Z
|
|
251
|
+
git push origin sdk-typescript-vX.Y.Z
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
CI will run the full verification suite, verify the tag matches `package.json`, build, and publish to npm. See [`sdk-typescript-publish.yml`](../../.github/workflows/sdk-typescript-publish.yml).
|
|
207
255
|
|
|
208
256
|
## License
|
|
209
257
|
|