Skip to main content

controlm-chain-admin

CI PyPI Python License: MIT

Your BMC Control-M environments in git: one branch per environment, compared by their real differences, promoted item by item. Export an environment from Control-M, refresh its branch, see what really differs from another environment, pick a job, a folder or a whole sub-application, and get the import file already written for the environment that receives it.

   Control-M (full XML export of each environment)
        |  ctmchain refresh <export.xml>      preview first, --apply overwrites the branch
        v
   main        production          \
   env/uat     UAT                  |   ctmchain compare main env/uat    real differences only
   env/egma    another test level   |   ctmchain take env/uat --list     what can be taken
   env/bench   bench               /    ctmchain package main env/uat --take folder:...
   map         what is expected to differ: the letter of the names, machines, users
        |
        v
   import file for the target environment (its letter, its machines, its users)

Status: alpha, used on a real application of a few hundred folders and well over a thousand jobs in four environments. The command line carries everything below; the web UI browses, edits and compares, and has no page yet for refresh and the map. Design: DESIGN.md; the needs it answers: NEEDS.md.

The problem

The same chains live in several Control-M environments, and no two are the same: every name carries the letter of its environment, jobs run on other machines as other users, and each environment is some changes ahead of or behind the others. The Control-M interface does not compare environments, and two XML exports differ on almost every line, so a plain diff says nothing. Moving a change from UAT to production means retyping it, or editing XML by hand.

controlm-chain-admin (the ctmchain command) answers three questions with one git repository of small JSON files:

  1. What does each environment have right now? One branch each, refreshed from its export.
  2. What is really different between two of them? Not the letter, the machine or the user.
  3. How do I move this job, this folder, this sub-application over there? An import file in the terms of the target, ready for Control-M.

What it does

You want to Command
Keep production on main and every other environment on a branch of its own ctmchain refresh prod.xml --apply, ctmchain refresh uat.xml --apply, ...
Export an environment again and see what changed before accepting it ctmchain refresh uat.xml (nothing is written), then --apply
Know what is expected to differ between environments, without it belonging to any of them ctmchain envmap derive --apply, ctmchain envmap show (kept on the branch map)
Compare two environments by their real differences ctmchain compare main env/uat (--raw: as stored)
Take one attribute, one variable, one job, one folder or a sub-application into another environment's branch ctmchain take env/uat --list, ctmchain take env/uat --item job:F/J --apply
Get the import file of what was chosen, adapted to the target, without changing any branch ctmchain package main env/uat --take folder:F -o prod_import.xml
Export a whole environment as it stands on its branch ctmchain export --env bench -o bench.xml

What "adapted to the target" means: the letter of every name (folders, jobs, conditions, resources, calendars), the machine, the user, the datacenter and any other value of the map are written as the target environment has them. What the map cannot settle is never guessed: the value is kept, a warning names it, and --prefer settles it.

A session

All examples use the fictional application P77; this repository never contains real exports.

# once: the rules of the repository, then one branch per environment from its full export
git init -b main my-chains && cd my-chains
ctmchain init --application P77_RISK_ENGINE --envs prod=P,uat=U,egma=E,bench=B \
    --prefixes P77,RQ_,RC_ --leading-only RQ_,RC_
git add -A && git commit -m "chore: the rules of the repository"
ctmchain refresh ../exports/prod.xml --apply     # main
ctmchain refresh ../exports/uat.xml --apply      # env/uat, created from the rules of main
ctmchain refresh ../exports/egma.xml --apply     # env/egma
ctmchain refresh ../exports/bench.xml --apply    # env/bench

Every branch now gives its export back byte for byte (ctmchain export; with --jobnames original where repeated JOBNAMEs were numbered). The map comes from the branches themselves:

$ ctmchain envmap derive --apply
3 new entries from main (prod), env/uat (uat), env/egma (egma), env/bench (bench)
  nodeid.1  NODEID  7 nodes
      prod=srvp-bat1  uat=srvu-bat1  egma=srve-bat1  bench=srvb-bat1
  run_as.1  RUN_AS  11 nodes
      prod=app77proc  uat=aup77proc  egma=aep77proc  bench=abp77proc
  datacenter.1  DATACENTER  2 nodes
      prod=CTMPROD  uat=CTMUAT  egma=CTMEGMA  bench=CTMBENCH
