Skip to content

OpenSenseNova/SenseNova-Skills / skills/sn-ppt-standard

sn-ppt-standard

Flagged

仅在 `sn-ppt-entry` 与 `sn-ppt-story` 已准备绝对 `DECK_DIR` 和 `outline.md` 后使用;生成每页独立 HTML(1600×900)、渲染 PNG、逐页讲稿、`present.html`,并按 `static_postprocess` 选择生成由 Standard 自有 exporter 转换的 PPTX。**`present.html` 始终是必交付产物,缺失即技术故障,不得交付;`static_postprocess` 含 `pptx` 时 PPTX 同为必交付产物(缺一即技术故障),且只能由 Standard 自有 exporter 生成;仅当用户明确要求只要 HTML(`static_postprocess` 为 `[]`)时,PPTX 才可不交付。**

FileKindSize
SKILL.mdskill md45.2 KB
agents/openai.yamlconfig350 B
assets/licenses/OFL-1.1.txtmarkdown3.9 KB
references/base-template.cssother34.5 KB
references/box-agent-tool-contract.mdmarkdown5.7 KB
references/design-rules.mdmarkdown62.8 KB
references/design-styles.mdmarkdown26.2 KB
references/editing-contract.mdmarkdown4.9 KB
references/fonts.mdmarkdown10.3 KB
references/layout-patterns.mdmarkdown17.3 KB
references/planning-contract.mdmarkdown27.0 KB
references/quality-checklist.mdmarkdown30.2 KB
scripts/deck.pyscript58.6 KB
scripts/export_pptx/html_to_pptx.mjsscript6.3 KB
scripts/export_pptx/lib/browser_picker.mjsscript5.5 KB
scripts/export_pptx/lib/cli_guards.mjsscript14.5 KB
scripts/export_pptx/lib/dom_extractor.mjsscript37.0 KB
scripts/export_pptx/lib/echarts_discovery.mjsscript1.2 KB
scripts/export_pptx/lib/echarts_to_pptx.mjsscript30.0 KB
scripts/export_pptx/lib/image_downloader.mjsscript4.1 KB
scripts/export_pptx/lib/postprocess_pptx.mjsscript6.9 KB
scripts/export_pptx/lib/pptx_builder.mjsscript84.9 KB
scripts/export_pptx/lib/style_parser.mjsscript18.8 KB
scripts/export_pptx/package-lock.jsonmanifest9.1 KB
scripts/export_pptx/package.jsonmanifest268 B
scripts/export_pptx/screenshot.mjsscript2.7 KB
scripts/export_pptx/test/fixtures/dom-layout-regression.htmlother758 B
scripts/export_pptx/test/fixtures/echarts-fallback.htmlother1.2 KB
scripts/export_pptx/test/test_color_srgb_regression.mjsscript881 B
scripts/export_pptx/test/test_dom_layout_regression.mjsscript1.5 KB
scripts/export_pptx/test/test_echarts_discovery.mjsscript1.4 KB
scripts/export_pptx/test/test_echarts_fallback.mjsscript2.0 KB
scripts/export_pptx/test/test_echarts_to_pptx_regression.mjsscript2.3 KB
scripts/export_pptx/test/test_radial_overlay_regression.mjsscript1.0 KB
scripts/export_pptx/test/test_text_box_padding_regression.mjsscript675 B
scripts/font_bundle.pyscript38.9 KB
scripts/image_cutout.pyscript14.2 KB
scripts/install.shscript12.8 KB
scripts/render.pyscript94.8 KB
scripts/serper_images.pyscript4.2 KB
scripts/stage_materials.pyscript37.6 KB
subagents/image.mdmarkdown14.3 KB
subagents/review.mdmarkdown26.0 KB
subagents/slide.mdmarkdown23.9 KB

scripts/export_pptx/lib/browser_picker.mjs

View on GitHub
// browser_picker.mjs — 浏览器可执行文件选择器
// 移植自 render.py 的 _ensure_browser_available(),四层优先级:
//   ① PPT_SKILL_BROWSER_EXE 环境变量覆盖(与 render.py 共用同一变量)
//   ② playwright 期望路径存在 → 优先同 revision 的 headless shell
//   ③ 期望版本缺失 → 扫描 PLAYWRIGHT_BROWSERS_PATH 本地缓存,
//      选架构匹配、可执行、revision 距离最近者(dist 相同时 headless shell 优先)
//   ④ 兜底返回 playwright 期望路径(行为同现状,让 playwright 自行报错)

import { existsSync, accessSync, constants, readdirSync } from 'node:fs';
import { homedir } from 'node:os';
import { join, resolve } from 'node:path';
import { chromium } from 'playwright';

function isExecutable(p) {
  if (!existsSync(p)) return false;
  try {
    accessSync(p, constants.X_OK);
    return true;
  } catch {
    return false;
  }
}

function expandHome(p) {
  if (p === '~') return homedir();
  if (p.startsWith('~/') || p.startsWith('~\\')) return join(homedir(), p.slice(2));
  return p;
}

