@kyun.si/codex-polish 0.0.1-beta.3 → 0.0.1-beta.5

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 (38) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/CONTRIBUTING.en.md +6 -6
  3. package/CONTRIBUTING.md +6 -6
  4. package/README.md +34 -64
  5. package/SECURITY.en.md +6 -4
  6. package/SECURITY.md +5 -3
  7. package/docs/README.zh-CN.md +56 -0
  8. package/docs/technical.en.md +66 -44
  9. package/docs/technical.md +62 -38
  10. package/evaluation/README.en.md +1 -1
  11. package/evaluation/README.md +1 -1
  12. package/package.json +1 -2
  13. package/plugins/codex-polish/.codex-plugin/plugin.json +1 -1
  14. package/plugins/codex-polish/hooks/editor_prompt.mjs +51 -0
  15. package/plugins/codex-polish/hooks/history.mjs +107 -66
  16. package/plugins/codex-polish/hooks/preferences.mjs +137 -114
  17. package/plugins/codex-polish/hooks/project_setting.mjs +40 -30
  18. package/plugins/codex-polish/hooks/recovery.mjs +2 -69
  19. package/plugins/codex-polish/hooks/rewrite_mode.mjs +19 -0
  20. package/plugins/codex-polish/skills/codex-polish/SKILL.md +3 -33
  21. package/plugins/codex-polish/skills/codex-polish/WORKFLOW.md +47 -0
  22. package/plugins/codex-polish/skills/codex-polish/references/acp.md +30 -17
  23. package/plugins/codex-polish/skills/codex-polish/references/codex-polish-editor.md +4 -2
  24. package/plugins/codex-polish/skills/codex-polish/scripts/acp_models.mjs +31 -6
  25. package/plugins/codex-polish/skills/codex-polish/scripts/acp_payload.mjs +55 -30
  26. package/plugins/codex-polish/skills/codex-polish/scripts/cli_io.mjs +2 -2
  27. package/plugins/codex-polish/skills/codex-polish/scripts/decisions.mjs +49 -58
  28. package/plugins/codex-polish/skills/codex-polish/scripts/editor_role.mjs +48 -0
  29. package/plugins/codex-polish/skills/codex-polish/scripts/format_reply.mjs +171 -0
  30. package/plugins/codex-polish/skills/codex-polish/scripts/previous_reply.mjs +31 -0
  31. package/plugins/codex-polish/skills/codex-polish/scripts/rewrite_material.mjs +28 -0
  32. package/plugins/codex-polish/skills/codex-polish/scripts/text_guard.mjs +65 -166
  33. package/plugins/codex-polish/skills/codex-polish-setup/SKILL.md +37 -11
  34. package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md +10 -8
  35. package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.md +7 -5
  36. package/scripts/install.mjs +389 -123
  37. package/scripts/native_cache.mjs +5 -5
  38. package/README.en.md +0 -84
@@ -33,7 +33,7 @@ export function treeContents(root) {
33
33
  return visit('') ? contents : null;
34
34
  }
35
35
 
36
- export function preserve(profile, market, name, version, getSource) {
36
+ export function preserve(profile, market, name, version, getSources) {
37
37
  let parent = profile;
38
38
  let cache;
39
39
  try {
@@ -55,10 +55,10 @@ export function preserve(profile, market, name, version, getSource) {
55
55
  const entries = fs.readdirSync(cache);
56
56
  if (!entries.length) return null;
57
57
  if (entries.length === 1 && entries[0] === version && fs.lstatSync(join(cache, version)).isDirectory()) {
58
- const source = getSource();
59
- if (source) {
60
- const expected = treeContents(source);
61
- if (expected && isDeepStrictEqual(expected, treeContents(join(cache, version)))) return null;
58
+ const sources = getSources();
59
+ if (sources.length) {
60
+ const cached = treeContents(join(cache, version));
61
+ if (cached && sources.some((source) => isDeepStrictEqual(treeContents(source), cached))) return null;
62
62
  }
63
63
  }
64
64
  }
package/README.en.md DELETED
@@ -1,84 +0,0 @@
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. When you get a rewrite, the chat shows Gemini’s version first, followed by the full original GPT draft for comparison. Projects default to automatic mode. Once you trust the plugin hook and start a new chat, ordinary questions trigger polishing.
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
- **Polished by Gemini**
10
-
11
- The export button is fixed and passed local tests. It still needs to be checked in production.
12
-
13
- **Original GPT draft**
14
-
15
- 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.
16
-
17
- To see just the rewrite for one reply, say **“Only show the polished text.”** If you ask for plain JSON, a command, or a verbatim quotation, the reply keeps that exact format.
18
-
19
- ## Quick Start
20
-
21
- 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.
22
-
23
- 1. **Install the plugin.** Use this command to install the beta from npm.
24
-
25
- ```sh
26
- npx @kyun.si/codex-polish@beta setup
27
- ```
28
-
29
- You can also clone the repository and run the installer locally.
30
-
31
- ```sh
32
- git clone https://github.com/mreasonyang/codex-polish.git
33
- cd codex-polish
34
- node scripts/install.mjs setup
35
- ```
36
-
37
- 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.
38
-
39
- 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.
40
- 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.”**
41
-
42
- ## Project Settings
43
-
44
- 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.
45
-
46
- | Setting | Default | Natural prompt |
47
- | --- | --- | --- |
48
- | Mode | Automatic (requires a trusted hook) | "Only polish when I ask", "Turn off Codex Polish", or "Polish automatically in this project" |
49
- | Gemini model | Gemini 4 Hydrogen | "Choose a rewrite model" (lists runtime account options, which can differ) or "Restore the default rewrite model" |
50
- | 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) |
51
- | OpenAI checks | On when `OPENAI_API_KEY` is set | "Use Gemini only" or "Use OpenAI checks when a key is available" |
52
- | Language | Auto (`zh` or `en`) | "Use English for plugin settings", "Use Chinese for plugin settings", or "Detect the plugin language automatically" |
53
-
54
- 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.
55
-
56
- ## Privacy and Hooks
57
-
58
- 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.
59
-
60
- 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.
61
-
62
- ## If a Reply Stays Unchanged
63
-
64
- If Gemini returns the same text, the reply says it left the draft unchanged and shows the text once. If polishing was skipped before sending the draft, the request failed to finish, or the rewrite failed a check, the reply says what happened and shows the original GPT draft. Ask **“Why wasn’t my last reply polished?”** for that turn’s reason, or **“Check Codex Polish setup”** to troubleshoot the connection.
65
-
66
- ## Check, Update, or Uninstall
67
-
68
- | Action | From the npm beta | From the source directory |
69
- | --- | --- | --- |
70
- | Check the current project | `npx @kyun.si/codex-polish@beta doctor` | `node scripts/install.mjs doctor` |
71
- | Update | `npx @kyun.si/codex-polish@beta update` | Get the latest source, then run `node scripts/install.mjs update` |
72
- | Uninstall | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
73
-
74
- 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.
75
-
76
- ## References and License
77
-
78
- - [Credentials and Sign-In Guide](plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md)
79
- - [Technical Reference](docs/technical.en.md) · [How to Evaluate Rewrites](evaluation/README.en.md)
80
- - [Contributing](CONTRIBUTING.en.md)
81
- - [Security Policy](SECURITY.en.md)
82
- - [Changelog](CHANGELOG.md)
83
-
84
- Codex Polish is licensed under the [Apache License 2.0](LICENSE).