Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.tensor9.com/llms.txt

Use this file to discover all available pages before exploring further.

cmdlib is the open-source reference repository of operational command templates that ship ready-to-register against any Tensor9 app. Most teams start by registering it as a source, then layer their own app-specific templates on top. It lives at github.com/tensor9ine/cmdlib, Apache 2.0 licensed. How to use cmdlib: register the repo as a source, browse the categories, submit any template like your own.

Why use it

Three reasons to register cmdlib on day one:
  1. Common ops are already written. Disk usage, top processes, pod restarts, EBS snapshots, Temporal workflow termination, etc. The templates declare appropriate data_access tags and permission tiers so your customers can review them quickly.
  2. Templates evolve from real ops incidents. Bug fixes and new templates land via PR in the cmdlib repo and propagate to every install that re-syncs.
  3. They’re good reference for your own templates. When you write an app-specific template, the closest match in cmdlib is usually a good starting point. Browse the directory that matches your target (linux, k8s, aws, etc.) and copy the closest file.

What’s in it

Templates are organized by target environment. Each category is a directory under src/; every .tensor9.tf file inside contributes one template.
CategoryExamplesUse when
linux/disk-usage, top-processes, journalctl-tail, dmesg-tail, network-connections, host-infoTriaging a Linux appliance host. Read-only diagnostics.
darwin/disk-usage, top-processes, log-tail, pmset-status, launchd-list, system-profileTriaging a macOS appliance host. Read-only diagnostics.
k8s/tail-pod-logs, restart-deployment, scale-deployment, drain-node, delete-failed-evicted-pods, describe-deployment, get-events, list-stuck-pods, restart-pods-by-labelStandard SRE operations on the appliance’s Kubernetes cluster.
aws/find-idle-instances, find-untagged-resources, find-unused-security-groups, list-public-s3-buckets, list-old-snapshots, rotate-iam-access-key, snapshot-ebs-volume, rds-snapshot, terminate-stopped-instancesDirect AWS resource operations (EC2, EBS, S3, RDS, IAM).
node/cpu-profile, heap-snapshot, event-loop-lag, gc-trace, open-handles, tail-stderr, npm-list, process-infoDebugging a Node.js process inside the appliance.
temporal/list-running-workflows, list-failed-workflows, describe-workflow, signal-workflow, reset-workflow, terminate-workflowInspecting and intervening in Temporal workflows.
orchestration/pre-deploy-backup, snapshot-then-restart, snapshot-then-resize-volume, drain-then-terminate-node, rollout-restart-then-tailMulti-step compositions that chain primitives from the other categories.
Open the category-level README.md in the repo for the full per-file inventory and the trade-off notes for each template.

Registering it

tensor9 ops template source create \
  --sourceType GitHub \
  --sourceUrl https://github.com/tensor9ine/cmdlib \
  --appName my-app \
  --sourceName cmdlib
Source registration walks every .tensor9.tf under src/, persists each as a template prefixed with its parent directory name (linux/disk-usage.tensor9.tf becomes linux-disk-usage, so it does not collide with darwin/disk-usage.tensor9.tf which becomes darwin-disk-usage). You can scope to a subset of categories with --dirs:
# Only the Kubernetes and AWS templates
tensor9 ops template source create \
  --sourceType GitHub \
  --sourceUrl https://github.com/tensor9ine/cmdlib \
  --appName my-app \
  --sourceName cmdlib-k8s-aws \
  --dirs src/k8s,src/aws
After registration, see Git template libraries for the resync / upgrade / retire commands as the upstream evolves.

Reading a template

Every file is a small standalone Terraform template. The canonical shape is documented in Authoring templates; linux/disk-usage.tensor9.tf is the example used there. Open any file in the repo to see the same pattern applied to a different operation.

Contributing

cmdlib accepts pull requests. Useful contributions tend to fall in one of three buckets:
  • A new template for an existing category. Follow the conventions in that category’s README.md. Match the existing data-access tags and permission-tier choices unless you have a reason not to.
  • A new category. Discuss in an issue first; new categories imply new conventions and shouldn’t be added without coordination.
  • A bug fix or hardening change to an existing template. Include a one-line reproducer in the PR description so reviewers can confirm the fix.
Templates that mutate state (ReadWrite or Admin tier) require an extra reviewer and a dry-run plan in the PR description. The bias is toward conservative defaults: prefer ReadOnly unless the operation genuinely cannot be expressed that way.

License

Apache 2.0. You can fork the repo, register your fork as a source instead of upstream, and curate the template set that matches your deployment shape.