peterfei/ai-agent-team / .claude/skills/softcopyright
softcopyright
Flagged智能软件著作权申请材料生成工具。自动分析项目源码,生成符合软著申请要求的软件说明书和源代码文档。支持关键词搜索、智能源码分析、格式化输出和PDF导出。
test-html-generation.js
View on GitHub#!/usr/bin/env node
/**
* 测试修复后的生成功能
*/
const chalk = require('chalk');
const path = require('path');
const scanner = require('./scripts/scanner');
const { generateManualHTML } = require('./scripts/simple-doc-generator');
const { exportSourceCodeHTML } = require('./scripts/html-source-exporter');
async function testHtmlGeneration() {
console.log(chalk.blue.bold('\n🧪 测试HTML生成功能\n'));
console.log(chalk.gray('='.repeat(60)));
try {
// 测试项目路径
const projectPath = process.argv[2] || process.cwd();
const outputDir = path.join(projectPath, 'test-output');
console.log(chalk.yellow(`\n📁 测试项目: ${projectPath}`));
console.log(chalk.yellow(`📁 输出目录: ${outputDir}\n`));
// 确保输出目录存在
const fs = require('fs-extra');
await fs.ensureDir(outputDir);
// 1. 扫描项目
console.log(chalk.cyan('步骤1: 扫描项目...'));
const projectInfo = await scanner.scanProject(projectPath);
console.log(chalk.green(`✅ 扫描完成: ${projectInfo.files.length}个文件, ${projectInfo.totalLines}行代码\n`));
// 2. 生成软件说明书HTML
console.log(chalk.cyan('步骤2: 生成软件说明书HTML...'));
const manualPath = await generateManualHTML(projectInfo, outputDir);
console.log(chalk.green(`✅ 软件说明书: ${path.basename(manualPath)}\n`));
// 3. 生成源代码文档HTML
console.log(chalk.cyan('步骤3: 生成源代码文档HTML...'));
const sourcePath = await exportSourceCodeHTML(projectInfo, outputDir);
console.log(chalk.green(`✅ 源代码文档: ${path.basename(sourcePath)}\n`));
// 4. 验证文件是否存在且包含中文
console.log(chalk.cyan('步骤4: 验证生成的文件...'));
const manualContent = fs.readFileSync(manualPath, 'utf8');
const sourceContent = fs.readFileSync(sourcePath, 'utf8');
const hasChinese = (content) => /[\u4e00-\u9fa5]/.test(content);
if (hasChinese(manualContent)) {
console.log(chalk.green('✅ 软件说明书包含中文字符'));
} else {
console.log(chalk.red('❌ 软件说明书未检测到中文'));
}
if (hasChinese(sourceContent)) {
console.log(chalk.green('✅ 源代码文档包含中文字符'));
} else {
console.log(chalk.red('❌ 源代码文档未检测到中文'));
}
console.log(chalk.blue.bold('\n🎉 测试完成!\n'));
console.log(chalk.cyan(`📁 输出目录: ${outputDir}`));
console.log(chalk.white('💡 请在浏览器中打开HTML文件验证中文显示\n'));
process.exit(0);
} catch (error) {
console.error(chalk.red('\n❌ 测试失败:'), error.message);
console.error(error.stack);
process.exit(1);
}
}
// 运行测试
testHtmlGeneration();
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |