@hirokisakabe/pom-cli 0.7.0 → 0.8.0

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.
package/README.md CHANGED
@@ -15,6 +15,7 @@
15
15
  - **Live Preview Server** — `pom preview` opens a browser, watches the source file, and rebuilds + reloads on every save (handles editor atomic writes like Vim).
16
16
  - **PPTX Build** — `pom build` converts `.pom.xml` / `.pom.md` to a `.pptx` file, with optional `--watch` mode for incremental rebuilds.
17
17
  - **PNG / SVG Render** — `pom render` rasterizes each slide to PNG (default) or SVG without LibreOffice, useful for slide-image previews in docs.
18
+ - **Theme Extraction** — `pom theme extract` reads an existing `.pptx` and prints its theme colors as pom `ThemeTokens` JSON, for onboarding brand assets.
18
19
  - **Diagnostic Surfacing** — Layout, image, master, and auto-fit diagnostics from `buildPptx` fail the run on stderr with a non-zero exit (`pom build` / `pom render`), while `pom preview` keeps updating so issues can be fixed interactively.
19
20
  - **Bundled Fonts** — Carlito and Noto Sans CJK JP are bundled for SVG / PNG rendering, so output looks the same on machines without those fonts installed.
20
21
  - **Configurable Output** — Choose port, target slides, output format, text rendering mode (`path` outlines vs native `<text>`), and verbose per-step timing.
@@ -139,6 +140,16 @@ To print per-step timing on stderr:
139
140
  pom render slides.pom.xml -o ./images --verbose
140
141
  ```
141
142
 
143
+ ### Theme Extract
144
+
145
+ Extracts PowerPoint theme colors from an existing `.pptx` as pom `ThemeTokens` JSON — useful for onboarding brand assets (e.g. the `pom-theme` agent skill).
146
+
147
+ ```bash
148
+ pom theme extract brand-master.pptx
149
+ ```
150
+
151
+ Prints a JSON array to stdout with one entry per visible slide layout (`text` / `background` / `primary` / `secondary` / `accent3`–`accent6`, all 6-digit uppercase hex prefixed with `#`), preserving the source master/layout order.
152
+
142
153
  ## Diagnostics
143
154
 
144
155
  `pom build` and `pom render` invoke `buildPptx` with `strict: true`, so any diagnostic collected during the build — layout problems (`NODE_OUT_OF_BOUNDS`, `NODE_OVERLAP`, `ARROW_REF_NOT_FOUND`, `PER_SIDE_BORDER_WITH_RADIUS`), image / master issues (`IMAGE_MEASURE_FAILED`, `IMAGE_NOT_PREFETCHED`, `MASTER_PPTX_PARSE_FAILED`), or `AUTOFIT_OVERFLOW` — fails the run with a non-zero exit code and prints the diagnostic codes / messages to stderr. Fix the offending XML or input and re-run to proceed. The `pom preview` server continues to update even when diagnostics are emitted, so you can iterate on the file interactively.
package/dist/cli.js CHANGED
@@ -5,6 +5,7 @@ import { DiagnosticsError } from "@hirokisakabe/pom";
5
5
  import { runBuild, runBuildWatch } from "./build.js";
6
6
  import { runPreview } from "./preview.js";
7
7
  import { runRender } from "./render.js";
8
+ import { runThemeExtract } from "./theme.js";
8
9
  const require = createRequire(import.meta.url);
9
10
  const { version } = require("../package.json");
10
11
  const program = new Command();
@@ -117,4 +118,15 @@ program
117
118
  process.exit(1);
118
119
  });
119
120
  });
121
+ const theme = program.command("theme").description("Theme-related utilities");
122
+ theme
123
+ .command("extract")
124
+ .description("Extract PowerPoint theme colors as pom ThemeTokens JSON (one entry per visible slide layout)")
125
+ .argument("<pptx>", "Input PPTX file")
126
+ .action((pptx) => {
127
+ runThemeExtract(pptx).catch((err) => {
128
+ console.error(err instanceof Error ? err.message : String(err));
129
+ process.exit(1);
130
+ });
131
+ });
120
132
  program.parse();
@@ -0,0 +1,2 @@
1
+ export declare function runThemeExtract(inputFile: string): Promise<void>;
2
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAIA,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtE"}
package/dist/theme.js ADDED
@@ -0,0 +1,12 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { extractThemeTokensFromPptx } from "@hirokisakabe/pom";
4
+ export async function runThemeExtract(inputFile) {
5
+ const absInput = path.resolve(inputFile);
6
+ if (!fs.existsSync(absInput)) {
7
+ throw new Error(`Input file not found: ${absInput}`);
8
+ }
9
+ const buffer = fs.readFileSync(absInput);
10
+ const tokens = await extractThemeTokensFromPptx(buffer);
11
+ console.log(JSON.stringify(tokens, null, 2));
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hirokisakabe/pom-cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "CLI tool for pom — preview, build, and render presentations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,13 +30,13 @@
30
30
  "node": ">=22"
31
31
  },
32
32
  "dependencies": {
33
- "@hirokisakabe/pom": "^9.0.0",
33
+ "@hirokisakabe/pom": "^9.1.0",
34
34
  "@hirokisakabe/pom-md": "^4.0.0",
35
35
  "commander": "^15.0.0",
36
36
  "pptx-glimpse": "^2.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/node": "^25.9.3"
39
+ "@types/node": "^26.1.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsc && node -e \"require('fs').chmodSync('dist/cli.js', '755')\"",