oc-tweaks 0.4.0 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +12 -4
  2. package/dist/index.js +14 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -89,13 +89,15 @@ Customize the appearance of the WPF notification window.
89
89
 
90
90
  ### `compaction`
91
91
 
92
- This plugin ensures that when OpenCode compacts a session's context, the resulting summary is generated in your preferred language (e.g., Chinese) instead of defaulting to English.
92
+ This plugin ensures that when OpenCode compacts a session's context, the resulting summary is generated in your preferred language and writing style.
93
93
 
94
94
  **Configuration Options:**
95
95
 
96
96
  | Property | Type | Default | Description |
97
97
  |---|---|---|---|
98
98
  | `enabled` | boolean | `true` | Enable or disable the plugin. |
99
+ | `language` | string | session language | Target language for the compaction summary (e.g., `"繁体中文"`, `"French"`). Defaults to the language the user used most in the session. |
100
+ | `style` | string | `"concise and well-organized"` | Writing style for the compaction summary (e.g., `"毛泽东语言风格"`, `"academic"`). |
99
101
 
100
102
  ### `autoMemory`
101
103
 
@@ -163,7 +165,9 @@ Here is an example of a `~/.config/opencode/oc-tweaks.json` file with all option
163
165
  }
164
166
  },
165
167
  "compaction": {
166
- "enabled": true
168
+ "enabled": true,
169
+ "language": "繁体中文",
170
+ "style": "毛泽东语言风格"
167
171
  },
168
172
  "autoMemory": {
169
173
  "enabled": true
@@ -275,13 +279,15 @@ bunx oc-tweaks init
275
279
 
276
280
  ### `compaction`
277
281
 
278
- 此插件确保当 OpenCode 压缩会话上下文时,生成的摘要使用你的首选语言(例如中文),而不是默认为英文。
282
+ 此插件确保当 OpenCode 压缩会话上下文时,生成的摘要使用你的首选语言和写作风格。
279
283
 
280
284
  **配置选项:**
281
285
 
282
286
  | 属性 | 类型 | 默认值 | 描述 |
283
287
  |---|---|---|---|
284
288
  | `enabled` | boolean | `true` | 启用或禁用此插件。 |
289
+ | `language` | string | 会话语言 | 压缩摘要的目标语言(如 `"繁体中文"`、`"French"`)。默认使用会话中用户最常使用的语言。 |
290
+ | `style` | string | `"concise and well-organized"` | 压缩摘要的写作风格(如 `"毛泽东语言风格"`、`"academic"`)。 |
285
291
 
286
292
  ### `autoMemory`
287
293
 
@@ -349,7 +355,9 @@ bunx oc-tweaks init
349
355
  }
350
356
  },
351
357
  "compaction": {
352
- "enabled": true
358
+ "enabled": true,
359
+ "language": "繁体中文",
360
+ "style": "毛泽东语言风格"
353
361
  },
354
362
  "autoMemory": {
355
363
  "enabled": true
package/dist/index.js CHANGED
@@ -321,11 +321,20 @@ ${VIOLATION_WARNING}`;
321
321
  };
322
322
  };
323
323
  // src/plugins/compaction.ts
324
- function buildLanguagePrompt(language) {
324
+ function buildCompactionPrompt(language, style) {
325
325
  const lang = language || "the language the user used most in this session";
326
- return `## Language Preference
327
-
328
- Write the compaction summary in ${lang}. Keep technical terms (filenames, commands, code) in their original form.`;
326
+ const lines = [
327
+ "## MANDATORY: Language & Writing Style",
328
+ "",
329
+ `**Language**: Write the ENTIRE compaction summary in ${lang}. Keep technical terms (filenames, commands, code) in their original form.`
330
+ ];
331
+ if (style) {
332
+ lines.push("", `**Writing Style**: ${style}`, "", "This is a NON-NEGOTIABLE requirement. Every section, every bullet point, every description in the summary MUST be written in this style. The structural format (numbered sections, bullet points) should be preserved, but the TONE, VOICE, and WORD CHOICE must unmistakably reflect the specified writing style throughout the entire output. Do NOT fall back to a neutral or generic tone.");
333
+ } else {
334
+ lines.push("", "**Writing Style**: concise and well-organized");
335
+ }
336
+ return lines.join(`
337
+ `);
329
338
  }
330
339
  var compactionPlugin = async () => {
331
340
  return {
@@ -333,7 +342,7 @@ var compactionPlugin = async () => {
333
342
  const config = await loadOcTweaksConfig();
334
343
  if (!config || config.compaction?.enabled !== true)
335
344
  return;
336
- output.context.push(buildLanguagePrompt(config.compaction?.language));
345
+ output.context.push(buildCompactionPrompt(config.compaction?.language, config.compaction?.style));
337
346
  })
338
347
  };
339
348
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-tweaks",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"