Context
We need a robust command-line interface (CLI) for docxgo that enables seamless invocation from Node.js, supporting integration across AWS Lambda, local servers, and any platform (Linux, Windows, macOS, arm64/x64).
PR Scope
- Create
cmd/docxgo/main.go implementing:
- Mode 1: One-shot execution (
docxgo exec --request 'JSON')—for simple calls via child_process.
- Mode 2: Persistent JSON-RPC session (
docxgo rpc)—for high-frequency batch/Lambda usage; runs as a process, receives JSON requests over stdin, writes JSON responses to stdout.
- Protocol: simple JSON-RPC, supporting all relevant docxgo operations: create document, open, modify, save, validate, inspect, etc.
- Accept input/output as file path or as Base64/buffer via JSON, to maximize compatibility with Node and Lambda.
Implementation Plan
1. CLI Design
- Design the protocol: JSON-RPC with mapped methods (
document.create, document.open, ...)
- Support file input/output and buffer modes.
2. CLI Implementation
- Create
cmd/docxgo package.
- Implement mode selector (
exec/rpc).
- Wire up domain API to JSON-RPC handlers.
3. Test Cases
- Unit tests for CLI interface and JSON mapping.
- E2E test: Create, modify, save a document via CLI.
4. Documentation
- Usage examples: both from shell and from Node.js (
child_process.spawn)
- Reference protocol (JSON formats, error responses)
5. Future Work
- NPM wrapper: multi-platform binary download + JS/TS client (builder/fluent API)
- AWS Lambda optimization: packaged binary, direct buffer send
Reference
This PR implements the CLI (step 1), with full plan below to guide subsequent npm package and integration work.
Full Implementation Plan (for Node integration)
A. CLI/JSON-RPC Layer (Go)
B. Node.js Wrapper (future, after CLI)
C. CI/CD
D. Testing
E. Docs
Assign: @mmonterroca
Label: enhancement
Type: feature
Context
We need a robust command-line interface (CLI) for
docxgothat enables seamless invocation from Node.js, supporting integration across AWS Lambda, local servers, and any platform (Linux, Windows, macOS, arm64/x64).PR Scope
cmd/docxgo/main.goimplementing:docxgo exec --request 'JSON')—for simple calls viachild_process.docxgo rpc)—for high-frequency batch/Lambda usage; runs as a process, receives JSON requests over stdin, writes JSON responses to stdout.Implementation Plan
1. CLI Design
document.create,document.open, ...)2. CLI Implementation
cmd/docxgopackage.exec/rpc).3. Test Cases
4. Documentation
child_process.spawn)5. Future Work
Reference
Full Implementation Plan (for Node integration)
A. CLI/JSON-RPC Layer (Go)
cmd/docxgo/main.gowith one-shot and rpc modes.B. Node.js Wrapper (future, after CLI)
@mmonterroca/docxgo.C. CI/CD
D. Testing
E. Docs
Assign: @mmonterroca
Label: enhancement
Type: feature