Skip to content

πŸ•·οΈ SILK - Smart Integrated Literary Kit. Modern CLI workflow for authors with LLM integration. Generate projects by genre, optimize context for Claude/GPT, track progress, publish professional PDFs.

License

Notifications You must be signed in to change notification settings

oinant/silk-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ•·οΈ SILK CLI - Smart Integrated Literary Kit

Structured Intelligence for Literary Kreation

Modern CLI workflow for authors with LLM integration.

🎯 What is SILK?

SILK weaves together all aspects of modern novel writing:

  • Smart templates adapted by genre and market
  • Integrated workflow from concept to publication
  • Literary focus on sophisticated fiction
  • Kit complete toolbox for authors

The name reflects both meanings:

  • Smart Integrated Literary Kit - What it does
  • Structured Intelligence for Literary Kreation - How it works

Just like a spider weaves its web, SILK helps you weave together characters, plot, and narrative into compelling fiction.

πŸš€ Quick Start

# Install SILK
curl -sSL https://raw.githubusercontent.com/oinant/silk-cli/main/install.sh | bash

# Create new project
silk init "My Novel"

# Generate LLM context
silk context "Character development"

# Track progress
silk wordcount 80000

# Publish professional PDF
silk publish -f digital

πŸ—οΈ Architecture

SILK uses a modular architecture for maintainability and extensibility:

silk-cli/
β”œβ”€β”€ silk                    # Main script (loads modules)
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ core/              # Core modules (auto-loaded)
β”‚   β”‚   β”œβ”€β”€ utils.sh       # Utility functions
β”‚   β”‚   β”œβ”€β”€ config.sh      # Configuration management
β”‚   β”‚   └── vault.sh       # Project management
β”‚   β”œβ”€β”€ commands/          # Command modules
β”‚   β”‚   β”œβ”€β”€ init.sh        # silk init
β”‚   β”‚   β”œβ”€β”€ context.sh     # silk context
β”‚   β”‚   β”œβ”€β”€ wordcount.sh   # silk wordcount
β”‚   β”‚   └── publish.sh     # silk publish
β”‚   └── templates/         # Genre templates
β”‚       β”œβ”€β”€ polar.sh       # Crime/thriller templates
β”‚       └── fantasy.sh     # Fantasy templates
β”œβ”€β”€ install.sh             # Modular installer
└── tests/                 # Test suite

πŸ’‘ Usage

# Create new project
silk init "My Novel"

# In project directory
silk context "Question for Claude"    # Generate LLM context
silk wordcount 80000                  # Progress statistics
silk publish -f iphone                # Generate PDF

🎯 Features

  • βœ… Smart Templates : Project generators by genre (crime, fantasy, romance)
  • βœ… Integrated Workflow : From idea to PDF in 4 commands
  • βœ… Literary Focus : Templates adapted by market (FR, US, UK, DE)
  • βœ… LLM Context : Unified context generation with flexible chapter ranges
  • βœ… Progress Analytics : Advanced wordcount with chapter grouping and projections
  • βœ… Multi-Format Publishing : Professional PDF generation
  • βœ… Multi-Platform : Compatible Windows/Linux/macOS

πŸ“š Typical Workflow

  1. πŸ•·οΈ Weaving : silk init "Project" β†’ Complete structure generated
  2. ✍️ Writing : Write in 01-Manuscrit/Ch*.md with ## manuscrit
  3. 🧠 Analysis : silk context "Question" β†’ Context for LLM
  4. πŸ“Š Tracking : silk wordcount β†’ Intelligent progress stats
  5. πŸ“– Publishing : silk publish β†’ Professional multi-format PDF

πŸ€– LLM Integration

Standard SILK separator

# Ch.15 : Title

## SILK Objectives
- Metadata for planning...

## manuscrit
[Pure content analyzed by LLM]

Intelligent context generation

# Generate unified context for LLM
silk context "Analyze character development" --chapters 1-5
silk context "Check narrative coherence" --chapters 15,18,20-25
silk context "Review dialogue quality" --full --wordcount

# Predefined prompts
silk context -p coherence --chapters 10-15
silk context -p revision --full

Advanced progress tracking

