@nshipster/sosumi 1.0.0 → 1.0.4
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 +36 -15
- package/bin/sosumi.mjs +0 -0
- package/package.json +24 -3
- package/public/SKILL.md +99 -0
- package/public/index.html +229 -69
- package/public/llms.txt +179 -25
- package/public/robots.txt +8 -0
- package/public/sitemap.xml +6 -0
- package/src/index.ts +91 -21
- package/src/lib/hig/render.ts +4 -1
- package/src/lib/reference/render.ts +51 -0
- package/src/lib/reference/types.ts +1 -0
- package/src/lib/search.ts +186 -169
- package/src/lib/skill.ts +148 -0
- package/src/lib/types.ts +21 -0
- package/wrangler.jsonc +2 -1
package/README.md
CHANGED
|
@@ -2,38 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Making Apple docs AI-readable.
|
|
4
4
|
|
|
5
|
-
[sosumi.ai](https://sosumi.ai)
|
|
6
|
-
provides Apple Developer documentation in an AI-readable format
|
|
5
|
+
[sosumi.ai](https://sosumi.ai)
|
|
6
|
+
provides Apple Developer documentation in an AI-readable format
|
|
7
7
|
by converting JavaScript-rendered pages into Markdown.
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
11
|
### HTTP API
|
|
12
12
|
|
|
13
|
-
Replace `developer.apple.com` with `sosumi.ai`
|
|
13
|
+
Replace `developer.apple.com` with `sosumi.ai`
|
|
14
14
|
in any Apple Developer documentation URL:
|
|
15
15
|
|
|
16
16
|
**Original:**
|
|
17
|
+
|
|
17
18
|
```
|
|
18
19
|
https://developer.apple.com/documentation/swift/array
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
**AI-readable:**
|
|
23
|
+
|
|
22
24
|
```
|
|
23
25
|
https://sosumi.ai/documentation/swift/array
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
This works for all API reference docs,
|
|
28
|
+
This works for all API reference docs,
|
|
27
29
|
as well as Apple's [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/) (HIG).
|
|
28
30
|
|
|
29
31
|
WWDC session transcripts are also supported by replacing the same host for video URLs:
|
|
30
32
|
|
|
31
33
|
**Original:**
|
|
34
|
+
|
|
32
35
|
```
|
|
33
36
|
https://developer.apple.com/videos/play/wwdc2021/10133/
|
|
34
37
|
```
|
|
35
38
|
|
|
36
39
|
**AI-readable:**
|
|
40
|
+
|
|
37
41
|
```
|
|
38
42
|
https://sosumi.ai/videos/play/wwdc2021/10133
|
|
39
43
|
```
|
|
@@ -41,11 +45,13 @@ https://sosumi.ai/videos/play/wwdc2021/10133
|
|
|
41
45
|
Sosumi can also proxy public non-Apple Swift-DocC pages using:
|
|
42
46
|
|
|
43
47
|
**Original:**
|
|
48
|
+
|
|
44
49
|
```
|
|
45
50
|
https://apple.github.io/swift-argument-parser/documentation/argumentparser
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
**AI-readable:**
|
|
54
|
+
|
|
49
55
|
```
|
|
50
56
|
https://sosumi.ai/external/https://apple.github.io/swift-argument-parser/documentation/argumentparser
|
|
51
57
|
```
|
|
@@ -60,8 +66,8 @@ https://sosumi.ai/external/https://apple.github.io/swift-argument-parser/documen
|
|
|
60
66
|
|
|
61
67
|
### MCP Integration
|
|
62
68
|
|
|
63
|
-
Sosumi's MCP server supports Streamable HTTP and Server-Sent Events (SSE) transport.
|
|
64
|
-
If your client supports either of these,
|
|
69
|
+
Sosumi's MCP server supports Streamable HTTP and Server-Sent Events (SSE) transport.
|
|
70
|
+
If your client supports either of these,
|
|
65
71
|
configure it to connect directly to `https://sosumi.ai/mcp`.
|
|
66
72
|
|
|
67
73
|
Otherwise,
|
|
@@ -148,11 +154,23 @@ sosumi fetch https://developer.apple.com/documentation/swift/array --json
|
|
|
148
154
|
sosumi search "SwiftData" --json
|
|
149
155
|
```
|
|
150
156
|
|
|
157
|
+
### AI Agent Skill
|
|
158
|
+
|
|
159
|
+
Want your AI coding assistant to use Sosumi consistently?
|
|
160
|
+
Use the hosted skill file:
|
|
161
|
+
[`https://sosumi.ai/SKILL.md`](https://sosumi.ai/SKILL.md)
|
|
162
|
+
|
|
163
|
+
Spec-compliant clients can also install it with:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npx skills add https://sosumi.ai
|
|
167
|
+
```
|
|
168
|
+
|
|
151
169
|
### Chrome Extension
|
|
152
170
|
|
|
153
|
-
You can also use Sosumi from a community-contributed
|
|
171
|
+
You can also use Sosumi from a community-contributed
|
|
154
172
|
[Chrome extension](https://chromewebstore.google.com/detail/donffakeimppgoehccpfhlchmbfdmfpj?utm_source=item-share-cb),
|
|
155
|
-
which adds a "Copy sosumi Link" button
|
|
173
|
+
which adds a "Copy sosumi Link" button
|
|
156
174
|
to Apple Developer documentation pages.
|
|
157
175
|
[Source code](https://github.com/FromAtom/Link-Generator-for-sosumi.ai) is available on GitHub.
|
|
158
176
|
|
|
@@ -161,11 +179,11 @@ to Apple Developer documentation pages.
|
|
|
161
179
|
This project is designed to be easily run on your own machine
|
|
162
180
|
or deployed to a hosting provider.
|
|
163
181
|
|
|
164
|
-
Sosumi.ai is currently hosted by
|
|
182
|
+
Sosumi.ai is currently hosted by
|
|
165
183
|
[Cloudflare Workers](https://workers.cloudflare.com).
|
|
166
184
|
|
|
167
185
|
> [!NOTE]
|
|
168
|
-
> The application is built with Hono,
|
|
186
|
+
> The application is built with Hono,
|
|
169
187
|
> making it compatible with various runtimes.
|
|
170
188
|
>
|
|
171
189
|
> See the [Hono docs](https://hono.dev/docs/getting-started/basic)
|
|
@@ -173,23 +191,26 @@ Sosumi.ai is currently hosted by
|
|
|
173
191
|
|
|
174
192
|
### Prerequisites
|
|
175
193
|
|
|
176
|
-
- Node.js
|
|
194
|
+
- Node.js 20+
|
|
177
195
|
- npm
|
|
178
196
|
|
|
179
197
|
### Quick Start
|
|
180
198
|
|
|
181
199
|
1. **Clone the repository:**
|
|
200
|
+
|
|
182
201
|
```bash
|
|
183
202
|
git clone https://github.com/nshipster/sosumi.ai.git
|
|
184
203
|
cd sosumi.ai
|
|
185
204
|
```
|
|
186
205
|
|
|
187
206
|
2. **Install dependencies:**
|
|
207
|
+
|
|
188
208
|
```bash
|
|
189
209
|
npm install
|
|
190
210
|
```
|
|
191
211
|
|
|
192
212
|
3. **Start development server:**
|
|
213
|
+
|
|
193
214
|
```bash
|
|
194
215
|
npm run dev
|
|
195
216
|
```
|
|
@@ -197,7 +218,7 @@ Sosumi.ai is currently hosted by
|
|
|
197
218
|
Once the application is up and running, press the <kbd>b</kbd>
|
|
198
219
|
to open the URL in your browser.
|
|
199
220
|
|
|
200
|
-
To configure MCP clients to use your development server,
|
|
221
|
+
To configure MCP clients to use your development server,
|
|
201
222
|
replace `sosumi.ai` with the local server address
|
|
202
223
|
(`http://localhost:8787` by default).
|
|
203
224
|
|
|
@@ -227,7 +248,7 @@ npm run test:run # Run tests once
|
|
|
227
248
|
```
|
|
228
249
|
|
|
229
250
|
> [!TIP]
|
|
230
|
-
> When running the CLI through npm scripts during local development,
|
|
251
|
+
> When running the CLI through npm scripts during local development,
|
|
231
252
|
> use `-s` (`--silent`)
|
|
232
253
|
> to suppress npm's script preamble so output pipes cleanly:
|
|
233
254
|
>
|
|
@@ -237,7 +258,7 @@ npm run test:run # Run tests once
|
|
|
237
258
|
|
|
238
259
|
### Code Quality
|
|
239
260
|
|
|
240
|
-
This project uses [Biome](https://biomejs.dev/)
|
|
261
|
+
This project uses [Biome](https://biomejs.dev/)
|
|
241
262
|
for code formatting, linting, and import organization.
|
|
242
263
|
|
|
243
264
|
- `npm run format` - Format all code files
|
|
@@ -255,7 +276,7 @@ For the best development experience, install the Biome extension for your editor
|
|
|
255
276
|
|
|
256
277
|
### Cloudflare Workers
|
|
257
278
|
|
|
258
|
-
Whenever you update your `wrangler.toml` or change your Worker bindings,
|
|
279
|
+
Whenever you update your `wrangler.toml` or change your Worker bindings,
|
|
259
280
|
be sure to re-run:
|
|
260
281
|
|
|
261
282
|
```bash
|
package/bin/sosumi.mjs
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nshipster/sosumi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Making Apple docs AI-readable",
|
|
4
5
|
"license": "MIT",
|
|
6
|
+
"author": "NSHipster",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/NSHipster/sosumi.ai"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"apple",
|
|
13
|
+
"docs",
|
|
14
|
+
"documentation",
|
|
15
|
+
"mcp",
|
|
16
|
+
"cli",
|
|
17
|
+
"markdown",
|
|
18
|
+
"swift-docc",
|
|
19
|
+
"ai"
|
|
20
|
+
],
|
|
21
|
+
"preferGlobal": true,
|
|
22
|
+
"homepage": "https://sosumi.ai",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/NSHipster/sosumi.ai/issues"
|
|
25
|
+
},
|
|
5
26
|
"type": "module",
|
|
6
27
|
"engines": {
|
|
7
28
|
"node": ">=20.18.1"
|
|
@@ -18,7 +39,7 @@
|
|
|
18
39
|
"access": "public"
|
|
19
40
|
},
|
|
20
41
|
"bin": {
|
|
21
|
-
"sosumi": "
|
|
42
|
+
"sosumi": "bin/sosumi.mjs"
|
|
22
43
|
},
|
|
23
44
|
"scripts": {
|
|
24
45
|
"dev": "wrangler dev",
|
|
@@ -45,7 +66,7 @@
|
|
|
45
66
|
"devDependencies": {
|
|
46
67
|
"@biomejs/biome": "2.2.2",
|
|
47
68
|
"@cloudflare/puppeteer": "^1.0.4",
|
|
48
|
-
"@cloudflare/vitest-pool-workers": "^0.
|
|
69
|
+
"@cloudflare/vitest-pool-workers": "^0.12.18",
|
|
49
70
|
"@vitest/ui": "^3.2.4",
|
|
50
71
|
"vitest": "^3.2.4",
|
|
51
72
|
"wrangler": "^4.32.0"
|
package/public/SKILL.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sosumi
|
|
3
|
+
description: Fetches Apple documentation as Markdown via Sosumi. Use for Apple API reference, Human Interface Guidelines, WWDC transcripts, and external Swift-DocC pages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sosumi Skill
|
|
7
|
+
|
|
8
|
+
Use this skill to reliably fetch Apple docs as Markdown when coding agents need precise API details.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
Use Sosumi when the request involves any of the following:
|
|
13
|
+
|
|
14
|
+
- Apple platform APIs (`Swift`, `SwiftUI`, `UIKit`, `AppKit`, `Foundation`, etc.)
|
|
15
|
+
- API signatures, availability, parameter behavior, or return semantics
|
|
16
|
+
- Human Interface Guidelines questions
|
|
17
|
+
- WWDC session transcript lookup
|
|
18
|
+
- External Swift-DocC documentation (for example, GitHub Pages or Swift Package Index hosts)
|
|
19
|
+
|
|
20
|
+
## Core Workflow
|
|
21
|
+
|
|
22
|
+
1. If you already have a `developer.apple.com` URL, replace the host with `sosumi.ai` and keep the same path.
|
|
23
|
+
2. If you do not know the exact page path, search first, then fetch the best match.
|
|
24
|
+
3. Prefer specific symbol pages instead of broad top-level pages when answering implementation questions.
|
|
25
|
+
|
|
26
|
+
### Optional CLI Preflight
|
|
27
|
+
|
|
28
|
+
If the Sosumi CLI is available, quickly verify local access before deeper debugging:
|
|
29
|
+
|
|
30
|
+
- `sosumi --version` confirms the CLI is installed and on `PATH`.
|
|
31
|
+
- `sosumi --help` shows top-level usage.
|
|
32
|
+
- `sosumi <command> --help` is the manual for command-specific behavior.
|
|
33
|
+
|
|
34
|
+
## HTTP Usage
|
|
35
|
+
|
|
36
|
+
Replace `developer.apple.com` with `sosumi.ai`:
|
|
37
|
+
|
|
38
|
+
- Original: `https://developer.apple.com/documentation/swift/array`
|
|
39
|
+
- AI-readable: `https://sosumi.ai/documentation/swift/array`
|
|
40
|
+
|
|
41
|
+
## Content Types
|
|
42
|
+
|
|
43
|
+
### Apple API Reference
|
|
44
|
+
|
|
45
|
+
- Pattern: `https://sosumi.ai/documentation/{framework}/{symbol}`
|
|
46
|
+
- Examples:
|
|
47
|
+
- `https://sosumi.ai/documentation/swift/array`
|
|
48
|
+
- `https://sosumi.ai/documentation/swiftui/view`
|
|
49
|
+
|
|
50
|
+
### Human Interface Guidelines
|
|
51
|
+
|
|
52
|
+
- Pattern: `https://sosumi.ai/design/human-interface-guidelines/{topic}`
|
|
53
|
+
- Examples:
|
|
54
|
+
- `https://sosumi.ai/design/human-interface-guidelines`
|
|
55
|
+
- `https://sosumi.ai/design/human-interface-guidelines/foundations/color`
|
|
56
|
+
|
|
57
|
+
### Apple Video Transcripts
|
|
58
|
+
|
|
59
|
+
- Pattern: `https://sosumi.ai/videos/play/{collection}/{id}`
|
|
60
|
+
- Examples:
|
|
61
|
+
- `https://sosumi.ai/videos/play/wwdc2021/10133`
|
|
62
|
+
- `https://sosumi.ai/videos/play/meet-with-apple/208`
|
|
63
|
+
|
|
64
|
+
### External Swift-DocC
|
|
65
|
+
|
|
66
|
+
- Pattern: `https://sosumi.ai/external/{full-https-url}`
|
|
67
|
+
- Examples:
|
|
68
|
+
- `https://sosumi.ai/external/https://apple.github.io/swift-argument-parser/documentation/argumentparser/`
|
|
69
|
+
- `https://sosumi.ai/external/https://swiftpackageindex.com/pointfreeco/swift-composable-architecture/1.23.1/documentation/composablearchitecture`
|
|
70
|
+
|
|
71
|
+
## MCP Tools Quick Reference
|
|
72
|
+
|
|
73
|
+
Use these when Sosumi is configured as an MCP server (`https://sosumi.ai/mcp`):
|
|
74
|
+
|
|
75
|
+
| Tool | Parameters | Use |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `searchAppleDocumentation` | `query: string` | Search Apple documentation and return structured results |
|
|
78
|
+
| `fetchAppleDocumentation` | `path: string` | Fetch Apple docs or HIG content by path as Markdown |
|
|
79
|
+
| `fetchAppleVideoTranscript` | `path: string` | Fetch Apple video transcript by `/videos/play/...` path |
|
|
80
|
+
| `fetchExternalDocumentation` | `url: string` | Fetch external Swift-DocC page by absolute HTTPS URL |
|
|
81
|
+
|
|
82
|
+
## Best Practices
|
|
83
|
+
|
|
84
|
+
- Search first if the exact path is unknown.
|
|
85
|
+
- Fetch targeted symbol pages for coding questions.
|
|
86
|
+
- Keep source links in answers so users can verify details quickly.
|
|
87
|
+
- Use Sosumi paths directly in responses whenever referencing Apple documentation pages.
|
|
88
|
+
|
|
89
|
+
## Troubleshooting
|
|
90
|
+
|
|
91
|
+
### 404 or sparse output
|
|
92
|
+
|
|
93
|
+
- The path may be incorrect or too broad.
|
|
94
|
+
- Run a search query first, then fetch a specific result path.
|
|
95
|
+
|
|
96
|
+
### External page cannot be fetched
|
|
97
|
+
|
|
98
|
+
- The host may block access via `robots.txt` or `X-Robots-Tag` directives.
|
|
99
|
+
- Try another canonical page URL for the same symbol.
|