A Swift-based compiler for the Hypercode language that transforms nested document structures into Markdown with comprehensive manifest generation and specification-driven validation.
- Hierarchical Compilation: Nested document structures with indentation-based nesting
- File References: Include Markdown (.md) and Hypercode (.hc) files inline
- Recursive Compilation: .hc files compiled recursively with automatic depth adjustment
- Circular Dependency Detection: Prevent infinite loops in nested references
- Declarative Validation: Grammar validated via composable specifications (SpecificationCore)
- Deterministic Output: Byte-for-byte identical across platforms
- Strict and Lenient Modes: Choose between strict error handling and lenient missing-file tolerance
- Comprehensive Statistics: Optional compilation metrics and detailed manifest generation
Prerequisites: Swift 5.9 or later (recommended: Swift 6.2+)
git clone https://github.com/0al-spec/Hyperprompt.git
cd Hyperprompt
swift build -c release
./.build/release/hyperprompt --versiongit clone https://github.com/0al-spec/Hyperprompt.git
cd Hyperprompt
swift build -c release
./.build/release/hyperprompt --versionNote: On Linux, ensure Swift is installed. See DOCS/RULES/02_Swift_Installation.md for detailed instructions.
Create a simple Hypercode file:
# Create a .hc file
cat > hello.hc << 'EOF'
"Hello, Hypercode!"
EOF
# Compile it
./.build/release/hyperprompt hello.hc --output output.md
# View the result
cat output.mdExpected output:
# Hello, Hypercode!hyperprompt root.hc --output compiled.mdhyperprompt root.hc --output out.md --manifest manifest.jsonhyperprompt root.hc --lenienthyperprompt root.hc --dry-runhyperprompt root.hc --statshyperprompt root.hc --verbose --stats- USAGE.md — Complete CLI reference with all flags and options
- LANGUAGE.md — Hypercode grammar specification and syntax rules
- ARCHITECTURE.md — System design, module overview, data flow
- ERROR_CODES.md — Exit codes, error scenarios, and solutions
- SPECS_INTEGRATION.md — SpecificationCore integration patterns
- TROUBLESHOOTING.md — Common issues and frequently asked questions
- PRD_EditorEngine.md — Future EditorEngine module plan
See Sources/CLI/Documentation.docc/examples/ for runnable example .hc files:
hello.hc— Simple root nodenested.hc— Hierarchical structurewith-markdown.hc— Markdown file referenceswith-hypercode.hc— Hypercode file referencescomments.hc— Using comments
| Component | Requirement |
|---|---|
| Swift Version | 5.9+ (6.0+ recommended) |
| macOS | 11.0 or later (x86_64, arm64) |
| Ubuntu | 20.04, 22.04, 24.04 LTS |
| Disk Space | ~100 MB (build artifacts) |
| Memory | 512 MB minimum, 2 GB recommended |
swift build
./.build/debug/hyperprompt --helpThe VS Code extension spawns the hyperprompt CLI by name and requires the Editor trait build:
swift build --traits Editor
export PATH="$PWD/.build/debug:$PATH"
hyperprompt editor-rpcRestart VS Code after updating PATH so the Extension Host picks it up.
For extension development setup (including Node.js/TypeScript installation), see Tools/VSCodeExtension/README.md.
swift build -c release
./.build/release/hyperprompt --helpswift testswift test -vHyperprompt/
├── Sources/
│ ├── CLI/ # Command-line interface
│ ├── Core/ # Core data structures
│ ├── Parser/ # Hypercode parser
│ ├── Resolver/ # File reference resolver
│ ├── Emitter/ # Markdown emitter
│ ├── Statistics/ # Compilation metrics
│ ├── HypercodeGrammar/ # Grammar specifications
│ └── EditorEngine/ # Future optional editor-facing engine (planned)
├── Tests/ # Test suites
├── Sources/CLI/Documentation.docc/examples/ # Example .hc files
├── Sources/CLI/Documentation.docc/ # User documentation
└── Package.swift # Swift Package manifest
hyperprompt <input-file> [OPTIONS]| Option | Short | Description | Default |
|---|---|---|---|
--output FILE |
-o |
Output Markdown file | out.md |
--manifest FILE |
-m |
Output manifest JSON | manifest.json |
--root DIR |
-r |
Root directory for file resolution | . |
--lenient |
— | Treat missing files as inline text | — |
--verbose |
-v |
Enable verbose logging | — |
--stats |
— | Collect compilation statistics | — |
--dry-run |
— | Validate without writing output | — |
--version |
— | Display version and exit | — |
--help |
-h |
Display help information | — |
Default Mode: Strict (missing files cause compilation failure)
Display help:
hyperprompt --helpShow version:
hyperprompt --versionCompile with all options:
hyperprompt root.hc -o output.md -m meta.json -r ./project -v --statsExit codes indicate compilation result:
| Code | Meaning | Action |
|---|---|---|
0 |
Success | Compilation completed successfully |
1 |
IO Error | File not found, permission denied, or disk error |
2 |
Syntax Error | Invalid Hypercode syntax |
3 |
Resolution Error | Missing reference or circular dependency |
4 |
Internal Error | Compiler bug (report to maintainers) |
For detailed solutions, see ERROR_CODES.md.
Hypercode is a simple, indentation-based language for defining hierarchical document structures.
Inline text:
"Hello, World!"
Hierarchical nesting:
"Root Section"
"Subsection 1"
"Subsection 2"
"Nested item"
File references:
"Main Document"
"details.md"
"nested-structure.hc"
For complete syntax specification, see LANGUAGE.md.
Hyperprompt uses SpecificationCore for:
- Lexical validation (indentation, quotes, escapes)
- Path classification and validation (traversal checks, boundary enforcement)
- Decision-based routing (file type detection, resolution strategy)
See SPECS_INTEGRATION.md for implementation details.
The generated manifest.json contains:
- List of all referenced files
- Compilation statistics (lines, nodes, depth)
- Dependency graph for circular reference detection
- Version and metadata
"Input file not found: file.hc"
- Verify file exists:
ls -la file.hc - Check working directory:
pwd - Use absolute path if needed
"Invalid indentation"
- Indentation must use spaces (4 spaces per level)
- No tabs allowed. Check:
cat -A file.hc(no^I) - Mixed spaces and tabs may cause errors
"Missing file reference in strict mode"
- Use
--lenientflag to treat missing files as text - Or verify referenced file exists and is readable
For more help, see TROUBLESHOOTING.md.
swift testswift test --enable-code-coverageswift build -c debug
# Generated docs in .build/release/documentation/Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Write tests for new functionality
- Ensure all tests pass:
swift test - Submit a pull request
For detailed contribution guidelines, see Sources/CLI/Documentation.docc/FUTURE.md.
MIT License — See LICENSE file for details.
- Issues: Report bugs on GitHub
- Documentation: See
Sources/CLI/Documentation.docc/directory - Examples: See
Sources/CLI/Documentation.docc/examples/directory
| Version | Date | Status | Notes |
|---|---|---|---|
| 0.1.0 | 2025-12-12 | Current | Initial release with core features |
Last Updated: December 12, 2025