Reference
Cosmos CLI referenceคู่มือ Cosmos CLI
The Cosmos CLI lets you scan AI tool connections, connect the Cosmos MCP server, check auto-connect status, and install the git lesson hook without opening the desktop app.Cosmos CLI ใช้สแกนการเชื่อมต่อ AI tools, เขียน Cosmos MCP config, ตรวจสถานะ auto-connect และติดตั้ง git lesson hook ได้โดยไม่ต้องเปิดแอปเดสก์ท็อป
The cosmos command is the terminal surface for local MCP auto-connect and project lesson hooks. Use it when you want to inspect or repair AI tool connections without opening the desktop app.
Install the CLI shim
From a source checkout, install the command into ~/.local/bin:
./scripts/install-cosmos-cli.sh
Then verify it is available:
which cosmos
cosmos status
If ~/.local/bin is not on your PATH, add it to your shell profile and reopen the terminal.
Scan AI tools
cosmos scan is read-only. It scans known AI tool config locations and reports whether each tool is connected to the Cosmos MCP server.
cosmos scan
cosmos scan --json
Use --json when a script or support workflow needs machine-readable output.
Connect Cosmos MCP
cosmos connect writes the Cosmos MCP entry into supported AI tool configs.
cosmos connect
cosmos connect --all
cosmos connect --tool cursor
cosmos connect --tool vscode
cosmos connect --tool zed
cosmos connect --json
Default behavior is the same as --all: Cosmos scans every supported tool and wires tools that are detected but not connected.
--tool <id> explicitly wires one tool. This path can create that tool's MCP config file when the file is missing, matching the desktop app's install button.
Supported tool IDs:
claude_desktop
claude_code
cursor
cline
windsurf
antigravity
antigravity_cli
continue
vscode
zed
roo_code
After connecting a tool, restart that AI app or session so it reloads its MCP configuration.
Check status
cosmos status shows the compact auto-connect summary.
cosmos status
cosmos status --json
The human output includes whether auto-connect is enabled, when the last scan ran, whether the Cosmos MCP launcher resolved, and how many tools are connected.
Manage lesson hooks
cosmos hooks installs, removes, or checks the Cosmos git post-commit lesson hook. The hook does not block commits; it only prints a reminder when a commit message looks like a bug fix.
cosmos hooks install --path ./my-project
cosmos hooks uninstall --path ./my-project
cosmos hooks status --path ./my-project
cosmos hooks status --json
The hook is marker-delimited, so uninstall removes only the Cosmos-managed block and preserves user-owned hook lines.
Troubleshooting
cosmos: command not found
Install the shim and confirm the target directory is on PATH:
./scripts/install-cosmos-cli.sh
which cosmos
No module named 'core'
Use the current launcher from the Cosmos repo. It resolves symlinks and sets PYTHONPATH automatically. Re-run the shim installer if an older local copy is on your PATH.
Tool connected but AI does not show Cosmos tools
Restart the AI app or the current AI session. Most MCP clients read config only on startup. Then verify with that tool's MCP status command, such as /mcp in Claude Code.
คำสั่ง cosmos คือช่องทางใช้งาน Cosmos จาก Terminal สำหรับ MCP auto-connect และ project lesson hooks เหมาะเวลาต้องการตรวจหรือซ่อมการเชื่อมต่อ AI tools โดยไม่ต้องเปิดแอปเดสก์ท็อป
ติดตั้ง CLI shim
จาก source checkout ให้ติดตั้งคำสั่งลง ~/.local/bin:
./scripts/install-cosmos-cli.sh
จากนั้นตรวจว่าเรียกได้แล้ว:
which cosmos
cosmos status
ถ้า ~/.local/bin ยังไม่อยู่ใน PATH ให้เพิ่มลง shell profile แล้วเปิด Terminal ใหม่
สแกน AI tools
cosmos scan เป็น read-only ใช้สแกนตำแหน่ง config ของ AI tools ที่รู้จัก แล้วรายงานว่าแต่ละ tool เชื่อมกับ Cosmos MCP แล้วหรือยัง
cosmos scan
cosmos scan --json
ใช้ --json เมื่อต้องการ output สำหรับ script หรือ support workflow
เชื่อม Cosmos MCP
cosmos connect เขียน Cosmos MCP entry ลงใน config ของ AI tools ที่รองรับ
cosmos connect
cosmos connect --all
cosmos connect --tool cursor
cosmos connect --tool vscode
cosmos connect --tool zed
cosmos connect --json
ค่า default เหมือน --all: Cosmos จะสแกนทุก tool ที่รองรับ และเชื่อม tool ที่ตรวจพบแต่ยังไม่ connected
--tool <id> ใช้เจาะจง tool เดียว path นี้สามารถสร้างไฟล์ MCP config ให้ tool นั้นได้ถ้าไฟล์ยังไม่มี เหมือนปุ่ม install ในแอปเดสก์ท็อป
Tool IDs ที่รองรับ:
claude_desktop
claude_code
cursor
cline
windsurf
antigravity
antigravity_cli
continue
vscode
zed
roo_code
หลัง connect แล้ว ให้รีสตาร์ท AI app หรือ session นั้น เพื่อให้ tool โหลด MCP config ใหม่
ตรวจสถานะ
cosmos status แสดงสรุป auto-connect แบบสั้น
cosmos status
cosmos status --json
output แบบอ่านง่ายจะบอกว่า auto-connect เปิดอยู่ไหม, scan ล่าสุดเมื่อไหร่, launcher ของ Cosmos MCP resolve ได้ไหม และตอนนี้เชื่อมอยู่กี่ tools
จัดการ lesson hooks
cosmos hooks ใช้ติดตั้ง ลบ หรือตรวจ git post-commit lesson hook ของ Cosmos hook นี้ไม่ block commit แค่เตือนเมื่อ commit message ดูเหมือนเป็น bug fix
cosmos hooks install --path ./my-project
cosmos hooks uninstall --path ./my-project
cosmos hooks status --path ./my-project
cosmos hooks status --json
hook ใช้ marker ชัดเจน ดังนั้น uninstall จะลบเฉพาะ block ที่ Cosmos จัดการ และเก็บบรรทัด hook ของผู้ใช้ไว้
Troubleshooting
cosmos: command not found
ติดตั้ง shim แล้วตรวจว่า path ถูกต้อง:
./scripts/install-cosmos-cli.sh
which cosmos
No module named 'core'
ใช้ launcher รุ่นล่าสุดจาก Cosmos repo ตัว launcher จะ resolve symlink และตั้ง PYTHONPATH ให้อัตโนมัติ ถ้า shell ยังเจอไฟล์เก่า ให้รัน install script ใหม่
Tool connected แล้ว แต่ AI ยังไม่เห็น Cosmos tools
รีสตาร์ท AI app หรือ AI session นั้นก่อน MCP clients ส่วนใหญ่อ่าน config เฉพาะตอน startup จากนั้นตรวจด้วยคำสั่ง MCP ของ tool นั้น เช่น /mcp ใน Claude Code
- Atitechs EngineeringMaintainer