@litfamily/litcodex 1.0.14 → 1.0.16

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 (122) hide show
  1. package/README-Ko-KR.md +10 -10
  2. package/README.md +10 -10
  3. package/dist/install/generated-skill-payload-hashes.d.ts +101 -40
  4. package/dist/install/generated-skill-payload-hashes.js +101 -40
  5. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  6. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  7. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  8. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  9. package/marketplace/plugins/litcodex/components/lit-loop/dist/auto-handoff.js +11 -7
  10. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  11. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  12. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  13. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  14. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  15. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  16. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/THIRD-PARTY-NOTICE.txt +0 -2
  17. package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +16 -12
  18. package/marketplace/plugins/litcodex/skills/lit-docx/references/components.md +113 -0
  19. package/marketplace/plugins/litcodex/skills/lit-docx/references/direction-step.md +164 -0
  20. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/01-report-ko.md +95 -0
  21. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/02-brief-ko.md +45 -0
  22. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/03-manual-ko.md +105 -0
  23. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/04-proposal-ko.md +97 -0
  24. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/05-memo-en.md +34 -0
  25. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/06-journal-en.md +89 -0
  26. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/07-report-en.md +101 -0
  27. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/08-proposal-en.md +94 -0
  28. package/marketplace/plugins/litcodex/skills/lit-docx/references/examples/09-memo-ko.md +34 -0
  29. package/marketplace/plugins/litcodex/skills/lit-docx/references/page-composition.md +141 -0
  30. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/brief.md +70 -0
  31. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/journal.md +73 -0
  32. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/manual.md +70 -0
  33. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/memo.md +75 -0
  34. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/proposal.md +71 -0
  35. package/marketplace/plugins/litcodex/skills/lit-docx/references/tonalities/report.md +83 -0
  36. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/convert_md_to_docx.py +401 -58
  37. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/docx_craft.py +124 -1
  38. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/docx_design.py +2446 -0
  39. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/docx_layout.py +960 -0
  40. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/slop_lint.py +21 -6
  41. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/brief.yaml +28 -0
  42. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/journal.yaml +26 -0
  43. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/manual.yaml +26 -0
  44. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/memo.yaml +27 -0
  45. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/proposal.yaml +27 -0
  46. package/marketplace/plugins/litcodex/skills/lit-docx/templates/tonalities/report.yaml +27 -0
  47. package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +12 -11
  48. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/public/static/Pretendard-Bold.otf +0 -0
  49. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/public/static/Pretendard-Regular.otf +0 -0
  50. package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +33 -29
  51. package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +11 -2
  52. package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +179 -0
  53. package/marketplace/plugins/litcodex/skills/lit-pptx/references/design-system-azure.md +1 -1
  54. package/marketplace/plugins/litcodex/skills/lit-pptx/references/direction-step.md +203 -0
  55. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/01-pitch-signal-ko.md +185 -0
  56. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/02-pitch-studio-en.md +162 -0
  57. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/03-business-review-ledger-ko.md +229 -0
  58. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/04-research-talk-paper-en.md +212 -0
  59. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/05-research-keynote-night-ko.md +191 -0
  60. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/06-lecture-chalk-ko.md +175 -0
  61. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/07-data-review-night-en.md +241 -0
  62. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/08-field-report-atlas-ko.md +168 -0
  63. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/09-briefing-gazette-ko.md +219 -0
  64. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/10-status-update-ledger-en.md +157 -0
  65. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/11-portfolio-studio-ko.md +183 -0
  66. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/12-tutorial-chalk-en.md +176 -0
  67. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/13-status-update-gazette-ko.md +157 -0
  68. package/marketplace/plugins/litcodex/skills/lit-pptx/references/interview-protocol.md +1 -1
  69. package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +210 -0
  70. package/marketplace/plugins/litcodex/skills/lit-pptx/references/title-treatments.md +146 -0
  71. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/atlas.md +113 -0
  72. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/chalk.md +115 -0
  73. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/gazette.md +118 -0
  74. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/ledger.md +129 -0
  75. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/night.md +126 -0
  76. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/paper.md +109 -0
  77. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/signal.md +121 -0
  78. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/studio.md +111 -0
  79. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +65 -17
  80. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +654 -11
  81. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +1 -1
  82. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/inventory.py +32 -2
  83. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/directive-parser.js +2 -2
  84. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/grid-resolver.js +521 -0
  85. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +401 -16
  86. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/markdown-loader.js +6 -4
  87. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-adapter-html.js +2 -2
  88. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-adapter-pptx.js +498 -145
  89. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-pack.js +3558 -0
  90. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-ast.js +54 -6
  91. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +335 -11
  92. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +2 -1
  93. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +99 -19
  94. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/validate_pptx.py +6 -1
  95. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/boilerplate_professional.css +6 -6
  96. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-A2Z/layout-mapping.yaml +1 -1
  97. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-A2Z/template.yaml +4 -1
  98. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-PRO/layout-mapping.yaml +1 -1
  99. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-PRO/template.yaml +4 -1
  100. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +105 -0
  101. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +110 -0
  102. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +105 -0
  103. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +106 -0
  104. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/night/pack.yaml +106 -0
  105. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/paper/pack.yaml +111 -0
  106. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/signal/pack.yaml +107 -0
  107. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/studio/pack.yaml +105 -0
  108. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +1 -1
  109. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/fonts.mjs +6 -6
  110. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gate.mjs +1 -1
  111. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +2 -2
  112. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +1 -1
  113. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +1 -1
  114. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +2 -2
  115. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +1 -1
  116. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/type-and-timing.md +3 -3
  117. package/node_modules/@litcodex/lit-loop/dist/auto-handoff.js +11 -7
  118. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  119. package/package.json +2 -2
  120. package/readme-assets/badge-version.svg +1 -1
  121. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/public/static/PretendardGOV-Bold.otf +0 -0
  122. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/public/static/PretendardGOV-Regular.otf +0 -0
