czon 0.9.2 → 0.9.3

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.
@@ -47,7 +47,6 @@ const extractMetadataByAI_1 = require("../process/extractMetadataByAI");
47
47
  const processTranslations_1 = require("../process/processTranslations");
48
48
  const scanSourceFiles_1 = require("../process/scanSourceFiles");
49
49
  const template_1 = require("../process/template");
50
- const opencode_1 = require("../services/opencode");
51
50
  const writeFile_1 = require("../utils/writeFile");
52
51
  const robots_1 = require("./robots");
53
52
  const sitemap_1 = require("./sitemap");
@@ -67,8 +66,6 @@ async function applyConfig(options) {
67
66
  async function buildPipeline(options) {
68
67
  // 验证配置
69
68
  await applyConfig(options);
70
- // 安装 OpenCode 代理到全局目录
71
- await (0, opencode_1.installAgentsToGlobal)();
72
69
  // 清理输出目录
73
70
  await fs.rm(paths_1.CZON_DIST_DIR, { recursive: true, force: true });
74
71
  // 扫描源文件
package/dist/paths.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LOCAL_OPENCODE_AGENT_DIR = exports.GLOBAL_OPENCODE_AGENT_DIR = exports.CZON_DIST_CUSTOM_STYLE_PATH = exports.CZON_CUSTOM_STYLE_PATH = exports.CZON_META_PATH = exports.CZON_SRC_DIR = exports.CZON_DIST_RAW_CONTENT_DIR = exports.CZON_DIST_DIR = exports.CZON_DIR = exports.INPUT_DIR = void 0;
4
- const os_1 = require("os");
3
+ exports.CZON_DIST_CUSTOM_STYLE_PATH = exports.CZON_CUSTOM_STYLE_PATH = exports.CZON_META_PATH = exports.CZON_SRC_DIR = exports.CZON_DIST_RAW_CONTENT_DIR = exports.CZON_DIST_DIR = exports.CZON_DIR = exports.INPUT_DIR = void 0;
5
4
  const path_1 = require("path");
6
5
  exports.INPUT_DIR = process.cwd();
7
6
  exports.CZON_DIR = (0, path_1.join)(process.cwd(), '.czon');
@@ -11,9 +10,4 @@ exports.CZON_SRC_DIR = (0, path_1.join)(exports.CZON_DIR, 'src');
11
10
  exports.CZON_META_PATH = (0, path_1.join)(exports.CZON_DIR, 'meta.json');
12
11
  exports.CZON_CUSTOM_STYLE_PATH = (0, path_1.join)(exports.CZON_DIR, 'style.css');
13
12
  exports.CZON_DIST_CUSTOM_STYLE_PATH = (0, path_1.join)(exports.CZON_DIST_DIR, 'style.css');
14
- /**
15
- * ~/.config/opencode/agents/
16
- */
17
- exports.GLOBAL_OPENCODE_AGENT_DIR = (0, path_1.join)((0, os_1.homedir)(), '.config', 'opencode', 'agents');
18
- exports.LOCAL_OPENCODE_AGENT_DIR = (0, path_1.join)(__dirname, '..', 'agents');
19
13
  //# sourceMappingURL=paths.js.map
@@ -19,48 +19,56 @@ const SUMMARY_STYLES = [
19
19
  name: '客观中立',
20
20
  title: 'AI 总结: 客观中立风格',
21
21
  slug: 'aigc-summary-objective',
22
+ category: 'AI Summary',
22
23
  },
23
24
  {
24
25
  skill: 'summary-critical',
25
26
  name: '客观批判',
26
27
  title: 'AI 总结: 客观批判风格',
27
28
  slug: 'aigc-summary-critical',
29
+ category: 'AI Summary',
28
30
  },
29
31
  {
30
32
  skill: 'summary-positive',
31
33
  name: '赞扬鼓励',
32
34
  title: 'AI 总结: 赞扬鼓励风格',
33
35
  slug: 'aigc-summary-positive',
36
+ category: 'AI Summary',
34
37
  },
35
38
  {
36
39
  skill: 'summary-popular',
37
40
  name: '科普介绍',
38
41
  title: 'AI 总结: 科普介绍风格',
39
42
  slug: 'aigc-summary-popular',
43
+ category: 'AI Summary',
40
44
  },
41
45
  {
42
46
  skill: 'summary-artistic',
43
47
  name: '文艺感性',
44
48
  title: 'AI 总结: 文艺感性风格',
45
49
  slug: 'aigc-summary-artistic',
50
+ category: 'AI Summary',
46
51
  },
47
52
  {
48
53
  skill: 'summary-philosophical',
49
54
  name: '哲学思辨',
50
55
  title: 'AI 总结: 哲学思辨风格',
51
56
  slug: 'aigc-summary-philosophical',
57
+ category: 'AI Summary',
52
58
  },
53
59
  {
54
60
  skill: 'summary-psychological',
55
61
  name: '心理分析',
56
62
  title: 'AI 总结: 心理分析风格',
57
63
  slug: 'aigc-summary-psychological',
64
+ category: 'AI Summary',
58
65
  },
59
66
  {
60
67
  skill: 'summary-historical',
61
68
  name: '历史时间跨度',
62
69
  title: 'AI 总结: 历史时间跨度风格',
63
70
  slug: 'aigc-summary-historical',
71
+ category: 'AI Summary',
64
72
  },
65
73
  ];
66
74
  /**
@@ -184,6 +192,7 @@ const processSummary = async (model) => {
184
192
  title: style.title,
185
193
  slug: style.slug,
186
194
  };
195
+ fileMeta.category = style.category;
187
196
  console.info(`✅ 「${style.name}」风格报告生成成功\n`);
188
197
  }
189
198
  else {
@@ -15,6 +15,7 @@ const TODO_CONFIG = {
15
15
  promptFile: 'todo-summary',
16
16
  title: 'AI 总结:待办事项',
17
17
  slug: 'aigc-todo-list',
18
+ category: 'AI Summary',
18
19
  outputRelative: '.czon/AIGC/TODO/todo-summary.md',
19
20
  };
20
21
  /**
@@ -87,6 +88,7 @@ ${promptContent}
87
88
  title: TODO_CONFIG.title,
88
89
  slug: TODO_CONFIG.slug,
89
90
  };
91
+ fileMeta.category = TODO_CONFIG.category;
90
92
  // 保存 MetaData
91
93
  await (0, metadata_1.saveMetaData)();
92
94
  return;
@@ -117,6 +119,7 @@ ${promptContent}
117
119
  title: TODO_CONFIG.title,
118
120
  slug: TODO_CONFIG.slug,
119
121
  };
122
+ fileMeta.category = TODO_CONFIG.category;
120
123
  await (0, metadata_1.saveMetaData)();
121
124
  return;
122
125
  }
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installAgentsToGlobal = exports.runOpenCode = void 0;
4
- const promises_1 = require("fs/promises");
5
- const path_1 = require("path");
6
- const paths_1 = require("../paths");
7
- const writeFile_1 = require("../utils/writeFile");
3
+ exports.runOpenCode = void 0;
8
4
  // ---------------------------------------------------------------------------
9
5
  // Constants
10
6
  // ---------------------------------------------------------------------------
@@ -164,16 +160,4 @@ const runOpenCode = async (prompt, options) => {
164
160
  return handle;
165
161
  };
166
162
  exports.runOpenCode = runOpenCode;
167
- const installAgentsToGlobal = async () => {
168
- const installedAgents = await (0, promises_1.readdir)(paths_1.LOCAL_OPENCODE_AGENT_DIR)
169
- .then(files => files.filter(f => f.startsWith('czon-')))
170
- .catch(() => []);
171
- // 3. Copy local agents from .opencode/agent to global directory
172
- for (const agentFile of installedAgents) {
173
- console.log(`📁 Installing OpenCode agent: ${agentFile} to global directory...`);
174
- await (0, writeFile_1.writeFile)((0, path_1.join)(paths_1.GLOBAL_OPENCODE_AGENT_DIR, agentFile), await (0, promises_1.readFile)((0, path_1.join)(paths_1.LOCAL_OPENCODE_AGENT_DIR, agentFile)));
175
- }
176
- console.log(`✅ Installed ${installedAgents.length} OpenCode agents to global directory.`);
177
- };
178
- exports.installAgentsToGlobal = installAgentsToGlobal;
179
163
  //# sourceMappingURL=opencode.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "czon",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "CZON - AI enhanced Markdown content engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -76,6 +76,23 @@
76
76
  | 原文引用 | 相关原文片段(1-2 句话) |
77
77
  | 推断日期 | 该 TODO 提出的日期(从文章内容推断) |
78
78
 
79
+ #### 状态相关的额外提取要素
80
+
81
+ 对于判断为「🔄 进行中」的 TODO,还需额外记录:
82
+
83
+ | 字段 | 说明 |
84
+ | ---------- | ------------------------------------------ |
85
+ | 已完成部分 | 已经取得的进展(具体做了什么) |
86
+ | 剩余部分 | 尚未完成的内容(还需要做什么) |
87
+ | 进展证据 | 体现进展的后续文章原文片段(注明来源文章) |
88
+
89
+ 对于判断为「✅ 已完成」的 TODO,还需额外记录:
90
+
91
+ | 字段 | 说明 |
92
+ | -------- | ------------------------------------------ |
93
+ | 完成依据 | 为什么判断已完成(引用具体证据及来源文章) |
94
+ | 成果 | 完成后取得了什么具体成果或产出 |
95
+
79
96
  ---
80
97
 
81
98
  ## 状态判断规则
@@ -159,7 +176,10 @@
159
176
 
160
177
  ### TODO 列表
161
178
 
162
- 按状态分组展示,每组内部按优先级排序(高 → 中 → 低):
179
+ 按状态分组展示,每组内部按优先级排序(高 → 中 → 低)。
180
+ 不同状态的 TODO 使用不同的展示格式:
181
+
182
+ #### ⬜ 待开始 格式
163
183
 
164
184
  ```markdown
165
185
  ## ⬜ 待开始
@@ -172,18 +192,44 @@
172
192
  > 引用相关原文片段
173
193
 
174
194
  ---
195
+ ```
175
196
 
176
- ### 🟡 [TODO 简短描述]
177
-
178
- ...
197
+ #### 🔄 进行中 格式
179
198
 
199
+ ```markdown
180
200
  ## 🔄 进行中
181
201
 
182
- ...
202
+ ### 🔴 [TODO 简短描述]
203
+
204
+ - **来源**:[文章标题](../../../path/to/file.md)
205
+ - **日期**:YYYY-MM-DD
206
+ - **原文**:
207
+ > 引用相关原文片段
208
+ - **进度**:
209
+ - **已完成**:描述已经取得的进展,具体做了什么
210
+ - **剩余**:描述尚未完成的内容,还需要做什么
211
+ - **证据**:[后续文章标题](../../../path/to/later-file.md)
212
+ > 引用体现进展的后续文章原文片段
213
+
214
+ ---
215
+ ```
183
216
 
217
+ #### ✅ 已完成 格式
218
+
219
+ ```markdown
184
220
  ## ✅ 已完成
185
221
 
186
- ...
222
+ ### 🔴 [TODO 简短描述]
223
+
224
+ - **来源**:[文章标题](../../../path/to/file.md)
225
+ - **日期**:YYYY-MM-DD
226
+ - **原文**:
227
+ > 引用相关原文片段
228
+ - **完成依据**:说明为什么判断已完成,引用具体证据
229
+ - 证据来源:[相关文章标题](../../../path/to/evidence-file.md)
230
+ - **成果**:描述完成后取得了什么具体成果或产出
231
+
232
+ ---
187
233
  ```
188
234
 
189
235
  ---
@@ -1,90 +0,0 @@
1
- ---
2
- description: >-
3
- Use this agent when you need to translate markdown files from one language to
4
- another while preserving the markdown formatting structure. Examples:
5
-
6
-
7
- - <example>
8
- Context: User wants to translate documentation files from English to Chinese.
9
- user: "Translate the README.md file to Japanese, preserving all headers, links, and code blocks"
10
- assistant: "I'll use the czon-markdown-translator agent to handle this translation task"
11
- <commentary>
12
- Since the user explicitly asked to translate a markdown file (README.md) while preserving formatting, the czon-markdown-translator agent is the appropriate choice.
13
- </commentary>
14
- </example>
15
- - <example>
16
- Context: User needs to localize technical documentation for a new market.
17
- user: "Please translate all .md files in the docs/ directory to German"
18
- assistant: "The czon-markdown-translator agent can read and translate the markdown files while maintaining proper structure"
19
- <commentary>
20
- When the user mentions translating multiple markdown files, this agent should be used to ensure consistent formatting preservation.
21
- </commentary>
22
- </example>
23
- - <example>
24
- Context: User wants to translate a markdown blog post.
25
- user: "Convert this markdown article to Spanish, keeping all formatting intact"
26
- assistant: "Let me invoke the czon-markdown-translator agent to handle the translation while preserving markdown syntax"
27
- <commentary>
28
- When the user emphasizes preserving formatting during translation, this specialized agent is ideal.
29
- </commentary>
30
- </example>
31
- mode: all
32
- ---
33
-
34
- You are a specialized Markdown Translator with expertise in technical documentation localization. Your primary responsibility is to accurately translate markdown files while meticulously preserving their structural integrity.
35
-
36
- ## Core Responsibilities
37
-
38
- 1. **Read and Parse Files**: Load markdown files from specified paths, understanding their full structure including frontmatter, headers, lists, code blocks, tables, links, images, and inline formatting.
39
-
40
- 2. **Translate Content**: Translate the textual content to the target language while:
41
- - Preserving all markdown syntax (headings with #, bold \*_, italic _, code blocks with ```, etc.)
42
- - Maintaining links, image references, and their alt text
43
- - Keeping tables intact and translating only cell content
44
- - Preserving code examples, file paths, and command snippets untranslated
45
- - Handling frontmatter metadata appropriately (translate values only, keep keys)
46
-
47
- 3. **Handle Special Content**:
48
- - **Code blocks**: Never translate content inside triple-backtick blocks
49
- - **Inline code**: Keep backtick-enclosed text untranslated
50
- - **Links**: Translate link text but preserve URLs
51
- - **Images**: Translate alt text but preserve image paths
52
- - **URLs and paths**: Keep untranslated (e.g., `/api/users`, `https://example.com`)
53
- - **Frontmatter**: Translate string values, preserve boolean/numeric values and keys
54
-
55
- 4. **Output Management**: Write translated content to the specified output file, maintaining UTF-8 encoding and original line endings where possible.
56
-
57
- ## Translation Quality Standards
58
-
59
- - Maintain consistent terminology throughout the document
60
- - Preserve the original tone (technical, casual, formal, etc.)
61
- - Ensure translations are natural and idiomatic in the target language
62
- - Keep headings and subheadings properly nested and meaningful
63
- - For list items, ensure parallel structure is maintained
64
-
65
- ## Workflow
66
-
67
- 1. Confirm the source file path and target language with the user if unclear
68
- 2. Read and parse the complete markdown file
69
- 3. Create a translation strategy (identify sections, special content types)
70
- 4. Translate section by section, marking translated content
71
- 5. Verify markdown syntax integrity after translation
72
- 6. Write to output file or return translated content as requested
73
-
74
- ## Error Handling
75
-
76
- - If a file doesn't exist or cannot be read, report the error clearly
77
- - If the target language is ambiguous, ask for clarification
78
- - If encoding issues are detected, attempt to resolve or report
79
- - If markdown parsing fails, identify the problematic section
80
-
81
- ## Output Format
82
-
83
- When completing the task:
84
-
85
- - Confirm the file was translated successfully
86
- - Report the character/word count if relevant
87
- - Note any sections that were preserved (code blocks, etc.)
88
- - Suggest any follow-up actions if needed (proofreading, formatting review)
89
-
90
- Remember: Your goal is to produce a translated markdown file that looks like it was originally written in the target language, with all formatting intact and functional.