codexmate 0.1.29 → 0.1.31

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 (72) hide show
  1. package/README.md +95 -4
  2. package/README.vi.md +95 -4
  3. package/README.zh.md +96 -4
  4. package/cli/config-bootstrap.js +25 -11
  5. package/cli/skills.js +33 -8
  6. package/cli.js +364 -42
  7. package/lib/cli-config-engine.js +260 -0
  8. package/lib/cli-utils.js +2 -1
  9. package/lib/cli-webhook.js +1 -1
  10. package/lib/handoff-mcp.js +282 -0
  11. package/lib/http-access-control.js +335 -0
  12. package/lib/thread-handoff.js +130 -0
  13. package/lib/web-startup-auth.js +49 -0
  14. package/lib/workflow-engine.js +92 -21
  15. package/lib/workflow-runner.js +261 -0
  16. package/package.json +6 -1
  17. package/web-ui/app.js +33 -4
  18. package/web-ui/logic.sessions.mjs +24 -0
  19. package/web-ui/modules/access-token.mjs +33 -0
  20. package/web-ui/modules/api.mjs +2 -1
  21. package/web-ui/modules/app.computed.dashboard.mjs +1 -1
  22. package/web-ui/modules/app.methods.codex-config.mjs +1 -1
  23. package/web-ui/modules/app.methods.index.mjs +2 -0
  24. package/web-ui/modules/app.methods.navigation.mjs +17 -3
  25. package/web-ui/modules/app.methods.prompts-editor.mjs +7 -0
  26. package/web-ui/modules/app.methods.providers.mjs +2 -2
  27. package/web-ui/modules/app.methods.runtime.mjs +3 -2
  28. package/web-ui/modules/app.methods.session-actions.mjs +3 -0
  29. package/web-ui/modules/app.methods.session-browser.mjs +11 -3
  30. package/web-ui/modules/app.methods.system-prompt.mjs +1 -8
  31. package/web-ui/modules/app.methods.workflows.mjs +41 -0
  32. package/web-ui/modules/i18n/locales/en.mjs +43 -2
  33. package/web-ui/modules/i18n/locales/ja.mjs +43 -2
  34. package/web-ui/modules/i18n/locales/vi.mjs +43 -2
  35. package/web-ui/modules/i18n/locales/zh-tw.mjs +43 -2
  36. package/web-ui/modules/i18n/locales/zh.mjs +43 -2
  37. package/web-ui/modules/i18n.mjs +16 -0
  38. package/web-ui/modules/sessions-filters-url.mjs +3 -0
  39. package/web-ui/modules/skills.computed.mjs +11 -0
  40. package/web-ui/modules/skills.methods.mjs +63 -12
  41. package/web-ui/modules/thread-handoff.mjs +142 -0
  42. package/web-ui/partials/index/layout-footer.html +1 -1
  43. package/web-ui/partials/index/layout-header.html +32 -12
  44. package/web-ui/partials/index/panel-config-claude.html +2 -0
  45. package/web-ui/partials/index/panel-config-codex.html +2 -0
  46. package/web-ui/partials/index/panel-config-kilocode.html +3 -1
  47. package/web-ui/partials/index/panel-config-openclaw.html +2 -0
  48. package/web-ui/partials/index/panel-config-opencode.html +3 -1
  49. package/web-ui/partials/index/panel-config-pi.html +2 -0
  50. package/web-ui/partials/index/panel-dashboard.html +59 -0
  51. package/web-ui/partials/index/panel-market.html +23 -5
  52. package/web-ui/partials/index/panel-prompts.html +28 -16
  53. package/web-ui/partials/index/panel-sessions.html +51 -70
  54. package/web-ui/partials/index/panel-trash.html +3 -0
  55. package/web-ui/partials/index/thread-handoff.html +59 -0
  56. package/web-ui/res/web-ui-render.precompiled.js +1020 -493
  57. package/web-ui/styles/controls-forms.css +9 -0
  58. package/web-ui/styles/dashboard.css +51 -0
  59. package/web-ui/styles/feedback.css +26 -0
  60. package/web-ui/styles/layout-shell.css +66 -2
  61. package/web-ui/styles/modals-core.css +87 -0
  62. package/web-ui/styles/navigation-panels.css +5 -11
  63. package/web-ui/styles/plugins-panel.css +62 -0
  64. package/web-ui/styles/prompts-editor.css +11 -4
  65. package/web-ui/styles/responsive.css +19 -10
  66. package/web-ui/styles/sessions-list.css +19 -1
  67. package/web-ui/styles/sessions-preview.css +224 -140
  68. package/web-ui/styles/sessions-toolbar-trash.css +2 -2
  69. package/web-ui/styles/settings-panel.css +1 -1
  70. package/web-ui/styles/skills-market.css +47 -0
  71. package/web-ui/styles/titles-cards.css +1 -1
  72. package/web-ui/styles/trash-panel.css +43 -6
package/README.md CHANGED
@@ -41,14 +41,33 @@ Was last week's solution discussed in Codex or Claude Code? Narrow down your loc
41
41
 
42
42
  Codex Mate manages existing tools and local records. It is not a new AI model or a replacement for your coding assistant. Start by finding one useful conversation, without configuring every tool first.
43
43
 