@@ -1,7 +1,26 @@
1
- """Office craft checks over DOCX XML without a new runtime dependency."""
1
+ """The lit-docx gate: office craft checks over the DOCX XML, plus the document output checks.
2
+
3
+ `audit_docx_office_floor` (OF-301 measure, OF-302 numeric alignment) reads the XML with the
4
+ standard library. Run as a script, this file is the document gate:
5
+
6
+ python3 docx_craft.py out.docx --source draft.md [--layout] [--tonality Report] [--compare other.docx]
7
+
8
+ It adds a content check (every Markdown heading reached the document, no unfilled blank, no
9
+ frontmatter printed as text) and docx_layout.py: noun-phrase headings and heading order always;
10
+ the restraint checks of the document spec on a tonality document (date.iso on every path);
11
+ with --layout the pages, rendered through soffice in a private profile, for fill, stranded
12
+ headings, splits, component variety and the cover block; with --compare the structural
13
+ difference from the same source in another tonality. Prints JSON; exit 0 on PASS, 1 on FAIL.
14
+ """
2
15
  from __future__ import annotations
3
16
 
17
+ import argparse
18
+ import json
4
19
  import re
20
+ import shutil
21
+ import subprocess
22
+ import sys
23
+ import tempfile
5
24
  import zipfile
6
25
  from dataclasses import dataclass
7
26
  from pathlib import Path
@@ -93,3 +112,107 @@ def audit_docx_office_floor(path: Path) -> list[DocxFinding]:
93
112
  elif align.get(f'{W}val') != 'right':
94
113
  result.append(DocxFinding('OF-302', 0, index + 1, 'DOCX', 'Numeric cell is explicitly not right aligned', _text(cell)[:80], 'HIGH', 'measured'))
95
114
  return result