Written on map: 3 entries added

ctmchain envmap suggest lists what else varies, with the command that adds it: here a variable that holds the environment's code and a word of a mail subject, two more entries. envmap add, remove and rename edit the map by hand.

Now the comparison says what matters. As stored, production and UAT differ everywhere; read through the map, a handful of real differences is left:

$ ctmchain compare main env/uat
Compare main (prod) with env/uat (uat): real differences only
  expected between prod and uat, not shown: 28 values and 2 texts of the map, 4 names with the letter, 0 conditions called another name

modified folder P77_INGEST_DAILY/
    variable %%RETRY: (none) -> 3
added    folder P77_WEEKLY_DAILY/
    jobs added: P77_WEEKLY_DAILY/P77_WEEKLY_INIT, P77_WEEKLY_DAILY/P77_WEEKLY_LOAD
added    job P77_CHAIN/P77_NEW
modified job P77_CHAIN/P77_A
    CMDLINE: /opt/p77/bin/a.ksh -> /opt/p77/bin/a2.ksh -x
...

An INCOND/OUTCOND pair whose name carries another letter, or is simply called something else, but links the same jobs with the same sign, is not a difference either.

Take what you choose, at the size you choose, into the branch that is checked out:

$ git switch env/bench
$ ctmchain take env/uat --list
Items env/uat (uat) has that can be taken into env/bench (bench):
  subapp:P77_BATCH  3 folders that differ
  folder:P77_INGEST_DAILY  the whole folder, modified
  var:P77_INGEST_DAILY/@%%RETRY  (none) -> 3
  folder:P77_CHAIN  the whole folder, modified
  folder:P77_WEEKLY_DAILY  the whole folder, added
  job:P77_CHAIN/P77_NEW  the whole job, added
  job:P77_CHAIN/P77_A  the whole job, modified
  attr:P77_CHAIN/P77_A@CMDLINE  /opt/p77/bin/a.ksh -> /opt/p77/bin/a2.ksh -x
  ...
$ ctmchain take env/uat --item folder:P77_WEEKLY_DAILY --item attr:P77_CHAIN/P77_A@CMDLINE --apply
$ ctmchain commit                                # a message written from what changed
$ ctmchain export --env bench -o bench.xml       # bench, with what it took

Or skip the branch and get the import file for the target directly. Production's branch is never edited by hand: it gets a file, and its next export brings the change back to main.

$ ctmchain package main env/uat --take folder:P77_WEEKLY_DAILY -o prod_import.xml
Package env/uat (uat) for prod (main): 1 folder, 1 item taken
  P77_WEEKLY_DAILY (2 jobs): folder added; job P77_WEEKLY_INIT added; job P77_WEEKLY_LOAD added
warning: P77_PRICING-P77_WEEKLY_DAILY_OK: a job waits for it but no job emits it here
Wrote prod_import.xml (2078 bytes)

prod_import.xml holds PP77_WEEKLY_DAILY with production's machine, user and datacenter, although it was read from UAT, and the warning says what the folder will wait for there.

When Control-M is exported again, ctmchain refresh shows what the export changes on the branch, and nothing is written until --apply:

$ ctmchain refresh ../exports/bench-new.xml
Refresh env/bench (bench) from bench-new.xml: 2 folders, 9 jobs in the export

  jobs: 1 modified

modified job P77_CHAIN/P77_C
    CMDLINE: /opt/p77/bin/c.ksh -> /opt/p77/bin/c9.ksh

Nothing written: --apply overwrites env/bench with this export.

