pmat 3.11.0

PMAT - Zero-config AI context generation and code quality toolkit (CLI, MCP, HTTP)
# PMAT Debian/Ubuntu Package

This directory contains the complete Debian package structure for PMAT v2.12.0.

## ๐Ÿ“ฆ Package Structure

```
debian/
โ”œโ”€โ”€ DEBIAN/
โ”‚   โ”œโ”€โ”€ control          # Package metadata and dependencies
โ”‚   โ”œโ”€โ”€ postinst         # Post-installation script with user guidance
โ”‚   โ”œโ”€โ”€ prerm            # Pre-removal script (service cleanup)
โ”‚   โ””โ”€โ”€ postrm           # Post-removal script (purge cleanup)
โ”œโ”€โ”€ etc/pmat/            # Configuration templates
โ”‚   โ”œโ”€โ”€ agent-development.toml
โ”‚   โ”œโ”€โ”€ agent-production.toml
โ”‚   โ””โ”€โ”€ agent-ci.toml
โ”œโ”€โ”€ lib/systemd/system/  # systemd service file
โ”‚   โ””โ”€โ”€ pmat-agent.service
โ”œโ”€โ”€ usr/share/doc/pmat/  # Documentation
โ”‚   โ”œโ”€โ”€ copyright        # Debian copyright format
โ”‚   โ”œโ”€โ”€ README.Debian    # Debian-specific documentation
โ”‚   โ”œโ”€โ”€ changelog.Debian.gz # Package changelog
โ”‚   โ””โ”€โ”€ CLAUDE_CODE_AGENT.md # User guide
โ””โ”€โ”€ usr/share/man/man1/  # Manual page
    โ””โ”€โ”€ pmat.1.gz        # Compressed man page
```

## ๐Ÿ—๏ธ Building the Package

### Quick Build
```bash
cd debian
./build-deb.sh
```

### Manual Build  
```bash
# Set correct permissions
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod +x DEBIAN/{postinst,prerm,postrm}

# Compress documentation
gzip -9 usr/share/doc/pmat/changelog.Debian
gzip -9 usr/share/man/man1/pmat.1

# Build package
cd .. && dpkg-deb --build debian pmat_2.12.0_amd64.deb
```

## ๐Ÿงช Testing

### Local Testing
```bash
./test-deb.sh
```

### Manual Testing
```bash
# Install package
sudo dpkg -i ../pmat_2.12.0_amd64.deb

# Fix dependencies if needed
sudo apt-get install -f

# Test functionality
pmat --version
systemctl status pmat-agent

# Remove package
sudo apt remove pmat

# Complete purge
sudo apt purge pmat
```

## ๐Ÿ“‹ Package Features

### Installation Strategy
The package provides a **framework installation** rather than binary installation:

1. **Service Setup**: Creates systemd service, user account, directories
2. **Configuration**: Installs templates and documentation  
3. **Integration**: Prepares system for PMAT usage
4. **Guidance**: Provides clear installation instructions for the actual binary

### Binary Installation Methods
Post-package installation, users choose their preferred method:

- **Cargo** (Recommended): `cargo install pmat`
- **npm**: `npm install -g pmat-agent` 
- **Docker**: `docker run paiml/pmat:latest`

### Service Integration
- **systemd service**: `/lib/systemd/system/pmat-agent.service`
- **Service user**: `pmat` system account
- **State directory**: `/var/lib/pmat-agent/`
- **Log directory**: `/var/log/pmat-agent/`

## ๐ŸŽฏ Installation Experience

### User Flow
1. **Install package**: `sudo apt install pmat` (once in repository)
2. **See guidance**: Package provides clear next-step instructions
3. **Install binary**: Choose preferred method (Cargo/npm/Docker)
4. **Configure**: Edit templates in `/etc/pmat/` if using service mode
5. **Use**: Run `pmat` commands or enable service

### Claude Code Integration
After binary installation:
```json
{
  "mcpServers": {
    "pmat": {
      "command": "pmat",
      "args": ["agent", "mcp-server"],
      "env": {}
    }
  }
}
```

## ๐Ÿ“Š Package Details

- **Package Name**: `pmat`
- **Version**: `2.12.0`
- **Architecture**: `amd64` (expandable to `arm64`)
- **Section**: `devel` (development tools)
- **Priority**: `optional`
- **Installed Size**: ~8MB
- **Dependencies**: Minimal system libraries only
- **Suggests**: `cargo`, `nodejs`, `npm`, `git`

## ๐Ÿš€ Distribution Options

### 1. Local Installation
```bash
sudo dpkg -i pmat_2.12.0_amd64.deb
```

### 2. APT Repository
Upload to private APT repository and install via:
```bash
sudo apt update && sudo apt install pmat
```

### 3. Ubuntu PPA
Submit to Personal Package Archive (see `SUBMIT_TO_UBUNTU_PPA.md`)

### 4. Debian Official Repository
Long-term goal: Submit to Debian official repositories

## ๐Ÿ”ง Maintenance

### Version Updates
1. Update `DEBIAN/control` version
2. Update `usr/share/doc/pmat/changelog.Debian`  
3. Rebuild with `./build-deb.sh`
4. Test with `./test-deb.sh`

### Configuration Updates  
- Templates in `etc/pmat/` can be updated
- Service file in `lib/systemd/system/` can be modified
- Documentation in `usr/share/doc/pmat/` can be enhanced

## ๐Ÿ“ž Support

- **Package Issues**: Check `/usr/share/doc/pmat/README.Debian`
- **PMAT Issues**: https://github.com/paiml/paiml-mcp-agent-toolkit/issues
- **Debian Packaging**: https://www.debian.org/doc/manuals/maint-guide/

---

**Ready for distribution!** Complete Debian package with service integration, comprehensive documentation, and user-friendly installation experience.