Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codebuddy/skills/pagx/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ relevant reference:
Before running any `pagx` command, ensure it is installed and meets the minimum version:

```bash
PAGX_MIN="0.4.33"
PAGX_MIN="0.4.38"
if ! command -v pagx &>/dev/null; then
npm install -g @libpag/pagx
elif [ "$(printf '%s\n' "$PAGX_MIN" "$(pagx -v | awk '{print $2}')" | sort -V | head -1)" != "$PAGX_MIN" ]; then
Expand Down
15 changes: 15 additions & 0 deletions cli/npm/bin/pagx.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ if (!process.env.PAGX_HTML_SNAPSHOT_BIN) {
}
}

// Intercept the preview sub-command and delegate to pagx-preview (a Node.js-based
// HTTP server + MCP service). The preview module lives under preview/ at the package
// root so it can be bundled and published alongside the native binary.
if (process.argv[2] === 'preview') {
const previewEntry = path.join(__dirname, '..', 'preview', 'src', 'cli.js');
if (!fs.existsSync(previewEntry)) {
console.error('pagx: preview command not available. Preview module not found.');
process.exit(1);
}
const { spawn } = require('child_process');
const child = spawn('node', [previewEntry, ...process.argv.slice(3)], { stdio: 'inherit' });
child.on('exit', (code) => process.exit(code != null ? code : 1));
return;
}

try {
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
} catch (e) {
Expand Down
8 changes: 7 additions & 1 deletion cli/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@libpag/pagx",
"version": "0.4.33",
"version": "0.4.38",
"description": "PAGX command-line tool for validation, rendering, optimization and formatting",
"license": "Apache-2.0",
"keywords": [
Expand Down Expand Up @@ -42,9 +42,15 @@
"x64",
"arm64"
],
"dependencies": {
"@modelcontextprotocol/sdk": "^1.0.0",
"chokidar": "^3.6.0",
"express": "^4.21.1"
},
"files": [
"bin/",
"html-snapshot/",
"preview/",
"README.md"
]
}
14 changes: 14 additions & 0 deletions playground/pagx-preview/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dependencies
node_modules/

# Logs
*.log

# Packing output
*.tgz

# Generated/copied build artifacts: pagx-viewer wasm+glue, pagx-player bundle, MCP ext bundle,
# and the MCP widget bundle. Kept in a single directory outside static/ (mirrors pagx-playground's
# wasm-mt/ layout) and never committed, so the source tree stays free of heavy binaries. These are
# regenerated on demand via `npm run build` and on publish via the prepack hook.
wasm/
8 changes: 8 additions & 0 deletions playground/pagx-preview/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Never ship source maps or wasm debug symbols in the published package — they only bloat the
# tarball (the player map alone is 2MB+). This is a safety net on top of prebuild.js, which
# already skips copying maps on release builds.
*.map
*.wasm.symbols

# Local packing output.
*.tgz
Loading
Loading