Why git, why JSON

  • One small file per folder and per job, with stable ordering: git diff, git log and a pull request work on a chain change.
  • Byte-identical export. A branch gives back exactly the export it was refreshed from; what Control-M adds on every upload (dates, versions, user of the change) is kept apart and never compared.
  • Links instead of condition names. OUTCOND/INCOND pairs become edges between jobs; the original names are kept, and an export can keep them or standardise them.
  • Nothing leaves your machine. The core and the command line use the Python standard library only; the web UI and the assistant are optional extras and bind 127.0.0.1.

Install

pip install controlm-chain-admin          # core + ctmchain CLI (standard library only)
pip install "controlm-chain-admin[web]"   # + the local web UI (ctmchain serve)
pip install "controlm-chain-admin[mcp]"   # + the tools for an assistant (Kilo, Claude)

Requires Python 3.11 or newer and git.

On Windows, from scratch (with Kilo)

In PowerShell, with Python 3.11 or newer, git, and optionally the Kilo CLI (kilo --version, signed in with the model your company allows) on the PATH. Only PyPI needs to be reachable.

# 1. The tool, in a virtual environment of its own (an older one: the same pip line in it)
py -m venv $HOME\ctmchain-venv
& $HOME\ctmchain-venv\Scripts\Activate.ps1   # blocked? Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
python -m pip install --upgrade pip
python -m pip install --upgrade "controlm-chain-admin[web,mcp]"
ctmchain --version