44
- [Get started](#quick-start) · [Session guide (Chinese)](https://sakurabytecore.github.io/codexmate/guide/sessions)
44
+ [Get started](#quick-start) · [Session guide (Chinese)](https://sakurabytecore.github.io/codexmate/guide/sessions) · [Thread handoff](#thread-handoff)
45
+
46
+ ## Comparison with Related Tools
47
+
48
+ Choose by primary use case rather than treating this as an exclusive feature checklist. These projects overlap and can be used together.
49
+
50
+ | Tool | Primary focus | Best fit |
51
+ | --- | --- | --- |
52
+ | **Codex Mate** | Local-first, cross-tool session and configuration management through CLI + Web and desktop entry points | Find, filter, and export conversations from different tools in one place, alongside Provider, Skills, and task workflow management |
53
+ | [CC Switch](https://github.com/farion1231/cc-switch) | Desktop configuration manager for multiple AI coding tools, covering providers, MCP, Skills, and prompts | Switching API providers and reducing manual edits to each tool's configuration files |
54
+ | [CloudCLI (Claude Code UI)](https://github.com/siteboon/claudecodeui) | Desktop and mobile Web UI for Claude Code, Cursor CLI, and Codex | Using coding assistants from a browser or phone and accessing local or remote projects and sessions |
55
+ | [ccusage](https://github.com/ryoppippi/ccusage) | CLI for analyzing token usage and costs from local coding-agent records | Daily, weekly, monthly, or per-session usage and cost reports |
56
+
57
+ **Why choose Codex Mate?** Bring cross-tool conversation lookup, Markdown archiving, and everyday configuration, Skills, and task management into one entry point without replacing your coding assistant.
58
+
59
+ This comparison follows the official project descriptions linked above; it does not imply that other tools lack unlisted features and is not a performance or pricing ranking. Codex Mate's session operations vary by source; see the [session guide (Chinese)](https://sakurabytecore.github.io/codexmate/guide/sessions). Export and handoff do not provide lossless migration of complete session state, and running locally does not mean models run offline.
45
60
 
46
61
  ## Quick Start
47
62
 
48
- Install using one option below, then run `codexmate run`. Open the address printed in your terminal, select a source with existing records in the session browser, open a conversation, and use its export action. If there are no local records, create a conversation in the original tool first.
63
+ For CLI + Web, install via Homebrew, npm, or curl below, then run `codexmate run`. Open the address printed in your terminal, select a source with existing records in the session browser, open a conversation, and use its export action. If there are no local records, create a conversation in the original tool first.
49
64
 
50
65
  Exports are for reading and archiving, not restoring complete agent state in another tool. Use `codexmate setup` when you need to configure a provider. See the [quick-start guide (Chinese)](https://sakurabytecore.github.io/codexmate/guide/quick-start) for details.
51
66
 
67
+ ### Install the Desktop App
68
+
69
+ Open the [latest release](https://github.com/SakuraByteCore/codexmate/releases/latest). Windows `.exe`, macOS `.dmg`, and Linux `.AppImage` packages appear in **Assets** only after the desktop builds complete. Download the package for your platform, install it, and launch the desktop app directly; `codexmate run` is not required.
70
+
52
71
  ### Install via Homebrew (macOS / Linux)
53
72
 
54
73
  ```bash
@@ -97,6 +116,38 @@ curl -fsSL https://raw.githubusercontent.com/SakuraByteCore/codexmate/main/scrip
97
116
 
98
117
  ---
99
118
 
119
+ ## Thread handoff
120
+
121
+ Share a structured handoff card with a target agent through a shared-memory MCP. This does not restore complete session state. Save a `card.json` containing a `goal` string and string arrays for `completed`, `blockers`, `nextSteps`, and `files`:
122
+
123
+ ```json
124
+ {
125
+ "goal": "Finish the documentation update",
126
+ "completed": ["Reviewed the session guide"],
127
+ "blockers": [],
128
+ "nextSteps": ["Check the translated examples"],
129
+ "files": ["README.md"]
130
+ }
131
+ ```
132
+
133
+ Run from the source checkout; after installation, replace `node cli.js` with `codexmate`:
134
+
135
+ ```bash
136
+ node cli.js thread handoff <thread-id> --card <json-file> --target <agent>
137
+ node cli.js thread list <thread-id>
138
+ node cli.js thread fallback <thread-id> --handoff <id>
139
+ node cli.js thread ack <thread-id> --handoff <id> --agent <target> --evidence <session-or-retrieval-id>
140
+ ```
141
+
142
+ Use the handoff's returned ID for `<id>`, the same target agent for `<target>`, and an actual session or retrieval ID for the evidence. Run `ack` only after the target reports reading the card.
143
+
144
+ - **File first, bounded MCP routing**: Save handoff files under `~/.codexmate/threads/<hash>/` first. Discover shared-memory MCPs by reading the project's `.mcp.json`, Claude user configuration, and Codex `config.toml` without modifying them. Select one MCP with a compatible native write tool and use a short-lived connection, not a daemon. Compatibility with arbitrary MCP versions is not guaranteed. No new dependencies or forced prompt insertion are added.
145
+ - **Explicit file fallback**: A failed MCP write does not retry automatically; the result reports the file path. `thread fallback` returns the file text. The session handoff area's copy-card button in the UI is also an explicit file fallback: paste the copied card into the target yourself; copying does not send it automatically.
146
+ - **Write success is not a read receipt**: A successful MCP write only sets `awaiting_read`, not proof that the target read the card. `thread ack` records the target's self-reported read with evidence, not an independently verified receipt.
147
+ - **Audit**: `thread list <thread-id>` returns the audit, including the selected MCP/tool, elapsed time, write result, fallback, and read status.
148
+
149
+ ---
150
+
100
151
  ## What's So Special?
101
152
 
102
153
  After finding your conversations, manage the configuration, skills, and tasks used in your daily work:
@@ -109,7 +160,7 @@ After finding your conversations, manage the configuration, skills, and tasks us
109
160
  - **Provider Health Cleanup**: Probe local Codex and Claude provider routes, surface failed configs in one modal, and bulk-clean selected broken providers without touching healthy or protected entries.
110
161
  - **Skills Marketplace**: A local-first market to share and import skills between different agent apps.
111
162
  - **Prompt File Editor**: Unified editor for global and project-level `CLAUDE.md` and `AGENTS.md` (including OpenCode's `~/.config/opencode/AGENTS.md`) with auto-detection of project paths, plus a shared preset pool for reusable prompts.
112
- - **Task Orchestrator**: Plan and execute complex tasks with dependency tracking.
163
+ - **Task Orchestrator**: Automatically advance existing workflows, persist progress and results, and request intervention only when blocked.
113
164
 
114
165
  ---
115
166
 
@@ -122,7 +173,7 @@ After finding your conversations, manage the configuration, skills, and tasks us
122
173
  | **Session Browser** | ✅ | Browse and filter local sessions; search and Markdown export depend on the source. See the session guide |
123
174
  | **Usage Analytics** | ✅ | Visualize message trends and top projects |
124
175
  | **Local Skills Market** | ✅ | Cross-app import/export of agent skills |
125
- | **Task Queue** | ✅ | DAG-based task execution and logs |
176
+ | **Task Queue** | ✅ | Dependency-aware automatic workflows, persistent progress, safe recovery, and result summaries |
126
177
  | **OpenAI Bridge** | ✅ | Convert Codex Responses API to standard OpenAI format and attach/normalize Codex fingerprints in the built-in conversion |
127
178
  | **Claude Provider Bridge** | ✅ | Connect Claude Code to OpenAI Chat Completions-compatible providers and Ollama via the built-in Claude-compatible proxy |
128
179
  | **OpenCode Provider Store** | ✅ | Keep multiple OpenCode providers in `~/.codexmate` while projecting only the selected provider to native OpenCode config |
@@ -136,6 +187,46 @@ After finding your conversations, manage the configuration, skills, and tasks us
136
187
 
137
188
  ---
138
189
 
190
+ ## Unattended Workflows
191
+
192
+ Reuse existing workflow definitions and let the backend advance tasks automatically after submission. The dashboard's workflow panel supports submission, result lookup, resuming with additional input, and cancellation of subsequent steps. Closing the page does not interrupt execution; tasks do not execute while the service is stopped.
193
+
194
+ ### Start and Use
195
+
196
+ Start the local service in one terminal and keep it running:
197
+
198
+ ```bash
199
+ codexmate run --no-browser
200
+ ```
201
+
202
+ Submit tasks from another terminal. Use the returned record's `id` as `<runId>` in subsequent commands:
203
+
204
+ ```bash
205
+ codexmate workflow list --json
206
+ codexmate workflow submit diagnose-config --json
207
+ codexmate workflow active-runs --json
208
+ codexmate workflow detail <runId> --json
209
+ codexmate workflow resume <runId> --input @input.json --json
210
+ codexmate workflow cancel <runId> --json
211
+ ```
212
+
213
+ - `resume` only resumes tasks waiting for intervention. Provide the complete updated input in `input.json`; omit `--input` to retain the original input.
214
+ - Write steps require explicit `--allow-write` permission and the corresponding tool configuration's write permission. Check actual side effects before resuming a write step with an uncertain outcome.
215
+ - The CLI connects to `127.0.0.1:3737` by default. For a custom port, set the same `CODEXMATE_PORT` in both terminals. When using an access token, use the same `CODEXMATE_HTTP_TOKEN` for the service and caller.
216
+ - The existing synchronous `codexmate workflow run` remains compatible. `workflow runs` reads its execution history; `workflow active-runs` reads persistent run records.
217
+
218
+ ### Automatic Handling and Safety Boundaries
219
+
220
+ - Persist definition snapshots, input, node states, full output, and attempt counts. Result summaries include completed items, the final result, and reasons for unfinished work.
221
+ - After a service restart, resume confirmed-safe read-only nodes without repeating successful nodes. Write or unclassified nodes with uncertain outcomes wait for intervention instead of replaying automatically.
222
+ - Validate explicit dependencies and preserve sequential execution for existing definitions. Natural-language task decomposition is not included.
223
+ - Retry only read-only failures explicitly marked as retryable, within a finite budget. `retry` accepts `0–5` and defaults to no retries. Write operations never retry automatically.
224
+ - Missing required input or write permission pauses execution for intervention. Cancellation stops subsequent advancement; an active tool must finish before cancellation completes.
225
+ - When `timeoutMs` expires, send an abort signal but still wait for the tool to settle. Tools that do not support the signal cannot guarantee a hard timeout; the system does not falsely report termination.
226
+ - Enable `workflow-completed`, `workflow-failed`, and `workflow-waiting` in Webhook settings for completion, failure, or intervention alerts. Notification failures are recorded separately and do not change execution outcomes. Results remain queryable without notifications.
227
+
228
+ ---
229
+
139
230
  ## Architecture
140
231
 
141
232
  ```mermaid
package/README.vi.md CHANGED
@@ -41,14 +41,33 @@ Giải pháp tuần trước được thảo luận trong Codex hay Claude Code?
41
41
 
42
42
  Codex Mate quản lý công cụ và dữ liệu cục bộ đã có. Đây không phải mô hình AI mới và không thay thế trợ lý lập trình của bạn. Hãy bắt đầu bằng việc tìm lại một cuộc trò chuyện hữu ích, không cần cấu hình mọi công cụ trước.
43
43
 
44
- [Bắt đầu sử dụng](#bắt-đầu-nhanh) · [Hướng dẫn phiên (tiếng Trung)](https://sakurabytecore.github.io/codexmate/guide/sessions)
44
+ [Bắt đầu sử dụng](#bắt-đầu-nhanh) · [Hướng dẫn phiên (tiếng Trung)](https://sakurabytecore.github.io/codexmate/guide/sessions) · [Bàn giao luồng](#bàn-giao-luồng)
45
+
46
+ ## So sánh với các công cụ cùng nhóm
47
+
48
+ Chọn theo nhu cầu chính, không xem bảng này là danh sách tính năng loại trừ lẫn nhau. Các dự án có tính năng giao nhau và có thể dùng kết hợp.
49
+
50
+ | Công cụ | Trọng tâm chính | Nhu cầu phù hợp |
51
+ | --- | --- | --- |
52
+ | **Codex Mate** | Quản lý phiên và cấu hình xuyên công cụ, ưu tiên cục bộ, qua CLI + Web và ứng dụng máy tính | Tìm, lọc và xuất hội thoại từ nhiều công cụ tại một nơi, cùng quản lý Provider, Skills và quy trình tác vụ |
53
+ | [CC Switch](https://github.com/farion1231/cc-switch) | Trình quản lý cấu hình trên máy tính cho nhiều công cụ lập trình AI, gồm provider, MCP, Skills và lời nhắc | Chuyển đổi API provider và giảm việc sửa thủ công tệp cấu hình của từng công cụ |
54
+ | [CloudCLI (Claude Code UI)](https://github.com/siteboon/claudecodeui) | Giao diện Web trên máy tính và thiết bị di động cho Claude Code, Cursor CLI và Codex | Dùng trợ lý lập trình từ trình duyệt hoặc điện thoại, truy cập dự án và phiên cục bộ hoặc từ xa |
55
+ | [ccusage](https://github.com/ryoppippi/ccusage) | CLI phân tích lượng token sử dụng và chi phí từ dữ liệu cục bộ của tác nhân lập trình | Xem báo cáo lượng sử dụng và chi phí theo ngày, tuần, tháng hoặc phiên |
56
+
57
+ **Vì sao chọn Codex Mate?** Tập hợp tra cứu hội thoại xuyên công cụ, lưu trữ Markdown, quản lý cấu hình, Skills và tác vụ hằng ngày tại một nơi mà không thay thế trợ lý lập trình đang dùng.
58
+
59
+ So sánh dựa trên mô tả chính thức tại các liên kết trên; không hàm ý công cụ khác thiếu tính năng chưa liệt kê và không phải bảng xếp hạng hiệu năng hay giá. Thao tác phiên của Codex Mate tùy thuộc nguồn; xem [hướng dẫn phiên (tiếng Trung)](https://sakurabytecore.github.io/codexmate/guide/sessions). Xuất và bàn giao không di chuyển nguyên vẹn toàn bộ trạng thái phiên; chạy cục bộ cũng không có nghĩa là mô hình chạy ngoại tuyến.
45
60
 
46
61
  ## Bắt đầu nhanh
47
62
 
48
- Chọn một cách cài đặt bên dưới, rồi chạy `codexmate run`. Mở địa chỉ được in trong terminal, chọn nguồn có dữ liệu trong trình duyệt phiên, mở cuộc trò chuyện và dùng chức năng xuất. Nếu chưa có dữ liệu cục bộ, hãy tạo cuộc trò chuyện trong công cụ gốc trước.
63
+ Để dùng CLI + Web, cài đặt qua Homebrew, npm hoặc curl bên dưới, rồi chạy `codexmate run`. Mở địa chỉ được in trong terminal, chọn nguồn có dữ liệu trong trình duyệt phiên, mở cuộc trò chuyện và dùng chức năng xuất. Nếu chưa có dữ liệu cục bộ, hãy tạo cuộc trò chuyện trong công cụ gốc trước.
49
64
 
50
65
  Bản xuất dùng để đọc và lưu trữ, không phải khôi phục toàn bộ trạng thái agent trong công cụ khác. Dùng `codexmate setup` khi cần cấu hình provider. Xem [hướng dẫn bắt đầu nhanh (tiếng Trung)](https://sakurabytecore.github.io/codexmate/guide/quick-start) để biết chi tiết.
51
66
 
67
+ ### Cài đặt ứng dụng máy tính
68
+
69
+ Mở [bản phát hành mới nhất](https://github.com/SakuraByteCore/codexmate/releases/latest). Các gói Windows `.exe`, macOS `.dmg` và Linux `.AppImage` chỉ xuất hiện trong mục **Assets** sau khi quá trình dựng ứng dụng máy tính hoàn tất. Tải gói dành cho nền tảng của bạn, cài đặt rồi mở trực tiếp ứng dụng máy tính; không cần chạy `codexmate run`.
70
+
52
71
  ### Cài đặt qua Homebrew (macOS / Linux)
53
72
 
54
73
  ```bash
@@ -97,6 +116,38 @@ curl -fsSL https://raw.githubusercontent.com/SakuraByteCore/codexmate/main/scrip
97
116
 
98
117
  ---
99
118
 
119
+ ## Bàn giao luồng
120
+
121
+ Chuyển thẻ bàn giao có cấu trúc cho tác nhân đích qua MCP bộ nhớ dùng chung. Thao tác này không khôi phục toàn bộ trạng thái phiên. Lưu `card.json` với `goal` là chuỗi, còn `completed`, `blockers`, `nextSteps` và `files` là các mảng chuỗi:
122
+
123
+ ```json
124
+ {
125
+ "goal": "Hoàn tất cập nhật tài liệu",
126
+ "completed": ["Đã xem hướng dẫn phiên"],
127
+ "blockers": [],
128
+ "nextSteps": ["Kiểm tra ví dụ trong các bản dịch"],
129
+ "files": ["README.md"]
130
+ }
131
+ ```
132
+
133
+ Chạy từ thư mục mã nguồn; sau khi cài đặt, thay `node cli.js` bằng `codexmate`:
134
+
135
+ ```bash
136
+ node cli.js thread handoff <thread-id> --card <json-file> --target <agent>
137
+ node cli.js thread list <thread-id>
138
+ node cli.js thread fallback <thread-id> --handoff <id>
139
+ node cli.js thread ack <thread-id> --handoff <id> --agent <target> --evidence <session-or-retrieval-id>
140
+ ```
141
+
142
+ Dùng mã bàn giao được trả về cho `<id>`, cùng tác nhân đích cho `<target>`, và mã phiên hoặc truy xuất thực tế làm bằng chứng. Chỉ chạy `ack` sau khi tác nhân đích tự báo đã đọc thẻ.
143
+
144
+ - **Lưu tệp trước, định tuyến MCP có giới hạn**: Trước tiên lưu tệp bàn giao tại `~/.codexmate/threads/<hash>/`. Dò tìm MCP bộ nhớ dùng chung bằng cách chỉ đọc `.mcp.json` của dự án, cấu hình người dùng Claude và `config.toml` của Codex, không sửa cấu hình. Chọn một MCP có công cụ ghi gốc tương thích, dùng kết nối ngắn hạn, không chạy tiến trình nền thường trực. Không bảo đảm tương thích với mọi phiên bản MCP. Không thêm phụ thuộc hay cơ chế ép chèn lời nhắc.
145
+ - **Dự phòng tệp tường minh**: Khi ghi MCP thất bại, hệ thống không tự thử lại và hiển thị đường dẫn tệp. `thread fallback` trả về nội dung văn bản của tệp. Nút sao chép thẻ trong khu vực bàn giao phiên của giao diện cũng là lựa chọn dự phòng tệp tường minh: vẫn phải tự dán thẻ vào tác nhân đích; sao chép không tự gửi.
146
+ - **Ghi thành công không xác nhận đã đọc**: Ghi MCP thành công chỉ đặt trạng thái `awaiting_read`, không chứng minh tác nhân đích đã đọc thẻ. `thread ack` ghi nhận việc tác nhân đích tự báo đã đọc kèm bằng chứng, không phải xác minh độc lập.
147
+ - **Nhật ký kiểm toán**: `thread list <thread-id>` trả về nhật ký gồm MCP/công cụ đã chọn, thời gian thực hiện, kết quả ghi, dự phòng và trạng thái đọc.
148
+
149
+ ---
150
+
100
151
  ## Điểm nổi bật
101
152
 
102
153
  Sau khi tìm lại cuộc trò chuyện, bạn có thể quản lý cấu hình, skill và tác vụ phục vụ công việc hằng ngày:
@@ -104,7 +155,7 @@ Sau khi tìm lại cuộc trò chuyện, bạn có thể quản lý cấu hình,
104
155
  - **Bridge tương thích OpenAI**: Dùng Codex với bất kỳ UI nào hỗ trợ OpenAI bằng cách chuẩn hóa Responses API.
105
156
  - **Dọn dẹp provider lỗi**: Kiểm tra route provider cục bộ của Codex/Claude, hiển thị cấu hình lỗi trong một modal và xóa hàng loạt các provider hỏng đã chọn mà không chạm vào mục khỏe mạnh hoặc được bảo vệ.
106
157
  - **Chợ skill cục bộ**: Chia sẻ và nhập skill giữa các app agent khác nhau.
107
- - **Điều phối tác vụ**: Lập kế hoạch và thực thi tác vụ phức tạp với theo dõi phụ thuộc.
158
+ - **Điều phối tác vụ**: Tự động thực thi quy trình hiện có, lưu bền vững tiến độ và kết quả, chỉ yêu cầu can thiệp khi bị chặn.
108
159
 
109
160
  ---
110
161
 
@@ -118,7 +169,7 @@ Sau khi tìm lại cuộc trò chuyện, bạn có thể quản lý cấu hình,
118
169
  | **Trình duyệt phiên** | ✅ | Xem và lọc phiên cục bộ; khả năng tìm kiếm và xuất Markdown tùy thuộc nguồn. Xem hướng dẫn phiên |
119
170
  | **Phân tích sử dụng** | ✅ | Trực quan hóa xu hướng tin nhắn và dự án nổi bật |
120
171
  | **Chợ skill cục bộ** | ✅ | Import/export skill giữa các app agent |
121
- | **Hàng đợi tác vụ** | ✅ | Thực thi tác vụ theo DAG và xem log |
172
+ | **Hàng đợi tác vụ** | ✅ | Quy trình tự động có phụ thuộc, lưu tiến độ, khôi phục an toàn và tổng kết kết quả |
122
173
  | **Bridge OpenAI** | ✅ | Chuyển đổi Codex Responses API sang định dạng OpenAI chuẩn |
123
174
  | **Kiểm tra sức khỏe Provider** | ✅ | Kiểm tra route provider Codex/Claude, đánh dấu cấu hình lỗi và xóa hàng loạt các provider hỏng đã chọn một cách an toàn |
124
175
  | **Mẫu Prompt** | ✅ | Plugin prompt tái sử dụng được với hỗ trợ biến |
@@ -128,6 +179,46 @@ Sau khi tìm lại cuộc trò chuyện, bạn có thể quản lý cấu hình,
128
179
 
129
180
  ---
130
181
 
182
+ ## Quy trình tự động không cần theo dõi liên tục
183
+
184
+ Tái sử dụng định nghĩa quy trình hiện có để backend tự động thực thi các bước sau khi gửi. Bảng quy trình trên trang tổng quan hỗ trợ gửi tác vụ, xem kết quả, tiếp tục sau khi bổ sung đầu vào và hủy các bước tiếp theo. Đóng trang không làm gián đoạn tác vụ; tác vụ không chạy khi dịch vụ dừng.
185
+
186
+ ### Khởi động và sử dụng
187
+
188
+ Khởi động dịch vụ cục bộ trong một terminal và giữ dịch vụ hoạt động:
189
+
190
+ ```bash
191
+ codexmate run --no-browser
192
+ ```
193
+
194
+ Gửi tác vụ từ terminal khác. Dùng trường `id` trong bản ghi trả về làm `<runId>` cho các lệnh tiếp theo:
195
+
196
+ ```bash
197
+ codexmate workflow list --json
198
+ codexmate workflow submit diagnose-config --json
199
+ codexmate workflow active-runs --json
200
+ codexmate workflow detail <runId> --json
201
+ codexmate workflow resume <runId> --input @input.json --json
202
+ codexmate workflow cancel <runId> --json
203
+ ```
204
+
205
+ - `resume` chỉ tiếp tục tác vụ đang chờ can thiệp. Tệp `input.json` chứa toàn bộ đầu vào đã cập nhật; bỏ `--input` để giữ đầu vào ban đầu.
206
+ - Bước ghi cần cấp rõ quyền `--allow-write` và bật quyền ghi cấu hình của công cụ tương ứng. Kiểm tra tác động thực tế trước khi tiếp tục bước ghi có kết quả chưa xác định.
207
+ - CLI mặc định kết nối đến `127.0.0.1:3737`. Khi dùng cổng tùy chỉnh, đặt cùng giá trị `CODEXMATE_PORT` trong hai terminal. Khi dùng token truy cập, dịch vụ và bên gọi cần dùng cùng `CODEXMATE_HTTP_TOKEN`.
208
+ - Lệnh đồng bộ `codexmate workflow run` hiện có vẫn tương thích. `workflow runs` đọc lịch sử thực thi cũ; `workflow active-runs` đọc các bản ghi thực thi được lưu bền vững.
209
+
210
+ ### Xử lý tự động và giới hạn an toàn
211
+
212
+ - Lưu bền vững bản chụp định nghĩa, đầu vào, trạng thái nút, toàn bộ đầu ra và số lần thử. Bản tổng kết gồm mục đã hoàn thành, kết quả cuối cùng và lý do các mục chưa hoàn thành.
213
+ - Sau khi khởi động lại dịch vụ, tiếp tục các nút chỉ đọc đã xác nhận an toàn, không chạy lại nút đã thành công. Nút ghi hoặc nút chưa phân loại có kết quả chưa xác định sẽ chờ can thiệp, không tự động chạy lại.
214
+ - Kiểm tra phụ thuộc được khai báo rõ ràng; giữ thứ tự thực thi tuần tự cho định nghĩa cũ. Không bao gồm tự động chia tác vụ từ ngôn ngữ tự nhiên.
215
+ - Chỉ thử lại lỗi chỉ đọc được đánh dấu rõ là có thể thử lại, trong giới hạn hữu hạn. `retry` nhận giá trị `0–5`, mặc định không thử lại. Thao tác ghi không tự động thử lại.
216
+ - Thiếu đầu vào bắt buộc hoặc quyền ghi sẽ tạm dừng để chờ can thiệp. Hủy chỉ ngăn các bước tiếp theo; công cụ đang chạy phải kết thúc trước khi việc hủy hoàn tất.
217
+ - Khi hết `timeoutMs`, gửi tín hiệu hủy nhưng vẫn chờ công cụ kết thúc thực sự. Công cụ không hỗ trợ tín hiệu này không bảo đảm thời hạn cứng; hệ thống không báo sai rằng công cụ đã dừng.
218
+ - Bật `workflow-completed`, `workflow-failed` và `workflow-waiting` trong cài đặt Webhook để nhận thông báo hoàn thành, thất bại hoặc cần can thiệp. Lỗi thông báo được ghi riêng, không thay đổi kết quả thực thi. Vẫn có thể tra cứu kết quả khi chưa cấu hình thông báo.
219
+
220
+ ---
221
+
131
222
  ## Kiến trúc
132
223
 
133
224
  ```mermaid
package/README.zh.md CHANGED
@@ -12,6 +12,7 @@ Codex Mate 是本地运行的 CLI + Web 管理工具,在一个界面查看、
12
12
  <a href="https://sakurabytecore.github.io/codexmate/">[项目文档]</a>
13
13
  <a href="#快速开始">[快速开始]</a>
14
14
  <a href="README.md">[English]</a>
15
+ <a href="README.vi.md">[Tiếng Việt]</a>
15
16
  </p>
16
17
 
17
18
  [![Version](https://img.shields.io/npm/v/codexmate?style=flat-square&color=A179FF)](https://www.npmjs.com/package/codexmate)
@@ -40,14 +41,33 @@ Codex Mate 是本地运行的 CLI + Web 管理工具,在一个界面查看、
40
41
 
41
42
  Codex Mate 管理已有工具和本地记录,不是新的 AI 模型,也不替代原来的编程助手。第一次使用不必配置全部工具;先找回一段对话即可。
42
43
 
43
- [开始使用](#快速开始) · [查看会话使用方法](https://sakurabytecore.github.io/codexmate/guide/sessions)
44
+ [开始使用](#快速开始) · [查看会话使用方法](https://sakurabytecore.github.io/codexmate/guide/sessions) · [线程交接](#线程交接)
45
+
46
+ ## 与同类工具对比
47
+
48
+ 按主要用途选择工具,而非将下表视为互斥功能清单。各项目存在功能重叠,也可以搭配使用。
49
+
50
+ | 工具 | 主要定位 | 适合的需求 |
51
+ | --- | --- | --- |
52
+ | **Codex Mate** | 本地优先的跨工具会话与配置管理,提供 CLI + Web 和桌面入口 | 在一个界面找回、筛选和导出不同工具的历史对话,集中管理 Provider、Skills 与任务工作流 |
53
+ | [CC Switch](https://github.com/farion1231/cc-switch) | 多种 AI 编程工具的桌面配置管理器,集中管理 Provider、MCP、Skills 与提示词 | 主要需要切换 API Provider,减少手工编辑各工具的配置文件 |
54
+ | [CloudCLI(Claude Code UI)](https://github.com/siteboon/claudecodeui) | 面向 Claude Code、Cursor CLI 和 Codex 的桌面与移动端 Web 界面 | 主要需要在浏览器或手机上使用编程助手,访问本地或远程项目与会话 |
55
+ | [ccusage](https://github.com/ryoppippi/ccusage) | 从本地编程智能体记录分析 Token 用量与费用的 CLI | 主要需要按日、周、月或会话查看用量与费用报表 |
56
+
57
+ **选择 Codex Mate 的理由**:将跨工具历史会话查阅、Markdown 归档与日常配置、Skills、任务管理放在同一入口,不必更换原来的编程助手。
58
+
59
+ 对比依据为上方链接中的官方项目说明;不代表其他工具缺少未列出的功能,也不是性能或价格排名。Codex Mate 的会话操作能力因来源而异,详见[会话指南](https://sakurabytecore.github.io/codexmate/guide/sessions);导出与交接不等于无损迁移完整会话状态,本地运行也不等于模型离线运行。
44
60
 
45
61
  ## 快速开始
46
62
 
47
- 先任选一种方式安装,再运行 `codexmate run`。按终端显示的地址打开 Web UI,在「会话来源」选已有记录的工具,打开一条会话并点击「导出记录」。没有本地记录时,先在原工具中产生一段对话。
63
+ 使用 CLI + Web 时,先通过下方 Homebrew、npm 或 curl 安装,再运行 `codexmate run`。按终端显示的地址打开 Web UI,在「会话来源」选已有记录的工具,打开一条会话并点击「导出记录」。没有本地记录时,先在原工具中产生一段对话。
48
64
 
49
65
  导出用于阅读与归档,不等于在另一工具中恢复完整状态。需要配置 Provider 时再使用 `codexmate setup`;详细步骤见[快速开始](https://sakurabytecore.github.io/codexmate/guide/quick-start)。
50
66
 
67
+ ### 桌面版安装
68
+
69
+ 打开[最新发布页](https://github.com/SakuraByteCore/codexmate/releases/latest)。桌面构建完成后,**Assets**(发布附件)中才会出现 Windows `.exe`、macOS `.dmg`、Linux `.AppImage` 安装包。下载对应平台的安装包,安装后直接启动桌面应用,无需运行 `codexmate run`。
70
+
51
71
  ### Homebrew 安装(macOS / Linux)
52
72
 
53
73
  ```bash
@@ -96,6 +116,38 @@ curl -fsSL https://raw.githubusercontent.com/SakuraByteCore/codexmate/main/scrip
96
116
 
97
117
  ---
98
118
 
119
+ ## 线程交接
120
+
121
+ 通过共享记忆 MCP 向目标智能体交接结构化卡片,不等于恢复完整会话状态。先保存 `card.json`:`goal` 为字符串,`completed`、`blockers`、`nextSteps`、`files` 均为字符串数组。
122
+
123
+ ```json
124
+ {
125
+ "goal": "完成文档更新",
126
+ "completed": ["已核查会话指南"],
127
+ "blockers": [],
128
+ "nextSteps": ["核对各语言示例"],
129
+ "files": ["README.md"]
130
+ }
131
+ ```
132
+
133
+ 在源码目录运行下列命令;安装后将 `node cli.js` 替换为 `codexmate`:
134
+
135
+ ```bash
136
+ node cli.js thread handoff <thread-id> --card <json-file> --target <agent>
137
+ node cli.js thread list <thread-id>
138
+ node cli.js thread fallback <thread-id> --handoff <id>
139
+ node cli.js thread ack <thread-id> --handoff <id> --agent <target> --evidence <session-or-retrieval-id>
140
+ ```
141
+
142
+ 将交接返回的编号填入 `<id>`,`<target>` 使用同一目标智能体,证据填写真实会话或检索编号。仅在目标自报已读取卡片后执行 `ack`。
143
+
144
+ - **文件优先,限定 MCP 路由**:先将交接文件保存到 `~/.codexmate/threads/<hash>/`。只读探测项目 `.mcp.json`、Claude 用户配置、Codex `config.toml` 中的共享记忆 MCP,不修改配置。按兼容原生写入工具选择单个 MCP,使用短连接,不启动守护进程。不承诺兼容任意 MCP 版本,不新增依赖,不添加强行插入提示词的机制。
145
+ - **显式文件回退**:MCP 写入失败不自动重试,结果明确提示文件路径。`thread fallback` 返回文件文本。界面会话交接区的「复制卡片」按钮同样是显式文件回退;复制后仍须手动粘贴到目标,不自动发送。
146
+ - **写入成功不等于读取**:MCP 写入成功仅进入 `awaiting_read`,不能证明目标已读取。`thread ack` 记录附证据的目标自报读取,不是独立验证的回执。
147
+ - **交接审计**:`thread list <thread-id>` 返回审计,包含所选 MCP/tool、耗时、写入结果、回退和读取状态。
148
+
149
+ ---
150
+
99
151
  ## 有什么独特之处?
100
152
 
101
153
  找回对话之后,还可以继续管理日常工作所需的配置、Skills 与任务:
@@ -107,7 +159,7 @@ curl -fsSL https://raw.githubusercontent.com/SakuraByteCore/codexmate/main/scrip
107
159
  - **Provider 健康清理**:探测本地 Codex 与 Claude provider 路由,在同一个弹窗里集中展示失败配置,并批量清理已选坏配置,不影响正常或受保护项。
108
160
  - **Skills 市场**:本地优先的市场,支持在不同的智能体应用之间共享和导入 Skills。
109
161
  - **提示词文件编辑器**:统一编辑全局和项目级 `CLAUDE.md` 与 `AGENTS.md`(含 OpenCode 的 `~/.config/opencode/AGENTS.md`),支持项目路径自动检测,并提供通用预设池复用 prompt。
110
- - **任务编排器**:支持带有依赖跟踪的复杂任务规划与执行。
162
+ - **任务编排器**:复用工作流定义自动推进任务,持久保存进度与结果,仅在阻塞时请求介入。
111
163
 
112
164
  ---
113
165
 
@@ -120,7 +172,7 @@ curl -fsSL https://raw.githubusercontent.com/SakuraByteCore/codexmate/main/scrip
120
172
  | **会话浏览器** | ✅ | 集中浏览与筛选本地会话,按来源提供检索、Markdown 导出等操作;详见会话指南 |
121
173
  | **Usage 统计** | ✅ | 可视化消息趋势与热门项目统计 |
122
174
  | **本地 Skills 市场** | ✅ | 跨应用的智能体 Skills 导入与导出 |
123
- | **任务队列** | ✅ | 基于 DAG 的任务执行与日志查看 |
175
+ | **任务队列** | ✅ | 支持依赖的自动工作流、持久进度、安全恢复与结果汇总 |
124
176
  | **OpenAI 桥接** | ✅ | 将 Codex Responses API 转换为标准 OpenAI 格式,并在内建转换中附加/规范化 Codex 指纹 |
125
177
  | **Claude Provider 桥接** | ✅ | 通过内建 Claude 兼容代理,让 Claude Code 接入 OpenAI Chat Completions 兼容 provider 与 Ollama |
126
178
  | **OpenCode Provider 存储** | ✅ | 在 `~/.codexmate` 中保留多个 OpenCode provider,只将当前选中的 provider 投影到 OpenCode 原生配置 |
@@ -133,6 +185,46 @@ curl -fsSL https://raw.githubusercontent.com/SakuraByteCore/codexmate/main/scrip
133
185
 
134
186
  ---
135
187
 
188
+ ## 自动工作流:提交后无需持续看守
189
+
190
+ 复用现有工作流定义,提交一次后由后端自动推进。首页“自动工作流”提供提交、结果查询、补充输入后继续、取消后续执行。关闭页面不影响任务;服务停止期间不执行任务。
191
+
192
+ ### 启动与使用
193
+
194
+ 先在一个终端启动本地服务,保持服务运行:
195
+
196
+ ```bash
197
+ codexmate run --no-browser
198
+ ```
199
+
200
+ 在另一个终端提交任务。将返回记录中的 `id` 用作后续命令的 `<runId>`:
201
+
202
+ ```bash
203
+ codexmate workflow list --json
204
+ codexmate workflow submit diagnose-config --json
205
+ codexmate workflow active-runs --json
206
+ codexmate workflow detail <runId> --json
207
+ codexmate workflow resume <runId> --input @input.json --json
208
+ codexmate workflow cancel <runId> --json
209
+ ```
210
+
211
+ - `resume` 仅继续等待介入的任务;`input.json` 提供补充后的完整输入。省略 `--input` 时保留原输入。
212
+ - 写入步骤需要显式传入 `--allow-write`,还须开启对应工具配置的写权限。结果不明的写步骤,须核对实际副作用后再决定是否继续。
213
+ - CLI 默认连接 `127.0.0.1:3737`。自定义端口时,服务与调用终端须配置相同的 `CODEXMATE_PORT`;配置访问令牌时,两端须使用相同的 `CODEXMATE_HTTP_TOKEN`。
214
+ - 原同步命令 `codexmate workflow run` 保持兼容;`workflow runs` 查询原执行历史,`workflow active-runs` 查询持久运行记录。
215
+
216
+ ### 自动处理与安全边界
217
+
218
+ - 持久保存定义快照、输入、节点状态、完整输出和尝试次数;结果汇总包含完成项、最终结果与未完成原因。
219
+ - 重启服务后恢复已确认安全的只读节点,不重复执行已成功节点。写节点或未分类节点的执行结果不明时,转为等待介入,不自动重放。
220
+ - 支持显式依赖校验;旧定义保持顺序执行。不包含自然语言自动拆任务。
221
+ - 仅对明确标为可重试的只读失败执行有限重试;`retry` 范围为 `0–5`,默认不重试。写操作不自动重试。
222
+ - 缺少必要输入或写权限时等待介入。取消只停止后续推进;执行中工具结束前显示“正在取消”。
223
+ - `timeoutMs` 到期后传递中止信号,但仍等待工具实际结束。不支持该信号的工具无法保证硬超时,不会虚报已终止。
224
+ - 在 Webhook 设置中启用 `workflow-completed`、`workflow-failed`、`workflow-waiting`,接收完成、失败或介入提醒。通知失败单独记录,不改变任务执行结论;未配置通知时仍可查询结果。
225
+
226
+ ---
227
+
136
228
  ## 架构总览
137
229
 
138
230
  ```mermaid
@@ -175,11 +175,16 @@ stream_idle_timeout_ms = 300000
175
175
  } catch (e) {
176
176
  return;
177
177
  }
178
+ try {
179
+ toml.parse(content);
180
+ } catch (_) {
181
+ return;
182
+ }
178
183
  // Check if [model_providers.local] section already exists
179
184
  if (/\[model_providers\.local\]/.test(content)) return;
180
185
 
181
186
  const localSection = `\n[model_providers.local]\nname = "local"\nbase_url = "http://127.0.0.1:3737/bridge/local/v1"\nwire_api = "responses"\nrequires_openai_auth = true\npreferred_auth_method = "codexmate"\nexperimental_bearer_token = "codexmate"\ncodexmate_bridge = "local"\nrequest_max_retries = 4\nstream_max_retries = 10\nstream_idle_timeout_ms = 300000\n`;
182
- fs.appendFileSync(CONFIG_FILE, localSection, 'utf-8');
187
+ writeConfig(content.trimEnd() + localSection);
183
188
  }
184
189
 
185
190
  function readConfigOrVirtualDefault() {
@@ -191,7 +196,8 @@ stream_idle_timeout_ms = 300000
191
196
  isVirtual: false,
192
197
  reason: '',
193
198
  detail: '',
194
- errorType: ''
199
+ errorType: '',
200
+ path: CONFIG_FILE
195
201
  };
196
202
  } catch (e) {
197
203
  const errorType = typeof e.configErrorType === 'string' && e.configErrorType.trim()
@@ -210,7 +216,8 @@ stream_idle_timeout_ms = 300000
210
216
  isVirtual: true,
211
217
  reason: publicReason,
212
218
  detail,
213
- errorType
219
+ errorType,
220
+ path: CONFIG_FILE
214
221
  };
215
222
  }
216
223
  }
@@ -220,20 +227,27 @@ stream_idle_timeout_ms = 300000
220
227
  isVirtual: true,
221
228
  reason: '未检测到 config.toml',
222
229
  detail: `配置文件不存在: ${CONFIG_FILE}`,
223
- errorType: 'missing'
230
+ errorType: 'missing',
231
+ path: CONFIG_FILE
224
232
  };
225
233
  }
226
234
 
227
235
  function printConfigLoadErrorAndMarkExit(result) {
228
- const isReadError = result && result.errorType === 'read';
236
+ const errorType = result && result.errorType === 'read' ? 'read' : 'parse';
237
+ const message = errorType === 'read' ? '读取 config.toml 失败' : '配置文件解析失败';
229
238
  const detail = result && typeof result.detail === 'string' && result.detail.trim()
230
239
  ? result.detail.trim()
231
- : (isReadError ? '读取配置文件失败' : '配置文件解析失败');
232
- console.error(`\n错误: ${isReadError ? '读取 config.toml 失败' : '配置文件解析失败'}`);
233
- console.error(` 详情: ${detail}`);
234
- console.error(` 路径: ${CONFIG_FILE}`);
235
- console.error(` 建议: ${isReadError ? '检查文件权限后重试' : '修复 config.toml 语法后重试'}`);
236
- console.error();
240
+ : message;
241
+ const payload = {
242
+ error: {
243
+ code: errorType === 'parse' ? 'CONFIG_TOML_PARSE_ERROR' : 'CONFIG_TOML_READ_ERROR',
244
+ type: errorType,
245
+ path: CONFIG_FILE,
246
+ message,
247
+ detail
248
+ }
249
+ };
250
+ console.error(JSON.stringify(payload));
237
251
  process.exitCode = 1;
238
252
  }
239
253
 
package/cli/skills.js CHANGED
@@ -938,16 +938,26 @@ async function exportSkills(params = {}) {
938
938
  if (!target) {
939
939
  return { error: '目标宿主不支持' };
940
940
  }
941
+ const includeAll = params.all === true;
941
942
  const rawNames = Array.isArray(params.names) ? params.names : [];
942
- const uniqueNames = Array.from(new Set(rawNames
943
- .map((item) => (typeof item === 'string' ? item.trim() : ''))
944
- .filter(Boolean)));
943
+ const uniqueNames = includeAll
944
+ ? listSkills({ targetApp: target.app }).items.map((item) => item && item.name).filter(Boolean)
945
+ : Array.from(new Set(rawNames
946
+ .map((item) => (typeof item === 'string' ? item.trim() : ''))
947
+ .filter(Boolean)));
945
948
  if (uniqueNames.length === 0) {
946
- return { error: '请先选择要导出的 skill' };
949
+ return { error: includeAll ? '当前目标没有可备份的 skill' : '请先选择要导出的 skill' };
947
950
  }
948
-
949
951
  const exported = [];
950
952
  const failed = [];
953
+ const manifest = {
954
+ format: 'codexmate-skills-backup',
955
+ version: 1,
956
+ createdAt: new Date().toISOString(),
957
+ targetApp: target.app,
958
+ targetLabel: target.label,
959
+ skills: []
960
+ };
951
961
  const stagingTempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codex-skills-export-'));
952
962
  const stagingRoot = path.join(stagingTempDir, 'skills');
953
963
  ensureDir(stagingRoot);
@@ -991,7 +1001,12 @@ async function exportSkills(params = {}) {
991
1001
  });
992
1002
  exported.push({
993
1003
  name: normalizedName.name,
994
- path: sourcePath
1004
+ path: sourcePath,
1005
+ hasSkillFile: fs.existsSync(path.join(targetPath, 'SKILL.md'))
1006
+ });
1007
+ manifest.skills.push({
1008
+ name: normalizedName.name,
1009
+ hasSkillFile: fs.existsSync(path.join(targetPath, 'SKILL.md'))
995
1010
  });
996
1011
  } catch (e) {
997
1012
  failed.push({
@@ -1013,13 +1028,18 @@ async function exportSkills(params = {}) {
1013
1028
  }
1014
1029
 
1015
1030
  const randomToken = crypto.randomBytes(12).toString('hex');
1016
- const zipFileName = `${target.app}-skills-${randomToken}.zip`;
1031
+ const zipFileName = includeAll
1032
+ ? `${target.app}-skills-backup-${randomToken}.zip`
1033
+ : `${target.app}-skills-${randomToken}.zip`;
1017
1034
  const zipFilePath = path.join(os.tmpdir(), zipFileName);
1018
1035
  if (fs.existsSync(zipFilePath)) {
1019
1036
  try {
1020
1037
  fs.unlinkSync(zipFilePath);
1021
1038
  } catch (_) {}
1022
1039
  }
1040
+ if (includeAll) {
1041
+ fs.writeFileSync(path.join(stagingRoot, 'codexmate-skills-backup.json'), JSON.stringify(manifest, null, 2), 'utf8');
1042
+ }
1023
1043
  await zipLib.archiveFolder(stagingRoot, zipFilePath);
1024
1044
  const artifact = registerDownloadArtifact(zipFilePath, {
1025
1045
  fileName: zipFileName,
@@ -1034,7 +1054,8 @@ async function exportSkills(params = {}) {
1034
1054
  failed,
1035
1055
  targetApp: target.app,
1036
1056
  targetLabel: target.label,
1037
- root: target.dir
1057
+ root: target.dir,
1058
+ backup: includeAll ? manifest : null
1038
1059
  };
1039
1060
  } catch (e) {
1040
1061
  return {
@@ -1056,6 +1077,9 @@ async function exportCodexSkills(params = {}) {
1056
1077
  return exportSkills({ ...(params || {}), targetApp: 'codex' });
1057
1078
  }
1058
1079
 
1080
+ async function backupSkills(params = {}) {
1081
+ return exportSkills({ ...(params || {}), all: true });
1082
+ }
1059
1083
  function removeDirectoryRecursive(targetPath) {
1060
1084
  if (typeof fs.rmSync === 'function') {
1061
1085
  fs.rmSync(targetPath, { recursive: true, force: false });
@@ -1152,6 +1176,7 @@ module.exports = {
1152
1176
  importCodexSkillsFromZip,
1153
1177
  exportSkills,
1154
1178
  exportCodexSkills,
1179
+ backupSkills,
1155
1180
  deleteSkills,
1156
1181
  deleteCodexSkills
1157
1182
  };