apple-docs 1.0.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/LICENSE +21 -0
- package/README.md +114 -0
- package/dist/cli.js +206 -0
- package/dist/mcp.js +17 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# apple-docs-cli
|
|
2
|
+
|
|
3
|
+
CLI for querying Apple Developer Documentation. Searches docs, browses frameworks, WWDC videos, sample code, and more.
|
|
4
|
+
|
|
5
|
+
Built on top of [apple-docs-mcp](https://github.com/kimsungwhee/apple-docs-mcp) — uses its library directly, no MCP server needed.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/mtcnbzks/apple-docs-cli.git
|
|
11
|
+
cd apple-docs-cli
|
|
12
|
+
npm install
|
|
13
|
+
npm run build
|
|
14
|
+
npm link
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
apple-docs <command> [args] [--flags]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Search & Documentation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Search Apple docs
|
|
27
|
+
apple-docs search "SwiftUI List"
|
|
28
|
+
apple-docs search "CoreML" --type documentation
|
|
29
|
+
|
|
30
|
+
# Get full doc page content
|
|
31
|
+
apple-docs doc "https://developer.apple.com/documentation/swiftui/list"
|
|
32
|
+
|
|
33
|
+
# Browse all Apple frameworks
|
|
34
|
+
apple-docs tech
|
|
35
|
+
apple-docs tech "App Frameworks" --limit 10
|
|
36
|
+
|
|
37
|
+
# Browse symbols in a framework
|
|
38
|
+
apple-docs symbols swiftui
|
|
39
|
+
apple-docs symbols uikit --type class --limit 20
|
|
40
|
+
apple-docs symbols foundation --type protocol --language swift
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### WWDC
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# List videos by year
|
|
47
|
+
apple-docs wwdc 2025
|
|
48
|
+
apple-docs wwdc 2024 --limit 10
|
|
49
|
+
|
|
50
|
+
# Search transcripts and code
|
|
51
|
+
apple-docs wwdc-search "async await"
|
|
52
|
+
|
|
53
|
+
# Get full video content (transcript + code)
|
|
54
|
+
apple-docs wwdc-video 2025 245
|
|
55
|
+
|
|
56
|
+
# Browse code examples
|
|
57
|
+
apple-docs wwdc-code SwiftUI --limit 5
|
|
58
|
+
|
|
59
|
+
# Browse topics
|
|
60
|
+
apple-docs wwdc-topics swift
|
|
61
|
+
|
|
62
|
+
# List available years
|
|
63
|
+
apple-docs wwdc-years
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Sample Code
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
apple-docs sample "camera"
|
|
70
|
+
apple-docs sample --framework SwiftUI
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### API Analysis
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Related APIs
|
|
77
|
+
apple-docs related "https://developer.apple.com/documentation/swiftui/list"
|
|
78
|
+
|
|
79
|
+
# Similar/alternative APIs
|
|
80
|
+
apple-docs similar "https://developer.apple.com/documentation/swiftui/list"
|
|
81
|
+
|
|
82
|
+
# Platform compatibility
|
|
83
|
+
apple-docs platform "https://developer.apple.com/documentation/swiftui/list"
|
|
84
|
+
|
|
85
|
+
# Resolve referenced types
|
|
86
|
+
apple-docs references "https://developer.apple.com/documentation/swiftui/list"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Updates & Overviews
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
apple-docs updates
|
|
93
|
+
apple-docs updates --technology SwiftUI --year 2025
|
|
94
|
+
apple-docs overviews --platform ios
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Flags
|
|
98
|
+
|
|
99
|
+
| Flag | Description |
|
|
100
|
+
|------|-------------|
|
|
101
|
+
| `--type <type>` | Symbol/search type filter (class, struct, enum, protocol) |
|
|
102
|
+
| `--limit <n>` | Max results |
|
|
103
|
+
| `--year <year>` | Year filter |
|
|
104
|
+
| `--framework <fw>` | Framework filter |
|
|
105
|
+
| `--topic <topic>` | Topic filter |
|
|
106
|
+
| `--platform <p>` | Platform filter (ios, macos, watchos, tvos, visionos) |
|
|
107
|
+
| `--query <q>` | Search query filter |
|
|
108
|
+
| `--technology <t>` | Technology filter |
|
|
109
|
+
| `--language <lang>` | Language filter (swift, occ) |
|
|
110
|
+
| `--depth <d>` | Search depth (shallow, medium, deep) |
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
MIT
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { callTool } from './mcp.js';
|
|
3
|
+
const [, , command, ...rest] = process.argv;
|
|
4
|
+
function parseArgs(argv) {
|
|
5
|
+
const positional = [];
|
|
6
|
+
const flags = {};
|
|
7
|
+
for (let i = 0; i < argv.length; i++) {
|
|
8
|
+
const arg = argv[i];
|
|
9
|
+
if (arg.startsWith('--')) {
|
|
10
|
+
const key = arg.slice(2);
|
|
11
|
+
flags[key] = argv[++i] || '';
|
|
12
|
+
}
|
|
13
|
+
else if (arg.startsWith('-') && arg.length === 2) {
|
|
14
|
+
const key = arg.slice(1);
|
|
15
|
+
flags[key] = argv[++i] || '';
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
positional.push(arg);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return { positional, flags };
|
|
22
|
+
}
|
|
23
|
+
const { positional, flags } = parseArgs(rest);
|
|
24
|
+
const num = (key) => flags[key] ? parseInt(flags[key], 10) : undefined;
|
|
25
|
+
const HELP = `Usage: apple-docs <command> [args] [--flags]
|
|
26
|
+
|
|
27
|
+
Commands:
|
|
28
|
+
search <query> Search Apple documentation
|
|
29
|
+
doc <url> Get documentation content
|
|
30
|
+
tech [category] List Apple technologies
|
|
31
|
+
symbols <framework> Browse framework symbols
|
|
32
|
+
wwdc [year] [topic] Browse WWDC videos
|
|
33
|
+
wwdc-search <query> Search WWDC transcripts
|
|
34
|
+
wwdc-video <year> <id> Get WWDC video content
|
|
35
|
+
wwdc-code [framework] Get WWDC code examples
|
|
36
|
+
wwdc-topics [topicId] Browse WWDC topics
|
|
37
|
+
wwdc-years List available WWDC years
|
|
38
|
+
sample [query] Browse sample code
|
|
39
|
+
related <url> Find related APIs
|
|
40
|
+
similar <url> Find similar APIs
|
|
41
|
+
platform <url> Check platform compatibility
|
|
42
|
+
updates [category] Documentation updates
|
|
43
|
+
overviews [category] Technology overviews
|
|
44
|
+
references <url> Resolve API references
|
|
45
|
+
|
|
46
|
+
Flags:
|
|
47
|
+
--type <type> Symbol/search type filter
|
|
48
|
+
--limit <n> Max results
|
|
49
|
+
--year <year> Year filter
|
|
50
|
+
--framework <fw> Framework filter
|
|
51
|
+
--topic <topic> Topic filter
|
|
52
|
+
--platform <p> Platform filter (ios, macos, watchos, tvos, visionos)
|
|
53
|
+
--query <q> Search query filter
|
|
54
|
+
--technology <t> Technology filter
|
|
55
|
+
--language <lang> Language filter (swift, occ)
|
|
56
|
+
--depth <d> Search depth (shallow, medium, deep)`;
|
|
57
|
+
function need(val, usage) {
|
|
58
|
+
if (!val) {
|
|
59
|
+
console.error(usage);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
return val;
|
|
63
|
+
}
|
|
64
|
+
async function main() {
|
|
65
|
+
switch (command) {
|
|
66
|
+
case 'search':
|
|
67
|
+
console.log(await callTool('search_apple_docs', {
|
|
68
|
+
query: need(positional.join(' ') || undefined, 'Usage: apple-docs search <query>'),
|
|
69
|
+
type: flags['type'] || 'all',
|
|
70
|
+
}));
|
|
71
|
+
break;
|
|
72
|
+
case 'doc':
|
|
73
|
+
console.log(await callTool('get_apple_doc_content', {
|
|
74
|
+
url: need(positional[0], 'Usage: apple-docs doc <url>'),
|
|
75
|
+
includeRelatedApis: flags['related'] === 'true',
|
|
76
|
+
includeReferences: flags['refs'] === 'true',
|
|
77
|
+
includeSimilarApis: flags['similar'] === 'true',
|
|
78
|
+
includePlatformAnalysis: flags['platforms'] === 'true',
|
|
79
|
+
}));
|
|
80
|
+
break;
|
|
81
|
+
case 'tech':
|
|
82
|
+
console.log(await callTool('list_technologies', {
|
|
83
|
+
category: positional[0],
|
|
84
|
+
language: flags['language'],
|
|
85
|
+
limit: num('limit'),
|
|
86
|
+
}));
|
|
87
|
+
break;
|
|
88
|
+
case 'symbols':
|
|
89
|
+
console.log(await callTool('search_framework_symbols', {
|
|
90
|
+
framework: need(positional[0], 'Usage: apple-docs symbols <framework>'),
|
|
91
|
+
symbolType: flags['type'] || 'all',
|
|
92
|
+
namePattern: flags['pattern'],
|
|
93
|
+
language: flags['language'] || 'swift',
|
|
94
|
+
limit: num('limit'),
|
|
95
|
+
}));
|
|
96
|
+
break;
|
|
97
|
+
case 'wwdc':
|
|
98
|
+
console.log(await callTool('list_wwdc_videos', {
|
|
99
|
+
year: positional[0],
|
|
100
|
+
topic: positional[1] || flags['topic'],
|
|
101
|
+
hasCode: flags['code'] === 'true' ? true : undefined,
|
|
102
|
+
limit: num('limit'),
|
|
103
|
+
}));
|
|
104
|
+
break;
|
|
105
|
+
case 'wwdc-search':
|
|
106
|
+
console.log(await callTool('search_wwdc_content', {
|
|
107
|
+
query: need(positional.join(' ') || undefined, 'Usage: apple-docs wwdc-search <query>'),
|
|
108
|
+
searchIn: flags['in'] || 'both',
|
|
109
|
+
year: flags['year'],
|
|
110
|
+
language: flags['language'],
|
|
111
|
+
limit: num('limit'),
|
|
112
|
+
}));
|
|
113
|
+
break;
|
|
114
|
+
case 'wwdc-video':
|
|
115
|
+
console.log(await callTool('get_wwdc_video', {
|
|
116
|
+
year: need(positional[0], 'Usage: apple-docs wwdc-video <year> <videoId>'),
|
|
117
|
+
videoId: need(positional[1], 'Usage: apple-docs wwdc-video <year> <videoId>'),
|
|
118
|
+
includeTranscript: flags['no-transcript'] !== 'true',
|
|
119
|
+
includeCode: flags['no-code'] !== 'true',
|
|
120
|
+
}));
|
|
121
|
+
break;
|
|
122
|
+
case 'wwdc-code':
|
|
123
|
+
console.log(await callTool('get_wwdc_code_examples', {
|
|
124
|
+
framework: positional[0] || flags['framework'],
|
|
125
|
+
topic: flags['topic'],
|
|
126
|
+
year: flags['year'],
|
|
127
|
+
language: flags['language'],
|
|
128
|
+
limit: num('limit'),
|
|
129
|
+
}));
|
|
130
|
+
break;
|
|
131
|
+
case 'wwdc-topics':
|
|
132
|
+
console.log(await callTool('browse_wwdc_topics', {
|
|
133
|
+
topicId: positional[0],
|
|
134
|
+
includeVideos: flags['no-videos'] !== 'true',
|
|
135
|
+
year: flags['year'],
|
|
136
|
+
limit: num('limit'),
|
|
137
|
+
}));
|
|
138
|
+
break;
|
|
139
|
+
case 'wwdc-years':
|
|
140
|
+
console.log(await callTool('list_wwdc_years', {}));
|
|
141
|
+
break;
|
|
142
|
+
case 'sample':
|
|
143
|
+
console.log(await callTool('get_sample_code', {
|
|
144
|
+
searchQuery: positional.join(' ') || undefined,
|
|
145
|
+
framework: flags['framework'],
|
|
146
|
+
beta: flags['beta'] || 'include',
|
|
147
|
+
limit: num('limit'),
|
|
148
|
+
}));
|
|
149
|
+
break;
|
|
150
|
+
case 'related':
|
|
151
|
+
console.log(await callTool('get_related_apis', {
|
|
152
|
+
apiUrl: need(positional[0], 'Usage: apple-docs related <url>'),
|
|
153
|
+
}));
|
|
154
|
+
break;
|
|
155
|
+
case 'similar':
|
|
156
|
+
console.log(await callTool('find_similar_apis', {
|
|
157
|
+
apiUrl: need(positional[0], 'Usage: apple-docs similar <url>'),
|
|
158
|
+
searchDepth: flags['depth'] || 'medium',
|
|
159
|
+
filterByCategory: flags['category'],
|
|
160
|
+
}));
|
|
161
|
+
break;
|
|
162
|
+
case 'platform':
|
|
163
|
+
console.log(await callTool('get_platform_compatibility', {
|
|
164
|
+
apiUrl: need(positional[0], 'Usage: apple-docs platform <url>'),
|
|
165
|
+
compareMode: flags['mode'] || 'single',
|
|
166
|
+
includeRelated: flags['related'] === 'true',
|
|
167
|
+
}));
|
|
168
|
+
break;
|
|
169
|
+
case 'updates':
|
|
170
|
+
console.log(await callTool('get_documentation_updates', {
|
|
171
|
+
category: positional[0] || 'all',
|
|
172
|
+
technology: flags['technology'],
|
|
173
|
+
year: flags['year'],
|
|
174
|
+
searchQuery: flags['query'],
|
|
175
|
+
limit: num('limit'),
|
|
176
|
+
}));
|
|
177
|
+
break;
|
|
178
|
+
case 'overviews':
|
|
179
|
+
console.log(await callTool('get_technology_overviews', {
|
|
180
|
+
category: positional[0],
|
|
181
|
+
platform: flags['platform'] || 'all',
|
|
182
|
+
searchQuery: flags['query'],
|
|
183
|
+
limit: num('limit'),
|
|
184
|
+
}));
|
|
185
|
+
break;
|
|
186
|
+
case 'references':
|
|
187
|
+
console.log(await callTool('resolve_references_batch', {
|
|
188
|
+
sourceUrl: need(positional[0], 'Usage: apple-docs references <url>'),
|
|
189
|
+
maxReferences: num('limit'),
|
|
190
|
+
filterByType: flags['type'] || 'all',
|
|
191
|
+
}));
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
console.log(HELP);
|
|
195
|
+
if (command) {
|
|
196
|
+
console.error(`\nUnknown command: ${command}`);
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
main()
|
|
202
|
+
.then(() => process.exit(0))
|
|
203
|
+
.catch((err) => {
|
|
204
|
+
console.error(`Error: ${err.message}`);
|
|
205
|
+
process.exit(1);
|
|
206
|
+
});
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import AppleDeveloperDocsMCPServer from '@kimsungwhee/apple-docs-mcp';
|
|
2
|
+
import { handleToolCall } from '@kimsungwhee/apple-docs-mcp/dist/tools/handlers.js';
|
|
3
|
+
const server = new AppleDeveloperDocsMCPServer();
|
|
4
|
+
function extractText(result) {
|
|
5
|
+
const text = result.content
|
|
6
|
+
.filter((c) => c.type === 'text')
|
|
7
|
+
.map((c) => c.text)
|
|
8
|
+
.join('\n');
|
|
9
|
+
if (result.isError) {
|
|
10
|
+
throw new Error(text || 'Tool call failed');
|
|
11
|
+
}
|
|
12
|
+
return text;
|
|
13
|
+
}
|
|
14
|
+
export async function callTool(name, toolArgs = {}) {
|
|
15
|
+
const result = await handleToolCall(name, toolArgs, server);
|
|
16
|
+
return extractText(result);
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "apple-docs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI for querying Apple Developer Documentation — search docs, browse frameworks, WWDC videos, sample code, and API analysis",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "mtcnbzks",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/mtcnbzks/apple-docs-cli.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/mtcnbzks/apple-docs-cli",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"apple",
|
|
14
|
+
"apple-developer",
|
|
15
|
+
"cli",
|
|
16
|
+
"swift",
|
|
17
|
+
"swiftui",
|
|
18
|
+
"ios",
|
|
19
|
+
"macos",
|
|
20
|
+
"wwdc",
|
|
21
|
+
"documentation",
|
|
22
|
+
"developer-tools"
|
|
23
|
+
],
|
|
24
|
+
"bin": {
|
|
25
|
+
"apple-docs": "dist/cli.js"
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"dev": "tsc --watch",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@kimsungwhee/apple-docs-mcp": "^1.0.26"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^20.11.0",
|
|
44
|
+
"typescript": "^5.3.3"
|
|
45
|
+
}
|
|
46
|
+
}
|