# 2. The data repository, outside the code: the full exports in exports\, the chains in
#    chains\ (a private git repository; the exports stay out of it)
mkdir $HOME\dev\my-data\chains; cd $HOME\dev\my-data\chains
git init -b main
# the quotes matter: PowerShell splits a bare word at its commas
ctmchain init --application P77_RISK_ENGINE --envs 'prod=P,uat=U,egma=E,bench=B' `
    --prefixes 'P77,RQ_,RC_' --leading-only 'RQ_,RC_' --dedupe-jobnames
Add-Content .gitignore ".kilo/"
git add -A; git commit -m "chore: the rules of the repository"

# 3. One branch per environment, production first (--stat: counts, not every difference)
ctmchain refresh ..\exports\prod.xml --apply --stat      # main
ctmchain refresh ..\exports\uat.xml --apply --stat       # env/uat
ctmchain refresh ..\exports\egma.xml --apply --stat      # env/egma
ctmchain refresh ..\exports\bench.xml --apply --stat     # env/bench
git switch main

# 4. The map of what is expected to differ, read from the four branches
ctmchain envmap derive                  # what it found; --apply writes it on the branch map
ctmchain envmap derive --apply
ctmchain envmap suggest                 # what else varies, with the command for each
ctmchain envmap show

# 5. Compare, choose, export
ctmchain compare main env/uat --format md | Out-File -Encoding utf8 uat-vs-prod.md
ctmchain take env/uat --list --base main
ctmchain package main env/uat --take 'folder:P77_WEEKLY_DAILY' -o prod_import.xml

# 6. Optional: the assistant and the web UI
ctmchain kilo init --repo .
ctmchain serve --assistant              # Assistant in the header; Kilo's model

--dedupe-jobnames is for exports where a folder repeats a JOBNAME: the repository gives the repeated ones a numeric suffix; package gives the original names back, and export does with --jobnames original. ctmchain serve --assistant starts kilo serve itself, with the model Kilo is set to (--assistant-model provider/model for another one, kilo models lists them) and stops it with the server. A kilo that is not on the PATH: $env:CTMCHAIN_KILO = "C:\path\to\kilo.cmd".

Where only PyPI is reachable

The source distribution carries the whole project (rules, skills, tests, the web sources and the built UI), so it can be read and adjusted where GitHub is out of reach:

pip download controlm-chain-admin==<version> --no-deps --no-binary :all:
tar -xzf controlm_chain_admin-<version>.tar.gz && cd controlm_chain_admin-<version>
git init -b main && git add -A && git commit -m "chore: controlm-chain-admin <version>"
python -m venv .venv && .venv/bin/pip install -e ".[dev,web]"

.claude/skills/bootstrap/SKILL.md in the archive is the step by step, for a person or an agent: the gate, then a data repository from the exports.

Also in the box

  • Validation with fixes the Control-M interface does not offer: conditions nobody emits or nobody cleans, chains broken by a rename, condition names that differ only by a copy's suffix or by case. ctmchain validate, ctmchain resolve <finding>=<fix> --apply.
  • Refactorings with a preview: rename-job, rename-folder, rename-subapp, move-job, insert-job (between two jobs of a chain), extract-variable, set-variable. Each prints the change and writes only with --apply.
  • A local web UI (ctmchain serve): the folders, the graph of a chain, a job with its attributes grouped, findings, comparison of two branches, an editing form with preview.
  • Ask in plain words. ctmchain mcp gives an assistant (Kilo, Claude, any MCP client) the repository as tools: it answers questions and proposes changes, previewed field by field, and writes one only when you agree. ctmchain kilo init sets Kilo up with an agent that may use those tools only. The assistant's model reads the names and fields of your jobs: use one your company allows.
  • --format json wherever a report is printed, for scripts and agents; exit codes 0 (ok), 1 (findings), 2 (usage), 3 (error).
  • Another way to hold the environments, from the first releases and still there: one branch with a neutral base, a constant per value that differs (@{name}) and the exceptions of each environment, with releases installed environment by environment (receive, check, release, env constants). See DESIGN.md section 5.

Concepts

Term Meaning
Chain repository A git repository of JSON files: chain.json (the rules), folders/<FOLDER>/folder.json, jobs/<JOB>.json, links.json
Environment branch main for production, env/<name> for every other environment: what its last full export said, plus what was taken into it
Refresh A full export overwriting the branch of its environment, after showing what it changes
Map map.json on the branch map: the letter of each environment and the values that stand for each other (a machine, a user, a word of a subject)
Real difference What is left between two environments once the map and the letter are read through
Item Something of a comparison that can be taken alone: subapp:S, folder:F, job:F/J, attr:F/J@NAME, var:F/J@%%NAME
Import file A Control-M XML of the chosen folders, in the terms of the target environment (ctmchain package)
Node A folder or a job, identified as FOLDER/JOB without the environment letter
Link A dependency edge: producer OUTCOND + → consumer INCOND with the same condition name

Development

pip install -e ".[dev,web]"
pytest                                   # unit, functional and end-to-end, synthetic fixtures
cd web && npm ci && npm run build        # builds the web UI into the package
.claude/skills/verify/verify.sh          # the whole quality gate

See CONTRIBUTING.md. The project is developed test-first.

License

MIT — see LICENSE.

Metadata

Release files for controlm-chain-admin 0.2.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 controlm-chain-admin 0.2.0
File Size Uploaded Provenance Actions
controlm_chain_admin-0.2.0.tar.gz 812.4 kB With provenance Details for controlm_chain_admin-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for controlm-chain-admin 0.2.0
File Interpreter ABI Platform Actions
controlm_chain_admin-0.2.0-py3-none-any.whl Python 3 none any Details for controlm_chain_admin-0.2.0-py3-none-any.whl

Total release size: 1.3 MB

Release files / controlm_chain_admin-0.2.0.tar.gz

Download URL controlm_chain_admin-0.2.0.tar.gz
Size 812.4 kB
Tags Source
SHA-256 checksum
How to use checksums
330ab2f8c21bbbbd567dccc49d30e64f7faf1df8526c8c1a59392512b17e31fb
BLAKE2b-256 checksum
How to use checksums
5c7bda8815495b05c4ce7c1220df19b2428dd60f2eeeaf3851628bbb3c97f92d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / controlm_chain_admin-0.2.0-py3-none-any.whl

Download URL controlm_chain_admin-0.2.0-py3-none-any.whl
Size 463.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72b850eba7031ef740796bf39c9fa154149e74b441c123dc8df44e9e7ead3aed
BLAKE2b-256 checksum
How to use checksums
9a9cdc875e9f56eed7a01895dd5e8fe8b7590613c6a44b3dff83d6934226b6e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for controlm-chain-admin 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for controlm_chain_admin-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

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