How thevkp/x-post-formatter works
X Post Slicer is a browser-based tool for turning long text into X-sized posts. Users enter text, choose split or compression mode, adjust the count limit and labels, review and edit compressed text, then copy individual posts or the full thread. Its runtime flow runs through the state hook and pure processing pipeline: compression, sentence-aware splitting, and weighted counting. The UI also exposes warnings and copy progress. The graph follows shown calls and imports; unsampled component and compressor internals are represented only at their supported subsystem boundaries.
Main entry points: App.tsx Slicer interface · split.ts Post splitting · pipeline.ts Processing pipeline · xWeightedCounter.ts X-weighted count
Components 14
User interface
- Slicer interface
x-post-slicer/src/App.tsx - Slicer state
x-post-slicer/src/hooks/usePostSlicer.ts - Post cards
x-post-slicer/src/components/PostCard.tsx
Text processing
- Compression modes
x-post-slicer/src/core/compressor/index.ts - Processing pipeline
x-post-slicer/src/core/pipeline.ts - Post splitting
x-post-slicer/src/core/splitter/split.ts - Text boundaries
x-post-slicer/src/core/splitter/boundaries.ts - Post labels
x-post-slicer/src/core/splitter/labels.ts
Character counting
- X-weighted count
x-post-slicer/src/core/counter/xWeightedCounter.ts - Grapheme segments
x-post-slicer/src/core/counter/graphemes.ts
Clipboard
- Copy controls
x-post-slicer/src/components/CopyButton.tsx - Browser clipboard
x-post-slicer/src/components/clipboard.ts
Other components
- Text editor
- Browser APIs
Connections 16
- Text editor → Slicer interface: enters text
x-post-slicer/src/App.tsx - Slicer interface → Slicer state: reads state
x-post-slicer/src/App.tsx - Slicer state → Processing pipeline: runs pipeline
x-post-slicer/src/hooks/usePostSlicer.ts - Processing pipeline → Compression modes: compresses text
x-post-slicer/src/core/pipeline.ts - Processing pipeline → Post splitting: splits text
x-post-slicer/src/core/pipeline.ts - Processing pipeline → X-weighted count: measures text
x-post-slicer/src/core/pipeline.ts - Post splitting → Text boundaries: gets units
x-post-slicer/src/core/splitter/split.ts - Post splitting → Post labels: adds labels
x-post-slicer/src/core/splitter/split.ts - Post splitting → X-weighted count: checks budgets
x-post-slicer/src/core/splitter/split.ts - Post splitting → Grapheme segments: cuts long words
x-post-slicer/src/core/splitter/split.ts - X-weighted count → Grapheme segments: counts segments
x-post-slicer/src/core/counter/xWeightedCounter.ts - Slicer interface → Post cards: renders posts
x-post-slicer/src/App.tsx - Slicer interface → Copy controls: renders copy control
x-post-slicer/src/App.tsx - Slicer interface → Browser clipboard: copies next post
x-post-slicer/src/App.tsx - Copy controls → Browser clipboard: copies text
x-post-slicer/src/components/CopyButton.tsx - Browser clipboard → Browser APIs: writes clipboard
x-post-slicer/src/components/clipboard.ts