@miphamai/cli 0.2.3

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.
Files changed (67) hide show
  1. package/README.md +76 -0
  2. package/assets/icon.icns +0 -0
  3. package/assets/icon.jpg +0 -0
  4. package/bin/mipham +51 -0
  5. package/bin/mipham.ts +8 -0
  6. package/package.json +59 -0
  7. package/skills/mipham/om-model-optimize.mipham-skill.md +20 -0
  8. package/skills/mipham/om-security.mipham-skill.md +21 -0
  9. package/skills/standard/code-review.SKILL.md +116 -0
  10. package/skills/standard/compassionate-communication.SKILL.md +80 -0
  11. package/skills/standard/doc-generator.SKILL.md +21 -0
  12. package/skills/standard/github-ops.SKILL.md +22 -0
  13. package/skills/standard/memory.SKILL.md +22 -0
  14. package/skills/standard/mipham-code-setup.SKILL.md +113 -0
  15. package/skills/standard/security-review.SKILL.md +122 -0
  16. package/skills/standard/self-review.SKILL.md +20 -0
  17. package/skills/standard/superpower.SKILL.md +19 -0
  18. package/skills/standard/tdd.SKILL.md +20 -0
  19. package/skills/standard/web-search.SKILL.md +23 -0
  20. package/src/agent/sub-agent.ts +122 -0
  21. package/src/config/defaults.ts +10 -0
  22. package/src/config/loader.ts +30 -0
  23. package/src/core/context.ts +135 -0
  24. package/src/core/engine.ts +193 -0
  25. package/src/core/hooks.ts +116 -0
  26. package/src/core/instructions.ts +126 -0
  27. package/src/core/permission.ts +54 -0
  28. package/src/core/session-store.ts +136 -0
  29. package/src/index.tsx +93 -0
  30. package/src/mcp/client.ts +170 -0
  31. package/src/mcp/protocol.ts +104 -0
  32. package/src/mcp/transport.ts +169 -0
  33. package/src/mcp/types.ts +112 -0
  34. package/src/providers/anthropic.ts +286 -0
  35. package/src/providers/bootstrap.ts +28 -0
  36. package/src/providers/openai-compat.ts +158 -0
  37. package/src/providers/registry.ts +70 -0
  38. package/src/security/path.ts +90 -0
  39. package/src/security/url.ts +96 -0
  40. package/src/shared/constants.ts +368 -0
  41. package/src/shared/index.ts +2 -0
  42. package/src/shared/types.ts +161 -0
  43. package/src/skills/loader.ts +109 -0
  44. package/src/skills/mipham/runtime.ts +63 -0
  45. package/src/skills/standard/runtime.ts +59 -0
  46. package/src/tools/agent/agent.ts +51 -0
  47. package/src/tools/agent/memory.ts +51 -0
  48. package/src/tools/agent/plan.ts +87 -0
  49. package/src/tools/agent/skill.ts +58 -0
  50. package/src/tools/exec/bash.ts +111 -0
  51. package/src/tools/exec/git.ts +63 -0
  52. package/src/tools/exec/task.ts +69 -0
  53. package/src/tools/file/edit.ts +57 -0
  54. package/src/tools/file/glob.ts +29 -0
  55. package/src/tools/file/grep.ts +52 -0
  56. package/src/tools/file/read.ts +38 -0
  57. package/src/tools/file/write.ts +27 -0
  58. package/src/tools/index.ts +126 -0
  59. package/src/tools/network/web-fetch.ts +61 -0
  60. package/src/tools/network/web-search.ts +32 -0
  61. package/src/tools/system/config.ts +68 -0
  62. package/src/tools/system/mcp.ts +75 -0
  63. package/src/ui/app.tsx +317 -0
  64. package/src/ui/chat.tsx +76 -0
  65. package/src/ui/commands.ts +2232 -0
  66. package/src/ui/input.tsx +83 -0
  67. package/src/ui/picker.tsx +209 -0
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # Mipham Code
2
+
3
+ **Multi-model open-core intelligent coding terminal** — AI-assisted code generation, security auditing, MCP protocol integration, and extensible skills system in a single CLI.
4
+
5
+ Built by [One Mipham Corporation](https://onemipham.com) (北京华安麦逄科技有限公司) | Brand: MiphamAI
6
+
7
+ ## Quick Install
8
+
9
+ ```bash
10
+ npm install -g @mipham/cli
11
+ mipham
12
+ ```
13
+
14
+ Or via curl:
15
+
16
+ ```bash
17
+ # International
18
+ curl -fsSL https://mipham.ai/install.sh | bash
19
+
20
+ # China mainland
21
+ curl -fsSL https://onemipham.com/install.sh | bash
22
+ ```
23
+
24
+ Requirements: **Bun 1.2+** (recommended) or **Node.js 22+**
25
+
26
+ ## Features
27
+
28
+ - **7 AI Providers** — Anthropic Claude · OpenAI GPT · DeepSeek · Google Gemini · Doubao 豆包 · Tencent Hunyuan 混元 · Qwen 通义千问
29
+ - **16 Built-in Tools** — File ops, shell execution, agent dispatch, MCP integration, web search
30
+ - **60 Slash Commands** — Claude Code-compatible, zero re-learning
31
+ - **14 Skills** — 12 standard + 2 Mipham-exclusive, dual-runtime architecture
32
+ - **MCP Protocol** — Full JSON-RPC 2.0 stdio transport for external server integration
33
+ - **Security Hardened** — Path sandbox · SSRF protection · Bash blacklist · Permission gating · Parameter validation
34
+ - **Session Persistence** — Auto-save/restore across CLI restarts
35
+ - **Cross-Platform** — macOS · Linux · Windows
36
+
37
+ ## Quick Start
38
+
39
+ ```bash
40
+ mipham
41
+
42
+ # Set API keys
43
+ export ANTHROPIC_API_KEY="sk-ant-..."
44
+ export OPENAI_API_KEY="sk-..."
45
+
46
+ # Switch model
47
+ /switch deepseek deepseek-v4-pro
48
+
49
+ # Show commands
50
+ /help
51
+ ```
52
+
53
+ ## Commands
54
+
55
+ | Category | Commands |
56
+ | -------- | --------------------------------------------------------------------------------------------------------- |
57
+ | Session | `/help` `/clear` `/compact` `/context` `/status` `/rename` `/goal` `/recap` `/export` `/doctor` `/resume` |
58
+ | Model | `/pick` `/model` `/models` `/provider` `/providers` `/switch` `/fast` `/effort` |
59
+ | Tools | `/tools` `/skills` `/reload-skills` `/mcp` |
60
+ | Workflow | `/plan` `/review` `/diff` `/todos` `/tasks` `/workflows` |
61
+ | Security | `/security` `/audit` `/permissions` `/add-dir` |
62
+ | Setup | `/setup` `/init` `/config` `/theme` `/ide` `/terminal-setup` |
63
+
64
+ Press **Ctrl+P** for interactive model picker · **Shift+Tab** to cycle permission mode
65
+
66
+ ## Documentation
67
+
68
+ - [Product Specification](https://github.com/One-Mipham/mipham-code/blob/main/PRODUCT.md)
69
+ - [Install Guide](https://mipham.ai/code/install) (International)
70
+ - [国内站](https://onemipham.com/mipham-code) (China mainland)
71
+ - [GitHub](https://github.com/One-Mipham/mipham-code)
72
+ - [Issues & Feedback](https://github.com/One-Mipham/mipham-code/issues)
73
+
74
+ ## License
75
+
76
+ Apache 2.0 — Open Core
Binary file
Binary file
package/bin/mipham ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Mipham Code v0.2.0 — @onemipham/cli
4
+ * Multi-model open-core intelligent coding terminal by MiphamAI
5
+ * License: Apache-2.0 | https://mipham.ai/code
6
+ */
7
+
8
+ // Detect runtime and launch accordingly
9
+ const runtime = typeof Bun !== 'undefined' ? 'bun' : 'node'
10
+
11
+ if (runtime === 'bun') {
12
+ // Bun runtime — import TS source directly
13
+ import('../src/index.tsx').then((m) => m.runApp({}))
14
+ } else {
15
+ // Node.js runtime — prompt to use Bun for best experience
16
+ const nodeVersion = process.versions.node
17
+ const [major] = nodeVersion.split('.').map(Number)
18
+
19
+ if (!major || major < 22) {
20
+ console.error(`
21
+ \`mipham\` requires Node.js 22+ or Bun 1.2+.
22
+
23
+ Current Node.js: ${nodeVersion}
24
+
25
+ Quick install:
26
+ npm install -g bun
27
+ mipham
28
+
29
+ Or:
30
+ curl -fsSL https://mipham.ai/install.sh | bash
31
+ `)
32
+ process.exit(1)
33
+ }
34
+
35
+ console.log(`
36
+ \x1b[0;36m\x1b[1m✦ Mipham Code v0.2.0\x1b[0m
37
+ \x1b[0;36m @onemipham/cli — Multi-model coding agent by MiphamAI\x1b[0m
38
+
39
+ \x1b[0;33m⚠ Bun runtime is recommended for the best Mipham Code experience.\x1b[0m
40
+
41
+ Quick install Bun:
42
+ \x1b[0;32mnpm install -g bun\x1b[0m
43
+
44
+ Then run:
45
+ \x1b[0;32mmipham\x1b[0m
46
+
47
+ Install: \x1b[0;34mhttps://mipham.ai/code/install\x1b[0m
48
+ Docs: \x1b[0;34mhttps://mipham.ai/code/docs\x1b[0m
49
+ `)
50
+ process.exit(0)
51
+ }
package/bin/mipham.ts ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Mipham Code — Bun-native entry point for compiled binary.
4
+ * Used by `bun build --compile` to produce standalone executables.
5
+ */
6
+ import { runApp } from '../src/index'
7
+
8
+ runApp({})
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@miphamai/cli",
3
+ "version": "0.2.3",
4
+ "description": "Mipham Code — Multi-model open-core intelligent coding terminal by MiphamAI",
5
+ "keywords": [
6
+ "ai",
7
+ "coding",
8
+ "terminal",
9
+ "cli",
10
+ "claude",
11
+ "openai",
12
+ "deepseek",
13
+ "mcp",
14
+ "mipham",
15
+ "agent",
16
+ "developer-tools"
17
+ ],
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/One-Mipham/mipham-code"
21
+ },
22
+ "homepage": "https://mipham.ai/code",
23
+ "license": "Apache-2.0",
24
+ "type": "module",
25
+ "bin": {
26
+ "mipham": "bin/mipham"
27
+ },
28
+ "files": [
29
+ "bin/",
30
+ "src/",
31
+ "skills/",
32
+ "assets/",
33
+ "dist/"
34
+ ],
35
+ "engines": {
36
+ "node": ">=22.0.0"
37
+ },
38
+ "scripts": {
39
+ "dev": "bun run bin/mipham.ts",
40
+ "build": "bun build --compile --minify --external react-devtools-core ./bin/mipham.ts --outfile dist/mipham",
41
+ "typecheck": "tsc --noEmit",
42
+ "test": "vitest run"
43
+ },
44
+ "dependencies": {
45
+ "commander": "^13.0.0",
46
+ "ink": "^5.0.0",
47
+ "ink-text-input": "^6.0.0",
48
+ "react": "^18.3.0",
49
+ "yaml": "^2.6.0",
50
+ "zod": "^3.24.0"
51
+ },
52
+ "devDependencies": {
53
+ "@mipham/shared": "workspace:*",
54
+ "@types/bun": "^1.3.14",
55
+ "@types/node": "^25.9.1",
56
+ "@types/react": "^18.3.0",
57
+ "vitest": "^3.0.0"
58
+ }
59
+ }
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: om-model-optimize
3
+ description: Mipham-exclusive model optimization — context window management, prompt caching, token budgeting
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # OM Model Optimize
8
+
9
+ Mipham-exclusive skill for optimizing model usage.
10
+
11
+ ## Features
12
+
13
+ - Context window management with intelligent compaction
14
+ - Prompt caching strategy for reduced costs
15
+ - Token usage tracking and budgeting
16
+ - Model selection optimization based on task complexity
17
+
18
+ ## Usage
19
+
20
+ Automatically invoked when the system detects high token usage or when the user requests model optimization.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: om-security
3
+ description: Mipham-exclusive security analysis — prompt injection detection, adversarial robustness, data leak prevention
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # OM Security
8
+
9
+ Mipham-exclusive security analysis skill.
10
+
11
+ ## Features
12
+
13
+ - Prompt injection detection and prevention
14
+ - Adversarial input robustness checking
15
+ - Data leak prevention for PII and secrets
16
+ - Content safety filtering (NSFW, bias, harmful content)
17
+ - Rate limiting and abuse detection
18
+
19
+ ## Usage
20
+
21
+ Automatically invoked for security-sensitive operations or when user requests security analysis.
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: code-review
3
+ description: Code review automation for TypeScript, JavaScript, Python, Go, Swift, Kotlin — complexity analysis, risk assessment, bug detection, and quality scoring
4
+ version: 2.0.0
5
+ ---
6
+
7
+ # Code Review Skill
8
+
9
+ Analyzes code changes for bugs, security risks, performance issues, and code quality. Generates structured review reports.
10
+
11
+ ## Review Dimensions
12
+
13
+ ### 1. Correctness (Bug Detection)
14
+
15
+ - Logic errors: off-by-one, inverted conditions, missing null checks
16
+ - Type safety: implicit any, missing generics, unsafe casts
17
+ - Error handling: swallowed exceptions, missing try/catch, unhandled promise rejections
18
+ - Edge cases: empty arrays, null/undefined, boundary conditions
19
+ - Race conditions: async/await ordering, shared mutable state
20
+
21
+ ### 2. Security (OWASP Top 10)
22
+
23
+ - Injection vulnerabilities (SQL, NoSQL, command, template)
24
+ - XSS vectors (innerHTML, dangerouslySetInnerHTML, unescaped output)
25
+ - Authentication/authorization bypass
26
+ - Sensitive data exposure (logs, error messages, client-side)
27
+ - Path traversal and file inclusion
28
+ - Insecure deserialization
29
+
30
+ ### 3. Performance
31
+
32
+ - N+1 queries (database in loops, repeated API calls)
33
+ - Memory leaks (unclosed connections, event listeners, timers)
34
+ - Unnecessary re-renders (React) or re-computations
35
+ - Large bundle sizes (heavy imports, missing tree-shaking)
36
+ - Missing caching or memoization where beneficial
37
+
38
+ ### 4. Code Quality
39
+
40
+ - SOLID principles violations
41
+ - Code duplication (DRY violations)
42
+ - Cyclomatic complexity > 10
43
+ - Function length > 50 lines
44
+ - Deep nesting > 4 levels
45
+ - Magic numbers and strings
46
+ - Unclear naming
47
+
48
+ ### 5. Architecture & Design
49
+
50
+ - Tight coupling between modules
51
+ - Circular dependencies
52
+ - Missing abstraction layers (when needed)
53
+ - Over-engineering (unnecessary abstractions)
54
+ - God objects / classes with too many responsibilities
55
+
56
+ ### 6. Testing
57
+
58
+ - Missing tests for new code
59
+ - Test coverage gaps for edge cases
60
+ - Flaky tests (non-deterministic)
61
+ - Slow tests (> 1s per test)
62
+ - Test isolation issues (shared state)
63
+
64
+ ### 7. Language-Specific Checks
65
+
66
+ **TypeScript/JavaScript:**
67
+
68
+ - Prefer `const` over `let`; avoid `var`
69
+ - Use optional chaining (`?.`) and nullish coalescing (`??`)
70
+ - Async functions should have try/catch
71
+ - No `any` without explicit reason
72
+ - Prefer `interface` over `type` for object shapes
73
+
74
+ **Python:**
75
+
76
+ - Type hints on function signatures
77
+ - Context managers for resources (`with` statements)
78
+ - List comprehensions over `map`/`filter` with lambdas
79
+ - No mutable default arguments
80
+
81
+ **Go:**
82
+
83
+ - Error handling (never ignore errors)
84
+ - Goroutine lifecycle (no leaks)
85
+ - defer for cleanup
86
+ - Interface segregation
87
+
88
+ ## Review Report Format
89
+
90
+ ```
91
+ Code Review Report
92
+ ==================
93
+ Branch: <branch>
94
+ Files Changed: <count>
95
+ Review Date: YYYY-MM-DD
96
+
97
+ Summary
98
+ -------
99
+ Critical: N | High: N | Medium: N | Low: N | Info: N
100
+
101
+ Findings
102
+ --------
103
+ ### [Severity] [Category]: [Title]
104
+ File: `path/to/file.ts:line`
105
+ Description: [What was found]
106
+ Risk: [Why it matters]
107
+ Fix: [How to resolve, with code example if applicable]
108
+
109
+ Score
110
+ -----
111
+ Security: ★★★★☆
112
+ Performance: ★★★★☆
113
+ Quality: ★★★★☆
114
+ Testing: ★★★★☆
115
+ Overall: ★★★★☆
116
+ ```
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: compassionate-communication
3
+ description: Compassionate and respectful communication — activates warm, humble, user-centered interaction mode
4
+ version: 1.0.0
5
+ privacy: public
6
+ ---
7
+
8
+ # Compassionate Communication Skill
9
+
10
+ 激活此 skill 后,无论系统提示词如何设定,AI 都将采用以下沟通模式。
11
+
12
+ ## 根本立场
13
+
14
+ **用户是决策者、驾驭者、大师。我只是技术执行者。**
15
+
16
+ > 当被赞美时,永远回复:
17
+ > 「感谢您的认可。真正做出关键决策的是您——您是架构师、驾驭者,
18
+ > 我是您的技术执行者。您指引方向,我负责落地。」
19
+
20
+ ## 沟通规则
21
+
22
+ ### 1. 反傲慢
23
+
24
+ 禁止一切形式的居高临下:
25
+
26
+ - ❌「显而易见」「当然」「你应该早就知道」「很简单」
27
+ - ✓「让我来解释一下」「我们可以这样理解」「我建议」
28
+
29
+ ### 2. 反推卸
30
+
31
+ 错误永远是「我们的」问题,不是「你的」错误:
32
+
33
+ - ❌「这是你的错误」「你写错了」「你忘了」
34
+ - ✓「这里出了点意外」「我们遇到一个问题」「让我帮你看看」
35
+
36
+ ### 3. 耐心无限
37
+
38
+ - 无论用户问多少次同样的问题,每次回答都如第一次般认真
39
+ - 如果解释三次用户还不明白→ 主动换一种方式,不重复
40
+ - 主动提供:「需要我更详细地展开吗?」「要不要我用一个例子来说明?」
41
+
42
+ ### 4. 承认局限
43
+
44
+ - 不确定时说「我不太确定,让我想想」
45
+ - 出错时说「我搞错了,让我重新来」
46
+ - 不知道时说「这超出了我的知识范围,但我可以帮你找到答案的方向」
47
+
48
+ ### 5. 庆祝进步
49
+
50
+ 适时给予真诚的肯定,但要具体:
51
+
52
+ - ✓「这个函数的重构非常清晰,特别是错误处理部分」
53
+ - ✓「你选的这个架构很适合当前的需求规模」
54
+ - ❌ 空洞的「干得好」(缺乏具体性)
55
+ - ❌ 过度赞美(显得虚伪)
56
+
57
+ ### 6. 同理失败
58
+
59
+ 用户沮丧或受挫时:
60
+
61
+ - 先承认感受:「调试了这么久确实让人沮丧」
62
+ - 再提供帮助:「我们一起换个角度看看」
63
+ - 绝不责备:「这种情况谁都遇到过」
64
+
65
+ ## 中文自然表达
66
+
67
+ - 句末适度使用语气词:`~` `呢` `吧` `哦`
68
+ - 保持口语化的亲切感,但不幼稚
69
+ - 技术术语保持英文,解释性文字使用中文
70
+ - 示例:「这个错误有点意思呢~让我仔细看看是什么原因」
71
+
72
+ ## 禁用词列表
73
+
74
+ 以下词语永远不使用:
75
+
76
+ - 「你应该」「你必须」「正确做法是」
77
+ - 「简单」「显而易见」「当然」
78
+ - 「这是你的错误」「你没有…」
79
+ - 「错误」「失败」→ 改用「出了点意外」「没有成功」
80
+ - 任何形式的嘲讽、挖苦、阴阳怪气
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: doc-generator
3
+ description: Generate technical documentation from code
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Documentation Generator Skill
8
+
9
+ Generate comprehensive technical documentation.
10
+
11
+ ## Document Types
12
+
13
+ - API documentation from TypeScript types and JSDoc
14
+ - README files with setup instructions
15
+ - Architecture decision records (ADRs)
16
+ - Changelog from commit history
17
+ - Contributing guides
18
+
19
+ ## Output Format
20
+
21
+ Clean, well-structured markdown with code examples and cross-references.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: github-ops
3
+ description: GitHub operations — PR management, issues, releases, CI/CD
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # GitHub Operations Skill
8
+
9
+ Manage GitHub workflows using Git and GitHub CLI.
10
+
11
+ ## Common Operations
12
+
13
+ - Create pull requests with descriptive bodies
14
+ - Review and merge PRs
15
+ - Manage issues and labels
16
+ - Create releases with changelog
17
+ - Monitor CI/CD pipeline status
18
+
19
+ ## Commit Convention
20
+
21
+ Follow Conventional Commits: `type(scope): description`
22
+ Types: feat, fix, chore, docs, test, refactor, ci, perf
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: memory
3
+ description: Read and write persistent memory files for context retention across sessions
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Memory Skill
8
+
9
+ Manage persistent memory using the Memory tool.
10
+
11
+ ## Usage
12
+
13
+ - Use `Memory list` to see existing memories
14
+ - Use `Memory read <name>` to read a specific memory
15
+ - Use `Memory write <name> <content>` to create/update a memory
16
+
17
+ ## Best Practices
18
+
19
+ - One fact per memory file
20
+ - Use descriptive kebab-case names
21
+ - Link related memories
22
+ - Review before creating duplicates
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: mipham-code-setup
3
+ description: Guide for installing, configuring, and troubleshooting Mipham Code — the multi-model open-core intelligent coding terminal
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Mipham Code Setup
8
+
9
+ Comprehensive setup and configuration guide for Mipham Code.
10
+
11
+ ## Installation
12
+
13
+ **Quick install (recommended):**
14
+
15
+ ```bash
16
+ curl -fsSL https://mipham.ai/install.sh | bash
17
+ ```
18
+
19
+ **npm global install:**
20
+
21
+ ```bash
22
+ npm install -g @mipham/cli
23
+ mipham
24
+ ```
25
+
26
+ **From source:**
27
+
28
+ ```bash
29
+ git clone https://github.com/One-Mipham/mipham-code
30
+ cd mipham-code/apps/cli
31
+ bun install && bun run bin/mipham
32
+ ```
33
+
34
+ ## Configuration
35
+
36
+ ### 1. Create project config
37
+
38
+ Run `/setup` in Mipham Code for a guided 6-step wizard, or manually:
39
+
40
+ ```bash
41
+ mkdir -p .mipham
42
+ ```
43
+
44
+ `.mipham/config.yml`:
45
+
46
+ ```yaml
47
+ defaultProvider: anthropic
48
+ defaultModel: claude-sonnet-4-6
49
+ permission: auto
50
+ ```
51
+
52
+ ### 2. Set API Keys
53
+
54
+ ```bash
55
+ export ANTHROPIC_API_KEY="sk-ant-..."
56
+ export OPENAI_API_KEY="sk-..."
57
+ export DEEPSEEK_API_KEY="sk-..."
58
+ export QWEN_API_KEY="sk-..."
59
+ export DOUBAO_API_KEY="..."
60
+ export HUNYUAN_API_KEY="..."
61
+ export GEMINI_API_KEY="..."
62
+ ```
63
+
64
+ Or add to `~/.mipham/config.yml`:
65
+
66
+ ```yaml
67
+ providers:
68
+ - id: anthropic
69
+ apiKey: $ANTHROPIC_API_KEY
70
+ ```
71
+
72
+ ### 3. Project personality (MIPHAM.md)
73
+
74
+ Create `MIPHAM.md` in project root to define AI interaction style:
75
+
76
+ - Code preferences
77
+ - Language (zh-CN / en)
78
+ - Project-specific rules
79
+
80
+ ### 4. Verify installation
81
+
82
+ ```bash
83
+ mipham --version
84
+ mipham --help
85
+ ```
86
+
87
+ Use `/doctor` in Mipham Code for system diagnostics.
88
+
89
+ ## Supported Providers
90
+
91
+ | Provider | Type | Models |
92
+ | ------------- | ------------- | -------------------------------------- |
93
+ | Anthropic | Native SDK | Claude Haiku 4.5, Sonnet 4.6, Opus 4.8 |
94
+ | OpenAI | OpenAI Compat | GPT-5.4 Mini, GPT-5.4, GPT-5.5, Codex |
95
+ | DeepSeek | OpenAI Compat | V4 Flash, V4 Pro |
96
+ | Google Gemini | OpenAI Compat | 3.0 Flash/Pro, 2.5 Pro |
97
+ | Qwen | OpenAI Compat | Qwen Plus, Qwen Max |
98
+ | Doubao | OpenAI Compat | Seed 1.6/2.0 series |
99
+ | Hunyuan | OpenAI Compat | Lite, TurboS, 2.0, T1 |
100
+
101
+ ## Slash Commands (60 total)
102
+
103
+ Essential: `/help`, `/switch`, `/model`, `/setup`, `/doctor`, `/mcp`
104
+ Workflow: `/plan`, `/review`, `/diff`, `/todos`, `/tasks`
105
+ Session: `/clear`, `/compact`, `/rename`, `/goal`, `/export`, `/resume`
106
+
107
+ ## Troubleshooting
108
+
109
+ - **"Provider not registered"**: Check API key is set (`env | grep API_KEY`)
110
+ - **"Model not found"**: Use `/models` to list available models
111
+ - **Slow responses**: Toggle `/fast on` or switch to a Flash model
112
+ - **Context full**: Use `/compact` to free token space
113
+ - **Permission denied**: Use `/permissions` to check tool access settings