115
+
116
+
117
+ HEADING = re.compile(r"^(#{1,6})\s+(.+?)\s*#*\s*$")
118
+ BLANK = re.compile(r"\[(?![^\]]*\d)[^\]\n]{1,12}\]|\bXXX\b|\bTBD\b|○○|\{\{[^}]*\}\}")
119
+ FRONTMATTER_LINE = re.compile(r"^(title|subtitle|author|organization|date|notice|tonality|publisher|lang):\s")
120
+
121
+
122
+ def check_content(docx_path: Path, source_text: str | None) -> dict:
123
+ """Body text exists, every source heading reached the page, no blank or frontmatter left."""
124
+ import docx_layout
125
+ from docx import Document
126
+
127
+ document = Document(str(docx_path))
128
+ paragraphs = [p.text for p in document.paragraphs]
129
+ cells = [c.text for t in document.tables for r in t.rows for c in r.cells]
130
+ page_text = docx_layout.norm("".join(paragraphs + cells))
131
+ missing, fenced = [], False
132
+ for line in (source_text or "").split("---", 2)[-1].splitlines() if source_text else []:
133
+ if line.lstrip().startswith(("```", "~~~")):
134
+ fenced = not fenced
135
+ continue
136
+ match = None if fenced else HEADING.match(line)
137
+ if match and docx_layout.norm(re.sub(r"[*_`]", "", match.group(2))) not in page_text:
138
+ missing.append(re.sub(r"[*_`]", "", match.group(2)).strip())
139
+ blanks = sorted({m.group(0) for text in paragraphs + cells for m in BLANK.finditer(text)})
140
+ leaked = [p for p in paragraphs[:8] if FRONTMATTER_LINE.match(p)]
141
+ chars = sum(len(p.strip()) for p in paragraphs + cells)
142
+ return {"pass": chars > 0 and not missing and not blanks and not leaked, "body_chars": chars,
143
+ "missing_headings": missing, "blanks": blanks, "frontmatter_leak": leaked}
144
+
145
+
146
+ def render_pdf(docx_path: Path, out_dir: Path) -> Path | None:
147
+ soffice = shutil.which("soffice") or shutil.which("libreoffice")
148
+ if not soffice:
149
+ return None
150
+ with tempfile.TemporaryDirectory(prefix="lit-docx-profile-") as profile:
151
+ subprocess.run([soffice, f"-env:UserInstallation={Path(profile).as_uri()}", "--headless", "--convert-to", "pdf",
152
+ "--outdir", str(out_dir), str(docx_path)], capture_output=True, text=True, timeout=300)
153
+ pdf = out_dir / f"{docx_path.stem}.pdf"
154
+ return pdf if pdf.exists() else None
155
+
156
+
157
+ def output_checks(docx_path: Path, front: dict, args) -> dict:
158
+ import docx_layout
159
+
160
+ tonality = bool(args.tonality or front.get("tonality"))
161
+ info = docx_layout.read_docx(docx_path)
162
+ found = docx_layout.structural(info, front, args.kind == "manuscript", tonality) + docx_layout.restraint(docx_path, tonality)
163
+ result = {"components": info["components"], "rendered": False}
164
+ if args.compare:
165
+ mine, other = docx_layout.structure(docx_path), docx_layout.structure(args.compare.expanduser().resolve())
166
+ differ = docx_layout.structure_diff(mine, other)
167
+ result["structure"] = {"this": mine, "other": other, "differ": differ}
168
+ if len(differ) < 3:
169
+ found.append(docx_layout.finding(
170
+ "tonality.structure", "FAIL", None, f"{len(differ)} structural difference(s): {', '.join(differ) or 'none'} (at least 3)",
171
+ "Tonalities differ in structure: title block, summary form, numbering, components, running head, contents."))
172
+ if args.layout:
173
+ with tempfile.TemporaryDirectory(prefix="lit-docx-pages-") as tmp:
174
+ pdf = render_pdf(docx_path, Path(tmp))
175
+ if pdf is None:
176
+ result["render"] = "soffice missing or the conversion failed: the page checks did not run"
177
+ else:
178
+ page_found, pages = docx_layout.paged(info, docx_layout.read_pdf(pdf), tonality, front)
179
+ found += page_found
180
+ result.update(pages, rendered=True)
181
+ result["findings"] = [f for f in found if f["severity"] == "FAIL"]
182
+ result["advisories"] = [f for f in found if f["severity"] != "FAIL"]
183
+ return result
184
+
185
+
186
+ def main(argv: list[str] | None = None) -> int:
187
+ parser = argparse.ArgumentParser(description="Pass/fail gate for a generated DOCX.")
188
+ parser.add_argument("docx", type=Path)
189
+ parser.add_argument("--source", type=Path, help="the Markdown the DOCX was converted from")
190
+ parser.add_argument("--kind", choices=("report", "manuscript"), default="report")
191
+ parser.add_argument("--layout", action="store_true", help="render through soffice and check the pages")
192
+ parser.add_argument("--tonality", help="the tonality used, when the source frontmatter does not name it")
193
+ parser.add_argument("--compare", type=Path, help="the same source in another tonality (structure check)")
194
+ args = parser.parse_args(argv)
195
+ sys.dont_write_bytecode = True
196
+ sys.path.insert(0, str(Path(__file__).resolve().parent))
197
+ from convert_md_to_docx import parse_frontmatter
198
+
199
+ docx_path = args.docx.expanduser().resolve()
200
+ source_text = args.source.read_text(encoding="utf-8") if args.source else None
201
+ front = parse_frontmatter(source_text)[0] if source_text and source_text.startswith("---") else {}
202
+ floor = audit_docx_office_floor(docx_path)
203
+ content = check_content(docx_path, source_text)
204
+ output = output_checks(docx_path, front, args)
205
+ blocking = [f for f in floor if f.severity == "HIGH"]
206
+ report = {
207
+ "file": str(docx_path),
208
+ "pass": not blocking and content["pass"] and not output["findings"],
209
+ "office_floor": [f.__dict__ for f in floor],
210
+ "content": content,
211
+ "output": output,
212
+ }
213
+ print(json.dumps(report, ensure_ascii=False, indent=2))
214
+ return 0 if report["pass"] else 1
215
+
216
+
217
+ if __name__ == "__main__":
218
+ raise SystemExit(main())