Skip to content

Commit 504b1d9

Browse files
committed
docs: bilingual fix 43→47 + AGENTS.md
- fix stale counts: README.md/es 25→47 (professional tools, Tools(47), TOOLS[47], 2250 lines) - docs/* + docs/es/*: opencode/codex/claude-code 43→47 registered, architecture 43→47 - SECURITY.md all 43→47 - AGENTS.md: single source of truth for AI — bilingual rule (EN primary docs/*.md/README.md, ES mirror docs/es/*.md/README.es.md), switcher, single-file conventions, tool adding steps, Yarn/Make, versioning 47→48, checklist before push - verified: make lint/test 47 tools, grep stale count OK
1 parent 131c0bd commit 504b1d9

14 files changed

Lines changed: 176 additions & 28 deletions

AGENTS.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# AGENTS — How AI Should Work in This Repo
2+
3+
> **This is the single source of truth for any AI agent (OpenCode, Codex, Claude Code, Cursor, Copilot, etc.) working in this repository.**
4+
> If you are an AI, read this whole file before editing anything. If you are a human, this tells you what to expect from AI.
5+
6+
**Version:** 1.0.0 · **Applies to:** `YanxReal/Xcode-MPC` · **Stack:** `index.js` single-file MCP server, Yarn 4, Make, `StdioServerTransport`
7+
8+
---
9+
10+
## 1. Bilingual Rule — NON-NEGOTIABLE
11+
12+
This repo is **bilingual by design**:
13+
14+
| Language | Canonical files | Audience |
15+
|---|---|---|
16+
| **English (primary)** | `README.md`, `docs/*.md` | International, GitHub default |
17+
| **Español (mirror)** | `README.es.md`, `docs/es/*.md` | Hispanohablante |
18+
19+
**Rule:** *Every change to a user-facing Markdown file MUST be mirrored in both languages in the same commit.*
20+
21+
- If you edit `README.md`, you **must** edit `README.es.md` with the equivalent Spanish translation.
22+
- If you edit `docs/installation.md`, you **must** edit `docs/es/installation.md`.
23+
- If you edit `docs/tools.md`, you **must** edit `docs/es/tools.md`, etc.
24+
- Do **not** leave one language behind. A PR that touches `docs/opencode.md` but not `docs/es/opencode.md` will be rejected.
25+
26+
**How to translate:**
27+
- Keep structure identical (same headings, order, tables). Only language changes.
28+
- Preserve code blocks, JSON/TOML, `shellEscape` examples, and `index.js:line` references verbatim — do not translate code.
29+
- Keep badges, links, and `{{placeholders}}` intact. Translate only prose.
30+
- When in doubt, copy the English structure and translate paragraph by paragraph to Spanish.
31+
32+
**Verification (run before commit):**
33+
```bash
34+
# Both READMEs must have same tool count
35+
grep -c "47 tools" README.md
36+
grep -c "47 herramientas" README.es.md
37+
# Both docs sets must exist
38+
ls docs/*.md docs/es/*.md
39+
# No 25/31/43 leftovers
40+
grep -r "25 tools\|31 tools\|43 tools" --include="*.md" docs/ README* && echo "FAIL: stale count" || echo "OK"
41+
```
42+
43+
---
44+
45+
## 2. Language Switcher
46+
47+
Every file has a switcher at the top:
48+
49+
- English files: `> 🌐 **Language:** **English** | [Español](es/... or README.es.md)`
50+
- Spanish files: `> 🌐 **Idioma:** [English](../... or README.md) | **Español**`
51+
52+
If you create a **new doc** `docs/new-feature.md`, you **must** also create `docs/es/new-feature.md` with the mirrored switcher:
53+
- `docs/new-feature.md``[Español](es/new-feature.md)`
54+
- `docs/es/new-feature.md``[English](../new-feature.md)`
55+
56+
Same for `README.md``README.es.md`.
57+
58+
---
59+
60+
## 3. Project Conventions
61+
62+
### 3.1 Single-File Server
63+
- `index.js` is **intentionally monolithic** (~2250 lines, single file). Do not split into `src/` without explicit human approval.
64+
- Keep `#!/usr/bin/env node`, `import { Server } from "@modelcontextprotocol/sdk/server/index.js"` and `import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"` at the top.
65+
- Use `promisify(exec)` with `MAX_BUFFER=10MB`, `shellEscape`, `expandTilde`, `runCommand`, `formatResult`, `textContent`/`errorContent` helpers.
66+
- Every tool needs: `TOOLS` entry (`name`, `description`, `inputSchema` with `additionalProperties:false`) + `async handle_*` + `HANDLERS` registration + `try/catch` in `CallToolRequestSchema`.
67+
68+
### 3.2 Adding a New Tool
69+
1. Define in `TOOLS` (`index.js:142` area) with JSON Schema.
70+
2. Implement `handle_new_tool` before `// Dispatcher` with validation, `fs.access`, `shellEscape`, and `return textContent` / `errorContent`.
71+
3. Register in `HANDLERS` map and bump `Server version` (`1.3.0``1.3.1` for patch, `1.4.0` for feature) and log `47→48 herramientas registradas`.
72+
4. Update `package.json:version` + `description` (`47 herramientas`).
73+
5. Update **both** `README.md` + `README.es.md`: Features table, Tools section (numbered), TOC anchor, smoke count.
74+
6. Update **both** `docs/tools.md` + `docs/es/tools.md`: add section `## 13. ...` with JSON examples.
75+
7. Run `make lint && make test` (must be `47→48 tools`).
76+
8. Commit bilingual docs together.
77+
78+
### 3.3 Yarn 4 + Make
79+
- `packageManager: "yarn@4.18.0"`, `nodeLinker: node-modules` in `.yarnrc.yml`, vendored `.yarn/releases/yarn-4.18.0.cjs` must stay committed.
80+
- Always use `make install` (not `yarn install` directly in docs examples for beginners), `make lint`, `make doctor`, `make test`, `make inspect`.
81+
- `yarn.lock` must be committed; `yarn install --immutable` in CI.
82+
83+
### 3.4 Versioning & Docs Counts
84+
- Current: **47 tools**, **1.3.0**, **2250 lines**. When you add a tool, search-replace `47 → 48` in `README*`, `docs/**/tools.md`, `docs/**/development.md`, `docs/**/architecture.md`, `SECURITY.md`, `package.json`, and `index.js` log.
85+
- Never leave `25`/`31`/`43` leftovers — the `AGENTS.md` check above must pass.
86+
87+
---
88+
89+
## 4. Behavior & Tone
90+
91+
- **Objective & concise.** No fluff, no excessive praise. State facts, show `file:line`, show commands.
92+
- **Verify before claiming.** Run `node --check index.js`, `make test`, or `python3 scripts/smoke_test.py` before saying “it works”.
93+
- **Evidence > speculation.** If your finding contradicts a prior claim, state the discrepancy and trust the file.
94+
- **No TODO comments.** Deliver complete, runnable code (`// TODO: ...` is forbidden).
95+
- **Ask before destructive actions.** `make clean` / `rm -rf ~/Library/Developer/Xcode/DerivedData` / `git push --force` require explicit user confirmation.
96+
97+
---
98+
99+
## 5. Multi-Client Support
100+
101+
The same `index.js` (stdio) must work with **all three clients** without changes:
102+
103+
| Client | Config | Verify |
104+
|---|---|---|
105+
| **OpenCode** | `~/.config/opencode/opencode.jsonc``mcp.xcode.command: ["node", "/.../index.js"]` | Restart OpenCode → `list xcode tools` |
106+
| **Codex** | `~/.codex/config.toml``[mcp_servers.xcode] command="node"` | `codex mcp list` |
107+
| **Claude Code** | `claude mcp add xcode -- node /.../index.js` or `.mcp.json` | `claude mcp list` |
108+
109+
If you change MCP transport or args, test all three. Document in **both** `README.md` and `README.es.md`.
110+
111+
---
112+
113+
## 6. Commit & PR Rules
114+
115+
- Commit messages: `feat: ...`, `fix: ...`, `docs: ...`, `chore: ...` in **English** (even if docs are bilingual).
116+
- Every commit that touches `*.md` must show `README.md` + `README.es.md` or `docs/*.md` + `docs/es/*.md` together. Example:
117+
```
118+
docs: add asset_generate_appicon (47→48)
119+
```
120+
- PR template: check `make lint && make test` OK, and confirm bilingual sync.
121+
- Never commit `node_modules`, `.yarn/cache`, `DerivedData`, `*.ipa`, `.env`.
122+
123+
---
124+
125+
## 7. Checklist Before Push (AI must run)
126+
127+
```bash
128+
make lint
129+
make test # must show 47 tools
130+
grep -r "25 tools\|31 tools\|43 tools" --include="*.md" . && echo "FAIL" || echo "OK bilingual counts"
131+
ls docs/es/*.md | wc -l # must equal ls docs/*.md | wc -l
132+
node --check index.js
133+
```
134+
135+
If any check fails, fix before `git push`.
136+
137+
---
138+
139+
## 8. If You Are Unsure
140+
141+
- Ask the user (in their language: if they wrote in Spanish, answer in Spanish) before guessing URLs, tool counts, or Apple API names.
142+
- Prefer editing existing files over creating new ones. Never create `*.md` unless explicitly requested, except the required mirror in `docs/es/`.
143+
144+
**Remember:** *Bilingual sync is not optional — it is the definition of “done” in this repo.*
145+
146+
---
147+
148+
*Maintained by [@YanxReal](https://github.com/YanxReal) — last updated 2026-08-27 for 47 tools, v1.3.0, Yarn 4 + Make + CI + Vision/UI.*

README.es.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
> 🌐 **Idioma:** [English](README.md) | **Español**
1717
18-
[Instalación](#-instalación-paso-a-paso)[Herramientas](#-herramientas-43)[OpenCode](docs/es/opencode.md)[Codex](docs/es/codex.md)[Claude Code](docs/es/claude-code.md)[Docs](docs/es/architecture.md)
18+
[Instalación](#-instalación-paso-a-paso)[Herramientas](#-herramientas-47)[OpenCode](docs/es/opencode.md)[Codex](docs/es/codex.md)[Claude Code](docs/es/claude-code.md)[Docs](docs/es/architecture.md)
1919

2020
</div>
2121

@@ -67,7 +67,7 @@
6767
2. [Instalación paso a paso](#-instalación-paso-a-paso)
6868
3. [Verificación](#-verificación)
6969
4. [Uso con OpenCode / Codex / Claude Code](#-uso-con-opencode--codex--claude-code)
70-
5. [Herramientas (43)](#-herramientas-43)
70+
5. [Herramientas (47)](#-herramientas-47)
7171
6. [Comandos Make](#-comandos-make)
7272
7. [Documentación](#-documentación)
7373
8. [Arquitectura](#-arquitectura)
@@ -311,7 +311,7 @@ O por proyecto con `.mcp.json`:
311311
312312
---
313313

314-
## 🛠️ Herramientas (43)
314+
## 🛠️ Herramientas (47)
315315

316316
### 1. Compilación, Diagnóstico y Limpieza
317317

@@ -432,8 +432,8 @@ make test
432432
index.js (2250 líneas, 1 archivo)
433433
├── Shebang + Imports (MCP SDK, promisify(exec), fs, path, os)
434434
├── Helpers: shellEscape, expandTilde, runCommand (try/catch + 10MB buffer), formatResult
435-
├── TOOLS[43]: JSON Schema estricto (additionalProperties:false)
436-
├── Handlers[43]: async handle_* con validación + fallbacks (xed→xcode://, swift-format→swiftlint)
435+
├── TOOLS[47]: JSON Schema estricto (additionalProperties:false)
436+
├── Handlers[47]: async handle_* con validación + fallbacks (xed→xcode://, swift-format→swiftlint)
437437
├── Dispatcher: HANDLERS map + ListTools/CallTool (try/catch → isError:true)
438438
└── Server: StdioServerTransport (stdin JSON-RPC, stdout JSON-RPC, stderr logs)
439439
```

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**Model Context Protocol Server for the Apple Ecosystem**
66

7-
*Connect OpenCode, Codex and Claude Code to Xcode — 43 professional tools in a single `index.js`*
7+
*Connect OpenCode, Codex and Claude Code to Xcode — 47 professional tools in a single `index.js`*
88

99
[![CI](https://github.com/YanxReal/Xcode-MPC/actions/workflows/ci.yml/badge.svg)](https://github.com/YanxReal/Xcode-MPC/actions)
1010
[![Node >=18](https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js&logoColor=white)](https://nodejs.org)
@@ -15,7 +15,7 @@
1515

1616
> 🌐 **Language:** **English** | [Español](README.es.md)
1717
18-
[Installation](#-step-by-step-installation)[Tools](#-tools-43)[OpenCode](docs/opencode.md)[Codex](docs/codex.md)[Claude Code](docs/claude-code.md)[Docs](docs/architecture.md)
18+
[Installation](#-step-by-step-installation)[Tools](#-tools-47)[OpenCode](docs/opencode.md)[Codex](docs/codex.md)[Claude Code](docs/claude-code.md)[Docs](docs/architecture.md)
1919

2020
</div>
2121

@@ -67,7 +67,7 @@
6767
2. [Step-by-step Installation](#-step-by-step-installation)
6868
3. [Verification](#-verification)
6969
4. [Usage with OpenCode / Codex / Claude Code](#-usage-with-opencode--codex--claude-code)
70-
5. [Tools (43)](#-tools-43)
70+
5. [Tools (47)](#-tools-47)
7171
6. [Make Commands](#-make-commands)
7272
7. [Documentation](#-documentation)
7373
8. [Architecture](#-architecture)
@@ -311,7 +311,7 @@ Or per-project with `.mcp.json`:
311311
312312
---
313313

314-
## 🛠️ Tools (43)
314+
## 🛠️ Tools (47)
315315

316316
### 1. Build, Diagnostics & Clean
317317

@@ -432,8 +432,8 @@ make test
432432
index.js (2250 lines, 1 file)
433433
├── Shebang + Imports (MCP SDK, promisify(exec), fs, path, os)
434434
├── Helpers: shellEscape, expandTilde, runCommand (try/catch + 10MB buffer), formatResult
435-
├── TOOLS[43]: Strict JSON Schema (additionalProperties:false)
436-
├── Handlers[43]: async handle_* with validation + fallbacks (xed→xcode://, swift-format→swiftlint)
435+
├── TOOLS[47]: Strict JSON Schema (additionalProperties:false)
436+
├── Handlers[47]: async handle_* with validation + fallbacks (xed→xcode://, swift-format→swiftlint)
437437
├── Dispatcher: HANDLERS map + ListTools/CallTool (try/catch → isError:true)
438438
└── Server: StdioServerTransport (stdin JSON-RPC, stdout JSON-RPC, stderr logs)
439439
```

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ We use **CVSS 3.1** for severity. You can track progress via the private advisor
6060

6161
**In scope:**
6262

63-
- `index.js` — MCP server, all 43 tools (`xcode_build`, `simctl_*`, `devicectl_*`, `xctrace_profile`, `agvtool_version_bump`, `xcode_get_active_file`, `xcode_sync_strings`, etc.)
63+
- `index.js` — MCP server, all 47 tools (`xcode_build`, `simctl_*`, `devicectl_*`, `xctrace_profile`, `agvtool_version_bump`, `xcode_get_active_file`, `xcode_sync_strings`, etc.)
6464
- Helpers: `shellEscape` (`index.js:25`), `runCommand` (`index.js:39`), `expandTilde`, `findLatestXcresult`
6565
- Dependency supply chain: `@modelcontextprotocol/sdk`, `yarn.lock` / `.yarn/releases`
6666
- Build / CI: `Makefile`, `.github/workflows/ci.yml`, `scripts/smoke_test.py`

docs/claude-code.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ claude mcp add xcode -- node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js
2828

2929
# Verify
3030
claude mcp list
31-
# xcode: node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js (connected) — 43 tools
31+
# xcode: node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js (connected) — 47 tools
3232

3333
# If you need project scope (only this repo)
3434
# claude mcp add xcode --scope project -- node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js
@@ -94,7 +94,7 @@ make lint && make test
9494
claude mcp list
9595
claude mcp get xcode
9696

97-
# Should show: 43 tools (xcode_build, simctl_list, etc.)
97+
# Should show: 47 tools (xcode_build, simctl_list, etc.)
9898

9999
# 3. Inside Claude Code, try:
100100
# "What Xcode tools do you have?"
@@ -193,4 +193,4 @@ If you use `.mcp.json` in a shared repo, every collaborator needs `node` and `Xc
193193
| **Codex** | `~/.codex/config.toml` (`mcp_servers`) | `node /.../index.js` |
194194
| **Claude Code** | `claude mcp add` / `.mcp.json` (`mcpServers`) | `claude mcp add xcode -- node ...` |
195195

196-
All use the same `index.js` stdio — same `tools/list` (43 tools). See also: [`opencode.md`](opencode.md) · [`codex.md`](codex.md) · [`tools.md`](tools.md)
196+
All use the same `index.js` stdio — same `tools/list` (47 tools). See also: [`opencode.md`](opencode.md) · [`codex.md`](codex.md) · [`tools.md`](tools.md)

docs/codex.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ make lint
7171
# Restart Codex
7272
codex --help
7373
codex mcp list
74-
# should list: xcode (43 tools)
74+
# should list: xcode (47 tools)
7575

7676
# Inside codex, try:
7777
# "list the xcode tools"
@@ -80,7 +80,7 @@ codex mcp list
8080

8181
Server logs go to stderr:
8282
```
83-
✅ Xcode MCP Server started (stdio) — 43 tools registered
83+
✅ Xcode MCP Server started (stdio) — 47 tools registered
8484
```
8585

8686
If it doesn't appear, run manually:

docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ make dev # watch mode
1818

1919
```
2020
Xcode-MPC/
21-
├── index.js # single-file MCP server (2250 lines, 43 tools)
21+
├── index.js # single-file MCP server (2250 lines, 47 tools)
2222
├── package.json # Yarn 4, type:module, bin
2323
├── yarn.lock # immutable lockfile
2424
├── .yarnrc.yml # vendored yarnPath

docs/es/claude-code.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ claude mcp add xcode -- node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js
2828

2929
# Verificar
3030
claude mcp list
31-
# xcode: node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js (connected) — 43 tools
31+
# xcode: node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js (connected) — 47 tools
3232

3333
# Si necesitas scope proyecto (solo este repo)
3434
# claude mcp add xcode --scope project -- node /Users/YanxReal/Dev/Tools/Xcode-MPC/index.js
@@ -94,7 +94,7 @@ make lint && make test
9494
claude mcp list
9595
claude mcp get xcode
9696

97-
# Debe mostrar: 43 tools (xcode_build, simctl_list, etc.)
97+
# Debe mostrar: 47 tools (xcode_build, simctl_list, etc.)
9898

9999
# 3. Dentro de Claude Code, prueba:
100100
# "¿Qué herramientas de Xcode tienes?"
@@ -193,4 +193,4 @@ Si usas `.mcp.json` en repo compartido, cada colaborador debe tener `node` y `Xc
193193
| **Codex** | `~/.codex/config.toml` (`mcp_servers`) | `node /.../index.js` |
194194
| **Claude Code** | `claude mcp add` / `.mcp.json` (`mcpServers`) | `claude mcp add xcode -- node ...` |
195195

196-
Todos usan el mismo `index.js` stdio — mismo `tools/list` (43 tools). Ver también: [`opencode.md`](opencode.md) · [`codex.md`](codex.md) · [`tools.md`](tools.md)
196+
Todos usan el mismo `index.js` stdio — mismo `tools/list` (47 tools). Ver también: [`opencode.md`](opencode.md) · [`codex.md`](codex.md) · [`tools.md`](tools.md)

docs/es/codex.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ make lint
7171
# Reiniciar Codex
7272
codex --help
7373
codex mcp list
74-
# debe listar: xcode (43 tools)
74+
# debe listar: xcode (47 tools)
7575

7676
# Dentro de codex, prueba:
7777
# "lista las herramientas de xcode"
@@ -80,7 +80,7 @@ codex mcp list
8080

8181
Logs del servidor van a stderr:
8282
```
83-
✅ Xcode MCP Server iniciado (stdio) — 43 herramientas registradas
83+
✅ Xcode MCP Server iniciado (stdio) — 47 herramientas registradas
8484
```
8585

8686
Si no aparece, ejecuta manual:

docs/es/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ make dev # watch mode
1818

1919
```
2020
Xcode-MPC/
21-
├── index.js # servidor MCP single-file (2250 líneas, 43 tools)
21+
├── index.js # servidor MCP single-file (2250 líneas, 47 tools)
2222
├── package.json # Yarn 4, type:module, bin
2323
├── yarn.lock # lockfile inmutable
2424
├── .yarnrc.yml # yarnPath vendorizado

0 commit comments

Comments
 (0)