src/
cli.ts # CLI entry point
index.ts # Library API exports
commands/ # Command implementations
init.ts # Initialize workspace from PPTX
status.ts # Show workspace status
commit.ts # Build PPTX from workspace
list-slides.ts # List slides
show-slide.ts # Show slide details
get-text.ts # Get text content
set-text.ts # Set text content
replace-text.ts # Find and replace text
set-font-size.ts # Set font size
core/
workspace.ts # Workspace management
selector.ts # Selector parsing and resolution
types.ts # TypeScript type definitions
readers/
pptx-reader.ts # PPTX reading wrapper
writers/
pptx-writer.ts # PPTX writing wrapper
validators/
utils/
logger.ts # Logging utility
errors.ts # Custom error classes
tests/
unit/ # Unit tests
integration/ # Integration tests
This project uses pnpm as the package manager. Install it if you haven't:
npm install -g pnpmpnpm installNote: Always use
pnpminstead ofnpmfor this project.
pnpm buildThis will:
- Compile TypeScript to JavaScript
- Generate type declarations
- Output to
dist/directory
pnpm devThis runs the build in watch mode, automatically rebuilding on file changes.
pnpm testFor test UI:
pnpm test:uipnpm typecheck- Project structure and configuration
- Core type definitions
- Workspace management
- Selector system (parsing and resolution)
- Basic commands:
- init
- status
- commit
- list slides
- show slide
- get text
- set text
- replace text
- set font-size
- CLI framework with commander
- Unit tests for core modules
- Error handling system
- Logger utility
The following components have placeholder implementations and need actual integration with the PPTX libraries:
Currently returns empty/placeholder data. Needs integration with @deckflow/presentation to:
- Read presentation structure
- Extract slide information
- Read shape data
- Extract text content
- Get metadata
Currently has no-op methods. Needs integration with @deckflow/pptx-modifier to:
- Modify text content
- Update font properties
- Modify shape geometry
- Save changes back to XML files
Many commands from the README are not yet implemented:
- validate
- doctor
- inspect
- tree
- find
- query
- stats
- More S0 commands (font-family, font-color, bold, italic, paragraph-align, etc.)
- S1 commands (fill, line, z-order, crop, etc.)
- S2 commands (with confirmation)
-
Integrate @deckflow/presentation
- Study the API documentation
- Implement PptxReader methods
- Update index building in init command
-
Integrate @deckflow/pptx-modifier
- Study the API documentation
- Implement PptxWriter methods
- Test write operations
-
Add More Commands
- Implement remaining S0 commands (safe text/formatting operations)
- Add S1 commands (fill, line, z-order, etc.)
- Implement diagnostic commands (validate, doctor, inspect)
-
Testing
- Create test PPTX files
- Write integration tests
- Test full workflows
-
Documentation
- API documentation
- Usage examples
- Contributing guide
The workspace is a directory containing:
- Extracted PPTX contents (XML files, media, etc.)
.deckuse/directory with:metadata.json- workspace metadata and indexes
Selectors allow targeting specific parts of a presentation:
slide:3- slide by indexslide:3/title- named element in slideshape[type=textbox]- shapes by filtertext[contains('keyword')]- text search
The selector is parsed into a Selector object, then resolved to concrete targets using the workspace indexes.
Each command is implemented as a separate module that:
- Loads the workspace
- Performs its operation
- Updates metadata if needed
- Provides user feedback
Custom error classes provide clear error messages:
WorkspaceNotInitializedErrorInvalidSelectorErrorCommandErrorValidationErroretc.
When adding new features:
- Add types to
src/core/types.ts - Implement the feature
- Add command if needed
- Register command in CLI
- Export from
src/index.tsif it's part of the public API - Add tests
- Update documentation