# Module :: `genfile`
<!--{ generate.module_header.start() }-->
[](https://github.com/emersion/stability-badges#stable) [](https://github.com/Wandalen/wTools/actions/workflows/workspace_push.yml) [](https://docs.rs/genfile) [](https://discord.gg/m3YfbXpUUY)
<!--{ generate.module_header.end }-->
[](https://crates.io/crates/genfile)
[](https://docs.rs/genfile)
[](LICENSE)
CLI for template archive management - create, manage, and materialize code generation templates.
## Quick Start
Install via cargo:
```bash
cargo install genfile
```
Create a portable template archive from a directory:
```bash
# Pack directory into archive
genfile .pack input::"./my-template" output::"template.json"
# Load and materialize
genfile .archive.load path::"template.json"
genfile .value.set name::"project_name" value::"my-project"
genfile .materialize destination::"./output"
```
## Features
- **Archive Management** - Create, load, save template archives
- **File Operations** - Add, remove, list template files
- **Parameter System** - Define and manage template parameters
- **Value Management** - Set parameter values for materialization
- **Content Control** - Inline or reference-based file storage
- **REPL Mode** - Interactive command-line interface
- **Dual Mode** - Works as single command or interactive REPL
## Interactive REPL
Run without arguments for interactive mode:
```bash
genfile
```
```
genfile REPL v0.4.0
Type '.help' for help, 'exit' to quit
genfile[0]> .archive.new name::"api-scaffold"
Created archive: api-scaffold
genfile[1]> .file.add path::"main.rs" content::"fn main() {}"
Added file: main.rs
genfile[2]> .archive.save path::"api.json"
Saved archive to: api.json
```
## Documentation
### CLI Documentation
Complete command-line interface reference:
- **[CLI Documentation](docs/cli/readme.md)** - Comprehensive CLI reference (24 commands, 23 parameters, 15 types)
- [Quick Start Guide](docs/cli/readme.md#quick-start) - Common workflows and examples
- [Commands Reference](docs/cli/command/readme.md) - All commands indexed by namespace
- [Parameters Reference](docs/cli/param.md) - Complete parameter specifications
- [Type System](docs/cli/type.md) - Type definitions for implementers
- [Tutorial](docs/cli/readme.md#common-workflows) - Step-by-step learning guide
### API Documentation
- [API Documentation](https://docs.rs/genfile) - Complete Rust API reference
- [Examples](https://github.com/Wandalen/wTools/tree/master/module/core/genfile/examples) - Usage examples
## Architecture
genfile is built on:
- **genfile_core** - Core template archive library
- **unilang** - Universal CLI framework with REPL support
- **error_tools** - Structured error handling
## Commands Overview
| Category | Commands |
|----------|----------|
| Archive | `.archive.new`, `.archive.load`, `.archive.save`, `.archive.from_directory` |
| Files | `.file.add`, `.file.remove`, `.file.list`, `.file.show` |
| Parameters | `.parameter.add`, `.parameter.list`, `.parameter.remove` |
| Values | `.value.set`, `.value.list`, `.value.clear` |
| Content | `.content.internalize`, `.content.externalize`, `.content.list` |
| Materialization | `.materialize`, `.unpack` |
| Serialization | `.pack` |
| Analysis | `.info`, `.status`, `.analyze`, `.discover.parameters` |
| Help | `.help`, `.`, `.command.help` |
## Development Status
Current version: **0.4.0**
All core features implemented and tested (74 integration tests, 100% passing):
- ✅ Archive lifecycle management (FR1: `.archive.*`)
- ✅ File operations (FR2: `.file.*`)
- ✅ Parameter and value management (FR3/FR4: `.parameter.*`, `.value.*`)
- ✅ Content transformation (FR5: `.content.*`)
- ✅ Template materialization (FR6: `.materialize`, `.unpack`)
- ✅ Archive serialization (FR7: `.pack`)
- ✅ Analysis and introspection (FR8: `.info`, `.status`, `.analyze`, `.discover.*`)
- ✅ Help system (FR9: `.help`, `.`, `.command.help`)
- ✅ REPL mode with state persistence
## Contributing
See [wTools](https://github.com/Wandalen/wTools) repository for contribution guidelines.
## License
MIT - see [LICENSE](LICENSE) for details.