// 各平台架构目录名(对应 render.py _scan_local_chromium 的 mac/linux 分支)
function archNames() {
  const plat = process.platform;
  const arch = process.arch;
  if (plat === 'darwin') {
    const mac = arch === 'arm64' ? 'mac-arm64' : 'mac-x64';
    return {
      shellArch: `chrome-headless-shell-${mac}`,
      fullArchs: [`chrome-${mac}`],
      shellExe: 'chrome-headless-shell',
      fullExe: join('Google Chrome for Testing.app', 'Contents', 'MacOS', 'Google Chrome for Testing'),
    };
  }
  if (plat === 'win32') {
    return {
      shellArch: 'chrome-headless-shell-win64',
      fullArchs: ['chrome-win64'],
      shellExe: 'chrome-headless-shell.exe',
      fullExe: 'chrome.exe',
    };
  }
  // linux 及默认
  return {
    shellArch: 'chrome-headless-shell-linux64',
    fullArchs: ['chrome-linux64'],
    shellExe: 'chrome-headless-shell',
    fullExe: 'chrome',
  };
}

// 浏览器缓存根:优先环境变量,缺省 node playwright 默认路径
function browserCacheRoot() {
  const env = process.env.PLAYWRIGHT_BROWSERS_PATH;
  if (env && env !== '0') return expandHome(env);
  return join(homedir(), '.cache', 'ms-playwright');
}

// 从期望路径提取 revision,优先同 revision 的 headless shell
// (对应 render.py _prefer_headless_shell)
function headlessShellFor(exe) {
  const m = /chromium-(\d+)/.exec(exe);
  if (!m) return null;
  const rev = m[1];
  const parts = exe.split(/[\\/]/);
  const idx = parts.indexOf(`chromium-${rev}`);
  if (idx < 0) return null;
  const cacheRoot = parts.slice(0, idx).join('/');
  const { shellArch, shellExe } = archNames();
  const candidate = join(cacheRoot, `chromium_headless_shell-${rev}`, shellArch, shellExe);
  return isExecutable(candidate) ? candidate : null;
}

// 扫描本地缓存:期望版本缺失时的回退选择
// (对应 render.py _scan_local_chromium;排序键 (dist, isShell, path),
//   dist 相同时 headless shell 优先,避开 render.py 里按路径字典序的瑕疵)
function scanLocal(expectedExe) {
  const root = browserCacheRoot();
  if (!existsSync(root)) return null;

  const em = /chromium-(\d+)/.exec(expectedExe || '');
  const desired = em ? parseInt(em[1], 10) : null;
  const { shellArch, fullArchs, shellExe, fullExe } = archNames();

  const entries = readdirSync(root, { withFileTypes: true })
    .filter(e => e.isDirectory())
    .map(e => e.name);

  const candidates = [];  // [dist, isShell(0=shell优先), path]

  // ① headless shell:chromium_headless_shell-<rev>/<shellArch>/<shellExe>
  for (const name of entries) {
    const m = /^chromium_headless_shell-(\d+)$/.exec(name);
    if (!m) continue;
    const rev = parseInt(m[1], 10);
    const c = join(root, name, shellArch, shellExe);
    if (isExecutable(c)) {
      const dist = desired === null ? rev : Math.abs(desired - rev);
      candidates.push([dist, 0, c]);
    }
  }

  // ② full chromium:chromium-<rev>/<fullArch>/<fullExe>
  for (const name of entries) {
    const m = /^chromium-(\d+)$/.exec(name);
    if (!m) continue;
    const rev = parseInt(m[1], 10);
    for (const arch of fullArchs) {
      const c = join(root, name, arch, fullExe);
      if (isExecutable(c)) {
        const dist = desired === null ? rev : Math.abs(desired - rev);
        candidates.push([dist, 1, c]);
        break;
      }
    }
  }

  if (candidates.length === 0) return null;
  candidates.sort((a, b) => (a[0] - b[0]) || (a[1] - b[1]));
  return candidates[0][2];
}

export function pickBrowserExe() {
  // ① 环境变量覆盖(与 render.py 同一变量,box-agent 运行脚本已导出)
  const override = process.env.PPT_SKILL_BROWSER_EXE;
  if (override) {
    const p = resolve(expandHome(override));
    if (isExecutable(p)) return p;
    console.error(`[browser_picker] PPT_SKILL_BROWSER_EXE 不存在: ${p},忽略并回退`);
  }

  // ② playwright 期望路径
  let expected = null;
  try {
    expected = chromium.executablePath();
  } catch {
    return null;
  }

  // ③ 期望路径存在 → 优选同 revision headless shell
  if (existsSync(expected)) {
    return headlessShellFor(expected) || expected;
  }

  // ④ 期望版本缺失 → 扫描本地缓存回退
  const local = scanLocal(expected);
  if (local) {
    console.error(`[browser_picker] 期望 ${expected} 不存在,回退到本地 ${local}`);
    return local;
  }

  // ⑤ 兜底返回期望路径(保持现状行为,让 playwright 自行报错)
  return expected;
}
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