@taloswork/ose-shared 0.1.12 → 0.1.13

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.
Files changed (66) hide show
  1. package/package.json +3 -3
  2. package/skills/document/SKILL.md +33 -45
  3. package/skills/document/bin/deck-build.cjs +10482 -272
  4. package/skills/document/bin/deck-chart.cjs +21 -12
  5. package/skills/document/bin/deck-plan.cjs +11654 -42
  6. package/skills/document/bin/deck-qa.cjs +95 -21
  7. package/skills/document/bin/deck-scenario.cjs +20 -3
  8. package/skills/document/bin/deck-styles.cjs +1604 -0
  9. package/skills/document/bin/doc-convert.cjs +182 -257
  10. package/skills/document/bin/doc-fill.cjs +140 -19
  11. package/skills/document/bin/doc-gen.cjs +1903 -281
  12. package/skills/document/bin/doc-validate.cjs +127 -52
  13. package/skills/document/bin/docx-defaults.cjs +9907 -0
  14. package/skills/document/bin/html2pptx.cjs +35949 -31972
  15. package/skills/document/bin/pdf-form.cjs +8 -0
  16. package/skills/document/bin/pdf-ops.cjs +8 -0
  17. package/skills/document/bin/pptx-notes.cjs +10038 -0
  18. package/skills/document/bin/pptx-tokenize.cjs +19 -4
  19. package/skills/document/bin/template-skin.cjs +10910 -0
  20. package/skills/document/bin-reference.md +15 -10
  21. package/skills/document/catalog.json +33 -32
  22. package/skills/document/content-pipeline.md +79 -44
  23. package/skills/document/deck-design.md +55 -32
  24. package/skills/document/generated-visuals.md +99 -0
  25. package/skills/document/layouts/MAINTAINERS.md +33 -0
  26. package/skills/document/layouts/README.md +20 -20
  27. package/skills/document/layouts/big-stat.tpl +1 -1
  28. package/skills/document/layouts/capacity.json +1 -1
  29. package/skills/document/layouts/cards-3.tpl +1 -1
  30. package/skills/document/layouts/chart-full.tpl +1 -1
  31. package/skills/document/layouts/chart-kpi.tpl +1 -1
  32. package/skills/document/layouts/comparison.tpl +1 -1
  33. package/skills/document/layouts/data-table.tpl +1 -1
  34. package/skills/document/layouts/funnel.tpl +1 -1
  35. package/skills/document/layouts/gantt.tpl +1 -1
  36. package/skills/document/layouts/hub-flow.tpl +4 -0
  37. package/skills/document/layouts/icon-row.tpl +1 -1
  38. package/skills/document/layouts/image-grid.tpl +1 -1
  39. package/skills/document/layouts/matrix-2x2.tpl +1 -1
  40. package/skills/document/layouts/mock-qa.tpl +4 -0
  41. package/skills/document/layouts/profiles.json +2 -2
  42. package/skills/document/layouts/pyramid.tpl +1 -1
  43. package/skills/document/layouts/radar.tpl +1 -1
  44. package/skills/document/layouts/ring-progress.tpl +1 -1
  45. package/skills/document/layouts/slots.json +1 -1
  46. package/skills/document/layouts/steps-vertical.tpl +1 -1
  47. package/skills/document/layouts/steps.tpl +1 -1
  48. package/skills/document/layouts/three-kpi.tpl +1 -1
  49. package/skills/document/layouts/timeline.tpl +1 -1
  50. package/skills/document/layouts/toc-panel.tpl +1 -1
  51. package/skills/document/layouts/two-kpi.tpl +2 -2
  52. package/skills/document/layouts/versus.tpl +1 -1
  53. package/skills/document/packs/README.md +1 -1
  54. package/skills/document/pdf.md +13 -0
  55. package/skills/document/rewrite.md +23 -8
  56. package/skills/document/scenarios.json +19 -2
  57. package/skills/document/scenarios.schema.json +1 -0
  58. package/skills/document/styles/_backdrops/rimlight.html +3 -2
  59. package/skills/document/styles/_contract-defaults.css +6 -1
  60. package/skills/document/styles/_samples/_groups/biz-premium.webp +0 -0
  61. package/skills/document/styles/_samples/mckinsey.webp +0 -0
  62. package/skills/document/styles/mckinsey/backdrop.html +7 -5
  63. package/skills/grill-me/SKILL.md +6 -0
  64. package/skills/grill-me/agents/openai.yaml +5 -0
  65. package/skills/grilling/SKILL.md +28 -0
  66. package/skills/grilling/agents/openai.yaml +3 -0
