A command-line tool for linting, validating, and parsing TaskPaper files. Built with Swift and powered by the modernized TaskPaper library.
- Validate TaskPaper files for syntax errors
- Parse TaskPaper files with multiple output formats
- Stdin support for piping content
- Detailed error reporting with line numbers
- Multiple output formats: JSON, pretty-print, and tree visualization
- Swift 6.0+
- macOS 13.0+ (Linux support may be available depending on TaskPaper library)
- Clone the repository:
git clone https://github.com/deverman/taskpaper-lint.git
cd taskpaper-lint- Build the project:
swift build -c release- The executable will be located at
.build/release/taskpaper-lint
You can copy the built executable to your local bin directory:
# Build in release mode
swift build -c release
# Copy to local bin (make sure ~/bin or /usr/local/bin is in your PATH)
cp .build/release/taskpaper-lint /usr/local/bin/
# Or to your home directory bin
mkdir -p ~/bin
cp .build/release/taskpaper-lint ~/bin/You can also run directly using Swift:
swift run taskpaper-lint validate myfile.taskpaperCheck if a TaskPaper file is syntactically valid:
# Validate a file
taskpaper-lint validate myfile.taskpaper
# Validate with verbose output (shows statistics)
taskpaper-lint validate myfile.taskpaper --verbose
# Validate from stdin
cat myfile.taskpaper | taskpaper-lint validate
echo "My Project:" | taskpaper-lint validateExit codes:
0: File is valid1: File has syntax errors or other errors
Example output:
β
myfile.taskpaper is valid
Document statistics:
Total items: 15
Projects: 3
Tasks: 10
Notes: 2
Parse and output the structure of a TaskPaper file:
# Parse with default (pretty) format
taskpaper-lint parse myfile.taskpaper
# Parse with JSON format
taskpaper-lint parse myfile.taskpaper --format json
# Parse with tree format
taskpaper-lint parse myfile.taskpaper --format tree
# Parse from stdin
cat myfile.taskpaper | taskpaper-lint parse --format jsonAvailable formats:
-
json - JSON representation of the parsed structure
{ "items": [ { "type": "project", "content": "My Project", "attributes": {}, "children": [...] } ] } -
pretty - Human-readable formatted output
π PROJECT: My Project β TASK: First task @priority: high β TASK: Second task π NOTE: Some note -
tree - Tree-style visualization
. βββ π My Project β βββ β First task [@priority(high)] β βββ β Second task β βββ π Some note
# Show help
taskpaper-lint --help
# Show version
taskpaper-lint --version
# Show help for a specific command
taskpaper-lint validate --help
taskpaper-lint parse --help# Create a sample file
cat > sample.taskpaper << 'EOF'
My Project:
- Task 1 @priority(high)
- Task 2 @done
Note about the project
EOF
# Validate it
taskpaper-lint validate sample.taskpaper --verbose# Parse and save JSON output
taskpaper-lint parse sample.taskpaper --format json > output.json
# Parse from stdin
echo "Quick Project:\n\t- Quick task" | taskpaper-lint parse --format tree# Create an invalid file (if TaskPaper has specific syntax rules)
echo "Invalid syntax here" > invalid.taskpaper
# Validate will report errors
taskpaper-lint validate invalid.taskpaper
# Output:
# β Validation failed for invalid.taskpaper
# Parse error: [error message]
# at line 1swift testtaskpaper-lint/
βββ Package.swift # Swift package manifest
βββ Sources/
β βββ taskpaper-lint/
β βββ main.swift # Main entry point
β βββ ValidateCommand.swift # Validate command
β βββ ParseCommand.swift # Parse command
β βββ OutputFormatter.swift # Output formatters
β βββ InputSource.swift # Input handling
β βββ CLIError.swift # Error definitions
βββ Tests/
βββ taskpaper-lint-tests/
βββ TaskPaperLintTests.swift # Unit tests
- Swift Argument Parser - Command-line argument parsing
- TaskPaper - TaskPaper parsing library
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- TaskPaper - The modernized TaskPaper Swift library
- TaskPaper Format - Original TaskPaper application and format
If you encounter build errors related to the TaskPaper dependency:
-
Ensure you have Swift 6.0+ installed:
swift --version
-
Clean and rebuild:
swift package clean swift build
-
Update dependencies:
swift package update
If the tool fails to read files:
- Check file permissions:
ls -la yourfile.taskpaper - Ensure the file exists and path is correct
- Try using absolute paths instead of relative paths
For stdin issues:
- Ensure you're piping valid UTF-8 text
- Check that the input is not empty
For issues and feature requests, please use the GitHub issue tracker.