@liuyoumi/codex-history 0.1.1 → 0.1.2
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/CHANGELOG.md +9 -0
- package/README.en.md +200 -0
- package/README.md +82 -61
- package/package.json +2 -2
- package/README.zh-CN.md +0 -179
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.2 - 2026-05-28
|
|
4
|
+
|
|
5
|
+
### Documentation
|
|
6
|
+
|
|
7
|
+
- Use Chinese as the default README language.
|
|
8
|
+
- Add an English README translation.
|
|
9
|
+
- Refresh the README cover image to focus on a single guarded `purge` command flow.
|
|
10
|
+
- Add README badges and clearer macOS, Windows, and Linux support notes.
|
|
11
|
+
|
|
3
12
|
## 0.1.1 - 2026-05-28
|
|
4
13
|
|
|
5
14
|
### Documentation
|
package/README.en.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<h1 align="center">Codex History</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img alt="npm" src="https://img.shields.io/npm/v/@liuyoumi/codex-history?style=flat-square&color=cb9b27" />
|
|
5
|
+
<img alt="platform" src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-2ea043?style=flat-square" />
|
|
6
|
+
<img alt="local only" src="https://img.shields.io/badge/local%20data-only-6e7681?style=flat-square" />
|
|
7
|
+
<img alt="backup" src="https://img.shields.io/badge/backup-before%20purge-0969da?style=flat-square" />
|
|
8
|
+
<img alt="license" src="https://img.shields.io/npm/l/@liuyoumi/codex-history?style=flat-square" />
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="README.md">中文</a> | <a href="README.en.md">English</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="https://raw.githubusercontent.com/liuyoumi/codex-history/main/assets/cover.png" alt="codex-history cover" width="100%" />
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
A small CLI for finding and removing local Codex conversation history.
|
|
20
|
+
|
|
21
|
+
`codex-history` works on local Codex data files on your machine. It lists conversations using the same short titles shown by Codex when available, lets you narrow the list with `--grep`, and deletes one resolved conversation only after confirmation.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g @liuyoumi/codex-history
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or run it without installing:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx @liuyoumi/codex-history doctor
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Supported Platforms
|
|
36
|
+
|
|
37
|
+
`codex-history` has been checked on macOS, Windows, and Linux for install, `doctor`, `list` / `--grep`, and guarded `purge` workflows with confirmation and backups.
|
|
38
|
+
|
|
39
|
+
| Platform | Status |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| macOS | Ready for everyday local history management |
|
|
42
|
+
| Windows | Ready for everyday local history management |
|
|
43
|
+
| Linux | Ready for everyday local history management |
|
|
44
|
+
|
|
45
|
+
Codex local data layouts may change between Codex releases. After updating Codex, run `codex-history doctor` before purging conversations.
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
codex-history doctor
|
|
51
|
+
codex-history list
|
|
52
|
+
codex-history list --grep "Astro"
|
|
53
|
+
codex-history purge 019e6885
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`purge` prints the resolved conversation and asks you to type the standard short id before it deletes anything:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
About to purge this local Codex conversation:
|
|
60
|
+
|
|
61
|
+
title: Implement Astro blog visual audit
|
|
62
|
+
id: 019e6885-b5ae-7ae0-a50d-ce5f75b0ac08
|
|
63
|
+
cwd: /Users/me/Projects/example
|
|
64
|
+
updated: 2026-05-28T03:16:01.959Z
|
|
65
|
+
|
|
66
|
+
A backup will be created before deletion.
|
|
67
|
+
Type 019e6885 to confirm:
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Commands
|
|
71
|
+
|
|
72
|
+
| Command | Description |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `codex-history doctor` | Check whether the local Codex data layout is supported. |
|
|
75
|
+
| `codex-history list` | List local conversations. |
|
|
76
|
+
| `codex-history list --grep <keyword>` | Filter conversations by title, id, or cwd. |
|
|
77
|
+
| `codex-history purge <id>` | Remove one resolved local conversation after confirmation. |
|
|
78
|
+
|
|
79
|
+
### `doctor`
|
|
80
|
+
|
|
81
|
+
Check whether the local Codex data layout is supported by this version.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
codex-history doctor
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Run this first after installing, or after a Codex update. If the local data layout is not supported, destructive commands fail closed instead of guessing how to delete.
|
|
88
|
+
|
|
89
|
+
### `list`
|
|
90
|
+
|
|
91
|
+
List local Codex conversations.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
codex-history list
|
|
95
|
+
codex-history list --grep "Astro"
|
|
96
|
+
codex-history list --limit 20
|
|
97
|
+
codex-history list --pretty=medium
|
|
98
|
+
codex-history list --pretty=full
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Default output is one line per conversation:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
019e6885 Implement Astro blog visual audit
|
|
105
|
+
019e6874 Review Astro blog visual plan
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`--grep` filters by displayed title, thread id, and cwd. It does not search or print prompt bodies.
|
|
109
|
+
|
|
110
|
+
Use the short id shown by `list`, or paste a full thread id, when running `purge`.
|
|
111
|
+
|
|
112
|
+
By default, `list` shows non-archived conversations. Use `--archived` for archived conversations only, or `--all` for both archived and non-archived conversations.
|
|
113
|
+
|
|
114
|
+
Wrap grep text in quotes when it contains spaces:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
codex-history list --grep "Astro blog"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`--pretty` formats:
|
|
121
|
+
|
|
122
|
+
- `oneline`: short id and title
|
|
123
|
+
- `medium`: full id, updated time, and cwd
|
|
124
|
+
- `full`: `medium` plus created time, archive state, and rollout path
|
|
125
|
+
|
|
126
|
+
When `list` runs in an interactive terminal without `--limit`, output is sent through the system pager. Piped or redirected output skips the pager automatically.
|
|
127
|
+
|
|
128
|
+
### `purge`
|
|
129
|
+
|
|
130
|
+
Remove one local Codex conversation by full id or unique short id prefix.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
codex-history purge 019e6885
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
For scripts or non-interactive shells, use `--force`:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
codex-history purge 019e6885 --force
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`--force` skips only the interactive short-id confirmation. It still keeps schema validation, mandatory backup, active-thread protection, and post-purge verification.
|
|
143
|
+
|
|
144
|
+
## Options
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
codex-history --codex-home /path/to/.codex list
|
|
148
|
+
codex-history --json list --grep "Astro"
|
|
149
|
+
codex-history --json purge 019e6885 --force
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
- `--codex-home` defaults to `~/.codex`.
|
|
153
|
+
- `--json` prints machine-readable output. For `purge`, JSON output requires `--force` because interactive confirmation is text-only.
|
|
154
|
+
- Color is enabled only in interactive terminals and respects `NO_COLOR`.
|
|
155
|
+
|
|
156
|
+
## Safety
|
|
157
|
+
|
|
158
|
+
Before deleting, `codex-history`:
|
|
159
|
+
|
|
160
|
+
- validates the supported Codex data model
|
|
161
|
+
- resolves the target to exactly one conversation
|
|
162
|
+
- refuses the currently active thread when detectable
|
|
163
|
+
- creates a mandatory backup under `~/.codex-history/backups`
|
|
164
|
+
- removes known references from supported local Codex stores
|
|
165
|
+
- verifies supported stores after mutation
|
|
166
|
+
|
|
167
|
+
This tool only changes local Codex data. It does not delete server-side OpenAI/Codex records, OS backups, terminal scrollback, crash reports, or user-created transcript copies.
|
|
168
|
+
|
|
169
|
+
If Codex Desktop is already showing the conversation you purge, quit or restart Codex before using it again. A running Codex process may still hold the old conversation in memory, and continuing to chat in that old window can write new local data for the same thread.
|
|
170
|
+
|
|
171
|
+
## Q&A
|
|
172
|
+
|
|
173
|
+
### Does this delete server-side Codex data?
|
|
174
|
+
|
|
175
|
+
No. It only modifies supported local files on your machine.
|
|
176
|
+
|
|
177
|
+
### Where are backups stored?
|
|
178
|
+
|
|
179
|
+
Backups are written under `~/.codex-history/backups`.
|
|
180
|
+
|
|
181
|
+
### Can I recover a purged conversation?
|
|
182
|
+
|
|
183
|
+
The tool creates a backup before deletion, but v0.1 does not include an automatic restore command. Treat `purge` as destructive.
|
|
184
|
+
|
|
185
|
+
### Do I need to restart Codex after purging?
|
|
186
|
+
|
|
187
|
+
Recommended, especially for Codex Desktop. `purge` updates local files on disk, but a running Codex process may not refresh its in-memory conversation list immediately. Restart Codex before continuing work.
|
|
188
|
+
|
|
189
|
+
## Development
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm install
|
|
193
|
+
npm run typecheck
|
|
194
|
+
npm test
|
|
195
|
+
npm run build
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">Codex History</h1>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img alt="npm" src="https://img.shields.io/npm/v/@liuyoumi/codex-history?style=flat-square&color=cb9b27" />
|
|
5
|
+
<img alt="platform" src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-2ea043?style=flat-square" />
|
|
6
|
+
<img alt="local only" src="https://img.shields.io/badge/local%20data-only-6e7681?style=flat-square" />
|
|
7
|
+
<img alt="backup" src="https://img.shields.io/badge/backup-before%20purge-0969da?style=flat-square" />
|
|
8
|
+
<img alt="license" src="https://img.shields.io/npm/l/@liuyoumi/codex-history?style=flat-square" />
|
|
9
|
+
</p>
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="README.md">中文</a> | <a href="README.en.md">English</a>
|
|
13
|
+
</p>
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="https://raw.githubusercontent.com/liuyoumi/codex-history/main/assets/cover.png" alt="codex-history 封面" width="100%" />
|
|
17
|
+
</p>
|
|
8
18
|
|
|
9
|
-
|
|
19
|
+
一个用来查找并删除本地 Codex 对话历史的小型命令行工具。
|
|
20
|
+
|
|
21
|
+
`codex-history` 只处理你机器上的本地 Codex 数据。它会尽量使用 Codex 对话列表里显示的短标题,支持用 `--grep` 缩小范围,并且只会在你确认目标后删除一条明确解析出来的对话。
|
|
22
|
+
|
|
23
|
+
## 安装
|
|
10
24
|
|
|
11
25
|
```bash
|
|
12
26
|
npm install -g @liuyoumi/codex-history
|
|
13
27
|
```
|
|
14
28
|
|
|
15
|
-
|
|
29
|
+
也可以不安装直接运行:
|
|
16
30
|
|
|
17
31
|
```bash
|
|
18
32
|
npx @liuyoumi/codex-history doctor
|
|
19
33
|
```
|
|
20
34
|
|
|
21
|
-
##
|
|
35
|
+
## 支持平台
|
|
36
|
+
|
|
37
|
+
`codex-history` 已在 macOS、Windows、Linux 上完成基础流程验证,包括安装、`doctor`、`list` / `--grep`,以及带确认和备份保护的 `purge`。
|
|
38
|
+
|
|
39
|
+
| 平台 | 状态 |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| macOS | 可用于日常本地历史管理 |
|
|
42
|
+
| Windows | 可用于日常本地历史管理 |
|
|
43
|
+
| Linux | 可用于日常本地历史管理 |
|
|
22
44
|
|
|
23
|
-
|
|
24
|
-
- Windows/Linux: not verified yet
|
|
45
|
+
Codex 本地数据结构可能随版本变化。Codex 升级后,建议先运行 `codex-history doctor` 再执行删除操作。
|
|
25
46
|
|
|
26
|
-
##
|
|
47
|
+
## 快速开始
|
|
27
48
|
|
|
28
49
|
```bash
|
|
29
50
|
codex-history doctor
|
|
@@ -32,12 +53,12 @@ codex-history list --grep "Astro"
|
|
|
32
53
|
codex-history purge 019e6885
|
|
33
54
|
```
|
|
34
55
|
|
|
35
|
-
`purge`
|
|
56
|
+
`purge` 会先展示解析到的对话信息,并要求你输入标准短 id,确认后才会删除:
|
|
36
57
|
|
|
37
58
|
```text
|
|
38
59
|
About to purge this local Codex conversation:
|
|
39
60
|
|
|
40
|
-
title:
|
|
61
|
+
title: 实施 Astro 博客视觉审计工具
|
|
41
62
|
id: 019e6885-b5ae-7ae0-a50d-ce5f75b0ac08
|
|
42
63
|
cwd: /Users/me/Projects/example
|
|
43
64
|
updated: 2026-05-28T03:16:01.959Z
|
|
@@ -46,28 +67,28 @@ A backup will be created before deletion.
|
|
|
46
67
|
Type 019e6885 to confirm:
|
|
47
68
|
```
|
|
48
69
|
|
|
49
|
-
##
|
|
70
|
+
## 命令
|
|
50
71
|
|
|
51
|
-
|
|
|
72
|
+
| 命令 | 说明 |
|
|
52
73
|
| --- | --- |
|
|
53
|
-
| `codex-history doctor` |
|
|
54
|
-
| `codex-history list` |
|
|
55
|
-
| `codex-history list --grep <keyword>` |
|
|
56
|
-
| `codex-history purge <id>` |
|
|
74
|
+
| `codex-history doctor` | 检查当前本地 Codex 数据结构是否受支持。 |
|
|
75
|
+
| `codex-history list` | 列出本地对话。 |
|
|
76
|
+
| `codex-history list --grep <keyword>` | 按标题、id 或 cwd 过滤对话。 |
|
|
77
|
+
| `codex-history purge <id>` | 确认后删除一条解析到的本地对话。 |
|
|
57
78
|
|
|
58
79
|
### `doctor`
|
|
59
80
|
|
|
60
|
-
|
|
81
|
+
检查当前本地 Codex 数据结构是否被这个版本支持。
|
|
61
82
|
|
|
62
83
|
```bash
|
|
63
84
|
codex-history doctor
|
|
64
85
|
```
|
|
65
86
|
|
|
66
|
-
|
|
87
|
+
建议安装后先跑一次;Codex 更新后也可以再跑一次。如果当前数据结构不受支持,删除命令会拒绝执行,而不是猜测应该怎么删。
|
|
67
88
|
|
|
68
89
|
### `list`
|
|
69
90
|
|
|
70
|
-
|
|
91
|
+
列出本地 Codex 对话。
|
|
71
92
|
|
|
72
93
|
```bash
|
|
73
94
|
codex-history list
|
|
@@ -77,50 +98,50 @@ codex-history list --pretty=medium
|
|
|
77
98
|
codex-history list --pretty=full
|
|
78
99
|
```
|
|
79
100
|
|
|
80
|
-
|
|
101
|
+
默认是一行一条:
|
|
81
102
|
|
|
82
103
|
```text
|
|
83
|
-
019e6885
|
|
84
|
-
019e6874
|
|
104
|
+
019e6885 实施 Astro 博客视觉审计工具
|
|
105
|
+
019e6874 评审 Astro 博客视觉方案
|
|
85
106
|
```
|
|
86
107
|
|
|
87
|
-
`--grep`
|
|
108
|
+
`--grep` 会按显示标题、线程 id、cwd 过滤。它不会搜索或输出对话正文。
|
|
88
109
|
|
|
89
|
-
|
|
110
|
+
执行 `purge` 时,可以使用 `list` 里显示的短 id,也可以粘贴完整 thread id。
|
|
90
111
|
|
|
91
|
-
|
|
112
|
+
默认情况下,`list` 只显示未归档对话。使用 `--archived` 只看已归档对话,使用 `--all` 同时查看已归档和未归档对话。
|
|
92
113
|
|
|
93
|
-
|
|
114
|
+
如果 grep 关键词里有空格,请加引号:
|
|
94
115
|
|
|
95
116
|
```bash
|
|
96
|
-
codex-history list --grep "Astro
|
|
117
|
+
codex-history list --grep "Astro 博客"
|
|
97
118
|
```
|
|
98
119
|
|
|
99
|
-
`--pretty`
|
|
120
|
+
`--pretty` 支持:
|
|
100
121
|
|
|
101
|
-
- `oneline
|
|
102
|
-
- `medium
|
|
103
|
-
- `full
|
|
122
|
+
- `oneline`:短 id 和标题
|
|
123
|
+
- `medium`:完整 id、更新时间、cwd
|
|
124
|
+
- `full`:在 `medium` 基础上增加创建时间、归档状态、rollout 路径
|
|
104
125
|
|
|
105
|
-
|
|
126
|
+
在交互式终端里,如果 `list` 没有加 `--limit`,输出会进入系统分页器。管道或重定向输出会自动跳过分页器。
|
|
106
127
|
|
|
107
128
|
### `purge`
|
|
108
129
|
|
|
109
|
-
|
|
130
|
+
通过完整 id 或唯一短 id 前缀删除一条本地 Codex 对话。
|
|
110
131
|
|
|
111
132
|
```bash
|
|
112
133
|
codex-history purge 019e6885
|
|
113
134
|
```
|
|
114
135
|
|
|
115
|
-
|
|
136
|
+
脚本或非交互环境可以使用 `--force`:
|
|
116
137
|
|
|
117
138
|
```bash
|
|
118
139
|
codex-history purge 019e6885 --force
|
|
119
140
|
```
|
|
120
141
|
|
|
121
|
-
`--force`
|
|
142
|
+
`--force` 只跳过交互式短 id 确认,不会跳过数据结构校验、强制备份、active thread 保护和删除后的验证。
|
|
122
143
|
|
|
123
|
-
##
|
|
144
|
+
## 选项
|
|
124
145
|
|
|
125
146
|
```bash
|
|
126
147
|
codex-history --codex-home /path/to/.codex list
|
|
@@ -128,44 +149,44 @@ codex-history --json list --grep "Astro"
|
|
|
128
149
|
codex-history --json purge 019e6885 --force
|
|
129
150
|
```
|
|
130
151
|
|
|
131
|
-
- `--codex-home`
|
|
132
|
-
- `--json`
|
|
133
|
-
-
|
|
152
|
+
- `--codex-home` 默认是 `~/.codex`。
|
|
153
|
+
- `--json` 输出机器可读的 JSON。`purge` 使用 JSON 输出时必须加 `--force`,因为交互确认只适合文本模式。
|
|
154
|
+
- 颜色只会在交互式终端中启用,并遵守 `NO_COLOR`。
|
|
134
155
|
|
|
135
|
-
##
|
|
156
|
+
## 安全机制
|
|
136
157
|
|
|
137
|
-
|
|
158
|
+
删除前,`codex-history` 会:
|
|
138
159
|
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
160
|
+
- 校验当前 Codex 本地数据结构是否受支持
|
|
161
|
+
- 将目标解析到唯一一条对话
|
|
162
|
+
- 在可检测时拒绝删除当前 active thread
|
|
163
|
+
- 在 `~/.codex-history/backups` 下创建强制备份
|
|
164
|
+
- 从受支持的本地 Codex 数据中移除已知引用
|
|
165
|
+
- 删除后扫描受支持的数据存储,确认目标引用已经移除
|
|
145
166
|
|
|
146
|
-
|
|
167
|
+
这个工具只处理本地 Codex 数据。它不会删除 OpenAI/Codex 服务端记录、系统备份、终端滚动历史、崩溃报告,或你手动保存过的对话副本。
|
|
147
168
|
|
|
148
|
-
|
|
169
|
+
如果 Codex Desktop 已经打开了你要删除的对话,删除后请先退出或重启 Codex,再继续使用。运行中的 Codex 进程可能仍然在内存里保留旧对话;如果继续在那个旧窗口里聊天,可能会为同一个 thread 重新写入本地数据。
|
|
149
170
|
|
|
150
171
|
## Q&A
|
|
151
172
|
|
|
152
|
-
###
|
|
173
|
+
### 会删除 Codex 服务端数据吗?
|
|
153
174
|
|
|
154
|
-
|
|
175
|
+
不会。它只修改你机器上受支持的本地文件。
|
|
155
176
|
|
|
156
|
-
###
|
|
177
|
+
### 备份在哪里?
|
|
157
178
|
|
|
158
|
-
|
|
179
|
+
备份会写入 `~/.codex-history/backups`。
|
|
159
180
|
|
|
160
|
-
###
|
|
181
|
+
### 删除后还能恢复吗?
|
|
161
182
|
|
|
162
|
-
|
|
183
|
+
工具会在删除前创建备份,但 v0.1 还没有自动恢复命令。请把 `purge` 当作破坏性操作对待。
|
|
163
184
|
|
|
164
|
-
###
|
|
185
|
+
### 删除后需要重启 Codex 吗?
|
|
165
186
|
|
|
166
|
-
|
|
187
|
+
建议重启,尤其是 Codex Desktop。`purge` 修改的是磁盘上的本地文件,但正在运行的 Codex 进程可能不会立刻刷新内存里的历史列表。继续工作前,最好先重启 Codex。
|
|
167
188
|
|
|
168
|
-
##
|
|
189
|
+
## 开发
|
|
169
190
|
|
|
170
191
|
```bash
|
|
171
192
|
npm install
|
|
@@ -174,6 +195,6 @@ npm test
|
|
|
174
195
|
npm run build
|
|
175
196
|
```
|
|
176
197
|
|
|
177
|
-
##
|
|
198
|
+
## 许可证
|
|
178
199
|
|
|
179
200
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liuyoumi/codex-history",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CLI for listing and safely purging local Codex conversation history",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md",
|
|
12
|
-
"README.
|
|
12
|
+
"README.en.md",
|
|
13
13
|
"CHANGELOG.md",
|
|
14
14
|
"LICENSE"
|
|
15
15
|
],
|
package/README.zh-CN.md
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
# codex-history
|
|
2
|
-
|
|
3
|
-
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
|
-
|
|
5
|
-
一个用来查找并删除本地 Codex 对话历史的小型命令行工具。
|
|
6
|
-
|
|
7
|
-
`codex-history` 只处理你机器上的本地 Codex 数据。它会尽量使用 Codex 对话列表里显示的短标题,支持用 `--grep` 缩小范围,并且只会在你确认目标后删除一条明确解析出来的对话。
|
|
8
|
-
|
|
9
|
-
## 安装
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install -g @liuyoumi/codex-history
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
也可以不安装直接运行:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npx @liuyoumi/codex-history doctor
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## 支持平台
|
|
22
|
-
|
|
23
|
-
- macOS:v0.1 已验证
|
|
24
|
-
- Windows/Linux:暂未验证
|
|
25
|
-
|
|
26
|
-
## 快速开始
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
codex-history doctor
|
|
30
|
-
codex-history list
|
|
31
|
-
codex-history list --grep "Astro"
|
|
32
|
-
codex-history purge 019e6885
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
`purge` 会先展示解析到的对话信息,并要求你输入标准短 id,确认后才会删除:
|
|
36
|
-
|
|
37
|
-
```text
|
|
38
|
-
About to purge this local Codex conversation:
|
|
39
|
-
|
|
40
|
-
title: 实施 Astro 博客视觉审计工具
|
|
41
|
-
id: 019e6885-b5ae-7ae0-a50d-ce5f75b0ac08
|
|
42
|
-
cwd: /Users/me/Projects/example
|
|
43
|
-
updated: 2026-05-28T03:16:01.959Z
|
|
44
|
-
|
|
45
|
-
A backup will be created before deletion.
|
|
46
|
-
Type 019e6885 to confirm:
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## 命令
|
|
50
|
-
|
|
51
|
-
| 命令 | 说明 |
|
|
52
|
-
| --- | --- |
|
|
53
|
-
| `codex-history doctor` | 检查当前本地 Codex 数据结构是否受支持。 |
|
|
54
|
-
| `codex-history list` | 列出本地对话。 |
|
|
55
|
-
| `codex-history list --grep <keyword>` | 按标题、id 或 cwd 过滤对话。 |
|
|
56
|
-
| `codex-history purge <id>` | 确认后删除一条解析到的本地对话。 |
|
|
57
|
-
|
|
58
|
-
### `doctor`
|
|
59
|
-
|
|
60
|
-
检查当前本地 Codex 数据结构是否被这个版本支持。
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
codex-history doctor
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
建议安装后先跑一次;Codex 更新后也可以再跑一次。如果当前数据结构不受支持,删除命令会拒绝执行,而不是猜测应该怎么删。
|
|
67
|
-
|
|
68
|
-
### `list`
|
|
69
|
-
|
|
70
|
-
列出本地 Codex 对话。
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
codex-history list
|
|
74
|
-
codex-history list --grep "Astro"
|
|
75
|
-
codex-history list --limit 20
|
|
76
|
-
codex-history list --pretty=medium
|
|
77
|
-
codex-history list --pretty=full
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
默认是一行一条:
|
|
81
|
-
|
|
82
|
-
```text
|
|
83
|
-
019e6885 实施 Astro 博客视觉审计工具
|
|
84
|
-
019e6874 评审 Astro 博客视觉方案
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
`--grep` 会按显示标题、线程 id、cwd 过滤。它不会搜索或输出对话正文。
|
|
88
|
-
|
|
89
|
-
执行 `purge` 时,可以使用 `list` 里显示的短 id,也可以粘贴完整 thread id。
|
|
90
|
-
|
|
91
|
-
默认情况下,`list` 只显示未归档对话。使用 `--archived` 只看已归档对话,使用 `--all` 同时查看已归档和未归档对话。
|
|
92
|
-
|
|
93
|
-
如果 grep 关键词里有空格,请加引号:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
codex-history list --grep "Astro 博客"
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
`--pretty` 支持:
|
|
100
|
-
|
|
101
|
-
- `oneline`:短 id 和标题
|
|
102
|
-
- `medium`:完整 id、更新时间、cwd
|
|
103
|
-
- `full`:在 `medium` 基础上增加创建时间、归档状态、rollout 路径
|
|
104
|
-
|
|
105
|
-
在交互式终端里,如果 `list` 没有加 `--limit`,输出会进入系统分页器。管道或重定向输出会自动跳过分页器。
|
|
106
|
-
|
|
107
|
-
### `purge`
|
|
108
|
-
|
|
109
|
-
通过完整 id 或唯一短 id 前缀删除一条本地 Codex 对话。
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
codex-history purge 019e6885
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
脚本或非交互环境可以使用 `--force`:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
codex-history purge 019e6885 --force
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
`--force` 只跳过交互式短 id 确认,不会跳过数据结构校验、强制备份、active thread 保护和删除后的验证。
|
|
122
|
-
|
|
123
|
-
## 选项
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
codex-history --codex-home /path/to/.codex list
|
|
127
|
-
codex-history --json list --grep "Astro"
|
|
128
|
-
codex-history --json purge 019e6885 --force
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
- `--codex-home` 默认是 `~/.codex`。
|
|
132
|
-
- `--json` 输出机器可读的 JSON。`purge` 使用 JSON 输出时必须加 `--force`,因为交互确认只适合文本模式。
|
|
133
|
-
- 颜色只会在交互式终端中启用,并遵守 `NO_COLOR`。
|
|
134
|
-
|
|
135
|
-
## 安全机制
|
|
136
|
-
|
|
137
|
-
删除前,`codex-history` 会:
|
|
138
|
-
|
|
139
|
-
- 校验当前 Codex 本地数据结构是否受支持
|
|
140
|
-
- 将目标解析到唯一一条对话
|
|
141
|
-
- 在可检测时拒绝删除当前 active thread
|
|
142
|
-
- 在 `~/.codex-history/backups` 下创建强制备份
|
|
143
|
-
- 从受支持的本地 Codex 数据中移除已知引用
|
|
144
|
-
- 删除后扫描受支持的数据存储,确认目标引用已经移除
|
|
145
|
-
|
|
146
|
-
这个工具只处理本地 Codex 数据。它不会删除 OpenAI/Codex 服务端记录、系统备份、终端滚动历史、崩溃报告,或你手动保存过的对话副本。
|
|
147
|
-
|
|
148
|
-
如果 Codex Desktop 已经打开了你要删除的对话,删除后请先退出或重启 Codex,再继续使用。运行中的 Codex 进程可能仍然在内存里保留旧对话;如果继续在那个旧窗口里聊天,可能会为同一个 thread 重新写入本地数据。
|
|
149
|
-
|
|
150
|
-
## Q&A
|
|
151
|
-
|
|
152
|
-
### 会删除 Codex 服务端数据吗?
|
|
153
|
-
|
|
154
|
-
不会。它只修改你机器上受支持的本地文件。
|
|
155
|
-
|
|
156
|
-
### 备份在哪里?
|
|
157
|
-
|
|
158
|
-
备份会写入 `~/.codex-history/backups`。
|
|
159
|
-
|
|
160
|
-
### 删除后还能恢复吗?
|
|
161
|
-
|
|
162
|
-
工具会在删除前创建备份,但 v0.1 还没有自动恢复命令。请把 `purge` 当作破坏性操作对待。
|
|
163
|
-
|
|
164
|
-
### 删除后需要重启 Codex 吗?
|
|
165
|
-
|
|
166
|
-
建议重启,尤其是 Codex Desktop。`purge` 修改的是磁盘上的本地文件,但正在运行的 Codex 进程可能不会立刻刷新内存里的历史列表。继续工作前,最好先重启 Codex。
|
|
167
|
-
|
|
168
|
-
## 开发
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
npm install
|
|
172
|
-
npm run typecheck
|
|
173
|
-
npm test
|
|
174
|
-
npm run build
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## 许可证
|
|
178
|
-
|
|
179
|
-
MIT
|