xcode-cli 1.0.5 → 1.0.6
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 +22 -51
- package/package.json +1 -1
- package/skills/xcode-cli/SKILL.md +33 -117
- package/src/mcpbridge.ts +500 -500
- package/src/xcode-skill.ts +14 -3
- package/src/xcode.ts +35 -3
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[中文文档](./README_CN.md)
|
|
4
4
|
|
|
5
|
-
CLI + Skill wrapper for the [official Xcode 26.3+ MCP tools](https://developer.apple.com/xcode/mcp/):
|
|
5
|
+
CLI + Skill wrapper for the [official Xcode 26.3+ MCP tools](https://developer.apple.com/xcode/mcp/): a long-lived `xcode-cli-service` so the "Allow access to Xcode?" popup stops showing up on every call, plus a Claude Code Skill that saves **~5 K tokens** of context per conversation.
|
|
6
6
|
|
|
7
|
-
|
|
|
8
|
-
|
|
9
|
-
| AI agents get a "Allow access to Xcode?" popup
|
|
10
|
-
|
|
|
7
|
+
| Pain point | Solution |
|
|
8
|
+
|------------|----------|
|
|
9
|
+
| AI agents get a "Allow access to Xcode?" popup on every Xcode MCP call, and it never remembers | A persistent `mcp-proxy` process — macOS only asks once |
|
|
10
|
+
| MCP tool definitions (20 tools, ~5K tokens) load into every conversation | Wrapped as a Claude Code Skill — loads on-demand |
|
|
11
11
|
|
|
12
12
|
## Details
|
|
13
13
|
|
|
@@ -46,6 +46,8 @@ Raw MCP server integration is available, but it is not the recommended default.
|
|
|
46
46
|
```bash
|
|
47
47
|
# 1. Install from npm
|
|
48
48
|
npm install -g xcode-cli
|
|
49
|
+
# To update to the latest version:
|
|
50
|
+
# npm install -g xcode-cli@latest
|
|
49
51
|
|
|
50
52
|
# 2. Install and start the local bridge service
|
|
51
53
|
xcode-cli-ctl install
|
|
@@ -69,33 +71,22 @@ xcode-cli build
|
|
|
69
71
|
|
|
70
72
|
## AI Agent Integration
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
use skill, you can saves **~5 K tokens** of context per conversation.
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
### Skill Installation (better)
|
|
75
77
|
|
|
76
|
-
```bash
|
|
77
|
-
xcode-cli-ctl skill install --claude
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
If you omit `--claude` / `--codex`, the skill installs to both by default.
|
|
81
|
-
|
|
82
|
-
### Codex (Skill)
|
|
83
|
-
|
|
84
|
-
Install the packaged skill for Codex:
|
|
85
78
|
|
|
86
79
|
```bash
|
|
80
|
+
xcode-cli-ctl skill install --claude
|
|
87
81
|
xcode-cli-ctl skill install --codex
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Or install to both agents at once:
|
|
91
|
-
|
|
92
|
-
```bash
|
|
82
|
+
# Install to both Claude Code and Codex
|
|
93
83
|
xcode-cli-ctl skill install
|
|
94
|
-
```
|
|
95
84
|
|
|
96
|
-
|
|
85
|
+
# Or copy manually
|
|
86
|
+
cp skills/xcode-cli/SKILL.md ~/.claude/skills/xcode-cli/SKILL.md
|
|
87
|
+
```
|
|
97
88
|
|
|
98
|
-
|
|
89
|
+
### MCP Server
|
|
99
90
|
|
|
100
91
|
```bash
|
|
101
92
|
# Claude Code
|
|
@@ -104,24 +95,6 @@ claude mcp add --transport http xcode http://localhost:48321/mcp
|
|
|
104
95
|
# Codex
|
|
105
96
|
codex mcp add xcode --url http://localhost:48321/mcp
|
|
106
97
|
```
|
|
107
|
-
|
|
108
|
-
> **Note:** This is available as a manual fallback, but the main point of this repo is the skill-based workflow, not raw MCP as the default integration path.
|
|
109
|
-
|
|
110
|
-
### Common `xcode-cli` Commands
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
xcode-cli windows
|
|
114
|
-
xcode-cli status
|
|
115
|
-
xcode-cli build
|
|
116
|
-
xcode-cli build-log --severity error
|
|
117
|
-
xcode-cli test list
|
|
118
|
-
xcode-cli test all
|
|
119
|
-
xcode-cli test some --target MyTests "FeatureTests#testExample"
|
|
120
|
-
xcode-cli file-issues "Sources/App.swift"
|
|
121
|
-
xcode-cli preview "Sources/MyView.swift" --out ./preview-out
|
|
122
|
-
xcode-cli doc "SwiftUI NavigationStack" --frameworks SwiftUI
|
|
123
|
-
```
|
|
124
|
-
|
|
125
98
|
### Available Tools (20) provided by Xcode 26.3+
|
|
126
99
|
|
|
127
100
|
| Category | Tools |
|
|
@@ -133,18 +106,16 @@ xcode-cli doc "SwiftUI NavigationStack" --frameworks SwiftUI
|
|
|
133
106
|
| **Preview & Execution** | `RenderPreview`, `ExecuteSnippet` |
|
|
134
107
|
| **Workspace** | `XcodeListWindows` |
|
|
135
108
|
|
|
136
|
-
##
|
|
137
|
-
|
|
138
|
-
```text
|
|
139
|
-
AI Agent ──skill / bash──▶ xcode-cli ──HTTP──▶ local bridge service ──▶ xcrun mcpbridge ──▶ Xcode IDE
|
|
140
|
-
```
|
|
109
|
+
## Component List
|
|
110
|
+
|
|
141
111
|
|
|
142
|
-
|
|
|
112
|
+
| | Role |
|
|
143
113
|
|-----------|------|
|
|
144
114
|
| `xcrun mcpbridge` | Xcode's built-in MCP bridge |
|
|
145
|
-
|
|
|
146
|
-
| `xcode-cli` |
|
|
147
|
-
| `xcode-cli
|
|
115
|
+
| `xcode-cli-service` | Persistent HTTP bridge on port `48321`, managed by `xcode-cli-ctl` — solves the repeated permission popup |
|
|
116
|
+
| `xcode-cli` | CLI for Xcode MCP workflows, used by the Skill and directly from the terminal |
|
|
117
|
+
| [`SKILL.md`](skills/xcode-cli/SKILL.md) | Recommended integration for Claude Code / Codex, installed via `xcode-cli-ctl skill install` |
|
|
118
|
+
| `xcode-cli-ctl` | Manages service lifecycle and Skill installation |
|
|
148
119
|
|
|
149
120
|
## License
|
|
150
121
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xcode-cli
|
|
3
|
-
version: 1.0.0
|
|
4
3
|
description: >-
|
|
5
4
|
Xcode IDE interaction skill. Uses the xcode-cli CLI to build, diagnose,
|
|
6
5
|
test, preview, and edit Xcode projects via MCP. Use when the user asks to
|
|
@@ -16,123 +15,40 @@ Interact with Xcode through the `xcode-cli` CLI backed by the Xcode MCP bridge.
|
|
|
16
15
|
|
|
17
16
|
- Xcode 26.3 or later is installed and open with the target project
|
|
18
17
|
- `xcode-cli` is installed: `npm install -g xcode-cli`
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
### 5. View all Navigator issues
|
|
49
|
-
```bash
|
|
50
|
-
xcode-cli issues --severity error
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 6. Quick project status (windows + issues)
|
|
54
|
-
```bash
|
|
55
|
-
xcode-cli status
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 7. SwiftUI preview (requires #Preview macro)
|
|
59
|
-
```bash
|
|
60
|
-
xcode-cli preview "MyApp/Sources/Views/MyView.swift" --out ./preview-out
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 8. Execute code snippet
|
|
64
|
-
```bash
|
|
65
|
-
xcode-cli snippet "MyApp/Sources/SomeFile.swift" "print(someExpression)"
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### 9. Testing
|
|
69
|
-
```bash
|
|
70
|
-
xcode-cli test all
|
|
71
|
-
xcode-cli test list --json
|
|
72
|
-
xcode-cli test some "TargetName::ClassName/testMethod()"
|
|
73
|
-
xcode-cli test some --target TargetName "ClassName#testMethod"
|
|
74
|
-
xcode-cli test list
|
|
75
|
-
```
|
|
76
|
-
For exact MCP parity, use `targetName` + `identifier` from `test list --json`:
|
|
77
|
-
- `targetName` maps to `RunSomeTests.tests[].targetName`
|
|
78
|
-
- `identifier` maps to `RunSomeTests.tests[].testIdentifier`
|
|
79
|
-
|
|
80
|
-
`RunSomeTests` only runs tests from the active scheme's active test plan in Xcode.
|
|
81
|
-
If a target is missing (for example you need `DashProxyMac` while `DashProxy` is active), switch scheme in Xcode first, then run `xcode-cli test list --json` again.
|
|
82
|
-
|
|
83
|
-
### 10. Search Apple documentation
|
|
84
|
-
```bash
|
|
85
|
-
xcode-cli doc "SwiftUI NavigationStack" --frameworks SwiftUI
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### 11. File operations (within Xcode project structure)
|
|
89
|
-
```bash
|
|
90
|
-
xcode-cli read "path/to/file"
|
|
91
|
-
xcode-cli ls /
|
|
92
|
-
xcode-cli ls -r /
|
|
93
|
-
xcode-cli grep "TODO|FIXME"
|
|
94
|
-
xcode-cli glob "**/*.swift"
|
|
95
|
-
xcode-cli write "path/to/file" "content"
|
|
96
|
-
xcode-cli update "path/to/file" "oldText" "newText" --replace-all
|
|
97
|
-
xcode-cli mv "Old.swift" "New.swift"
|
|
98
|
-
xcode-cli mkdir "MyApp/Sources/Feature"
|
|
99
|
-
xcode-cli rm "MyApp/Sources/Unused.swift"
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### 12. Service management
|
|
103
|
-
```bash
|
|
104
|
-
xcode-cli-ctl install # Install and start as background service (launchd)
|
|
105
|
-
xcode-cli-ctl status # Check if bridge is running
|
|
106
|
-
xcode-cli-ctl logs -f # Follow bridge logs
|
|
107
|
-
xcode-cli-ctl uninstall # Stop and remove service
|
|
108
|
-
```
|
|
18
|
+
- Bridge running: `xcode-cli-ctl install` (background) or `xcode-cli-ctl run` (foreground)
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
All commands: `xcode-cli <cmd> [args]`. **Always use `--tab <tabIdentifier>`** — run `xcode-cli windows` first to get the tabIdentifier, then pass it to every subsequent command. Add `--json` for JSON output.
|
|
23
|
+
|
|
24
|
+
| Command | Usage | Notes |
|
|
25
|
+
|---------|-------|-------|
|
|
26
|
+
| `windows` | `windows` | List tabs/workspaces; get `tabIdentifier` |
|
|
27
|
+
| `status` | `status` | Quick project status (windows + issues) |
|
|
28
|
+
| `build` | `build` | Build project |
|
|
29
|
+
| `build-log` | `build-log --severity error` | View build errors |
|
|
30
|
+
| `run` | `run` | Build and run active scheme (like Cmd+R) |
|
|
31
|
+
| `run-without-build` | `run-without-build` | Run without building (like Ctrl+Cmd+R) |
|
|
32
|
+
| `issues` | `issues --severity error` | Navigator issues |
|
|
33
|
+
| `file-issues` | `file-issues "MyApp/Sources/MyFile.swift"` | Single-file diagnostics, no full build |
|
|
34
|
+
| `test` | `test all` / `test list [--json]` / `test some "Target::Class/method()"` | Run/list tests |
|
|
35
|
+
| `preview` | `preview "MyApp/Sources/MyView.swift" --out ./out` | SwiftUI preview (requires `#Preview` macro) |
|
|
36
|
+
| `snippet` | `snippet "MyApp/Sources/File.swift" "print(expr)"` | Execute code snippet |
|
|
37
|
+
| `doc` | `doc "SwiftUI NavigationStack" --frameworks SwiftUI` | Search Apple documentation |
|
|
38
|
+
| `read` | `read "path/to/file"` | Read file |
|
|
39
|
+
| `ls` | `ls [-r] /` | List directory |
|
|
40
|
+
| `grep` | `grep "TODO\|FIXME"` | Search files |
|
|
41
|
+
| `glob` | `glob "**/*.swift"` | Find files by pattern |
|
|
42
|
+
| `write` | `write "path/to/file" "content"` | Write file |
|
|
43
|
+
| `update` | `update "path/to/file" "old" "new" [--replace-all]` | Edit file |
|
|
44
|
+
| `mv` | `mv "Old.swift" "New.swift"` | Move/rename file |
|
|
45
|
+
| `mkdir` | `mkdir "MyApp/Sources/Feature"` | Create directory |
|
|
46
|
+
| `rm` | `rm "MyApp/Sources/Unused.swift"` | Delete file |
|
|
109
47
|
|
|
110
48
|
## Notes
|
|
49
|
+
|
|
111
50
|
- File paths are relative to the Xcode project structure, not absolute filesystem paths.
|
|
112
|
-
- Use `--tab <tabIdentifier>` if multiple Xcode tabs are open.
|
|
113
51
|
- If the bridge is not responding: `xcode-cli-ctl status` then `xcode-cli-ctl uninstall && xcode-cli-ctl install`.
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
## CLI to MCP Mapping
|
|
118
|
-
- `status` -> `XcodeListWindows` + `XcodeListNavigatorIssues`
|
|
119
|
-
- `build` -> `BuildProject`
|
|
120
|
-
- `build-log` -> `GetBuildLog`
|
|
121
|
-
- `test all` -> `RunAllTests`
|
|
122
|
-
- `test list` -> `GetTestList`
|
|
123
|
-
- `test some` -> `RunSomeTests`
|
|
124
|
-
- `issues` -> `XcodeListNavigatorIssues`
|
|
125
|
-
- `file-issues` -> `XcodeRefreshCodeIssuesInFile`
|
|
126
|
-
- `windows` -> `XcodeListWindows`
|
|
127
|
-
- `read` -> `XcodeRead`
|
|
128
|
-
- `grep` -> `XcodeGrep`
|
|
129
|
-
- `ls` -> `XcodeLS`
|
|
130
|
-
- `glob` -> `XcodeGlob`
|
|
131
|
-
- `write` -> `XcodeWrite`
|
|
132
|
-
- `update` -> `XcodeUpdate`
|
|
133
|
-
- `mv` -> `XcodeMV`
|
|
134
|
-
- `mkdir` -> `XcodeMakeDir`
|
|
135
|
-
- `rm` -> `XcodeRM`
|
|
136
|
-
- `preview` -> `RenderPreview`
|
|
137
|
-
- `snippet` -> `ExecuteSnippet`
|
|
138
|
-
- `doc` -> `DocumentationSearch`
|
|
52
|
+
- Use `xcode-cli call <toolName> --args '{"key":"value"}'` to invoke any MCP tool directly.
|
|
53
|
+
- `run` and `run-without-build` use AppleScript to send keyboard shortcuts to Xcode; ensure Accessibility access is granted to Terminal/iTerm in System Settings → Privacy & Security → Accessibility.
|
|
54
|
+
- Testing: use `targetName` + `identifier` from `test list --json` for exact test targeting. `test some` only runs tests from the active scheme's active test plan — switch scheme in Xcode if a target is missing.
|