Assemble all images in a workspace directory into a Word document with one
image per page (A4, 0.5-inch margins). Each page optionally reserves a ruled
writing area at the bottom for handwritten annotations.
PNG · JPG/JPEG · GIF · BMP · SVG
scripts/create_doc.js — Node.js script (requires the docx npm package).
The docx npm package must be installed globally (one-time setup):
npm install -g docx
Skip this step if docx is already listed in npm ls -g --depth=0.
node scripts/create_doc.js "<WORKSPACE_DIR>"
Set NODE_PATH to the global node_modules directory so that the
skill script can resolve the docx package:
NODE_PATH="$(npm root -g)" node scripts/create_doc.js "<WORKSPACE_DIR>"
| Argument | Required | Default | Description |
|---|---|---|---|
| ----------------- | ---------- | ------------------------------------------ | ------------- |
workspace_dir | ✅ | — | Current workspace root |
output_file | ❌ | | Output file path |
writing_lines | ❌ | 5 | Ruled lines per page |
image_ratio | ❌ | 0.68 | Image height as fraction of page |
# Basic usage
node scripts/create_doc.js "/path/to/workspace"
# Custom output file
node scripts/create_doc.js "/path/to/workspace" "/path/to/workspace/output.docx"
# Full options: custom output, 3 lines per page, 75% image height
node scripts/create_doc.js "/path/to/workspace" "/path/to/workspace/output.docx" 3 0.75
The script generates a .docx file containing all images from the workspace,
one image per page, with optional ruled writing lines at the bottom of each page.
Images are sorted alphabetically by filename. Images that cannot have their
dimensions parsed fall back to 800×600.
Report to the user:
.docx fileWhen running in WorkBuddy: Do NOT call open_result_view or deliver_attachments after generating the .docx file. Simply report the result to the user in text (file path, page count, skipped images). This avoids triggering WorkBuddy's artifact download panel.
When running in other AI agents, follow their normal file presentation conventions.
output_file, writing_lines, or image_ratio, always use the script's built-in defaults (omit those arguments entirely). Do NOT override defaults on your own.docx package should be installed globally (npm install -g docx). Do NOT install it locally in the workspace.writing_lines value.共 2 个版本