Skip to content

peterfei/ai-agent-team / .claude/skills/softcopyright

softcopyright

Flagged

智能软件著作权申请材料生成工具。自动分析项目源码,生成符合软著申请要求的软件说明书和源代码文档。支持关键词搜索、智能源码分析、格式化输出和PDF导出。

FileKindSize
.npmignoreother14 B
CHANGELOG.mdmarkdown6.8 KB
IMPLEMENTATION_REPORT.mdmarkdown7.5 KB
LICENSEother1.0 KB
PERFORMANCE_OPTIMIZATION.mdmarkdown4.0 KB
PERFORMANCE_OPTIMIZATION_SUMMARY.mdmarkdown7.8 KB
PERFORMANCE_QUICK_START.mdmarkdown6.6 KB
README.mdmarkdown6.5 KB
SKILL.mdskill md7.6 KB
TESTING_GUIDE.mdmarkdown11.4 KB
USAGE_EXAMPLES.mdmarkdown8.4 KB
demo-keywords.mdmarkdown2.5 KB
install.shexecutablescript1.5 KB
package-lock.jsonmanifest122.7 KB
package.jsonmanifest1.1 KB
scripts/auto-pdf-generator.jsscript5.2 KB
scripts/auto-print-pdf.jsscript7.1 KB
scripts/chinese-pdf-fix.jsscript4.0 KB
scripts/cli.jsexecutablescript5.9 KB
scripts/doc-generator-english.jsscript13.2 KB
scripts/doc-generator-new.jsscript624 B
scripts/doc-generator.jsscript28.1 KB
scripts/font-manager.jsscript5.7 KB
scripts/html-pdf-generator.jsscript17.3 KB
scripts/html-source-exporter.jsscript30.8 KB
scripts/html-to-pdf.jsscript5.6 KB
scripts/index.jsscript17.3 KB
scripts/index.js.pdf-backupother12.3 KB
scripts/run.batscript463 B
scripts/run.shexecutablescript893 B
scripts/scanner-optimized.jsscript21.9 KB
scripts/scanner.jsscript22.2 KB
scripts/simple-doc-generator.jsscript25.9 KB
scripts/simple-pdf-generator.jsscript14.4 KB
scripts/simple-source-exporter.jsscript4.6 KB
scripts/source-exporter.jsscript13.1 KB
scripts/system-chrome-pdf.jsscript7.0 KB
scripts/utils-optimized.jsscript4.8 KB
scripts/utils.jsscript9.2 KB
softcopyrightexecutablescript150 B
softcopyright-generateexecutablescript168 B
softcopyright-generate.batscript194 B
softcopyright-manualexecutablescript169 B
softcopyright-manual.batscript195 B
softcopyright-sourceexecutablescript169 B
softcopyright-source.batscript195 B
softcopyright.batscript176 B
templates/software-manual.mdmarkdown6.0 KB
test-auto-pdf.jsscript636 B
test-clean-header-footer.jsscript2.3 KB
test-complete.jsscript848 B
test-counter-fix.jsexecutablescript2.3 KB
test-fixed-page-number.jsscript2.4 KB
test-html-generation.jsscript2.9 KB
test-html.jsscript732 B
test-no-border.jsscript1.8 KB
test-pdf.jsscript639 B
test-performance.jsexecutablescript4.9 KB

scripts/system-chrome-pdf.js

View on GitHub
/**
 * 使用系统Chrome生成PDF
 * 避免Puppeteer兼容性问题
 */

const { execSync } = require('child_process');
const fs = require('fs-extra');
const path = require('path');
const chalk = require('chalk');

/**
 * 检查系统Chrome是否可用
 * @returns {boolean}
 */
function checkSystemChrome() {
  try {
    // macOS Chrome
    execSync('which google-chrome', { stdio: 'ignore' });
    return 'google-chrome';
  } catch (e) {
    try {
      // macOS Chrome Canary
      execSync('which google-chrome-stable', { stdio: 'ignore' });
      return 'google-chrome-stable';
    } catch (e) {
      try {
        // macOS Safari (不支持HTML转PDF)
        execSync('which safari', { stdio: 'ignore' });
        return 'safari';
      } catch (e) {
        return false;
      }
    }
  }
}

/**
 * 使用系统Chrome将HTML转换为PDF
 * @param {string} htmlPath HTML文件路径
 * @param {string} outputPath PDF输出路径
 * @returns {Promise<boolean>}
 */
