Skip to main content
unbolt

Tests License

Turn COBOL copybooks into a versioned, language-independent DSL, explain every Go/Java type choice, and generate traceable code — as a pure-Python package, a CLI, and an MCP server.

Mainframe data definitions are hard to reuse in modern services. Teams hand-translate copybooks and lose information: numeric ranges, decimal scale, packed/binary storage, signedness, nesting, overlays (REDEFINES). unbolt parses a copybook into an immutable DSL, recommends valid Go and Java types with a written reason for every candidate, and generates deterministic code with full traceability back to the source line.

30-second demo

unbolt parsing a copybook, recommending a Go type with its rationale, generating code, and tracing the decision — a real terminal recording, not a mockup

The same copybook in text, for anyone who'd rather read than watch:

$ cat account.cpy
01  CUSTOMER-RECORD.
    05  CUSTOMER-ID         PIC 9(6).
    05  CUSTOMER-AGE        PIC S9(3).
    05  ACCOUNT-BALANCE     PIC S9(7)V99.

$ unbolt generate account.cpy --target go -o out/
wrote out/gen.go
// out/gen.go
type CustomerRecord struct {
	CustomerId     int32
	CustomerAge    int16
	AccountBalance int64
}

func ValidateAccountBalance(v int64) error {
	if v < -999999999 || v > 999999999 {
		return fmt.Errorf("ACCOUNT-BALANCE: %v outside -999999999..999999999", v)
	}
	return nil
}

Why ACCOUNT-BALANCE (PIC S9(7)V99) became int64, not float64: unbolt report account.cpy --target go says exactly why —

unscaled value fits int64 (-999999999.00..999999999.00); caller divides by 10^2 (decision 0002)

A float would silently lose cents on arithmetic; unbolt never defaults decimal/packed fields to floating point, and the report always says why a field got the type it got, not just what the type is.

Install

pip install unbolt
pip install "unbolt[mcp]"   # adds the MCP server

Quickstart

Library

from unbolt.parser import parse_copybook
from unbolt.dsl import build_dsl
from unbolt.mapping import recommend_mappings
from unbolt.generators import generate_code

source = open("account.cpy").read()
dsl = build_dsl(parse_copybook(source), source_file="account.cpy")
mapping = recommend_mappings(dsl, "go")
files = generate_code(dsl, mapping, "go")  # {"gen.go": "..."}

A full runnable version, including the validation and traceability report, is in examples/quickstart.py.

CLI

unbolt parse account.cpy                        # diagnostics
unbolt recommend account.cpy --target go         # every candidate + why
unbolt generate account.cpy --target go -o out/  # write the code
unbolt report account.cpy --target go            # full traceability report

See docs/cli.md for every command and flag.

MCP

pip install "unbolt[mcp]"
unbolt mcp   # stdio transport - copybooks never leave your machine
{
  "mcpServers": {
    "unbolt": {
      "command": "uvx",
      "args": ["unbolt[mcp]", "mcp"]
    }
  }
}

See docs/mcp.md for every tool's params/returns/errors.

Supported / not supported

Supported Levels 01-49/77, PIC (numeric + alphanumeric), DISPLAY/COMP/COMP-3/COMP-4/COMP-5/COMP-1/COMP-2, OCCURS n, REDEFINES, SIGN SEPARATE
Diagnostic (reported, not converted) Level 66 (RENAMES), OCCURS ... DEPENDING ON, COPY ... REPLACING, edited pictures (Z, *, $, ...)
Unsupported PIC N/G (national/DBCS)

Full matrix: docs/supported-constructs.md.

How it works

copybook text → parser → AST + diagnostics → DSL (immutable source facts)
                                              │
                    rules + overrides ────────┤→ mapping candidates + rationale
                                              │
                                              └→ generators → Go / Java + validators
                                                     └→ report (field ↔ source line ↔ rule)

Docs

Full index: docs/index.md.

Metadata

Release files for unbolt 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unbolt 0.1.0
File Size Uploaded Provenance Actions
unbolt-0.1.0.tar.gz 1.1 MB Without provenance Details for unbolt-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for unbolt 0.1.0
File Interpreter ABI Platform Actions
unbolt-0.1.0-py3-none-any.whl Python 3 none any Details for unbolt-0.1.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / unbolt-0.1.0.tar.gz

Download URL unbolt-0.1.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9202639c6a919fbc749aaa4a7a511b7164b4f2e96e64e5b063b26860b9050e73
BLAKE2b-256 checksum
How to use checksums
e43a9585afb5e550a41b17e70a2ee058441106def018423e55843d0d74d1ca12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / unbolt-0.1.0-py3-none-any.whl

Download URL unbolt-0.1.0-py3-none-any.whl
Size 47.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
611d918b31042306842c2bbdfcc398751ef858423179310c051708c3beaaef42
BLAKE2b-256 checksum
How to use checksums
2167d6fc3669707c996c391cc70c10a2599c37836e5c2cd833828e003ac70a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for unbolt 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page