# Comprehensive wordcount analysis
silk wordcount                    # Default target from config
silk wordcount 100000            # Custom target
silk wordcount --summary         # Quick overview
silk wordcount --json           # Export data

# Features:
# - Automatic chapter grouping (Ch23 + Ch23-1 = Ch23)
# - Editorial threshold positioning (40k-120k words)
# - Regularity analysis with recommendations
# - Priority chapters identification
# - Export formats (JSON, CSV)

Intelligent context

silk context "Coherence Emma" -ch 15,18,20-25  # Flexible range
silk context --full --wordcount                # Complete mode + stats

πŸ› οΈ Development

Adding New Modules

  1. Create module in appropriate directory (lib/core/, lib/commands/, lib/templates/)
  2. Follow naming convention: cmd_<name>() for commands
  3. Export functions and set readonly SILK_MODULE_<NAME>_LOADED=true
  4. Test with ./tests/test-modular-compatibility.sh

Module Dependencies

# In module file
if [[ "${SILK_CORE_UTILS_LOADED:-false}" != "true" ]]; then
    echo "❌ Module core/utils required" >&2
    exit 1
fi

πŸ§ͺ Testing

# Basic compatibility
./tests/test-modular-compatibility.sh

# Full test suite
./tests/silk_master_test_suite.sh

# Platform compatibility
./tests/test-compatibility.sh

🌍 Supported Genres

Crime/Thriller (πŸ‡«πŸ‡· specialty)

  • Investigation/revelation structured templates
  • Target audience women CSP+ 35-55
  • Specialized LLM prompts for investigation

Fantasy/Romance

  • Coherent worldbuilding (fantasy)
  • Authentic relationship arcs (romance)
  • Templates adapted for international markets

πŸ› οΈ Technologies

  • Core : Portable Bash (Windows Git Bash compatible)
  • Publishing : Pandoc + XeLaTeX for professional PDF
  • Future : .NET Core migration planned (GUI)
  • LLM : Multi-provider (Claude, GPT, etc.)

πŸ“ˆ Roadmap

  • v1.0 : Modular CLI Smart Integrated Literary Kit
  • v1.1 : Complete multilingual support + extended genre templates
  • v1.2 : Advanced progression analytics + market metrics
  • v2.0 : .NET Core version + GUI + cloud integration
  • v2.1 : Integrated AI + personalized writing coaching

πŸ§ͺ Testing & Debugging

Running Tests

SILK includes comprehensive test suites to ensure reliability across platforms:

# Basic functionality tests
./tests/test-modular-compatibility.sh

# Full test suite with project creation
./tests/silk_master_test_suite.sh

# Platform compatibility (Windows/Linux/macOS)
./tests/test-compatibility.sh

# Architecture validation
./validate-silk-architecture.sh

Debug Mode

Enable detailed logging to troubleshoot issues:

# Enable debug mode for any command
SILK_DEBUG=true silk context "Your prompt" --chapters 1-5

# Debug specific modules
SILK_DEBUG=true silk init "Debug Project" --yes

# Debug extraction issues
SILK_DEBUG=true silk wordcount --summary

Debug output shows:

  • Module loading sequence
  • File detection and processing
  • Chapter extraction logic
  • Range validation
  • Context generation steps

Common Issues

Chapter detection fails:

# Check file patterns and extraction
SILK_DEBUG=true silk context "Test" --chapters 1-3
# Look for "extract_chapter_number" debug lines

Context generation stops early:

# Verify bash strict mode compatibility
set +e  # Temporarily disable in problematic functions

Module loading errors:

# Check module dependencies
SILK_DEBUG=true silk --version

🀝 Contributing

SILK was born from a real author's workflow with 30+ chapters, 450 pages, and optimized LLM integration. We welcome contributions that enhance the modern writing experience!

Development Setup

  1. Fork and clone:

    git clone https://github.com/your-username/silk-cli
    cd silk-cli
    chmod +x silk
  2. Test your environment:

    ./tests/test-modular-compatibility.sh
    SILK_DEBUG=true ./silk version
  3. Create a test project:

    ./silk init "Development Test" --genre polar-psychologique --yes
    cd development-test
    ../silk context "Test development setup"

Architecture Guidelines

