@kyun.si/codex-polish 0.0.0-stage → 0.0.1-beta.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/.agents/plugins/marketplace.json +12 -0
- package/CHANGELOG.md +24 -0
- package/CONTRIBUTING.en.md +48 -0
- package/CONTRIBUTING.md +47 -0
- package/Install Codex Polish.command +29 -0
- package/LICENSE +202 -0
- package/README.en.md +77 -0
- package/README.md +78 -2
- package/SECURITY.en.md +17 -0
- package/SECURITY.md +17 -0
- package/docs/technical.en.md +98 -0
- package/docs/technical.md +91 -0
- package/evaluation/README.en.md +47 -0
- package/evaluation/README.md +47 -0
- package/package.json +48 -4
- package/plugins/codex-polish/.codex-plugin/plugin.json +21 -0
- package/plugins/codex-polish/LICENSE +202 -0
- package/plugins/codex-polish/hooks/history.mjs +169 -0
- package/plugins/codex-polish/hooks/hooks.json +15 -0
- package/plugins/codex-polish/hooks/preferences.mjs +401 -0
- package/plugins/codex-polish/hooks/project_setting.mjs +93 -0
- package/plugins/codex-polish/hooks/recovery.mjs +201 -0
- package/plugins/codex-polish/hooks/ui_locale.mjs +61 -0
- package/plugins/codex-polish/skills/codex-polish/SKILL.md +36 -0
- package/plugins/codex-polish/skills/codex-polish/references/acp.md +94 -0
- package/plugins/codex-polish/skills/codex-polish/references/codex-polish-editor.md +15 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/acp_models.mjs +99 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/acp_payload.mjs +53 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/cli_io.mjs +29 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/decisions.mjs +224 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/text_guard.mjs +203 -0
- package/plugins/codex-polish/skills/codex-polish-setup/SKILL.md +52 -0
- package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md +47 -0
- package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.md +56 -0
- package/scripts/install.mjs +1221 -0
- package/scripts/native_cache.mjs +86 -0
- package//345/256/211/350/243/205/345/233/236/345/244/215/346/266/246/350/211/262.command +2 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codex-polish-local",
|
|
3
|
+
"interface": { "displayName": "Codex Polish · 回复润色" },
|
|
4
|
+
"plugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "codex-polish",
|
|
7
|
+
"source": { "source": "local", "path": "./plugins/codex-polish" },
|
|
8
|
+
"policy": { "installation": "AVAILABLE", "authentication": "ON_INSTALL" },
|
|
9
|
+
"category": "Productivity"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 更新记录 / Changelog
|
|
2
|
+
|
|
3
|
+
[中文使用说明](README.md) · [English README](README.en.md)
|
|
4
|
+
|
|
5
|
+
## 0.0.1-beta.2
|
|
6
|
+
|
|
7
|
+
- 项目没有指定润色模式时,普通提问也会自动触发润色。使用前,在 Codex 中信任插件的 `UserPromptSubmit` 钩子。已选“只在我要求时”或“关闭”的项目会沿用该选择。
|
|
8
|
+
- Projects without a saved mode now polish ordinary replies automatically once the `UserPromptSubmit` hook is trusted. Projects set to on-demand or off keep their preference.
|
|
9
|
+
|
|
10
|
+
## 0.0.1-beta.1
|
|
11
|
+
|
|
12
|
+
### 简体中文
|
|
13
|
+
|
|
14
|
+
- 通过 Antigravity 的 `agy` 调用 Gemini 润色 Codex 回复。在 macOS 和 Linux 上使用 Node.js 22.16 或更新版本运行插件,macOS 也支持双击安装。
|
|
15
|
+
- 默认按需润色。每个项目可以单独设置触发模式、Gemini 模型和插件界面语言。
|
|
16
|
+
- 在 Codex 中信任 `UserPromptSubmit` 钩子后,可以开启自动润色,也可以选择让 Gemini 参考最近几轮已完成的问答。
|
|
17
|
+
- 改写时用占位符保护代码、命令、路径、链接和数值。可选的 OpenAI 检查会先判断是否需要润色,再核对改稿是否保留原意。检查失败时交付原稿。
|
|
18
|
+
|
|
19
|
+
### English
|
|
20
|
+
|
|
21
|
+
- Polish Codex replies with Gemini through the Antigravity CLI (`agy`). Install with Node.js 22.16+ on macOS or Linux, or double-click the installer on macOS.
|
|
22
|
+
- Request a rewrite when you need one. Each project has its own settings for rewrite mode, Gemini model, and interface language.
|
|
23
|
+
- Trust the `UserPromptSubmit` hook in Codex to enable automatic rewrites or let Gemini use recent completed exchanges as context.
|
|
24
|
+
- Placeholders protect code, commands, paths, links, and numbers. Optional OpenAI checks decide whether a draft needs editing and whether the rewrite preserves its meaning. If a check fails, the plugin keeps the original.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Contributing to Codex Polish
|
|
2
|
+
|
|
3
|
+
[简体中文](CONTRIBUTING.md)
|
|
4
|
+
|
|
5
|
+
For installation, see the [project README](README.en.md). For the checks a reply goes through, see the [technical reference](docs/technical.en.md).
|
|
6
|
+
|
|
7
|
+
## Where to Make Changes
|
|
8
|
+
|
|
9
|
+
- `scripts/install.mjs` and the `.command` launchers handle installation, updates, status checks, uninstallation, and local marketplace registration.
|
|
10
|
+
- `plugins/codex-polish/` contains the plugin manifest, the `UserPromptSubmit` hook, and two skills. `codex-polish` handles placeholder protection, optional OpenAI Decisions checks, `agy acp` rewrites, and validation. `codex-polish-setup` manages `.codex/codex-polish.*` settings, runtime model discovery, diagnostics, and the [credential guide](plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md).
|
|
11
|
+
- The full source tree includes the regression suite in `tests/` and the evaluation script and synthetic samples in `evaluation/`. See the [evaluation guide](evaluation/README.en.md).
|
|
12
|
+
- When updating user-facing prompts or documentation, update both English and Chinese.
|
|
13
|
+
|
|
14
|
+
## Testing and Packaging from Source
|
|
15
|
+
|
|
16
|
+
Run these commands from a source checkout on macOS or Linux with Node.js 22.16+ (standard library only, no `npm install`). Packaging requires npm. The native installation tests also use the Codex CLI, npx, and tar. [Get the full source](https://github.com/mreasonyang/codex-polish)
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm test
|
|
20
|
+
node evaluation/report.mjs evaluation/example.jsonl
|
|
21
|
+
mkdir -p dist
|
|
22
|
+
npm pack --ignore-scripts --pack-destination dist
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`npm pack` writes version `0.0.1-beta.2` of `@kyun.si/codex-polish` to `dist/kyun.si-codex-polish-0.0.1-beta.2.tgz`. Default tests need no API key. Native installer tests use a temporary Codex profile. A separate opt-in test makes four billable OpenAI requests. See the [live test instructions](docs/technical.en.md).
|
|
26
|
+
|
|
27
|
+
## Reporting Bugs
|
|
28
|
+
|
|
29
|
+
Report bugs in GitHub Issues. Include steps to reproduce, expected and actual results, and the versions of your OS, Node.js, Codex CLI, and `agy`. For diagnostics, ask Codex **"Check Codex Polish setup"** in the affected project. Redact credentials, private paths, and chat text before sharing. [Open an issue](https://github.com/mreasonyang/codex-polish/issues)
|
|
30
|
+
|
|
31
|
+
Report security vulnerabilities privately. [Security policy](SECURITY.en.md)
|
|
32
|
+
|
|
33
|
+
## Submitting a Verifiable Patch
|
|
34
|
+
|
|
35
|
+
Open a GitHub pull request with the reason for the change, steps to reproduce or verify it, and results from the tests you ran. For changes involving a provider, say whether you used a mock or a live account. Use synthetic samples or authorized, de-identified material. The project uses the [Apache License 2.0](LICENSE).
|
|
36
|
+
|
|
37
|
+
## Publishing a beta
|
|
38
|
+
|
|
39
|
+
Set the version in both `package.json` and the plugin manifest to `X.Y.Z-beta.N`. Commit the change and push the matching Git tag. For example, to publish `0.0.1-beta.2`:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
git tag v0.0.1-beta.2
|
|
43
|
+
git push origin v0.0.1-beta.2
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
GitHub Actions tests the tagged code, publishes the package to npm with the `beta` tag, and creates a GitHub prerelease. If a step fails, run the publishing workflow again from the Actions tab and enter the existing tag.
|
|
47
|
+
|
|
48
|
+
npm grants publishing access per package. Configure this package’s trusted publisher for the `mreasonyang/codex-polish` repository and the `publish.yml` workflow, and enable **Allow npm publish** and **Allow npm dist-tag**. Tag access lets the workflow remove `latest` if npm sets it on the first beta. GitHub authenticates the workflow to npm on each release without a stored npm token. [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/)
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# 参与贡献
|
|
2
|
+
|
|
3
|
+
[English](CONTRIBUTING.en.md)
|
|
4
|
+
|
|
5
|
+
安装和使用请看[项目说明](README.md)。改动插件前,可以先查[技术参考](docs/technical.md),了解一次改写经过哪些检查。
|
|
6
|
+
|
|
7
|
+
## 改哪里
|
|
8
|
+
|
|
9
|
+
- `scripts/install.mjs` 和两个 `.command` 启动脚本负责安装、更新、环境检查和卸载。
|
|
10
|
+
- `plugins/codex-polish/` 里有插件清单、钩子和两个技能。`codex-polish` 负责改写与校验,`codex-polish-setup` 负责设置、选择模型和检查环境。改动用户提示时,请一起更新中英文。
|
|
11
|
+
- 完整源码的 `tests/` 放回归测试,`evaluation/` 放评测脚本和合成样本。[评测说明](evaluation/README.md)
|
|
12
|
+
|
|
13
|
+
## 本地测试与打包
|
|
14
|
+
|
|
15
|
+
在完整源码的根目录运行以下命令。需要 macOS 或 Linux 和 Node.js 22.16 或更新版本。打包需要 npm,原生安装测试还会用到 Codex CLI、npx 和 tar。[获取完整源码](https://github.com/mreasonyang/codex-polish)
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm test
|
|
19
|
+
node evaluation/report.mjs evaluation/example.jsonl
|
|
20
|
+
mkdir -p dist
|
|
21
|
+
npm pack --ignore-scripts --pack-destination dist
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`npm pack` 会把 `@kyun.si/codex-polish` 的 `0.0.1-beta.2` 版打包为 `dist/kyun.si-codex-polish-0.0.1-beta.2.tgz`。默认测试无需 API 密钥,原生安装测试会使用临时 Codex 配置。另有一项在线测试需要显式开启,会向 OpenAI 发出四次付费请求。[运行在线检查](docs/technical.md)
|
|
25
|
+
|
|
26
|
+
## 反馈问题
|
|
27
|
+
|
|
28
|
+
请在 GitHub Issues 提交普通问题,附上复现步骤、预期和实际结果,并注明操作系统、Node.js、Codex CLI 和 `agy` 版本。在遇到问题的项目里对 Codex 说 **“检查回复润色环境”** 可获取诊断信息。分享前请删去密钥、登录凭据、私人路径和对话原文。[提交问题](https://github.com/mreasonyang/codex-polish/issues)
|
|
29
|
+
|
|
30
|
+
安全漏洞请私下报告。[安全说明](SECURITY.md)
|
|
31
|
+
|
|
32
|
+
## 提交补丁
|
|
33
|
+
|
|
34
|
+
请通过 GitHub Pull Request 提交改动,附上改动原因、复现或验证方法,以及实际跑过的测试结果。如果改动涉及 Gemini 或 OpenAI,写明用的是模拟服务还是真实账号。测试样本请使用虚构内容,或已获授权且脱敏的材料。本项目采用 [Apache License 2.0](LICENSE)。
|
|
35
|
+
|
|
36
|
+
## 发布 beta
|
|
37
|
+
|
|
38
|
+
将 `package.json` 和插件清单中的版本一同改为 `X.Y.Z-beta.N`,提交后推送同名 Git 标签。例如发布 `0.0.1-beta.2` 时运行:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
git tag v0.0.1-beta.2
|
|
42
|
+
git push origin v0.0.1-beta.2
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
GitHub Actions 会测试这个标签的代码,将安装包发布到 npm 的 `beta` 标签,并创建 GitHub 预发布版。如果某一步失败,可以在 Actions 中选择发布工作流,用已有标签重试。
|
|
46
|
+
|
|
47
|
+
npm 按包授权。此包使用 GitHub 仓库 `mreasonyang/codex-polish` 的 `publish.yml` 工作流,可信发布者勾选 **Allow npm publish** 和 **Allow npm dist-tag**。后一项让工作流在 npm 把首个 beta 同时标记为 `latest` 时自动清理标签。发布时 GitHub 会向 npm 证明工作流身份,仓库无需保存 npm 令牌。[npm 可信发布设置](https://docs.npmjs.com/trusted-publishers/)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Finder's Terminal may have a shorter PATH than the user's development shell.
|
|
3
|
+
PATH="${PATH:-/usr/bin:/bin}:$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin"
|
|
4
|
+
export PATH
|
|
5
|
+
if command -v node >/dev/null 2>&1 && node -e 'const [major, minor] = process.versions.node.split(".").map(Number); process.exit(major > 22 || major === 22 && minor >= 16 ? 0 : 1)'; then
|
|
6
|
+
CODEX_POLISH_INSTALL_WINDOW=1
|
|
7
|
+
export CODEX_POLISH_INSTALL_WINDOW
|
|
8
|
+
exec node "$(dirname "$0")/scripts/install.mjs" setup
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
# Node.js is unavailable, so the shared locale helper cannot run.
|
|
12
|
+
ui_locale=${LC_ALL:-${LC_MESSAGES:-${LANG:-}}}
|
|
13
|
+
if [ -z "$ui_locale" ] && [ -x /usr/bin/defaults ]; then
|
|
14
|
+
ui_locale=$(/usr/bin/defaults read -g AppleLanguages 2>/dev/null | /usr/bin/sed -n '2s/[",[:space:]]//gp')
|
|
15
|
+
fi
|
|
16
|
+
case "$ui_locale" in
|
|
17
|
+
[zZ][hH]*)
|
|
18
|
+
printf '%s\n' '安装回复润色需要 Node.js 22.16 或更高版本。装好 Node.js 后,再双击这个文件。' >&2
|
|
19
|
+
close_text='按回车关闭安装窗口。' ;;
|
|
20
|
+
*)
|
|
21
|
+
printf '%s\n' 'Codex Polish needs Node.js 22.16 or later. Install Node.js, then double-click this file again.' >&2
|
|
22
|
+
close_text='Press Enter to close the installer.' ;;
|
|
23
|
+
esac
|
|
24
|
+
printf '%s\n' 'https://nodejs.org/en/download' >&2
|
|
25
|
+
if [ -t 0 ]; then
|
|
26
|
+
printf '\n%s' "$close_text"
|
|
27
|
+
IFS= read -r reply
|
|
28
|
+
fi
|
|
29
|
+
exit 1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Codex Polish
|
|
2
|
+
|
|
3
|
+
**English** | **[简体中文](README.md)**
|
|
4
|
+
|
|
5
|
+
Codex Polish uses Gemini through Antigravity’s `agy acp` to polish Codex’s final replies. Projects default to automatic mode. Once you trust the plugin hook and start a new chat, ordinary questions trigger polishing. If the rewrite fails a check, you get the original.
|
|
6
|
+
|
|
7
|
+
In one test, Codex had to report that the export button was fixed and had passed local tests. A production check was still pending. Both texts below are translated from that test.
|
|
8
|
+
|
|
9
|
+
- **Draft** “Regarding progress with the export button fix, let me explain the actual situation. The export button has now been fixed, local tests have passed, and production verification has not yet been done.”
|
|
10
|
+
- **After** “The export button is fixed and passed local tests. It still needs to be checked in production.”
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
You need macOS or Linux, Node.js 22.16+, and a [Codex CLI](https://developers.openai.com/codex/cli/) with plugin support. In T3 Code, select Codex and install the plugin on the machine running that backend.
|
|
15
|
+
|
|
16
|
+
1. **Install the plugin.** Use this command to install the beta from npm.
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx @kyun.si/codex-polish@beta setup
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
You can also clone the repository and run the installer locally.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
git clone https://github.com/mreasonyang/codex-polish.git
|
|
26
|
+
cd codex-polish
|
|
27
|
+
node scripts/install.mjs setup
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
On macOS, you can also download and extract the GitHub repository, then double-click [Install Codex Polish.command](Install%20Codex%20Polish.command) in its root folder.
|
|
31
|
+
|
|
32
|
+
2. **Connect Gemini.** Setup reuses the Antigravity CLI (`agy` 1.2.1+) if it finds it. If it offers to install the official CLI, press Enter to accept. For unattended installation, add `--install-agy` to either `setup` command above. Your existing Antigravity sign-in works over ACP. If asked to sign in, run `agy` on the machine that runs Codex.
|
|
33
|
+
3. **Trust the hook and try an ordinary question.** Automatic polishing sends eligible questions and drafts to Google, with up to two completed exchanges by default. In Codex **Settings → Hooks** (`/hooks` in the CLI), trust the plugin’s `UserPromptSubmit` hook. Start a new chat in your project and ask **“Explain what DNS does in one sentence.”** To switch the project to manual mode, say **“Only polish when I ask.”**
|
|
34
|
+
|
|
35
|
+
## Project Settings
|
|
36
|
+
|
|
37
|
+
Settings are saved in each project’s `.codex/` directory and carry over to new chats in that project. Say **"Show Codex Polish settings"** to inspect them.
|
|
38
|
+
|
|
39
|
+
| Setting | Default | Natural prompt |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| Mode | Automatic (requires a trusted hook) | "Only polish when I ask", "Turn off Codex Polish", or "Polish automatically in this project" |
|
|
42
|
+
| Gemini model | Gemini 4 Hydrogen | "Choose a rewrite model" (lists runtime account options, which can differ) or "Restore the default rewrite model" |
|
|
43
|
+
| History turns | Up to 2 earlier question-and-answer pairs | "Include the last 5 exchanges" or "Don't include any conversation history when polishing replies" (`0` to `10`, max 16 KiB) |
|
|
44
|
+
| OpenAI checks | On when `OPENAI_API_KEY` is set | "Use Gemini only" or "Use OpenAI checks when a key is available" |
|
|
45
|
+
| Language | Auto (`zh` or `en`) | "Use English for plugin settings", "Use Chinese for plugin settings", or "Detect the plugin language automatically" |
|
|
46
|
+
|
|
47
|
+
Without `OPENAI_API_KEY`, eligible drafts go straight to ACP. With OpenAI checks on, OpenAI runs a style check first and a meaning check after the rewrite. An invalid `OPENAI_API_KEY` blocks rewrites when checks are on until you fix or clear the key or set the project to Gemini only. Rewrites always stay in the draft's language.
|
|
48
|
+
|
|
49
|
+
## Privacy and Hooks
|
|
50
|
+
|
|
51
|
+
In automatic mode, the trusted `UserPromptSubmit` hook reminds Codex to polish the final reply to an ordinary question. Before trusting the hook, you can still say **“Polish this reply”** to share just the current question and draft. In manual mode, only explicit requests trigger polishing. Including history still requires the trusted hook. Turning polishing off skips even explicit requests.
|
|
52
|
+
|
|
53
|
+
For a rewrite, Google receives your current question and reply draft. The plugin replaces fixed details such as commands, paths, links, and numbers with placeholders. Ordinary prose is still readable. If history is enabled and available, Google also receives earlier exchanges as written, including code. The plugin skips turns with detected secrets, attachments, or incomplete output. OpenAI checks use only the protected current question and draft, plus the proposed rewrite for the final check. The plugin writes no draft logs of its own. Codex, your providers, and any global `agy` hooks have their own settings.
|
|
54
|
+
|
|
55
|
+
## If a Reply Stays Unchanged
|
|
56
|
+
|
|
57
|
+
Exact-output requests, already clear drafts when OpenAI checks are active, missing models, or failed checks keep the original draft. Say **"Check Codex Polish setup"** to inspect `agy` and cooldowns, **"Choose a rewrite model"** to verify model access, or **"Why wasn't my last reply polished?"** for the turn's reason.
|
|
58
|
+
|
|
59
|
+
## Check, Update, or Uninstall
|
|
60
|
+
|
|
61
|
+
| Action | From the npm beta | From the source directory |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| Check the current project | `npx @kyun.si/codex-polish@beta doctor` | `node scripts/install.mjs doctor` |
|
|
64
|
+
| Update | `npx @kyun.si/codex-polish@beta update` | Get the latest source, then run `node scripts/install.mjs update` |
|
|
65
|
+
| Uninstall | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
|
|
66
|
+
|
|
67
|
+
Updates preserve saved project modes and the plugin’s enabled state. Projects with no saved mode also pick up the automatic default. Start a new chat after upgrading, and review the updated hook if Codex prompts you. Uninstalling keeps your `.codex` project settings and shared `agy` binary.
|
|
68
|
+
|
|
69
|
+
## References and License
|
|
70
|
+
|
|
71
|
+
- [Credentials and Sign-In Guide](plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md)
|
|
72
|
+
- [Technical Reference](docs/technical.en.md) · [How to Evaluate Rewrites](evaluation/README.en.md)
|
|
73
|
+
- [Contributing](CONTRIBUTING.en.md)
|
|
74
|
+
- [Security Policy](SECURITY.en.md)
|
|
75
|
+
- [Changelog](CHANGELOG.md)
|
|
76
|
+
|
|
77
|
+
Codex Polish is licensed under the [Apache License 2.0](LICENSE).
|
package/README.md
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Codex Polish · Codex 回复润色
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**简体中文** | [English](README.en.md)
|
|
4
|
+
|
|
5
|
+
Codex Polish 通过 Antigravity 的 `agy acp` 请 Gemini 润色 Codex 的最终回复。项目默认使用自动模式。信任插件的 hook 并新开聊天后,像平常一样提问就会触发润色。改写失败或检查没通过,你看到的还是原稿。
|
|
6
|
+
|
|
7
|
+
## 改写示例
|
|
8
|
+
|
|
9
|
+
一次测试里,Codex 要告诉用户导出按钮修好了,本地测过了,线上还没验。
|
|
10
|
+
|
|
11
|
+
- **原稿** “关于导出按钮的修复进度,这里向你说明一下实际情况。目前导出按钮已经修复,本地测试已经通过,线上还没有验证。”
|
|
12
|
+
- **改写后** “导出按钮目前已经修复,本地测试也已通过,不过线上还没有验证。”
|
|
13
|
+
|
|
14
|
+
## 三步快速开始
|
|
15
|
+
|
|
16
|
+
支持 macOS 和 Linux。需要 Node.js 22.16 或更新版本,以及支持插件的 [Codex CLI](https://developers.openai.com/codex/cli/)。如果你用 T3 Code,选择 Codex 后端,并把插件装在运行该后端的机器上。
|
|
17
|
+
|
|
18
|
+
1. **安装插件。** 用下面的命令安装 npm 上的测试版。
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npx @kyun.si/codex-polish@beta setup
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
也可以下载源码,运行仓库里的安装脚本。
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
git clone https://github.com/mreasonyang/codex-polish.git
|
|
28
|
+
cd codex-polish
|
|
29
|
+
node scripts/install.mjs setup
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
在 macOS 上也可以下载并解压 GitHub 仓库,在项目根目录双击[安装回复润色.command](安装回复润色.command)。
|
|
33
|
+
|
|
34
|
+
2. **连接 Gemini。** 安装器会复用已有的 Antigravity CLI(`agy` 1.2.1 或更新版本)。如果没装,按回车即可安装官方版本。无人值守安装时,在上述 `setup` 命令末尾加上 `--install-agy`。插件默认沿用 Antigravity 登录。只有收到登录提示时,才需要在运行 Codex 的机器上打开 `agy` 登录。
|
|
35
|
+
3. **信任 hook,试一次普通提问。** 自动润色会将符合条件的问题和草稿发给 Google,默认最多附带最近 2 轮完整问答。在 Codex 的 **设置 → Hooks**(CLI 输入 `/hooks`)里信任本插件的 `UserPromptSubmit`,然后在项目里新开聊天,问 **“用一句话解释 DNS。”** 想改成手动,可以在项目里说 **“只在我要求时润色”**。
|
|
36
|
+
|
|
37
|
+
## 项目设置
|
|
38
|
+
|
|
39
|
+
直接对 Codex 说 **“查看回复润色设置”** 就能看到当前配置。每个项目单独保存,在同一项目新开的聊天也会沿用。
|
|
40
|
+
|
|
41
|
+
| 设置 | 默认值 | 可以这样说 |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| 什么时候润色 | 自动(需信任 hook) | “只在我要求时润色”“关闭回复润色”“给这个项目开启自动润色” |
|
|
44
|
+
| Gemini 模型 | Gemini 4 Hydrogen | “选择改写模型”会列出当前账号可用的模型,也可以说“恢复默认改写模型” |
|
|
45
|
+
| 带几轮历史 | 最近 2 轮 | “带最近 5 轮对话”“润色时不带历史”。一轮是之前的一个问题和对应的最终回复,可选 0 到 10 轮,历史正文合计最多 16 KiB |
|
|
46
|
+
| OpenAI 检查 | 配了 `OPENAI_API_KEY` 时启用 | “这个项目只用 Gemini 改写”“有密钥时用 OpenAI 检查” |
|
|
47
|
+
| 插件提示语言 | 自动识别中英文 | “插件提示改成中文”“恢复自动识别语言”。改稿始终沿用草稿的语言 |
|
|
48
|
+
|
|
49
|
+
没有 OpenAI 密钥也能用,符合条件的草稿会直接交给 Gemini。有密钥且启用了检查时,OpenAI 会先判断草稿是否值得润色,改完再核对原意。如果密钥无效,插件会保留原稿。可以修正或清除密钥,也可以把这个项目设为只用 Gemini。
|
|
50
|
+
|
|
51
|
+
## 谁会收到对话内容
|
|
52
|
+
|
|
53
|
+
自动模式下,受信任的 `UserPromptSubmit` 会在普通提问时提醒 Codex 润色最终回复。信任前,仍可说 **“把这轮回复润色一下”**,仅发送本轮材料。手动模式只在点名时触发,附带历史同样需要信任 hook。关闭后,即使点名也会跳过润色。
|
|
54
|
+
|
|
55
|
+
每次润色,Google 都会收到当前问题和草稿,其中的代码、命令、路径、链接和数值会先替换成占位符,普通文字仍可读。附带的历史则按原文发送,可能包含代码。插件会跳过检测到凭据、带附件或回复不完整的历史轮次。启用检查时,OpenAI 只会收到经过占位符处理的本轮材料,最后一次检查还会收到候选改稿。插件本身不记录草稿。Codex、服务商和全局 `agy` 钩子各有自己的日志设置。
|
|
56
|
+
|
|
57
|
+
## 为什么还是原稿?
|
|
58
|
+
|
|
59
|
+
如果要求原样输出、OpenAI 判断原稿已经够清楚、所选模型不可用,或改稿没通过校验,插件都会保留原稿。可以问 **“为什么上条回复没润色?”** 查看本轮原因,或说 **“检查回复润色环境”** 排查安装与连接。
|
|
60
|
+
|
|
61
|
+
## 检查、更新与卸载
|
|
62
|
+
|
|
63
|
+
| 操作 | 通过 npm 测试版 | 在源码根目录运行 |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| 检查当前项目 | `npx @kyun.si/codex-polish@beta doctor` | `node scripts/install.mjs doctor` |
|
|
66
|
+
| 更新 | `npx @kyun.si/codex-polish@beta update` | 取得新版源码后运行 `node scripts/install.mjs update` |
|
|
67
|
+
| 卸载 | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
|
|
68
|
+
|
|
69
|
+
更新会保留已保存的项目模式和插件启用状态。此前未设置模式的项目也会采用默认的自动模式。升级后新开一个聊天。如果 Codex 提示钩子内容已变更,请重新审查并信任。卸载后,项目的 `.codex` 设置和共用的 `agy` 会保留。
|
|
70
|
+
|
|
71
|
+
## 文档与许可
|
|
72
|
+
|
|
73
|
+
- [凭据与登录](plugins/codex-polish/skills/codex-polish-setup/references/credentials.md)
|
|
74
|
+
- [技术说明与验证范围](docs/technical.md) · [如何评估润色效果](evaluation/README.md)
|
|
75
|
+
- [贡献指南](CONTRIBUTING.md)
|
|
76
|
+
- [安全问题反馈](SECURITY.md)
|
|
77
|
+
- [更新记录](CHANGELOG.md)
|
|
78
|
+
|
|
79
|
+
本项目采用 [Apache License 2.0](LICENSE)。
|
package/SECURITY.en.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
[简体中文](SECURITY.md) · [README](README.en.md) · [Technical reference](docs/technical.en.md)
|
|
4
|
+
|
|
5
|
+
## Report a vulnerability privately
|
|
6
|
+
|
|
7
|
+
Please [report vulnerabilities privately on GitHub](https://github.com/mreasonyang/codex-polish/security/advisories/new). The maintainer can follow up with you in the report.
|
|
8
|
+
|
|
9
|
+
Include the plugin version, steps to reproduce the issue, what you expected, and what happened. Add relevant details such as your operating system, the versions of Node.js, Codex CLI, and `agy`, or the status of a project setting or hook. Use a fictional exchange and placeholder values in your example. Remove keys, tokens, authorization headers, and private conversation text.
|
|
10
|
+
|
|
11
|
+
## Control what the plugin sends
|
|
12
|
+
|
|
13
|
+
- To stop future rewrite requests in the current project, set `.codex/codex-polish.mode` to `off`.
|
|
14
|
+
- To keep rewriting but send only the current turn to Google, set `.codex/codex-polish.history-turns` to `0`.
|
|
15
|
+
- To turn off the plugin’s OpenAI checks, set `.codex/codex-polish.decisions` to `off`.
|
|
16
|
+
|
|
17
|
+
If a key or token may have been exposed, revoke it with the provider and replace it wherever it is configured.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# 安全说明
|
|
2
|
+
|
|
3
|
+
[English](SECURITY.en.md) · [使用说明](README.md) · [技术说明](docs/technical.md)
|
|
4
|
+
|
|
5
|
+
## 私下报告漏洞
|
|
6
|
+
|
|
7
|
+
如发现安全漏洞,请[私下提交漏洞报告](https://github.com/mreasonyang/codex-polish/security/advisories/new)。维护者可以在同一份报告里与你跟进。
|
|
8
|
+
|
|
9
|
+
在报告中写明插件版本、复现步骤、预期结果和实际结果。视问题补充操作系统、Node.js、Codex CLI 或 `agy` 的版本,以及相关的项目设置或钩子状态。请用虚构的对话和占位符演示问题,并删去密钥、令牌、认证头和私人对话原文。
|
|
10
|
+
|
|
11
|
+
## 控制插件发送的内容
|
|
12
|
+
|
|
13
|
+
- 要停止当前项目后续的改写请求,将 `.codex/codex-polish.mode` 设为 `off`。
|
|
14
|
+
- 要继续改写,但只向 Google 发送本轮内容,将 `.codex/codex-polish.history-turns` 设为 `0`。
|
|
15
|
+
- 要关闭插件的 OpenAI 检查,将 `.codex/codex-polish.decisions` 设为 `off`。
|
|
16
|
+
|
|
17
|
+
如果密钥或令牌可能已经泄露,请到相应服务商处撤销受影响的凭据,并在使用它的配置中换用新凭据。
|