@@ -9790,9 +9790,9 @@ var require_load = __commonJS({
9790
9790
  var require_lib3 = __commonJS({
9791
9791
  "node_modules/jszip/lib/index.js"(exports2, module2) {
9792
9792
  "use strict";
9793
- function JSZip4() {
9794
- if (!(this instanceof JSZip4)) {
9795
- return new JSZip4();
9793
+ function JSZip6() {
9794
+ if (!(this instanceof JSZip6)) {
9795
+ return new JSZip6();
9796
9796
  }
9797
9797
  if (arguments.length) {
9798
9798
  throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
@@ -9801,7 +9801,7 @@ var require_lib3 = __commonJS({
9801
9801
  this.comment = null;
9802
9802
  this.root = "";
9803
9803
  this.clone = function() {
9804
- var newObj = new JSZip4();
9804
+ var newObj = new JSZip6();
9805
9805
  for (var i in this) {
9806
9806
  if (typeof this[i] !== "function") {
9807
9807
  newObj[i] = this[i];
@@ -9810,16 +9810,16 @@ var require_lib3 = __commonJS({
9810
9810
  return newObj;
9811
9811
  };
9812
9812
  }
9813
- JSZip4.prototype = require_object();
9814
- JSZip4.prototype.loadAsync = require_load();
9815
- JSZip4.support = require_support();
9816
- JSZip4.defaults = require_defaults();
9817
- JSZip4.version = "3.10.1";
9818
- JSZip4.loadAsync = function(content, options) {
9819
- return new JSZip4().loadAsync(content, options);
9813
+ JSZip6.prototype = require_object();
9814
+ JSZip6.prototype.loadAsync = require_load();
9815
+ JSZip6.support = require_support();
9816
+ JSZip6.defaults = require_defaults();
9817
+ JSZip6.version = "3.10.1";
9818
+ JSZip6.loadAsync = function(content, options) {
9819
+ return new JSZip6().loadAsync(content, options);
9820
9820
  };
9821
- JSZip4.external = require_external();
9822
- module2.exports = JSZip4;
9821
+ JSZip6.external = require_external();
9822
+ module2.exports = JSZip6;
9823
9823
  }
9824
9824
  });
9825
9825
 
@@ -27608,6 +27608,7 @@ __export(pdf_extract_exports, {
27608
27608
  extractPdfText: () => extractPdfText,
27609
27609
  extractPdfTextLines: () => extractPdfTextLines,
27610
27610
  pdfNeedsPassword: () => pdfNeedsPassword,
27611
+ pngPixels: () => pngPixels,
27611
27612
  renderPdfPages: () => renderPdfPages,
27612
27613
  scanPdfSignals: () => scanPdfSignals,
27613
27614
  textMathHint: () => textMathHint,
@@ -27901,6 +27902,13 @@ async function renderPdfPages(bytes, pages, scale = 2, maxEdge) {
27901
27902
  }
27902
27903
  return out;
27903
27904
  }
27905
+ async function pngPixels(png) {
27906
+ const mupdf = await loadMupdf();
27907
+ const pix = new mupdf.Image(png).toPixmap();
27908
+ const width = pix.getWidth(), height = pix.getHeight();
27909
+ const channels = pix.getStride() / width;
27910
+ return { width, height, channels, data: pix.getPixels() };
27911
+ }
27904
27912
  async function extractPdfImages(bytes, pages) {
27905
27913
  const { doc } = await openDoc(bytes);
27906
27914
  const total = doc.countPages();
@@ -27973,8 +27981,74 @@ var import_promises2 = require("node:fs/promises");
27973
27981
  var import_node_path3 = require("node:path");
27974
27982
 
27975
27983
  // packages/core/dist/document/doc-validate.js
27976
- var import_jszip = __toESM(require_lib3(), 1);
27984
+ var import_jszip3 = __toESM(require_lib3(), 1);
27977
27985
  var import_pdf_lib = __toESM(require_cjs(), 1);
27986
+
27987
+ // packages/core/dist/document/pptx-notes.js
27988
+ var import_jszip = __toESM(require_lib3(), 1);
27989
+
27990
+ // packages/core/dist/document/pptx-parts.js
27991
+ var SLIDE_PART = /^ppt\/slides\/(slide\d+\.xml)$/;
27992
+ function relsPathFor(path) {
27993
+ return path.replace(SLIDE_PART, "ppt/slides/_rels/$1.rels");
27994
+ }
27995
+ function attr(el, name) {
27996
+ return new RegExp(`\\b${name}="([^"]*)"`).exec(el)?.[1];
27997
+ }
27998
+ async function slidePartsInOrder(zip) {
27999
+ const byNumber = Object.keys(zip.files).filter((p) => SLIDE_PART.test(p)).sort((a, b) => Number(/(\d+)\.xml$/.exec(a)[1]) - Number(/(\d+)\.xml$/.exec(b)[1]));
28000
+ const toParts = (paths) => paths.map((path, i) => ({ position: i + 1, path, relsPath: relsPathFor(path) }));
28001
+ const pres = await zip.file("ppt/presentation.xml")?.async("string");
28002
+ const rels = await zip.file("ppt/_rels/presentation.xml.rels")?.async("string");
28003
+ if (!pres || !rels)
28004
+ return toParts(byNumber);
28005
+ const targetById = /* @__PURE__ */ new Map();
28006
+ for (const [el] of rels.matchAll(/<Relationship\b[^>]*>/g)) {
28007
+ const id = attr(el, "Id");
28008
+ const target = attr(el, "Target");
28009
+ if (!id || !target)
28010
+ continue;
28011
+ targetById.set(id, target.startsWith("/") ? target.slice(1) : `ppt/${target.replace(/^\.\//, "")}`);
28012
+ }
28013
+ const list = /<p:sldIdLst\b[^>]*>([\s\S]*?)<\/p:sldIdLst>/.exec(pres)?.[1] ?? "";
28014
+ const ordered = [...list.matchAll(/<p:sldId\b[^>]*>/g)].map(([el]) => targetById.get(attr(el, "r:id") ?? "")).filter((p) => p !== void 0 && SLIDE_PART.test(p) && zip.file(p) !== null);
28015
+ const complete = ordered.length === byNumber.length && new Set(ordered).size === ordered.length;
28016
+ return toParts(complete ? ordered : byNumber);
28017
+ }
28018
+
28019
+ // packages/core/dist/document/pptx-notes.js
28020
+ var REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
28021
+ var NOTES_SLIDE_REL = `${REL_NS}/notesSlide`;
28022
+ var NOTES_MASTER_REL = `${REL_NS}/notesMaster`;
28023
+ var SLIDE_REL = `${REL_NS}/slide`;
28024
+ async function notesKeynoteIssues(zip) {
28025
+ const out = [];
28026
+ for (const p of Object.keys(zip.files).filter((p2) => /^ppt\/notesSlides\/notesSlide\d+\.xml$/.test(p2)).sort()) {
28027
+ const xml = await zip.file(p).async("string");
28028
+ if (!/<p:clrMapOvr\b/.test(xml))
28029
+ out.push(p);
28030
+ }
28031
+ return out;
28032
+ }
28033
+ async function unlistedNotesMaster(zip) {
28034
+ const relsFile = zip.file("ppt/_rels/presentation.xml.rels");
28035
+ const presFile = zip.file("ppt/presentation.xml");
28036
+ if (!relsFile || !presFile)
28037
+ return null;
28038
+ const rel = new RegExp(`<Relationship\\b[^>]*Type="${NOTES_MASTER_REL}"[^>]*>`).exec(await relsFile.async("string"))?.[0];
28039
+ const rid = rel ? /\bId="([^"]+)"/.exec(rel)?.[1] : void 0;
28040
+ if (!rid)
28041
+ return null;
28042
+ return /<p:notesMasterId\b/.test(await presFile.async("string")) ? null : rid;
28043
+ }
28044
+
28045
+ // packages/core/dist/document/docx-defaults.js
28046
+ var import_jszip2 = __toESM(require_lib3(), 1);
28047
+ function hasDefaultParagraphStyle(stylesXml) {
28048
+ return [...stylesXml.matchAll(/<w:style\b[^>]*>/g)].some(([tag]) => /\bw:type="paragraph"/.test(tag) && /\bw:default="(1|true|on)"/.test(tag));
28049
+ }
28050
+
28051
+ // packages/core/dist/document/doc-validate.js
27978
28052
  function looksLikePdf(bytes) {
27979
28053
  const head = Buffer.from(bytes.subarray(0, 1024)).toString("latin1");
27980
28054
  return head.includes("%PDF-");
@@ -28154,7 +28228,7 @@ async function validateOoxml(bytes) {
28154
28228
  const result = (kind) => ({ ok: errors.length === 0, kind, errors, warnings });
28155
28229
  let zip;
28156
28230
  try {
28157
- zip = await import_jszip.default.loadAsync(Buffer.from(bytes));
28231
+ zip = await import_jszip3.default.loadAsync(Buffer.from(bytes));
28158
28232
  } catch (e) {
28159
28233
  errors.push({ code: "zip-unreadable", message: `not a readable OOXML zip: ${e.message}` });
28160
28234
  return result("unknown");
@@ -28222,6 +28296,30 @@ async function validateOoxml(bytes) {
28222
28296
  }
28223
28297
  }
28224
28298
  }
28299
+ if (root.kind === "pptx") {
28300
+ const bad = await notesKeynoteIssues(zip);
28301
+ if (bad.length) {
28302
+ errors.push({
28303
+ code: "notes-keynote",
28304
+ part: bad[0],
28305
+ message: `${bad.length} notes slide(s) lack <p:clrMapOvr> (${bad.slice(0, 3).join(", ")}${bad.length > 3 ? ", \u2026" : ""}) \u2014 Keynote refuses the whole file ("\u6587\u4EF6\u683C\u5F0F\u65E0\u6548"). Repair with \`pptx-notes <in.pptx> {} <out.pptx>\`; write notes with pptx-notes, never by hand`
28306
+ });
28307
+ }
28308
+ }
28309
+ if (root.kind === "pptx" && await unlistedNotesMaster(zip)) {
28310
+ errors.push({
28311
+ code: "notes-keynote",
28312
+ part: "ppt/presentation.xml",
28313
+ message: 'the notes master is not listed in <p:notesMasterIdLst> (python-pptx leaves it out) \u2014 Keynote refuses the whole file ("\u6587\u4EF6\u683C\u5F0F\u65E0\u6548"). Repair with `pptx-notes <in.pptx> {} <out.pptx>`'
28314
+ });
28315
+ }
28316
+ if (root.kind === "docx" && has("word/styles.xml") && !hasDefaultParagraphStyle(await text("word/styles.xml"))) {
28317
+ errors.push({
28318
+ code: "docx-default-style",
28319
+ part: "word/styles.xml",
28320
+ message: 'no default paragraph style (w:default="1", usually "Normal") \u2014 Word fills the gap, but Pages lays every unstyled paragraph out like the one before it (a centred title turns the whole body huge and centred). Repair with `docx-defaults <in.docx> <out.docx>`; docx from doc-gen already has it'
28321
+ });
28322
+ }
28225
28323
  return result(root.kind);
28226
28324
  }
28227
28325
 
@@ -28229,7 +28327,7 @@ async function validateOoxml(bytes) {
28229
28327
  var import_node_path2 = require("node:path");
28230
28328
  var import_node_url2 = require("node:url");
28231
28329
  var import_promises = require("node:fs/promises");
28232
- var import_jszip2 = __toESM(require_lib3(), 1);
28330
+ var import_jszip4 = __toESM(require_lib3(), 1);
28233
28331
  var _xmllint = null;
28234
28332
  function loadXmllint() {
28235
28333
  if (!_xmllint) {
@@ -28285,7 +28383,7 @@ function errText(e) {
28285
28383
  }
28286
28384
  async function validateOoxmlStrict(bytes, schemaDir) {
28287
28385
  const [{ validateXML }, schemas] = await Promise.all([loadXmllint(), loadSchemaSet(schemaDir)]);
28288
- const zip = await import_jszip2.default.loadAsync(Buffer.from(bytes));
28386
+ const zip = await import_jszip4.default.loadAsync(Buffer.from(bytes));
28289
28387
  const checked = [];
28290
28388
  const skipped = [];
28291
28389
  const errors = [];
@@ -28328,7 +28426,7 @@ async function validateOoxmlStrict(bytes, schemaDir) {
28328
28426
  }
28329
28427
 
28330
28428
  // packages/core/dist/document/doc-design-lint.js
28331
- var import_jszip3 = __toESM(require_lib3(), 1);
28429
+ var import_jszip5 = __toESM(require_lib3(), 1);
28332
28430
 
28333
28431
  // packages/core/dist/document/ooxml-util.js
28334
28432
  function unescXml(s) {
@@ -28352,35 +28450,6 @@ function unescXml(s) {
28352
28450
  });
28353
28451
  }
28354
28452
 
28355
- // packages/core/dist/document/pptx-parts.js
28356
- var SLIDE_PART = /^ppt\/slides\/(slide\d+\.xml)$/;
28357
- function relsPathFor(path) {
28358
- return path.replace(SLIDE_PART, "ppt/slides/_rels/$1.rels");
28359
- }
28360
- function attr(el, name) {
28361
- return new RegExp(`\\b${name}="([^"]*)"`).exec(el)?.[1];
28362
- }
28363
- async function slidePartsInOrder(zip) {
28364
- const byNumber = Object.keys(zip.files).filter((p) => SLIDE_PART.test(p)).sort((a, b) => Number(/(\d+)\.xml$/.exec(a)[1]) - Number(/(\d+)\.xml$/.exec(b)[1]));
28365
- const toParts = (paths) => paths.map((path, i) => ({ position: i + 1, path, relsPath: relsPathFor(path) }));
28366
- const pres = await zip.file("ppt/presentation.xml")?.async("string");
28367
- const rels = await zip.file("ppt/_rels/presentation.xml.rels")?.async("string");
28368
- if (!pres || !rels)
28369
- return toParts(byNumber);
28370
- const targetById = /* @__PURE__ */ new Map();
28371
- for (const [el] of rels.matchAll(/<Relationship\b[^>]*>/g)) {
28372
- const id = attr(el, "Id");
28373
- const target = attr(el, "Target");
28374
- if (!id || !target)
28375
- continue;
28376
- targetById.set(id, target.startsWith("/") ? target.slice(1) : `ppt/${target.replace(/^\.\//, "")}`);
28377
- }
28378
- const list = /<p:sldIdLst\b[^>]*>([\s\S]*?)<\/p:sldIdLst>/.exec(pres)?.[1] ?? "";
28379
- const ordered = [...list.matchAll(/<p:sldId\b[^>]*>/g)].map(([el]) => targetById.get(attr(el, "r:id") ?? "")).filter((p) => p !== void 0 && SLIDE_PART.test(p) && zip.file(p) !== null);
28380
- const complete = ordered.length === byNumber.length && new Set(ordered).size === ordered.length;
28381
- return toParts(complete ? ordered : byNumber);
28382
- }
28383
-
28384
28453
  // packages/core/dist/document/png-decode.js
28385
28454
  var import_node_zlib = require("node:zlib");
28386
28455
  var SIG = [137, 80, 78, 71, 13, 10, 26, 10];
@@ -28477,6 +28546,14 @@ function decodePng(bytes) {
28477
28546
  }
28478
28547
  }
28479
28548
 
28549
+ // packages/core/dist/document/readable-type.js
28550
+ var MIN_FONT_PT = 10;
28551
+ var LABEL_MAX_CHARS = 24;
28552
+ var MIN_LABEL_FONT_PT = 8;
28553
+ function readableFloorPt(text) {
28554
+ return [...text.trim()].length <= LABEL_MAX_CHARS ? MIN_LABEL_FONT_PT : MIN_FONT_PT;
28555
+ }
28556
+
28480
28557
  // packages/core/dist/document/text-slack.js
28481
28558
  var SLACK_CJK_RE = /[\u3000-\u303F\u3400-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/;
28482
28559
  var PCT = { single: { cjk: 0.22, latin: 0.16 }, multi: { cjk: 0.1, latin: 0.06 } };
@@ -28672,9 +28749,7 @@ function lintSlideXml(slideXml, slideNumber, masterBg, expectedLang = detectDeck
28672
28749
  var EMU_PER_INCH = 914400;
28673
28750
  var DEFAULT_CANVAS = { w: 12192e3, h: 6858e3 };
28674
28751
  var OFFCANVAS_TOL = EMU_PER_INCH / 10;
28675
- var MIN_FONT_HUNDREDTHS = 1e3;
28676
- var LABEL_MAX_CHARS = 24;
28677
- var MIN_LABEL_FONT_HUNDREDTHS = 800;
28752
+ var MIN_FONT_HUNDREDTHS = MIN_FONT_PT * 100;
28678
28753
  var CHART_TEXT_RE = new RegExp(`<p:cNvPr\\b[^>]*\\bname="${CHART_TEXT_NAME}\\b`);
28679
28754
  var OVERLAP_RATIO = 0.3;
28680
28755
  function firstBox(block) {
@@ -28776,7 +28851,7 @@ function lintSlideGeometry(slideXml, slideNumber, canvas = DEFAULT_CANVAS) {
28776
28851
  continue;
28777
28852
  const text = unescXml(raw).trim();
28778
28853
  const sz = /<a:rPr\b[^>]*\bsz="(\d+)"/.exec(run)?.[1];
28779
- const floor = [...text].length <= LABEL_MAX_CHARS ? MIN_LABEL_FONT_HUNDREDTHS : MIN_FONT_HUNDREDTHS;
28854
+ const floor = readableFloorPt(text) * 100;
28780
28855
  if (sz && +sz < floor && (!smallest || +sz < smallest.sz)) {
28781
28856
  smallest = { sz: +sz, text, floor };
28782
28857
  }
@@ -28951,7 +29026,7 @@ async function backdropRaster(zip, slideXml, relsPath, canvas) {
28951
29026
  return media ? decodePng(await media.async("uint8array")) : void 0;
28952
29027
  }
28953
29028
  async function designLintPptx(bytes) {
28954
- const zip = await import_jszip3.default.loadAsync(Buffer.from(bytes));
29029
+ const zip = await import_jszip5.default.loadAsync(Buffer.from(bytes));
28955
29030
  const findings = [];
28956
29031
  let masterBg = { colored: false };
28957
29032
  const masterFile = Object.keys(zip.files).find((p) => /^ppt\/slideMasters\/slideMaster\d+\.xml$/.test(p));