Core Modules (lib/core/):

  • utils.sh - Utility functions (logging, validation, file operations)
  • config.sh - Configuration management
  • vault.sh - Project detection and navigation

Command Modules (lib/commands/):

  • Follow naming: cmd_<name>() for main function
  • Include show_<name>_help() for detailed help
  • Add dependency checks for required core modules
  • Export functions and set readonly SILK_COMMAND_<NAME>_LOADED=true

Template Modules (lib/templates/):

  • Genre-specific project generators
  • Market-adapted content (FR, US, UK, DE)
  • LLM-optimized prompts and structures

Code Standards

#!/bin/bash
# lib/commands/example.sh - Brief description

# Dependency verification
if [[ "${SILK_CORE_UTILS_LOADED:-false}" != "true" ]]; then
    echo "❌ Module core/utils required" >&2
    exit 1
fi

cmd_example() {
    # Implementation with proper error handling
    # Use set +e around problematic loops if needed
}

show_example_help() {
    cat << 'HELP'
πŸ•·οΈ SILK EXAMPLE - Brief description
# Detailed help content
HELP
}

# Export functions
export -f cmd_example show_example_help
readonly SILK_COMMAND_EXAMPLE_LOADED=true

Testing Your Changes

  1. Syntax validation:

    bash -n lib/commands/your-module.sh
    ./check-syntax.sh  # Validates all modules
  2. Functionality testing:

    # Test your specific command
    SILK_DEBUG=true ./silk your-command --help
    SILK_DEBUG=true ./silk your-command test-args
    
    # Full integration test
    ./tests/silk_master_test_suite.sh
  3. Platform compatibility:

    # Test on different environments
    ./tests/test-compatibility.sh

Contribution Areas

High Priority:

  • Genre Templates: Expand beyond polar/fantasy/romance
  • LLM Integration: New prompt strategies and context optimizations
  • Publication Formats: Additional PDF layouts and export options
  • Analytics: Advanced progression tracking and writing metrics

Multilingual Support:

  • Template localization (ES, DE, IT)
  • Market-specific publishing formats
  • Cultural adaptation of narrative structures

Platform Extensions:

  • VS Code extension for SILK projects
  • Integration with writing tools (Scrivener, Notion)
  • Cloud sync and collaboration features

Pull Request Process

  1. Create feature branch:

    git checkout -b feature/silk-amazing-feature
  2. Develop with tests:

    # Make changes
    # Add tests
    ./tests/test-modular-compatibility.sh
  3. Document your changes:

    • Update relevant help text
    • Add examples to documentation
    • Include any breaking changes in commit message
  4. Submit PR:

    git commit -m 'Add SILK amazing feature
    
    - Implements new context generation strategy
    - Adds support for screenplay format
    - Includes tests and documentation
    
    BREAKING CHANGE: Updates context.sh API'
    git push origin feature/silk-amazing-feature

Development Philosophy

Author-Centric Design:

  • Every feature should solve a real writing problem
  • Optimize for daily workflow efficiency
  • Maintain compatibility with existing projects

LLM-First Approach:

  • Context generation is the core feature
  • Templates should produce optimal prompts
  • Support multiple LLM providers and styles

Cross-Platform Reliability:

  • Test on Windows (Git Bash), Linux, and macOS
  • Handle path differences and shell variations
  • Maintain POSIX compatibility where possible

Community

  • Issues: Report bugs, request features, ask questions
  • Discussions: Share writing workflows, LLM strategies
  • Wiki: Contribute templates, examples, best practices

Recognition: Contributors are credited in releases and documentation. Major contributions may be highlighted in the project showcase.

SILK weaves together the contributions of the writing community! πŸ•ΈοΈ

πŸ“Š Project Stats

GitHub stars GitHub downloads GitHub issues

πŸ•·οΈ Philosophy

"Just like a spider weaves its web, SILK helps you weave together characters, plot, and narrative into compelling fiction."

SILK weaves your story together.

Generated with ❀️ by an author for authors. Smart Integrated Literary Kit - Structured Intelligence for Literary Kreation

About

πŸ•·οΈ SILK - Smart Integrated Literary Kit. Modern CLI workflow for authors with LLM integration. Generate projects by genre, optimize context for Claude/GPT, track progress, publish professional PDFs.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages