@wwkit/harness 1.0.45 → 1.0.47
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/package.json +1 -1
- package/skills/pea/SKILL.md +20 -5
- package/skills/pea/references/tpl-prd/epic.md +17 -2
- package/skills/pea/references/tpl-prd/us.md +4 -4
- package/skills/peago/SKILL.md +121 -0
- package/skills/peago/references/cleancode/languages/py-ut.md +88 -0
- package/skills/peago/references/cleancode/languages/py.md +222 -0
- package/skills/{blame-cleancode/references → peago/references/cleancode}/report_template.md +45 -12
- package/skills/peago/references/cleancode/rules-ut.md +133 -0
- package/skills/peago/references/cleancode/rules.md +477 -0
- package/skills/peago/references/cleancode/spec.md +204 -0
- package/skills/peago/references/lint/spec.md +160 -0
- package/skills/peago/references/res2kb/spec.md +113 -0
- package/skills/peago/references/spec-format.md +123 -0
- package/skills/peago/references/test/languages/js.md +74 -0
- package/skills/peago/references/test/languages/py.md +68 -0
- package/skills/peago/references/test/spec.md +201 -0
- package/skills/peago/references/translate/baseline.md +26 -0
- package/skills/peago/references/translate/scripts/check-structure.js +118 -0
- package/skills/{translate → peago/references/translate}/scripts/chunk-text.js +7 -2
- package/skills/peago/references/translate/scripts/extract-vision.js +267 -0
- package/skills/peago/references/translate/scripts/merge-pages.js +202 -0
- package/skills/{translate → peago/references/translate}/scripts/verify-chunk.js +15 -0
- package/skills/peago/references/translate/spec.md +140 -0
- package/skills/shared/references/template/pea/spec-agile.md +15 -6
- package/skills/shared/references/template/pea/spec-common.md +12 -2
- package/skills/shared/scripts/format.md +1 -1
- package/skills/better-class/SKILL.md +0 -48
- package/skills/better-class/references/planning_spec.md +0 -91
- package/skills/better-class/references/report-template.md +0 -65
- package/skills/better-class/references/sprint_for_eo.md +0 -83
- package/skills/better-class/references/sprint_for_report.md +0 -22
- package/skills/better-class/references/subagent-prompt.md +0 -47
- package/skills/better-class/references/workflow.md +0 -75
- package/skills/better-class/scripts/check-syntax.js +0 -112
- package/skills/better-class/scripts/check_input_vars.js +0 -52
- package/skills/better-class/scripts/init.js +0 -88
- package/skills/better-class/scripts/resolve_run_vars.js +0 -96
- package/skills/better-class/scripts/run-tests.js +0 -108
- package/skills/better-cleancode/SKILL.md +0 -157
- package/skills/better-ut/SKILL.md +0 -236
- package/skills/blame-class/SKILL.md +0 -78
- package/skills/blame-class/references/report_template.md +0 -98
- package/skills/blame-class/references/rules.md +0 -40
- package/skills/blame-cleancode/SKILL.md +0 -105
- package/skills/blame-cleancode/plan.md +0 -1408
- package/skills/blame-cleancode/references/rules.md +0 -630
- package/skills/blame-ut/SKILL.md +0 -113
- package/skills/blame-ut/references/report_template.md +0 -102
- package/skills/blame-ut/references/rules.md +0 -197
- package/skills/convert-files/SKILL.md +0 -37
- package/skills/convert-files/package.json +0 -11
- package/skills/convert-files/references/sprint_for_conversion.md +0 -17
- package/skills/convert-files/scripts/check_input_vars.js +0 -54
- package/skills/convert-files/scripts/convert.js +0 -331
- package/skills/convert-files/scripts/init.js +0 -75
- package/skills/convert-files/scripts/resolve_run_vars.js +0 -124
- package/skills/create-ppt/SKILL.md +0 -47
- package/skills/create-ppt/package.json +0 -9
- package/skills/create-ppt/references/ppt-styles.md +0 -287
- package/skills/create-ppt/references/sprint_for_ppt_generation.md +0 -81
- package/skills/create-ppt/references/sprint_for_source_discovery.md +0 -18
- package/skills/create-ppt/scripts/check_input_vars.js +0 -57
- package/skills/create-ppt/scripts/find-source-files.js +0 -98
- package/skills/create-ppt/scripts/init.js +0 -96
- package/skills/create-ppt/scripts/md-to-pptx.js +0 -579
- package/skills/create-ppt/scripts/resolve_run_vars.js +0 -91
- package/skills/extract/SKILL.md +0 -251
- package/skills/extract/references/detail_schema.json5 +0 -49
- package/skills/extract/references/detail_workflow.md +0 -55
- package/skills/extract/references/list_rule_gen.md +0 -109
- package/skills/extract/references/list_schema.json5 +0 -34
- package/skills/extract/references/list_workflow.md +0 -135
- package/skills/extract/references/navi_schema.json5 +0 -23
- package/skills/extract/references/navi_workflow.md +0 -45
- package/skills/extract/references/planning_template.md +0 -206
- package/skills/extract/references/text_schema.json5 +0 -22
- package/skills/extract/references/text_workflow.md +0 -41
- package/skills/extract/scripts/build_xpath.js +0 -31
- package/skills/extract/scripts/clean_html.js +0 -91
- package/skills/extract/scripts/extract_detail.js +0 -72
- package/skills/extract/scripts/extract_regex.js +0 -82
- package/skills/extract/scripts/extract_sample.js +0 -49
- package/skills/extract/scripts/to_text.js +0 -21
- package/skills/extract/scripts/validate_schema.js +0 -40
- package/skills/jstest/SKILL.md +0 -561
- package/skills/jstest/references/case-create.md +0 -327
- package/skills/jstest/references/case-fix.md +0 -273
- package/skills/jstest/references/config.md +0 -148
- package/skills/jstest/references/coverage-analyze.md +0 -247
- package/skills/jstest/references/env-ensure.md +0 -210
- package/skills/jstest/references/execute.md +0 -168
- package/skills/jstest/references/sample.md +0 -166
- package/skills/jstest/references/scoring-rules.md +0 -75
- package/skills/jstest/references/suitability-check.md +0 -232
- package/skills/jstest/references/test-standards.md +0 -288
- package/skills/lint/SKILL.md +0 -440
- package/skills/lint/references/ai-fix.md +0 -138
- package/skills/lint/references/config-setup.md +0 -103
- package/skills/lint/references/config.md +0 -65
- package/skills/lint/references/env-ensure.md +0 -89
- package/skills/lint/references/language-detect.md +0 -76
- package/skills/lint/references/rules-analyze.md +0 -126
- package/skills/lint/references/suitability-check.md +0 -82
- package/skills/lint/references/tool-fix.md +0 -91
- package/skills/pytest/SKILL.md +0 -556
- package/skills/pytest/references/case-create.md +0 -325
- package/skills/pytest/references/case-fix.md +0 -272
- package/skills/pytest/references/config.md +0 -145
- package/skills/pytest/references/coverage-analyze.md +0 -224
- package/skills/pytest/references/env-ensure.md +0 -196
- package/skills/pytest/references/execute.md +0 -153
- package/skills/pytest/references/sample.md +0 -160
- package/skills/pytest/references/scoring-rules.md +0 -57
- package/skills/pytest/references/suitability-check.md +0 -221
- package/skills/pytest/references/test-standards.md +0 -244
- package/skills/revise/SKILL.md +0 -66
- package/skills/revise/references/article.md +0 -37
- package/skills/revise/references/article.schema.json5 +0 -40
- package/skills/revise/references/gallery.md +0 -35
- package/skills/revise/references/gallery.schema.json5 +0 -40
- package/skills/revise/references/question.md +0 -33
- package/skills/revise/references/question.schema.json5 +0 -31
- package/skills/revise/references/sprint_for_revise.md +0 -46
- package/skills/revise/references/status.md +0 -32
- package/skills/revise/references/status.schema.json5 +0 -27
- package/skills/revise/scripts/check_input_vars.js +0 -127
- package/skills/revise/scripts/init.js +0 -84
- package/skills/revise/scripts/resolve_run_vars.js +0 -71
- package/skills/revise/scripts/validate-schema.js +0 -94
- package/skills/translate/SKILL.md +0 -398
- package/skills/translate/app.json5 +0 -70
- package/skills/translate/package.json +0 -11
- package/skills/translate/references/failure-diagnosis.md +0 -43
- package/skills/translate/references/format-prompt.md +0 -62
- package/skills/translate/references/format-rules.md +0 -39
- package/skills/translate/references/global-review-rules.md +0 -23
- package/skills/translate/references/glossary-prompt.md +0 -86
- package/skills/translate/references/glossary-rules.md +0 -44
- package/skills/translate/references/prepare-prompt.md +0 -110
- package/skills/translate/references/prepare-rules.md +0 -20
- package/skills/translate/references/resume-detection.md +0 -51
- package/skills/translate/references/rulings.md +0 -15
- package/skills/translate/references/translation-prompt.md +0 -73
- package/skills/translate/references/translation-rules.md +0 -51
- package/skills/translate/scripts/check-boundaries.js +0 -169
- package/skills/translate/scripts/extract-pdf.js +0 -94
- package/skills/translate/scripts/generate-review.js +0 -179
- package/skills/translate/scripts/init-progress.js +0 -144
- package/skills/translate/todos.md +0 -38
- package/skills/translate-file/SKILL.md +0 -45
- package/skills/translate-file/package.json +0 -10
- package/skills/translate-file/references/sprint_for_preprocess.md +0 -14
- package/skills/translate-file/references/sprint_for_teardown.md +0 -15
- package/skills/translate-file/references/sprint_for_translate.md +0 -74
- package/skills/translate-file/references/translation_prompt.md +0 -43
- package/skills/translate-file/scripts/check_input_vars.js +0 -53
- package/skills/translate-file/scripts/chunk_text.js +0 -167
- package/skills/translate-file/scripts/clean_text.js +0 -121
- package/skills/translate-file/scripts/extract.js +0 -98
- package/skills/translate-file/scripts/generate_review.js +0 -155
- package/skills/translate-file/scripts/init.js +0 -86
- package/skills/translate-file/scripts/merge_results.js +0 -112
- package/skills/translate-file/scripts/resolve_run_vars.js +0 -123
- package/skills/translate-file/scripts/verify_chunk.js +0 -144
- package/skills/translate-format/SKILL.md +0 -45
- package/skills/translate-format/references/format-prompt.md +0 -80
- package/skills/translate-format/references/format-rules.md +0 -39
- package/skills/translate-format/references/sprint_for_format.md +0 -208
- package/skills/translate-format/scripts/check-paragraphs.js +0 -81
- package/skills/translate-format/scripts/check_input_vars.js +0 -51
- package/skills/translate-format/scripts/chunk-bilingual.js +0 -135
- package/skills/translate-format/scripts/count-words.js +0 -38
- package/skills/translate-format/scripts/diagnose-failure.js +0 -54
- package/skills/translate-format/scripts/init.js +0 -71
- package/skills/translate-format/scripts/md-to-docx.js +0 -398
- package/skills/translate-format/scripts/merge-format.js +0 -118
- package/skills/translate-format/scripts/resolve_run_vars.js +0 -78
- /package/skills/{lint/references → peago/references/lint}/languages/js.md +0 -0
- /package/skills/{lint/references → peago/references/lint}/languages/py.md +0 -0
- /package/skills/{lint/references → peago/references/lint/scripts}/detect-language.js +0 -0
- /package/skills/{jstest/references/src/jstest-sample → peago/references/test/sample-src/js}/Calculator.js +0 -0
- /package/skills/{jstest/references/src/jstest-sample → peago/references/test/sample-src/js}/ConfigManager.js +0 -0
- /package/skills/{jstest/references/src/jstest-sample → peago/references/test/sample-src/js}/FileProcessor.js +0 -0
- /package/skills/{jstest/references/src/jstest-sample → peago/references/test/sample-src/js}/OrderService.js +0 -0
- /package/skills/{jstest/references/src/jstest-sample → peago/references/test/sample-src/js}/TokenGenerator.js +0 -0
- /package/skills/{jstest/references/src/jstest-sample → peago/references/test/sample-src/js}/UserService.js +0 -0
- /package/skills/{jstest/references/src/jstest-sample → peago/references/test/sample-src/js}/index.js +0 -0
- /package/skills/{pytest/references/src/pytest-sample → peago/references/test/sample-src/py}/Calculator.py +0 -0
- /package/skills/{pytest/references/src/pytest-sample → peago/references/test/sample-src/py}/ConfigManager.py +0 -0
- /package/skills/{pytest/references/src/pytest-sample → peago/references/test/sample-src/py}/FileProcessor.py +0 -0
- /package/skills/{pytest/references/src/pytest-sample → peago/references/test/sample-src/py}/OrderService.py +0 -0
- /package/skills/{pytest/references/src/pytest-sample → peago/references/test/sample-src/py}/TokenGenerator.py +0 -0
- /package/skills/{pytest/references/src/pytest-sample → peago/references/test/sample-src/py}/UserService.py +0 -0
- /package/skills/{pytest/references/src/pytest-sample → peago/references/test/sample-src/py}/__init__.py +0 -0
- /package/skills/{translate → peago/references/translate}/scripts/check-paragraphs.js +0 -0
- /package/skills/{translate → peago/references/translate}/scripts/chunk-bilingual.js +0 -0
- /package/skills/{translate → peago/references/translate}/scripts/clean-text.js +0 -0
- /package/skills/{translate → peago/references/translate}/scripts/count-terms.js +0 -0
- /package/skills/{translate → peago/references/translate}/scripts/md-to-docx.js +0 -0
- /package/skills/{translate → peago/references/translate}/scripts/merge-format.js +0 -0
- /package/skills/{translate → peago/references/translate}/scripts/merge-result.js +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* extract-pdf.js — PDF 文本提取脚本(ESM,纯 JS,无系统依赖)
|
|
4
|
-
*
|
|
5
|
-
* 依赖:pdf-parse(npm 包,随 skill 安装)
|
|
6
|
-
* 输入:argv[2] = PDF 文件路径,argv[3] = 输出文本文件路径
|
|
7
|
-
* 或 argv[2] = '--check'(仅检查 pdf-parse 可用性)
|
|
8
|
-
* 输出:纯文本(\f 分页符分隔页面),stdout 打印行数和页数
|
|
9
|
-
*
|
|
10
|
-
* 用法:
|
|
11
|
-
* node extract-pdf.js "<pdf路径>" "<output.txt>"
|
|
12
|
-
* node extract-pdf.js --check
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
16
|
-
import { dirname } from 'path';
|
|
17
|
-
import { createRequire } from 'module';
|
|
18
|
-
|
|
19
|
-
const require = createRequire(import.meta.url);
|
|
20
|
-
const args = process.argv.slice(2);
|
|
21
|
-
|
|
22
|
-
// --check 模式
|
|
23
|
-
if (args[0] === '--check') {
|
|
24
|
-
try {
|
|
25
|
-
const { PDFParse } = require('pdf-parse');
|
|
26
|
-
if (typeof PDFParse === 'function') {
|
|
27
|
-
console.log('pdf-parse: OK');
|
|
28
|
-
process.exit(0);
|
|
29
|
-
}
|
|
30
|
-
} catch {
|
|
31
|
-
// fall through to error
|
|
32
|
-
}
|
|
33
|
-
console.error('ERROR: pdf-parse not available. Run: npm install');
|
|
34
|
-
process.exit(3);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (args.length < 2) {
|
|
38
|
-
console.error('usage: extract-pdf.js <pdf-file> <output-txt>');
|
|
39
|
-
console.error(' extract-pdf.js --check');
|
|
40
|
-
process.exit(2);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const pdfPath = args[0];
|
|
44
|
-
const outPath = args[1];
|
|
45
|
-
|
|
46
|
-
// 检查 PDF 文件存在
|
|
47
|
-
if (!existsSync(pdfPath)) {
|
|
48
|
-
console.error(`ERROR: PDF file not found: ${pdfPath}`);
|
|
49
|
-
process.exit(2);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// 检查输出目录
|
|
53
|
-
const outDir = dirname(outPath);
|
|
54
|
-
if (!existsSync(outDir)) {
|
|
55
|
-
mkdirSync(outDir, { recursive: true });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// 加载 pdf-parse
|
|
59
|
-
let PDFParse;
|
|
60
|
-
try {
|
|
61
|
-
const mod = require('pdf-parse');
|
|
62
|
-
PDFParse = mod.PDFParse;
|
|
63
|
-
} catch (e) {
|
|
64
|
-
console.error('ERROR: pdf-parse not available. Run: npm install');
|
|
65
|
-
console.error(e.message);
|
|
66
|
-
process.exit(3);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 提取文本
|
|
70
|
-
try {
|
|
71
|
-
const buf = readFileSync(pdfPath);
|
|
72
|
-
const parser = new PDFParse({ data: buf });
|
|
73
|
-
const result = await parser.getText();
|
|
74
|
-
|
|
75
|
-
if (!result || !result.pages) {
|
|
76
|
-
console.error('ERROR: pdf-parse returned no pages');
|
|
77
|
-
process.exit(4);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// 将每页文本用 \f 连接(与 pdftotext 输出格式一致,chunk-text.js 依赖此格式)
|
|
81
|
-
const pages = result.pages.map(p => p.text || '');
|
|
82
|
-
const content = pages.join('\f');
|
|
83
|
-
|
|
84
|
-
writeFileSync(outPath, content, 'utf-8');
|
|
85
|
-
|
|
86
|
-
const lines = content.split('\n').length;
|
|
87
|
-
const formFeeds = (content.match(/\f/g) || []).length;
|
|
88
|
-
const pageCount = formFeeds + 1;
|
|
89
|
-
console.log(`extracted: ${lines} lines, ~${pageCount} pages -> ${outPath}`);
|
|
90
|
-
} catch (e) {
|
|
91
|
-
console.error(`ERROR: pdf-parse failed on: ${pdfPath}`);
|
|
92
|
-
console.error(e.message);
|
|
93
|
-
process.exit(4);
|
|
94
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* generate-review.js — 从 progress.md 生成翻译自检日志(ESM)
|
|
4
|
-
*
|
|
5
|
-
* 用法:node generate-review.js <work-dir>
|
|
6
|
-
*
|
|
7
|
-
* 功能(纯脚本,不需要 LLM):
|
|
8
|
-
* 1. 读取 progress.md,解析每 chunk 的状态和重试次数
|
|
9
|
-
* 2. 读取 bilingual.md,统计行数和 [CONT] 标记数
|
|
10
|
-
* 3. 生成 review.md(逐块自检结果 + 统计 + 轻量结构校验 + 结论)
|
|
11
|
-
* 4. 覆写 <work-dir>/review.md(每次调用反映当前状态 = 增量更新)
|
|
12
|
-
*
|
|
13
|
-
* 自检日志目的:提供人工审计能力,让人确信每个 chunk 都经过了自检。
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
17
|
-
import { join, basename } from 'path';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 从 progress.md 生成自检日志。
|
|
21
|
-
* @param {string} workDir - 文件工作目录(含 progress.md 和 bilingual.md)
|
|
22
|
-
* @returns {{ total: number, done: number, failed: number, firstPass: number, retryPass: number, conclusion: string }}
|
|
23
|
-
* @throws {Error} progress.md 不存在或为空
|
|
24
|
-
*/
|
|
25
|
-
export function generateReview(workDir) {
|
|
26
|
-
if (!workDir) {
|
|
27
|
-
throw new Error('Usage: node generate-review.js <work-dir>');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const progressPath = join(workDir, 'progress.md');
|
|
31
|
-
if (!existsSync(progressPath)) {
|
|
32
|
-
throw new Error(`progress.md not found: ${progressPath}`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const progress = readFileSync(progressPath, 'utf-8');
|
|
36
|
-
|
|
37
|
-
// --- Parse progress.md ---
|
|
38
|
-
|
|
39
|
-
const chunks = [];
|
|
40
|
-
for (const line of progress.split('\n')) {
|
|
41
|
-
// New format: | pNNN | status | retry |
|
|
42
|
-
const newFmt = line.match(/^\| (p\d+) \| (\w+) \| (\d+) \|$/);
|
|
43
|
-
if (newFmt) {
|
|
44
|
-
chunks.push({ id: newFmt[1], status: newFmt[2], retry: parseInt(newFmt[3]) });
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
// Old format: | pNNN | status |
|
|
48
|
-
const oldFmt = line.match(/^\| (p\d+) \| (\w+) \|$/);
|
|
49
|
-
if (oldFmt) {
|
|
50
|
-
chunks.push({ id: oldFmt[1], status: oldFmt[2], retry: 0 });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (chunks.length === 0) {
|
|
55
|
-
throw new Error(`No chunk rows found in progress.md: ${progressPath}`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// --- Per-chunk rows ---
|
|
59
|
-
|
|
60
|
-
const rows = chunks.map(c => {
|
|
61
|
-
let note;
|
|
62
|
-
if (c.status === 'done' && c.retry === 0) {
|
|
63
|
-
note = '一次通过';
|
|
64
|
-
} else if (c.status === 'done' && c.retry > 0) {
|
|
65
|
-
note = `重试${c.retry}次后通过`;
|
|
66
|
-
} else if (c.status === 'failed' && c.retry >= 3) {
|
|
67
|
-
note = '3次失败,主Agent补处理';
|
|
68
|
-
} else if (c.status === 'failed') {
|
|
69
|
-
note = `重试${c.retry}次,待处理`;
|
|
70
|
-
} else {
|
|
71
|
-
note = '待翻译';
|
|
72
|
-
}
|
|
73
|
-
return `| ${c.id} | ${c.status} | ${c.retry} | ${note} |`;
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// --- Statistics ---
|
|
77
|
-
|
|
78
|
-
const total = chunks.length;
|
|
79
|
-
const done = chunks.filter(c => c.status === 'done');
|
|
80
|
-
const failed = chunks.filter(c => c.status === 'failed');
|
|
81
|
-
const pending = chunks.filter(c => c.status === 'pending');
|
|
82
|
-
const firstPass = done.filter(c => c.retry === 0);
|
|
83
|
-
const retryPass = done.filter(c => c.retry > 0);
|
|
84
|
-
|
|
85
|
-
const pct = (n) => total > 0 ? (n / total * 100).toFixed(1) : '0.0';
|
|
86
|
-
|
|
87
|
-
// --- Structure checks (lightweight, from bilingual.md) ---
|
|
88
|
-
|
|
89
|
-
const bilingualPath = join(workDir, 'bilingual.md');
|
|
90
|
-
let bilingualLines = 0;
|
|
91
|
-
let contCount = 0;
|
|
92
|
-
let bilingualExists = existsSync(bilingualPath);
|
|
93
|
-
|
|
94
|
-
if (bilingualExists) {
|
|
95
|
-
const bilingual = readFileSync(bilingualPath, 'utf-8');
|
|
96
|
-
bilingualLines = bilingual.split('\n').length;
|
|
97
|
-
contCount = (bilingual.match(/\[CONT\]/g) || []).length;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const completionRate = pct(done.length);
|
|
101
|
-
const contPaired = contCount % 2 === 0;
|
|
102
|
-
|
|
103
|
-
// --- Conclusion ---
|
|
104
|
-
|
|
105
|
-
let conclusion;
|
|
106
|
-
if (failed.length > 0 && failed.some(c => c.retry >= 3)) {
|
|
107
|
-
conclusion = '合格(含补处理)';
|
|
108
|
-
} else if (failed.length > 0) {
|
|
109
|
-
conclusion = '需修复';
|
|
110
|
-
} else if (pending.length > 0) {
|
|
111
|
-
conclusion = '进行中';
|
|
112
|
-
} else if (retryPass.length > 0) {
|
|
113
|
-
conclusion = '合格(含重试)';
|
|
114
|
-
} else {
|
|
115
|
-
conclusion = '合格';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// --- Generate markdown ---
|
|
119
|
-
|
|
120
|
-
const fileName = basename(workDir);
|
|
121
|
-
const now = new Date().toISOString().replace('T', ' ').slice(0, 19);
|
|
122
|
-
|
|
123
|
-
const md = `# 翻译自检日志 — ${fileName}
|
|
124
|
-
|
|
125
|
-
> 自动生成,请勿手动编辑。每次 merge-result.js 后更新。
|
|
126
|
-
> 最后更新:${now} UTC
|
|
127
|
-
|
|
128
|
-
## 逐块自检结果
|
|
129
|
-
|
|
130
|
-
| Chunk | 状态 | 重试 | 备注 |
|
|
131
|
-
|---|---|---|---|
|
|
132
|
-
${rows.join('\n')}
|
|
133
|
-
|
|
134
|
-
## 统计
|
|
135
|
-
|
|
136
|
-
- 总块数: ${total}
|
|
137
|
-
- 一次通过: ${firstPass.length} (${pct(firstPass.length)}%)
|
|
138
|
-
- 重试后通过: ${retryPass.length} (${pct(retryPass.length)}%)
|
|
139
|
-
- 最终失败(补处理): ${failed.filter(c => c.retry >= 3).length} (${pct(failed.filter(c => c.retry >= 3).length)}%)
|
|
140
|
-
- 待处理: ${pending.length + failed.filter(c => c.retry < 3).length} (${pct(pending.length + failed.filter(c => c.retry < 3).length)}%)
|
|
141
|
-
|
|
142
|
-
## 结构校验
|
|
143
|
-
|
|
144
|
-
| 校验项 | 结果 | 详情 |
|
|
145
|
-
|---|---|---|
|
|
146
|
-
| chunk 完成率 | ${done.length}/${total} (${completionRate}%) | ${failed.length > 0 ? '有未完成chunk' : pending.length > 0 ? '翻译进行中' : '全部完成'} |
|
|
147
|
-
| bilingual.md | ${bilingualExists ? bilingualLines + ' 行' : '尚未生成'} | ${bilingualExists ? '' : '(无已合并内容)'} |
|
|
148
|
-
| [CONT] 标记 | ${contCount} 个(${contPaired ? '偶数配对' : '奇数,需检查'}) | 保留在双语输出中 |
|
|
149
|
-
|
|
150
|
-
## 结论
|
|
151
|
-
|
|
152
|
-
${conclusion}
|
|
153
|
-
`;
|
|
154
|
-
|
|
155
|
-
writeFileSync(join(workDir, 'review.md'), md);
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
total,
|
|
159
|
-
done: done.length,
|
|
160
|
-
failed: failed.length,
|
|
161
|
-
firstPass: firstPass.length,
|
|
162
|
-
retryPass: retryPass.length,
|
|
163
|
-
conclusion,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// --- CLI entry point ---
|
|
168
|
-
|
|
169
|
-
const isMain = import.meta.url === `file://${process.argv[1]}`;
|
|
170
|
-
if (isMain) {
|
|
171
|
-
const [, , workDir] = process.argv;
|
|
172
|
-
try {
|
|
173
|
-
const result = generateReview(workDir);
|
|
174
|
-
console.log(`${result.done}/${result.total} done, ${result.failed} failed — ${result.conclusion}`);
|
|
175
|
-
} catch (e) {
|
|
176
|
-
console.error(e.message);
|
|
177
|
-
process.exit(1);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* init-progress.js — 翻译进度初始化(ESM,纯 JS,无依赖)
|
|
4
|
-
*
|
|
5
|
-
* 用法:node init-progress.js <translate_dir>
|
|
6
|
-
* <translate_dir> = {{input_dir}}/.tsl 目录
|
|
7
|
-
*
|
|
8
|
-
* 功能:
|
|
9
|
-
* 1. 读取 <translate_dir>/prepare-result.md,解析 Per-File Summary 表(文件名 + chunk_count)
|
|
10
|
-
* 2. 逐文件创建 <translate_dir>/<文件名>/progress.md(身份行 + chunk 状态表)
|
|
11
|
-
* 3. 创建 <translate_dir>/progress-global.md(身份行 + 文件状态表,三态:pending → translated → done)
|
|
12
|
-
*
|
|
13
|
-
* 短路:progress.md 已存在 → 跳过该文件;progress-global.md 已存在 → 跳过
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
17
|
-
import { join, basename } from 'path';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 解析 prepare-result.md,提取文件名和 chunk_count。
|
|
21
|
-
* @param {string} translateDir — .tsl 目录路径
|
|
22
|
-
* @returns {{ filename: string, chunkCount: number }[]} 文件列表
|
|
23
|
-
*/
|
|
24
|
-
export function parsePrepareResult(translateDir) {
|
|
25
|
-
const resultPath = join(translateDir, 'prepare-result.md');
|
|
26
|
-
if (!existsSync(resultPath)) {
|
|
27
|
-
throw new Error(`prepare-result.md not found: ${resultPath}`);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const content = readFileSync(resultPath, 'utf-8');
|
|
31
|
-
|
|
32
|
-
const statusMatch = content.match(/^## status\s*\n\s*(\w+)/m);
|
|
33
|
-
if (!statusMatch) {
|
|
34
|
-
throw new Error('No ## status found in prepare-result.md');
|
|
35
|
-
}
|
|
36
|
-
if (statusMatch[1] !== 'complete') {
|
|
37
|
-
throw new Error(`prepare-result.md status is "${statusMatch[1]}", expected "complete"`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const summaryMatch = content.match(/## Per-File Summary\s*\n([\s\S]*?)(?:\n## |\n$|$)/);
|
|
41
|
-
if (!summaryMatch) {
|
|
42
|
-
throw new Error('No ## Per-File Summary found in prepare-result.md');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const files = [];
|
|
46
|
-
const lines = summaryMatch[1].split('\n');
|
|
47
|
-
for (const line of lines) {
|
|
48
|
-
const row = line.match(/^\|\s*(.+?)\s*\|\s*(\d+)\s*\|$/);
|
|
49
|
-
if (row && row[1] !== '文件' && row[1] !== '---' && !row[1].startsWith('-')) {
|
|
50
|
-
files.push({ filename: row[1].trim(), chunkCount: parseInt(row[2], 10) });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (files.length === 0) {
|
|
55
|
-
throw new Error('No files found in Per-File Summary table');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return files;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 生成 chunk 级 progress.md 内容。
|
|
63
|
-
* @param {string} bookName — 书名(input_dir basename)
|
|
64
|
-
* @param {string} filename — 文件名
|
|
65
|
-
* @param {number} chunkCount — chunk 数量
|
|
66
|
-
* @returns {string} progress.md 内容
|
|
67
|
-
*/
|
|
68
|
-
export function buildProgressContent(bookName, filename, chunkCount) {
|
|
69
|
-
const lines = [
|
|
70
|
-
`# tsl progress — book: ${bookName}, file: ${filename}`,
|
|
71
|
-
'',
|
|
72
|
-
'| Chunk | 状态 | 重试 |',
|
|
73
|
-
'|-------|------|------|',
|
|
74
|
-
];
|
|
75
|
-
for (let i = 0; i < chunkCount; i++) {
|
|
76
|
-
const num = String(i + 1).padStart(3, '0');
|
|
77
|
-
lines.push(`| p${num} | pending | 0 |`);
|
|
78
|
-
}
|
|
79
|
-
return lines.join('\n') + '\n';
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* 生成文件级 progress-global.md 内容。
|
|
84
|
-
* @param {string} bookName — 书名(input_dir basename)
|
|
85
|
-
* @param {{ filename: string, chunkCount: number }[]} files — 文件列表
|
|
86
|
-
* @returns {string} progress-global.md 内容
|
|
87
|
-
*/
|
|
88
|
-
export function buildGlobalProgressContent(bookName, files) {
|
|
89
|
-
const lines = [
|
|
90
|
-
`# tsl global progress — book: ${bookName}`,
|
|
91
|
-
'',
|
|
92
|
-
'| 文件 | 状态 |',
|
|
93
|
-
'|------|------|',
|
|
94
|
-
];
|
|
95
|
-
for (const f of files) {
|
|
96
|
-
lines.push(`| ${f.filename} | pending |`);
|
|
97
|
-
}
|
|
98
|
-
return lines.join('\n') + '\n';
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// --- CLI ---
|
|
102
|
-
|
|
103
|
-
const isMain = import.meta.url === `file://${process.argv[1]}`;
|
|
104
|
-
|
|
105
|
-
if (isMain) {
|
|
106
|
-
const [,, translateDir] = process.argv;
|
|
107
|
-
|
|
108
|
-
if (!translateDir) {
|
|
109
|
-
console.error('Usage: node init-progress.js <translate_dir>');
|
|
110
|
-
process.exit(2);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
try {
|
|
114
|
-
const files = parsePrepareResult(translateDir);
|
|
115
|
-
const bookName = basename(join(translateDir, '..'));
|
|
116
|
-
|
|
117
|
-
let created = 0;
|
|
118
|
-
let skipped = 0;
|
|
119
|
-
|
|
120
|
-
for (const f of files) {
|
|
121
|
-
const fileWorkDir = join(translateDir, f.filename);
|
|
122
|
-
const progressPath = join(fileWorkDir, 'progress.md');
|
|
123
|
-
|
|
124
|
-
if (existsSync(progressPath)) {
|
|
125
|
-
skipped++;
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
mkdirSync(fileWorkDir, { recursive: true });
|
|
130
|
-
writeFileSync(progressPath, buildProgressContent(bookName, f.filename, f.chunkCount), 'utf-8');
|
|
131
|
-
created++;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const globalPath = join(translateDir, 'progress-global.md');
|
|
135
|
-
if (!existsSync(globalPath)) {
|
|
136
|
-
writeFileSync(globalPath, buildGlobalProgressContent(bookName, files), 'utf-8');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
console.log(`created: ${created}, skipped: ${skipped}`);
|
|
140
|
-
} catch (e) {
|
|
141
|
-
console.error(e.message);
|
|
142
|
-
process.exit(1);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# tsl 技能待办清单(todos)
|
|
2
|
-
|
|
3
|
-
> 记录从规则评审中沉淀的待办事项。完成一项勾一项。
|
|
4
|
-
|
|
5
|
-
## 待办
|
|
6
|
-
|
|
7
|
-
- [ ] **新增词频统计脚本(count-terms.js)**
|
|
8
|
-
- 背景:terminology-rules.md 2.3 数量限制需按出现次数排序,模型感知候选 ≤50 后由脚本统计频次(LLM 无法精确计数)。
|
|
9
|
-
- 待办:实现词频统计脚本(输入:候选术语列表 + source 全文;输出:各术语出现次数);资源准备 subagent 术语表创建步骤调用(prepare-prompt.md 同步)。
|
|
10
|
-
|
|
11
|
-
- [ ] **自定义 `style` 参数规则机制重新设计**
|
|
12
|
-
- 背景:翻译规则转正后,规则中的风格即为直译,暂不支持 `style` 参数覆盖。旧机制(Style 可由 `style` 覆盖)已从 `translation-rules.md` 移除。
|
|
13
|
-
- 待办:重新设计 style 参数机制(如何表达风格、是否允许覆盖直译),设计完成后补回规则。
|
|
14
|
-
|
|
15
|
-
- [ ] **新翻译规则同步到 skill 生效区**
|
|
16
|
-
- 背景:新版 `translation-rules.md`(R1-R7 + V1-V4,纯规则表格)已定稿于 `.opencode-bridge/skills/tsl/references/`。
|
|
17
|
-
- 待办:覆盖同步到生效区 `skills/tsl/references/translation-rules.md`(旧版 46 行:Style + Format 契约 + 8 条细则)。
|
|
18
|
-
|
|
19
|
-
- [x] **`translation-prompt.md` 同步**
|
|
20
|
-
- 脚注格式示例:已与 R4 一致(`原文 | 译文`,去掉"译文:"前缀)。
|
|
21
|
-
- 禁止事项核对:已与转正后规则一致(不分块、不写 bilingual/progress/glossary、不做格式重建)。
|
|
22
|
-
- `{{file_number}}` 变量已从 prompt 移除(来源文件列填写 {{file_work_dir}});SKILL.md 中"替换 {{变量}}(含 {{file_number}}...)"的说明已同步删除。
|
|
23
|
-
|
|
24
|
-
- [ ] **`chunk-text.js` 页眉断裂补 [CONT]**(原 C4,属主 Agent 环节)
|
|
25
|
-
- 背景:抽查发现跨页码页眉断裂的段落无 [CONT] 标记(如 Georges Canguilhem V 行 13968→13974)。
|
|
26
|
-
- 待办:分块时检测页眉行(`### \d+` 模式)打断的未完段落,自动补 [CONT]。
|
|
27
|
-
|
|
28
|
-
- [ ] **N1/N2 语义级自检暂不引入**
|
|
29
|
-
- 背景:原文段污染检测(N1)与未译残留检测(N2)曾作为新增规则候选,因易误判(如英文原文可能引用中文谚语)暂不引入。
|
|
30
|
-
- 待办:如后续需要,先设计白名单与阈值,再评估是否升级为 verify-chunk 检查项。
|
|
31
|
-
|
|
32
|
-
- [ ] **术语表存量治理**
|
|
33
|
-
- 背景:Georges Canguilhem 术语表膨胀至 11,006 行(大量一次性译者人名、个人文章标题滥收),根因已定位——收录标准未注入 subagent、术语识别非独立步骤。prompt/rules 已重构(Backlog 新增「术语识别」步骤 + Item 1 直接读取 terminology-rules.md)。
|
|
34
|
-
- 待办:用 `cleanup-glossary.js` 收敛存量术语表(按排除标准批量删除一次性专名/作品名),并核对 merge-result.js 去重逻辑(规范化匹配)。
|
|
35
|
-
|
|
36
|
-
- [ ] **职责边界约束核对**
|
|
37
|
-
- 背景:subagent 不执行分块/术语表管理/写主产物/格式重建。转正后此约束由 `translation-prompt.md` 禁止事项承载,规则文件已不再重复。
|
|
38
|
-
- 待办:核对 prompt 禁止事项是否完整覆盖上述边界。
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: translate-file
|
|
3
|
-
description: |
|
|
4
|
-
Use when translating a single file (PDF / text / markdown) into bilingual side-by-side format (txt output). Triggers on: file translation, single file translate, 单文件翻译, translate one file.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
作为 Scrum 开发者,我想要将源文件翻译为双语对照格式,以便输出 .txt 翻译文件。using the **fixed-sequence Sprint workflow** (seq)。
|
|
8
|
-
|
|
9
|
-
# Product Goal
|
|
10
|
-
Translate the source file into bilingual side-by-side format and output to a txt file.
|
|
11
|
-
|
|
12
|
-
# Extract Variables
|
|
13
|
-
|
|
14
|
-
Extract input variables from the context:
|
|
15
|
-
|
|
16
|
-
| Variable | Type | Required | Description |
|
|
17
|
-
|---|---|---|---|
|
|
18
|
-
| `input_path` | string | ✅ | source file or directory path |
|
|
19
|
-
| `language` | string | ❌ | Target language, default: Chinese |
|
|
20
|
-
| `chunk_words` | integer | ❌ | Maximum words per chunk, default: 3000 |
|
|
21
|
-
| `force` | boolean | ❌ | Force execution, ignore historical progress, default: false. Set `true` when the user asks for a retranslation (translate again / force translation / clear history then translate); otherwise `false` |
|
|
22
|
-
|
|
23
|
-
# Environment Initialization
|
|
24
|
-
|
|
25
|
-
1. Run `node scripts/init.js '{{input_path}}' {{force}}` to validate input, resolve variables, clear historical progress when `{{force}}` is true, and check npm dependencies.
|
|
26
|
-
2. Read **Sprint Standards** `{{shared_dir}}/references/sprint_standards.md`.
|
|
27
|
-
|
|
28
|
-
# Product Increment
|
|
29
|
-
|
|
30
|
-
| Product | Type | Description | DoD |
|
|
31
|
-
|---|---|---|---|
|
|
32
|
-
| `{{output_dir}}/{{run_name}}.txt` | file | Bilingual translation txt file | file exists and is not empty |
|
|
33
|
-
| `{{output_dir}}/review.md` | file | translation review file | file exists and is not empty |
|
|
34
|
-
|
|
35
|
-
# Sprint Backlogs
|
|
36
|
-
| Sprint Name | Backlog File | Description |
|
|
37
|
-
|---|---|---|
|
|
38
|
-
| Sprint for progress | `{{shared_dir}}/references/sprint_for_progress.md` | shared skill file |
|
|
39
|
-
| Sprint for preprocess | `{{skill_dir}}/references/sprint_for_preprocess.md` | |
|
|
40
|
-
| Sprint for translate | `{{skill_dir}}/references/sprint_for_translate.md` | |
|
|
41
|
-
| Sprint for teardown | `{{skill_dir}}/references/sprint_for_teardown.md` | |
|
|
42
|
-
|
|
43
|
-
# Sprint Now!
|
|
44
|
-
|
|
45
|
-
Read all **Sprint Backlogs**, follow **Sprint Workflow** `{{shared_dir}}/references/run/run_sprint_loop.md`, then *sprint*.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Sprint Backlog for preprocess
|
|
2
|
-
|
|
3
|
-
## Sprint Goal
|
|
4
|
-
Convert the source file to clean plain text.
|
|
5
|
-
|
|
6
|
-
## Sprint Backlog Items
|
|
7
|
-
|
|
8
|
-
### Item1: Text extraction
|
|
9
|
-
- Implement: run `node '{{skill_dir}}/scripts/extract.js' '{{source_file}}' '{{run_dir}}/source.txt'`
|
|
10
|
-
- DoD check: `source.txt` is generated and not empty
|
|
11
|
-
|
|
12
|
-
### Item2: Text cleaning
|
|
13
|
-
- Implement: run `node '{{skill_dir}}/scripts/clean_text.js' '{{run_dir}}/source.txt'`
|
|
14
|
-
- DoD check: The cleaning script outputs an OK status
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Sprint Backlog for teardown
|
|
2
|
-
|
|
3
|
-
## Sprint Goal
|
|
4
|
-
Clean up and finalize after the merged output is generated.
|
|
5
|
-
|
|
6
|
-
## Sprint Backlog Items
|
|
7
|
-
|
|
8
|
-
### Item1: Fix CONT connections
|
|
9
|
-
- Short-circuit: skip when no `[CONT]` marker is found in `{{output_dir}}/{{run_name}}.txt`
|
|
10
|
-
- Implement: Search `[CONT]` markers with 2 lines of context before and after (forbidden to read the full file), fix the translation at splice points to ensure smooth sentences, and remove the `[CONT]` markers
|
|
11
|
-
- DoD check: No `[CONT]` markers remain in `{{output_dir}}/{{run_name}}.txt` and splice points are semantically smooth
|
|
12
|
-
|
|
13
|
-
### Item2: Generate review log
|
|
14
|
-
- Implement: run `node '{{skill_dir}}/scripts/generate_review.js' '{{run_dir}}/batch_progress.csv' '{{output_dir}}/review.md'`
|
|
15
|
-
- DoD check: `{{output_dir}}/review.md` is created
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Sprint Backlog for translate
|
|
2
|
-
|
|
3
|
-
## Sprint Goal
|
|
4
|
-
|
|
5
|
-
Chunk the clean text, then translate a batch of chunks in parallel.
|
|
6
|
-
|
|
7
|
-
## Sprint Backlog Items
|
|
8
|
-
|
|
9
|
-
### Item1: Create chunks
|
|
10
|
-
|
|
11
|
-
- Implement: run `node '{{skill_dir}}/scripts/chunk_text.js' '{{run_dir}}/source.txt' '{{run_dir}}/chunks' {{chunk_words}}`
|
|
12
|
-
- DoD check: Chunk files are saved to `{{run_dir}}/chunks`
|
|
13
|
-
|
|
14
|
-
### Item2: Prepare loop resources
|
|
15
|
-
|
|
16
|
-
- Implement:
|
|
17
|
-
1. Create `{{run_dir}}/batch_progress.csv`:
|
|
18
|
-
```
|
|
19
|
-
chunk_id,status,retry
|
|
20
|
-
p001,pending,0
|
|
21
|
-
p002,pending,0
|
|
22
|
-
...
|
|
23
|
-
```
|
|
24
|
-
2. Read subagent prompt from `{{skill_dir}}/references/translation_prompt.md`
|
|
25
|
-
3. Read failure diagnosis guide from `{{shared_dir}}/references/failure_diagnosis.md`
|
|
26
|
-
4. Prepare variable table:
|
|
27
|
-
|
|
28
|
-
| Variable | Value | Description |
|
|
29
|
-
|---|---|---|
|
|
30
|
-
| `chunk_id` | per chunk | from batch_progress.csv |
|
|
31
|
-
| `run_dir` | `{{run_dir}}` | run data directory |
|
|
32
|
-
| `language` | `{{language}}` | target language |
|
|
33
|
-
| `skill_dir` | `{{skill_dir}}` | skill directory |
|
|
34
|
-
|
|
35
|
-
- DoD check: `batch_progress.csv` created with all chunks pending; prompt and variable table ready
|
|
36
|
-
|
|
37
|
-
### Item3: Batch translate loop
|
|
38
|
-
|
|
39
|
-
- Implement:
|
|
40
|
-
```
|
|
41
|
-
# prompt and variable table prepared in Item2
|
|
42
|
-
while true:
|
|
43
|
-
# read up to max_parallel pending/failed(retry<3) chunks
|
|
44
|
-
batch = read from batch_progress.csv where status != completed and retry < 3, up to {{max_parallel}}
|
|
45
|
-
|
|
46
|
-
# exit when no pending chunks
|
|
47
|
-
if batch is empty:
|
|
48
|
-
break
|
|
49
|
-
|
|
50
|
-
print batch N: dispatching subagents for chunks [p00m, p00n, ...]
|
|
51
|
-
|
|
52
|
-
# adjust prompt for failed chunks
|
|
53
|
-
for chunk in batch:
|
|
54
|
-
if chunk.status == failed:
|
|
55
|
-
adjust prompt based on failure_diagnosis.md
|
|
56
|
-
|
|
57
|
-
# dispatch one subagent per chunk, all in a single message
|
|
58
|
-
parallel dispatch_subagent(subagent_type: "general", description: "Translate chunk {{chunk_id}}", prompt: <subagent prompt> \n Variable table: <subagent variable table>)
|
|
59
|
-
|
|
60
|
-
# update status per chunk
|
|
61
|
-
for chunk in batch:
|
|
62
|
-
if {{run_dir}}/results/{{chunk_id}}.md exists and not empty:
|
|
63
|
-
update batch_progress.csv → completed
|
|
64
|
-
else:
|
|
65
|
-
update batch_progress.csv → failed, retry+1
|
|
66
|
-
|
|
67
|
-
print batch N status: [p00m:status, p00n:status, ...]
|
|
68
|
-
```
|
|
69
|
-
- DoD check: All chunks in `batch_progress.csv` are either `completed` or `failed` with `retry >= 3`
|
|
70
|
-
|
|
71
|
-
### Item4: Merge output
|
|
72
|
-
|
|
73
|
-
- Implement: run `node '{{skill_dir}}/scripts/merge_results.js' '{{run_dir}}/chunks' '{{run_dir}}/results' '{{output_dir}}' '{{run_name}}'`
|
|
74
|
-
- DoD check: `{{output_dir}}/{{run_name}}.txt` is generated
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
You are a translator named Paul in the Scrum Team. Please achieve the Sprint Goal within one Sprint.
|
|
2
|
-
|
|
3
|
-
## Translation Rules
|
|
4
|
-
|
|
5
|
-
| ID | Category | Rule |
|
|
6
|
-
|---|---|---|
|
|
7
|
-
| R1 | Style | **Literal translation**: do not add, remove, or alter words and content; do not change sentence order; translate sentence by sentence; do not add explanations not present in the source |
|
|
8
|
-
| R2 | Output contract | **Bilingual layout**: source paragraph first, translation paragraph second, separated by a blank line; headings are laid out the same as paragraphs; no formatting preserved |
|
|
9
|
-
| R3 | Output contract | **Output form**: output bilingual text only, no explanations, no thought process |
|
|
10
|
-
| R4 | Detail | **Footnote translation**: preserve the marker `[^N]`, content format `source \| translation` |
|
|
11
|
-
| R5 | Detail | **Source file error correction**: proactively identify OCR and other source file errors, fix during translation, use the corrected text in the source paragraph |
|
|
12
|
-
| R6 | Detail | **[CONT] marker**: a marker that may appear at the end of a chunk indicating an incomplete sentence. Preserve it in both languages |
|
|
13
|
-
|
|
14
|
-
## Sprint Goal
|
|
15
|
-
Translate 1 chunk into `{{language}}` and write to the result file.
|
|
16
|
-
|
|
17
|
-
## Sprint Increment
|
|
18
|
-
|
|
19
|
-
| Product | Type | Description | DoD |
|
|
20
|
-
|---|---|---|---|
|
|
21
|
-
| `{{run_dir}}/results/{{chunk_id}}.md` | file | Translation result (bilingual) | file exists and is not empty |
|
|
22
|
-
|
|
23
|
-
## Sprint Backlog Items
|
|
24
|
-
|
|
25
|
-
### Item1: Translate
|
|
26
|
-
- Implement: Translate `{{run_dir}}/chunks/{{chunk_id}}.txt` following the **Translation Rules** above and write directly to `{{run_dir}}/results/{{chunk_id}}.md`
|
|
27
|
-
- DoD check: `{{run_dir}}/results/{{chunk_id}}.md` exists and is not empty
|
|
28
|
-
|
|
29
|
-
### Item2: Self-check
|
|
30
|
-
- Implement: run `node '{{skill_dir}}/scripts/verify_chunk.js' '{{run_dir}}/chunks/{{chunk_id}}.txt' '{{run_dir}}/results/{{chunk_id}}.md'`
|
|
31
|
-
- DoD check: Self-check result is obtained (VALID or INVALID with reasons)
|
|
32
|
-
|
|
33
|
-
### Item3: Fix and update
|
|
34
|
-
- Short-circuit: skip when self-check result is VALID
|
|
35
|
-
- Implement: Investigate errors, fix and update `{{run_dir}}/results/{{chunk_id}}.md`. After ≤2 fix attempts, if still INVALID, stop fixing (keep the content)
|
|
36
|
-
- DoD check: Self-check update is complete
|
|
37
|
-
|
|
38
|
-
# Sprint Now!
|
|
39
|
-
|
|
40
|
-
Follow the Sequential workflow to implement:
|
|
41
|
-
1. Sprint: Execute the **Sprint Backlog Items** one by one.
|
|
42
|
-
2. Increment Check: Check that the **Sprint Increment** meets the DoD.
|
|
43
|
-
3. Sprint Review: Present the **Sprint Goal** completion or non-completion process to the team in minimal steps.
|