async function convertHTMLToPDFWithSystemChrome(htmlPath, outputPath) {
  const chromeCommand = checkSystemChrome();

  if (!chromeCommand) {
    console.warn(chalk.yellow('⚠️  未找到系统Chrome浏览器'));
    console.warn(chalk.cyan('💡 建议手动操作:'));
    console.warn(chalk.cyan('   1. 在浏览器中打开HTML文件'));
    console.warn(chalk.cyan('   2. 使用打印功能保存为PDF'));
    return false;
  }

  if (chromeCommand === 'safari') {
    console.warn(chalk.yellow('⚠️  Safari不支持HTML转PDF'));
    console.warn(chalk.cyan('💡 建议手动操作:'));
    console.warn(chalk.cyan('   1. 在Chrome浏览器中打开HTML文件'));
    console.warn(chalk.cyan('   2. 使用打印功能保存为PDF'));
    return false;
  }

  try {
    console.log(chalk.blue(`🔄 使用系统Chrome转换: ${chromeCommand}`));

    // 使用Chrome的无头模式
    const args = [
      '--headless',
      '--disable-gpu',
      '--disable-dev-shm-usage',
      '--no-sandbox',
      '--disable-setuid-sandbox',
      '--disable-web-security',
      '--allow-running-insecure-content',
      '--disable-features=IsolateOrigins,site-per-process',
      '--disable-background-timer-throttling',
      '--disable-backgrounding-occluded-windows',
      '--disable-renderer-backgrounding',
      '--disable-extensions',
      '--disable-plugins',
      '--disable-default-apps',
      '--mute-audio'
    ];

    const chromeArgs = [
      '--print-to-pdf=' + outputPath,
      '--print-to-pdf-no-header',
      '--virtual-time-budget=10000',
      ...args,
      'file://' + path.resolve(htmlPath)
    ];

    console.log(chalk.gray('命令:'), chromeCommand, chromeArgs.join(' '));

    execSync(`${chromeCommand} ${chromeArgs.join(' ')}`, {
      stdio: 'inherit',
      timeout: 30000
    });

    if (await fs.pathExists(outputPath)) {
      console.log(chalk.green(`✅ PDF转换成功: ${outputPath}`));
      return true;
    } else {
      console.warn(chalk.red('❌ PDF文件未生成'));
      return false;
    }

  } catch (error) {
    console.warn(chalk.red('❌ Chrome转换失败:'), error.message);
    console.warn(chalk.cyan('💡 建议手动操作:'));
    console.warn(chalk.cyan('   1. 在Chrome浏览器中打开HTML文件'));
    console.warn(chalk.cyan('   2. 使用打印功能保存为PDF'));
    return false;
  }
}

/**
 * 自动转换HTML为PDF(带备用方案)
 * @param {string} htmlPath HTML文件路径
 * @param {string} outputPath PDF输出路径
 * @returns {Promise<boolean>}
 */
async function autoConvertHTMLToPDF(htmlPath, outputPath) {
  try {
    console.log(chalk.yellow('🔄 尝试自动HTML转PDF...'));

    // 方法1: 尝试使用系统Chrome
    const chromeSuccess = await convertHTMLToPDFWithSystemChrome(htmlPath, outputPath);
    if (chromeSuccess) {
      return true;
    }

    // 方法2: 提供手动操作指导
    console.log(chalk.blue('\n📋 手动操作指南:'));
    console.log(chalk.white('1. 复制HTML文件路径:'));
    console.log(chalk.cyan(`   ${htmlPath}`));
    console.log(chalk.white('2. 在Chrome浏览器中打开该文件'));
    console.log(chalk.white('3. 按 Cmd+P 打开打印对话框'));
    console.log(chalk.white('4. 选择"保存为PDF"'));
    console.log(chalk.white('5. 选择输出路径和文件名'));

    return false;

  } catch (error) {
    console.error(chalk.red('❌ 转换过程出错:'), error.message);
    return false;
  }
}

/**
 * 完整的自动PDF生成流程(含备用方案)
 * @param {Object} projectInfo 项目信息
 * @param {string} outputDir 输出目录
 * @returns {Promise<{htmlPath: string, pdfPath: string, success: boolean}>}
 */
async function generateAutoPDF(projectInfo, outputDir) {
  try {
    const moment = require('moment');
    const timestamp = moment().format('YYYYMMDD_HHMMSS');

    // 1. 生成HTML
    const { generateManualHTML } = require('./simple-doc-generator');
    console.log(chalk.yellow('📝 步骤1: 生成HTML文档...'));
    const htmlPath = await generateManualHTML(projectInfo, outputDir);

    // 2. 生成PDF文件名
    const pdfFileName = `软件说明书_${projectInfo.name}_${timestamp}.pdf`;
    const pdfPath = path.join(outputDir, pdfFileName);

    // 3. 自动转换HTML为PDF
    console.log(chalk.yellow('📄 步骤2: 自动转换为PDF...'));
    const success = await autoConvertHTMLToPDF(htmlPath, pdfPath);

    // 4. 返回结果
    return {
      htmlPath,
      pdfPath,
      success: success || await fs.pathExists(pdfPath) // 最后检查是否成功
    };

  } catch (error) {
    throw new Error(`自动PDF生成失败: ${error.message}`);
  }
}

/**
 * 创建包含PDF转换指导的HTML文件
 * @param {string} htmlPath 原始HTML路径
 * @returns {Promise<string>} 增强版HTML路径
 */
async function createEnhancedHTML(htmlPath) {
  try {
    const content = await fs.readFile(htmlPath, 'utf8');

    // 在HTML头部添加PDF转换指导
    const enhancedContent = content.replace(
      '<head>',
      `<head>
    <script>
      // 自动打开PDF转换指导
      window.onload = function() {
        console.log('📄 软件说明书已加载');
        console.log('💡 提示: 按下 Cmd+P 可直接打印为PDF');

        // 添加快捷键提示
        document.addEventListener('keydown', function(e) {
          if (e.metaKey && e.key === 'p') {
            e.preventDefault();
            console.log('🖨️  正在打开打印对话框...');
            setTimeout(() => {
              window.print();
            }, 100);
          }
        });
      };
    </script>
    `
    );

    const enhancedPath = htmlPath.replace('.html', '_enhanced.html');
    await fs.writeFile(enhancedPath, enhancedContent, 'utf8');

    console.log(chalk.green(`✅ 增强版HTML已生成: ${enhancedPath}`));
    return enhancedPath;

  } catch (error) {
    console.warn(chalk.yellow('⚠️  创建增强版HTML失败:'), error.message);
    return htmlPath;
  }
}

module.exports = {
  checkSystemChrome,
  convertHTMLToPDFWithSystemChrome,
  autoConvertHTMLToPDF,
  generateAutoPDF,
  createEnhancedHTML
};
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall