opencode-account-manager 0.4.1 → 0.4.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.
- package/README.md +134 -168
- package/README_VI.md +232 -0
- package/dist/cli.js +1 -1
- package/dist/core/importers/amExport.d.ts +42 -0
- package/dist/core/importers/amExport.d.ts.map +1 -0
- package/dist/core/importers/amExport.js +154 -0
- package/dist/core/importers/amExport.js.map +1 -0
- package/dist/core/types.d.ts +13 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +15 -0
- package/dist/core/types.js.map +1 -1
- package/dist/tui/Dashboard.d.ts.map +1 -1
- package/dist/tui/Dashboard.js +34 -19
- package/dist/tui/Dashboard.js.map +1 -1
- package/dist/tui/components/ImportModal.d.ts.map +1 -1
- package/dist/tui/components/ImportModal.js +41 -4
- package/dist/tui/components/ImportModal.js.map +1 -1
- package/docs/ROADMAP.md +25 -9
- package/package.json +1 -1
- package/src/cli.ts +1 -1
- package/src/core/importers/amExport.ts +177 -0
- package/src/core/types.ts +40 -0
- package/src/tui/Dashboard.tsx +35 -19
- package/src/tui/components/ImportModal.tsx +50 -4
package/README.md
CHANGED
|
@@ -1,266 +1,232 @@
|
|
|
1
1
|
# OpenCode Account Manager (OCAM)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
|
+
<h3>TUI Dashboard for OpenCode Account Management</h3>
|
|
5
|
+
<p>Manage providers, MCP servers, and plugin accounts in one place.</p>
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://www.npmjs.com/package/opencode-account-manager">
|
|
9
|
+
<img src="https://img.shields.io/npm/v/opencode-account-manager.svg" alt="npm version">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/opencode-account-manager">
|
|
12
|
+
<img src="https://img.shields.io/npm/dw/opencode-account-manager.svg" alt="npm downloads">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/d-init-d/opencode-account-manager/blob/main/LICENSE">
|
|
15
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License">
|
|
16
|
+
</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p>
|
|
20
|
+
<strong>English</strong> |
|
|
21
|
+
<a href="./README_VI.md">Tiếng Việt</a>
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
4
24
|
|
|
5
|
-
|
|
25
|
+
---
|
|
6
26
|
|
|
7
|
-
|
|
8
|
-
- **Providers**: Xem tất cả AI providers (Google, Ollama, Claudible, Antigravity Manager) với số models
|
|
9
|
-
- **MCP Servers**: Xem trạng thái enabled/disabled của các MCP servers
|
|
10
|
-
- **Plugin Accounts**: Quản lý accounts của Antigravity Auth plugin
|
|
11
|
-
- Xem rate limit status theo từng model (claude, gemini)
|
|
12
|
-
- Enable/Disable accounts
|
|
13
|
-
- Xóa accounts
|
|
27
|
+
## Features
|
|
14
28
|
|
|
15
|
-
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- **
|
|
29
|
+
- **Providers View**: See all AI providers (Google, Ollama, Anthropic, etc.) with model counts
|
|
30
|
+
- **MCP Servers**: View enabled/disabled status of MCP servers
|
|
31
|
+
- **Plugin Accounts**: Manage Google accounts connected to OpenCode
|
|
32
|
+
- Rate limit status per model (claude, gemini)
|
|
33
|
+
- Enable/Disable/Delete accounts
|
|
34
|
+
- **Encrypted Export**: AES-256-GCM encryption with password protection
|
|
35
|
+
- **Multi-format Import**: Support for encrypted `.ocam`, plain JSON, and Antigravity Manager exports
|
|
21
36
|
|
|
22
37
|
---
|
|
23
38
|
|
|
24
|
-
##
|
|
39
|
+
## Installation
|
|
25
40
|
|
|
26
|
-
###
|
|
41
|
+
### Option A: Let an LLM do it
|
|
27
42
|
|
|
28
|
-
|
|
29
|
-
# Clone repo
|
|
30
|
-
git clone https://github.com/d-init-d/opencode-account-manager.git
|
|
31
|
-
cd opencode-account-manager
|
|
43
|
+
Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
npm
|
|
45
|
+
```
|
|
46
|
+
Install opencode-account-manager globally via npm, then run "ocam" to verify installation.
|
|
47
|
+
Repository: https://github.com/d-init-d/opencode-account-manager
|
|
48
|
+
```
|
|
35
49
|
|
|
36
|
-
|
|
37
|
-
npm run build
|
|
50
|
+
### Option B: Install from npm
|
|
38
51
|
|
|
39
|
-
|
|
40
|
-
npm
|
|
52
|
+
```bash
|
|
53
|
+
npm install -g opencode-account-manager
|
|
41
54
|
```
|
|
42
55
|
|
|
43
|
-
###
|
|
56
|
+
### Option C: Install from GitHub
|
|
44
57
|
|
|
45
58
|
```bash
|
|
46
59
|
npm install -g github:d-init-d/opencode-account-manager
|
|
47
60
|
```
|
|
48
61
|
|
|
49
|
-
###
|
|
62
|
+
### Verify installation
|
|
50
63
|
|
|
51
64
|
```bash
|
|
52
|
-
# Nếu đã npm link hoặc cài global
|
|
53
65
|
ocam --version
|
|
54
|
-
|
|
55
|
-
# Hoặc chạy trực tiếp
|
|
56
|
-
node dist/cli.js --version
|
|
57
66
|
```
|
|
58
67
|
|
|
59
68
|
---
|
|
60
69
|
|
|
61
|
-
##
|
|
70
|
+
## For LLM Agents
|
|
71
|
+
|
|
72
|
+
### Step-by-Step Instructions
|
|
62
73
|
|
|
63
|
-
|
|
74
|
+
1. Run `npm install -g opencode-account-manager` to install globally
|
|
75
|
+
2. Run `ocam` to start the TUI dashboard
|
|
76
|
+
3. The dashboard will auto-detect OpenCode config at `~/.config/opencode/opencode.json`
|
|
77
|
+
|
|
78
|
+
### Verification
|
|
64
79
|
|
|
65
80
|
```bash
|
|
66
|
-
|
|
67
|
-
|
|
81
|
+
ocam --version
|
|
82
|
+
# Expected output: 0.4.2
|
|
83
|
+
```
|
|
68
84
|
|
|
69
|
-
|
|
70
|
-
opencode-account-manager
|
|
85
|
+
---
|
|
71
86
|
|
|
72
|
-
|
|
73
|
-
npm run dashboard
|
|
87
|
+
## Usage
|
|
74
88
|
|
|
75
|
-
|
|
76
|
-
|
|
89
|
+
### Start Dashboard
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
ocam
|
|
93
|
+
# or
|
|
94
|
+
opencode-account-manager
|
|
77
95
|
```
|
|
78
96
|
|
|
79
97
|
### CLI Commands
|
|
80
98
|
|
|
81
99
|
```bash
|
|
82
|
-
#
|
|
100
|
+
# List accounts
|
|
83
101
|
ocam list
|
|
84
102
|
|
|
85
|
-
# Export accounts
|
|
103
|
+
# Export accounts
|
|
86
104
|
ocam export -o backup.json
|
|
87
105
|
|
|
88
|
-
# Import accounts
|
|
106
|
+
# Import accounts
|
|
89
107
|
ocam import backup.json
|
|
90
108
|
|
|
91
|
-
# Import
|
|
109
|
+
# Import from Antigravity Manager folder
|
|
92
110
|
ocam import-am
|
|
93
111
|
|
|
94
|
-
#
|
|
112
|
+
# Help
|
|
95
113
|
ocam --help
|
|
96
114
|
```
|
|
97
115
|
|
|
98
116
|
---
|
|
99
117
|
|
|
100
|
-
##
|
|
118
|
+
## Keyboard Shortcuts
|
|
101
119
|
|
|
102
120
|
### Main Dashboard
|
|
103
121
|
|
|
104
|
-
|
|
|
105
|
-
|
|
106
|
-
| `Tab` |
|
|
107
|
-
| `R` | Refresh
|
|
108
|
-
| `E` | Export accounts
|
|
109
|
-
| `I` | Import accounts
|
|
110
|
-
| `A` | Import
|
|
111
|
-
| `S` |
|
|
112
|
-
| `Q` |
|
|
113
|
-
|
|
114
|
-
### Select Mode (
|
|
115
|
-
|
|
116
|
-
|
|
|
117
|
-
|
|
118
|
-
| `↑/↓` |
|
|
119
|
-
| `Space` |
|
|
120
|
-
| `A` |
|
|
121
|
-
| `N` |
|
|
122
|
-
| `E` | Enable
|
|
123
|
-
| `D` | Disable
|
|
124
|
-
| `X` | Export
|
|
125
|
-
| `DEL` |
|
|
126
|
-
| `
|
|
127
|
-
|
|
128
|
-
### Export Flow
|
|
129
|
-
|
|
130
|
-
1. Bấm `E` để export
|
|
131
|
-
2. Chọn format: `[1] Encrypted (.ocam)` hoặc `[2] Plain JSON`
|
|
132
|
-
3. Chọn folder lưu file
|
|
133
|
-
4. Nhập password (chỉ với encrypted)
|
|
134
|
-
5. Done!
|
|
135
|
-
|
|
136
|
-
### Import Flow
|
|
137
|
-
|
|
138
|
-
1. Bấm `I` để import
|
|
139
|
-
2. Duyệt và chọn file `.ocam` hoặc `.json`
|
|
140
|
-
3. Nhập password (chỉ với file encrypted)
|
|
141
|
-
4. Xem preview các accounts
|
|
142
|
-
5. Bấm `Enter` để confirm import
|
|
122
|
+
| Key | Action |
|
|
123
|
+
|-----|--------|
|
|
124
|
+
| `Tab` | Switch section (Providers → Accounts → MCP) |
|
|
125
|
+
| `R` | Refresh data |
|
|
126
|
+
| `E` | Export accounts |
|
|
127
|
+
| `I` | Import accounts |
|
|
128
|
+
| `A` | Import from Antigravity Manager |
|
|
129
|
+
| `S` | Enter Select Mode |
|
|
130
|
+
| `Q` | Quit |
|
|
131
|
+
|
|
132
|
+
### Select Mode (Accounts)
|
|
133
|
+
|
|
134
|
+
| Key | Action |
|
|
135
|
+
|-----|--------|
|
|
136
|
+
| `↑/↓` | Navigate |
|
|
137
|
+
| `Space` | Toggle selection |
|
|
138
|
+
| `A` | Select all |
|
|
139
|
+
| `N` | Deselect all |
|
|
140
|
+
| `E` | Enable selected |
|
|
141
|
+
| `D` | Disable selected |
|
|
142
|
+
| `X` | Export selected |
|
|
143
|
+
| `DEL` | Delete selected |
|
|
144
|
+
| `Esc` | Exit Select Mode |
|
|
143
145
|
|
|
144
146
|
---
|
|
145
147
|
|
|
146
|
-
##
|
|
148
|
+
## Supported Import Formats
|
|
147
149
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
- Human-readable, không mã hóa
|
|
155
|
-
- Chứa refresh tokens dạng clear text
|
|
156
|
-
- Chỉ nên dùng cho local backup
|
|
150
|
+
| Format | Extension | Description |
|
|
151
|
+
|--------|-----------|-------------|
|
|
152
|
+
| Encrypted | `.ocam` | AES-256-GCM encrypted, password required |
|
|
153
|
+
| Portable | `.json` | OpenCode Account Manager plain export |
|
|
154
|
+
| AM Export | `.json` | Antigravity Manager app export `[{email, refresh_token}]` |
|
|
155
|
+
| Plugin Native | `.json` | `antigravity-accounts.json` format |
|
|
157
156
|
|
|
158
157
|
---
|
|
159
158
|
|
|
160
|
-
##
|
|
161
|
-
|
|
162
|
-
| File | Vị trí | Mô tả |
|
|
163
|
-
|------|--------|-------|
|
|
164
|
-
| `opencode.json` | `~/.config/opencode/` | Config chính của OpenCode (providers, MCP) |
|
|
165
|
-
| `antigravity-accounts.json` | `%APPDATA%/opencode/` | Accounts của plugin (Windows) |
|
|
166
|
-
| `antigravity-accounts.json` | `~/.config/opencode/` | Accounts của plugin (Linux/Mac) |
|
|
167
|
-
| `ocam-config.json` | `%APPDATA%/opencode/` | Preferences của app (recent folders) |
|
|
159
|
+
## Configuration Paths
|
|
168
160
|
|
|
169
|
-
|
|
161
|
+
| File | Windows | Linux/Mac |
|
|
162
|
+
|------|---------|-----------|
|
|
163
|
+
| OpenCode config | `~/.config/opencode/opencode.json` | `~/.config/opencode/opencode.json` |
|
|
164
|
+
| Plugin accounts | `%APPDATA%/opencode/antigravity-accounts.json` | `~/.config/opencode/antigravity-accounts.json` |
|
|
165
|
+
| OCAM preferences | `%APPDATA%/opencode/ocam-config.json` | `~/.config/opencode/ocam-config.json` |
|
|
170
166
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
- **Node.js**: >= 16.x
|
|
174
|
-
- **OpenCode**: Cần cài sẵn OpenCode với Antigravity Auth plugin
|
|
175
|
-
- **Terminal**: Hỗ trợ Unicode và 256 colors (Windows Terminal, iTerm2, etc.)
|
|
167
|
+
> **Note**: `~` on Windows resolves to your user home directory (e.g., `C:\Users\YourName`)
|
|
176
168
|
|
|
177
169
|
---
|
|
178
170
|
|
|
179
|
-
##
|
|
171
|
+
## Requirements
|
|
180
172
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
Providers Models MCP On MCP Off Accounts Available Limited
|
|
185
|
-
4 29 6 0 5 3 2
|
|
186
|
-
|
|
187
|
-
Sections: [1] Providers [2] Accounts [3] MCP (Tab to switch)
|
|
188
|
-
|
|
189
|
-
╭─ PROVIDERS ──────────────────────────────────────────────────╮
|
|
190
|
-
│ PROVIDER MODELS TYPE BASE URL │
|
|
191
|
-
│ Google 7 builtin - │
|
|
192
|
-
│ Ollama 5 custom http://localhost:11434│
|
|
193
|
-
│ Claudible 3 custom https://claudible.io │
|
|
194
|
-
│ Antigravity Manager 14 custom http://localhost:8045 │
|
|
195
|
-
╰──────────────────────────────────────────────────────────────╯
|
|
196
|
-
|
|
197
|
-
╭─ PLUGIN ACCOUNTS (opencode-antigravity-auth) ────────────────╮
|
|
198
|
-
│ EMAIL STATUS RATE LIMIT │
|
|
199
|
-
│ user1@gmail.com enabled claude: 2.1h │
|
|
200
|
-
│ user2@gmail.com enabled OK │
|
|
201
|
-
│ user3@gmail.com disabled - │
|
|
202
|
-
╰──────────────────────────────────────────────────────────────╯
|
|
203
|
-
|
|
204
|
-
╭─ MCP SERVERS ────────────────────────────────────────────────╮
|
|
205
|
-
│ SERVER STATUS ENV COMMAND │
|
|
206
|
-
│ playwright enabled 0 npx @playwright/mcp │
|
|
207
|
-
│ firecrawl enabled 1 npx firecrawl-mcp │
|
|
208
|
-
│ github enabled 1 npx @modelcontextprot...│
|
|
209
|
-
╰──────────────────────────────────────────────────────────────╯
|
|
210
|
-
|
|
211
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
212
|
-
│ [R] Refresh [E] Export [I] Import [A] AM Import [S] Select Mode [Q] Quit │
|
|
213
|
-
└──────────────────────────────────────────────────────────────┘
|
|
214
|
-
```
|
|
173
|
+
- **Node.js**: >= 16.x
|
|
174
|
+
- **OpenCode**: Installed and configured
|
|
175
|
+
- **Terminal**: Unicode and 256 colors support (Windows Terminal, iTerm2, etc.)
|
|
215
176
|
|
|
216
177
|
---
|
|
217
178
|
|
|
218
179
|
## Troubleshooting
|
|
219
180
|
|
|
220
|
-
###
|
|
181
|
+
### "command not found: ocam"
|
|
221
182
|
|
|
222
183
|
```bash
|
|
223
|
-
|
|
224
|
-
cd /path/to/opencode-account-manager
|
|
225
|
-
npm link
|
|
226
|
-
|
|
227
|
-
# Hoặc chạy trực tiếp:
|
|
228
|
-
node /path/to/opencode-account-manager/dist/cli.js
|
|
184
|
+
npm install -g opencode-account-manager
|
|
229
185
|
```
|
|
230
186
|
|
|
231
|
-
###
|
|
187
|
+
### "Plugin accounts file not found"
|
|
188
|
+
|
|
189
|
+
Login at least one account first:
|
|
232
190
|
|
|
233
191
|
```bash
|
|
234
|
-
|
|
235
|
-
npm run build
|
|
192
|
+
opencode auth login
|
|
236
193
|
```
|
|
237
194
|
|
|
238
|
-
###
|
|
195
|
+
### "Cannot find module"
|
|
196
|
+
|
|
197
|
+
Reinstall the package:
|
|
239
198
|
|
|
240
|
-
Cần đăng nhập ít nhất 1 account trong OpenCode trước:
|
|
241
199
|
```bash
|
|
242
|
-
|
|
200
|
+
npm uninstall -g opencode-account-manager
|
|
201
|
+
npm install -g opencode-account-manager
|
|
243
202
|
```
|
|
244
203
|
|
|
245
204
|
---
|
|
246
205
|
|
|
247
206
|
## Documentation
|
|
248
207
|
|
|
249
|
-
- [ROADMAP.md](./docs/ROADMAP.md) -
|
|
250
|
-
- [BLUEPRINT.md](./docs/BLUEPRINT.md) -
|
|
208
|
+
- [ROADMAP.md](./docs/ROADMAP.md) - Version history and plans
|
|
209
|
+
- [BLUEPRINT.md](./docs/BLUEPRINT.md) - Technical architecture
|
|
251
210
|
|
|
252
211
|
---
|
|
253
212
|
|
|
254
213
|
## Contributing
|
|
255
214
|
|
|
256
|
-
1. Fork repo
|
|
257
|
-
2.
|
|
258
|
-
3. Commit: `git commit -m "feat:
|
|
259
|
-
4. Push: `git push origin feature/
|
|
260
|
-
5.
|
|
215
|
+
1. Fork the repo
|
|
216
|
+
2. Create branch: `git checkout -b feature/your-feature`
|
|
217
|
+
3. Commit: `git commit -m "feat: description"`
|
|
218
|
+
4. Push: `git push origin feature/your-feature`
|
|
219
|
+
5. Create Pull Request
|
|
261
220
|
|
|
262
221
|
---
|
|
263
222
|
|
|
264
223
|
## License
|
|
265
224
|
|
|
266
|
-
MIT
|
|
225
|
+
MIT License. See [LICENSE](./LICENSE) for details.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Credits
|
|
230
|
+
|
|
231
|
+
- [OpenCode](https://opencode.ai) - The AI coding assistant this tool is built for
|
|
232
|
+
- [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) - Optional plugin for Google OAuth authentication
|
package/README_VI.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# OpenCode Account Manager (OCAM)
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<h3>TUI Dashboard quản lý tài khoản OpenCode</h3>
|
|
5
|
+
<p>Quản lý providers, MCP servers, và plugin accounts trong một giao diện.</p>
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://www.npmjs.com/package/opencode-account-manager">
|
|
9
|
+
<img src="https://img.shields.io/npm/v/opencode-account-manager.svg" alt="npm version">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/opencode-account-manager">
|
|
12
|
+
<img src="https://img.shields.io/npm/dw/opencode-account-manager.svg" alt="npm downloads">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/d-init-d/opencode-account-manager/blob/main/LICENSE">
|
|
15
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License">
|
|
16
|
+
</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p>
|
|
20
|
+
<a href="./README.md">English</a> |
|
|
21
|
+
<strong>Tiếng Việt</strong>
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Tính năng
|
|
28
|
+
|
|
29
|
+
- **Xem Providers**: Hiển thị tất cả AI providers (Google, Ollama, Anthropic, etc.) với số lượng models
|
|
30
|
+
- **MCP Servers**: Xem trạng thái bật/tắt của các MCP servers
|
|
31
|
+
- **Quản lý Accounts**: Quản lý các tài khoản Google đang kết nối với OpenCode
|
|
32
|
+
- Trạng thái rate limit theo từng model (claude, gemini)
|
|
33
|
+
- Bật/Tắt/Xóa accounts
|
|
34
|
+
- **Export mã hóa**: Mã hóa AES-256-GCM với mật khẩu bảo vệ
|
|
35
|
+
- **Import đa định dạng**: Hỗ trợ file `.ocam` mã hóa, JSON thuần, và file export từ Antigravity Manager
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Cài đặt
|
|
40
|
+
|
|
41
|
+
### Cách A: Nhờ AI cài giúp
|
|
42
|
+
|
|
43
|
+
Paste đoạn này vào bất kỳ AI agent nào (Claude Code, OpenCode, Cursor, etc.):
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Cài đặt opencode-account-manager từ npm, sau đó chạy "ocam" để kiểm tra.
|
|
47
|
+
Repository: https://github.com/d-init-d/opencode-account-manager
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Cách B: Cài từ npm
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install -g opencode-account-manager
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Cách C: Cài từ GitHub
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install -g github:d-init-d/opencode-account-manager
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Kiểm tra cài đặt
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
ocam --version
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Dành cho AI Agents
|
|
71
|
+
|
|
72
|
+
### Hướng dẫn từng bước
|
|
73
|
+
|
|
74
|
+
1. Chạy `npm install -g opencode-account-manager` để cài global
|
|
75
|
+
2. Chạy `ocam` để mở TUI dashboard
|
|
76
|
+
3. Dashboard sẽ tự động đọc config OpenCode tại `~/.config/opencode/opencode.json`
|
|
77
|
+
|
|
78
|
+
### Xác minh
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
ocam --version
|
|
82
|
+
# Kết quả mong đợi: 0.4.2
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Sử dụng
|
|
88
|
+
|
|
89
|
+
### Mở Dashboard
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
ocam
|
|
93
|
+
# hoặc
|
|
94
|
+
opencode-account-manager
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Các lệnh CLI
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Liệt kê accounts
|
|
101
|
+
ocam list
|
|
102
|
+
|
|
103
|
+
# Export accounts
|
|
104
|
+
ocam export -o backup.json
|
|
105
|
+
|
|
106
|
+
# Import accounts
|
|
107
|
+
ocam import backup.json
|
|
108
|
+
|
|
109
|
+
# Import từ thư mục Antigravity Manager
|
|
110
|
+
ocam import-am
|
|
111
|
+
|
|
112
|
+
# Trợ giúp
|
|
113
|
+
ocam --help
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Phím tắt
|
|
119
|
+
|
|
120
|
+
### Dashboard chính
|
|
121
|
+
|
|
122
|
+
| Phím | Chức năng |
|
|
123
|
+
|------|-----------|
|
|
124
|
+
| `Tab` | Chuyển section (Providers → Accounts → MCP) |
|
|
125
|
+
| `R` | Làm mới dữ liệu |
|
|
126
|
+
| `E` | Export accounts |
|
|
127
|
+
| `I` | Import accounts |
|
|
128
|
+
| `A` | Import từ Antigravity Manager |
|
|
129
|
+
| `S` | Vào chế độ chọn |
|
|
130
|
+
| `Q` | Thoát |
|
|
131
|
+
|
|
132
|
+
### Chế độ chọn (Accounts)
|
|
133
|
+
|
|
134
|
+
| Phím | Chức năng |
|
|
135
|
+
|------|-----------|
|
|
136
|
+
| `↑/↓` | Di chuyển |
|
|
137
|
+
| `Space` | Chọn/bỏ chọn |
|
|
138
|
+
| `A` | Chọn tất cả |
|
|
139
|
+
| `N` | Bỏ chọn tất cả |
|
|
140
|
+
| `E` | Bật các account đã chọn |
|
|
141
|
+
| `D` | Tắt các account đã chọn |
|
|
142
|
+
| `X` | Export các account đã chọn |
|
|
143
|
+
| `DEL` | Xóa các account đã chọn |
|
|
144
|
+
| `Esc` | Thoát chế độ chọn |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Định dạng Import được hỗ trợ
|
|
149
|
+
|
|
150
|
+
| Định dạng | Đuôi file | Mô tả |
|
|
151
|
+
|-----------|-----------|-------|
|
|
152
|
+
| Mã hóa | `.ocam` | Mã hóa AES-256-GCM, cần mật khẩu |
|
|
153
|
+
| Portable | `.json` | Export thuần từ OpenCode Account Manager |
|
|
154
|
+
| AM Export | `.json` | Export từ app Antigravity Manager `[{email, refresh_token}]` |
|
|
155
|
+
| Plugin Native | `.json` | Định dạng `antigravity-accounts.json` |
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Đường dẫn cấu hình
|
|
160
|
+
|
|
161
|
+
| File | Windows | Linux/Mac |
|
|
162
|
+
|------|---------|-----------|
|
|
163
|
+
| Config OpenCode | `~/.config/opencode/opencode.json` | `~/.config/opencode/opencode.json` |
|
|
164
|
+
| Plugin accounts | `%APPDATA%/opencode/antigravity-accounts.json` | `~/.config/opencode/antigravity-accounts.json` |
|
|
165
|
+
| Cài đặt OCAM | `%APPDATA%/opencode/ocam-config.json` | `~/.config/opencode/ocam-config.json` |
|
|
166
|
+
|
|
167
|
+
> **Lưu ý**: `~` trên Windows là thư mục home của user (ví dụ: `C:\Users\TenBan`)
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Yêu cầu hệ thống
|
|
172
|
+
|
|
173
|
+
- **Node.js**: >= 16.x
|
|
174
|
+
- **OpenCode**: Đã cài đặt và cấu hình
|
|
175
|
+
- **Terminal**: Hỗ trợ Unicode và 256 màu (Windows Terminal, iTerm2, etc.)
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Xử lý lỗi
|
|
180
|
+
|
|
181
|
+
### "command not found: ocam"
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npm install -g opencode-account-manager
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### "Plugin accounts file not found"
|
|
188
|
+
|
|
189
|
+
Đăng nhập ít nhất một tài khoản trước:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
opencode auth login
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### "Cannot find module"
|
|
196
|
+
|
|
197
|
+
Cài lại package:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
npm uninstall -g opencode-account-manager
|
|
201
|
+
npm install -g opencode-account-manager
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Tài liệu
|
|
207
|
+
|
|
208
|
+
- [ROADMAP.md](./docs/ROADMAP.md) - Lịch sử phiên bản và kế hoạch
|
|
209
|
+
- [BLUEPRINT.md](./docs/BLUEPRINT.md) - Kiến trúc kỹ thuật
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Đóng góp
|
|
214
|
+
|
|
215
|
+
1. Fork repo
|
|
216
|
+
2. Tạo branch: `git checkout -b feature/ten-tinh-nang`
|
|
217
|
+
3. Commit: `git commit -m "feat: mo-ta"`
|
|
218
|
+
4. Push: `git push origin feature/ten-tinh-nang`
|
|
219
|
+
5. Tạo Pull Request
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Giấy phép
|
|
224
|
+
|
|
225
|
+
MIT License. Xem [LICENSE](./LICENSE) để biết chi tiết.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Credits
|
|
230
|
+
|
|
231
|
+
- [OpenCode](https://opencode.ai) - AI coding assistant mà công cụ này được xây dựng cho
|
|
232
|
+
- [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) - Plugin tùy chọn để xác thực Google OAuth
|
package/dist/cli.js
CHANGED
|
@@ -35,7 +35,7 @@ const program = new commander_1.Command();
|
|
|
35
35
|
program
|
|
36
36
|
.name("ocam")
|
|
37
37
|
.description("OpenCode Account Manager - TUI dashboard and CLI for managing accounts")
|
|
38
|
-
.version("0.4.
|
|
38
|
+
.version("0.4.3");
|
|
39
39
|
// Default command - show dashboard
|
|
40
40
|
program
|
|
41
41
|
.command("dashboard", { isDefault: true })
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import accounts from Antigravity Manager EXPORTED files
|
|
3
|
+
*
|
|
4
|
+
* AM Export Format (from app export button):
|
|
5
|
+
* [
|
|
6
|
+
* { "email": "xxx@gmail.com", "refresh_token": "1//..." },
|
|
7
|
+
* ...
|
|
8
|
+
* ]
|
|
9
|
+
*
|
|
10
|
+
* This is different from AM folder structure (accounts.json + accounts/*.json)
|
|
11
|
+
*/
|
|
12
|
+
import { Account } from "../types";
|
|
13
|
+
/**
|
|
14
|
+
* Single entry in AM export file
|
|
15
|
+
*/
|
|
16
|
+
export interface AMExportEntry {
|
|
17
|
+
email: string;
|
|
18
|
+
refresh_token: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Type guard to check if data is an AM export file (array of entries)
|
|
22
|
+
*/
|
|
23
|
+
export declare function isAMExportFile(data: unknown): data is AMExportEntry[];
|
|
24
|
+
export interface ImportFromAMExportResult {
|
|
25
|
+
accounts: Account[];
|
|
26
|
+
skipped: string[];
|
|
27
|
+
errors: string[];
|
|
28
|
+
source: "am-export";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Import accounts from AM export file content
|
|
32
|
+
*/
|
|
33
|
+
export declare function importFromAMExportContent(entries: AMExportEntry[]): ImportFromAMExportResult;
|
|
34
|
+
/**
|
|
35
|
+
* Import accounts from AM export file path
|
|
36
|
+
*/
|
|
37
|
+
export declare function importFromAMExportFile(filePath: string): ImportFromAMExportResult;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a file is an AM export file (by reading and checking format)
|
|
40
|
+
*/
|
|
41
|
+
export declare function isAMExportFilePath(filePath: string): boolean;
|
|
42
|
+
//# sourceMappingURL=amExport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amExport.d.ts","sourceRoot":"","sources":["../../../src/core/importers/amExport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,aAAa,EAAE,CAYrE;AA0CD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,wBAAwB,CAmC5F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,wBAAwB,CA+BjF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAU5D"}
|