Skip to main content

CPTD CLI

Reason this release was yanked:

important update security

Project description

CPTD CLI

CPTD CLI is not just a command-line tool. It is an extensible management platform designed to:

Create custom commands and extensions Enable command exchange between users Integrate with external tools and APIs Automate workflows, reporting, and strategic analysis Serve as the core engine for any user or graphical interfaces (UI)

Architectural Principles

  1. CLI as an Extensible Platform

Every command is just a regular Python file with a defined interface. You can create your own command in under 5 minutes.

Commands are simple Python modules with minimal structure. Each command includes a manifest file (name, description, author, version, dependencies). Developers can use the "cptd newcommand" template to get started instantly.

Commands can be tested and debugged interactively during development using:

cptd command --add yourcommand.zip (adds the command to the CLI system - only ZIP)

cptd command --del yourcommand (removes the command)

This enables rapid prototyping, testing, and cleanup without restarting or rebuilding the system.

Run your command:

cptd yourcommand

Run your project:

cptd yourcommand

  1. Security and Validation

All commands in the shared repository undergo strict security review. During installation, CPTD CLI performs automatic checks for forbidden code (e.g., dynamic pip install inside command files). During publishing to the shared repository, each command undergoes rigorous validation for security, structure, and manifest integrity. When submitted by the community, commands are moderated and reviewed before inclusion in the official repository.

  1. CLI as a Core Engine for UI

It serves as a bridge between graphical environments that use CLI as their core engine. CPTD CLI acts as the core backend for all present and future interfaces. All UI components interact with the CLI for logic processing and data operations.

  1. Centralized and Decentralized Distribution

Commands can be shared and loaded from shared repositories. Follows a standardized format for sharing, importing, and distributing CLI commands.

  1. Autonomy and Reliability

Works fully offline — no cloud required. No telemetry, no hidden data collection, no external connections. Compatible with Windows, Linux, and macOS.

Why It Matters

Flexibility: Adapt CLI to any workflow — from license checks to automation. Scalability: From solo developers to enterprise teams. Extensibility: Build, share, moderate, and integrate custom commands. Security: Strict validation at all stages — installation, execution, and repository submission. Transparency: All code is open, modular, and auditable.

  1. Open Source and Public Repository

CPTD CLI is a free and open-source project. Its full source code is available in the public repository:
https://github.com/asbjornrasen/cptd-dsl

This guarantees full transparency, increases trust and security, and allows anyone to inspect, contribute to, or fork the system. By being open, CPTD ensures long-term independence and verifiability.

Ready? Submit Your Command to the Official CPTD CLI Repository:

  • Fork the repository:
    https://github.com/asbjornrasen/cptdcli-plugin

  • Create a branch:
    feature/mycommand

  • Add your ZIP archive to:
    cptdcli-plugin/community_plugin/yourcommand.zip

  • Ensure that:

    • the structure is correct

    • main.py, manifests, and folders are in the root of the archive

    • --help works

    • no auto-install logic is used

  • Append your plugin manifest at the end of the community-plugins.json file with the following format:

{
"name": "example",
"description": "example",
"version": "1.0.0",
"target": "Windows",
"entrypoint": "example.py",
"dependencies": ["example"],
"author": "example",
"email": "example@example.com",
"github": "https://github.com/example/example",
"website": "https://example.com",
"license": "example.md"
}

When specifying "target", define the target OS: Windows, Linux, MacOS, or All.


Sure. Here's the same content in plain English text, with all Markdown formatting removed and nothing deleted:


How to Add a New Command to CPTD CLI

To add your command to the CLI, run:

cptd command --add yourcommand.zip

Submission Format (ZIP ONLY)

All CPTD CLI commands must be submitted as a .zip archive.

Example of a Simple Command:

taskcleaner.zip
├── main.py
├── manifest.yaml
└── manifest.json

Example of a Project-Level Command with Subfolders:

taskmanager.zip
├── main.py
├── manifest.yaml
├── manifest.json
├── util/
│ └── parser.py
└── service/
└── api.py

Rules:

  • main.py, manifest.yaml, and manifest.json must be located at the root of the archive
  • The archive must not contain a nested folder named after the command
  • The archive name determines the command name: For example: taskcleaner.zipcptd taskcleaner
  • manifest.yaml and manifest.json must both explicitly define entrypoint: main.py
  • If main.py is placed in a subfolder, the command will be rejected
  • Both manifest files (YAML and JSON) are required
  • Folders like util/ and service/ are allowed and encouraged for modular design
  • Auto-installation of dependencies in code is strictly prohibited

Mandatory Elements of a Command

Each command must contain the following required elements:

  1. SYNTAX — Command Description:

SYNTAX = {
"name": "yourcommand",
"description": "What this command does.",
"usage": "cptd yourcommand --input

  1. run(argv) Function:

def run(argv): ...

This is the entry point invoked when the command is executed.

  1. --help Handling and Help Output:

if "--help" in argv or "-h" in argv:
print_help(SYNTAX)
return

This ensures unified help and autodocumentation support.

  1. Use of print_help(SYNTAX) on Errors:

except Exception as e:
print(f"[!] Argument error: {e}")
print_help(SYNTAX)
return

Recommended Template:

from pathlib import Path
import argparse
from cptd_tools.syntax_utils import print_help

SYNTAX = {
"name": "yourcommand",
"description": "Describe what this command does.",
"usage": "cptd yourcommand --input

def run(argv):
if "--help" in argv or "-h" in argv:
print_help(SYNTAX)
return


parser = argparse.ArgumentParser(description=SYNTAX["description"], add_help=False)
parser.add_argument('--input', type=Path, required=True, help='Path to the input file or folder')
parser.add_argument('--flag', action='store_true', help='Optional flag')

try:
args = parser.parse_args(argv)
except Exception as e:
print(f"[!] Argument error: {e}")
print_help(SYNTAX)
return

if not args.input.exists():
print(f"[!] Input path does not exist:\n {args.input}")
return

print(f"[✔] Processing input: {args.input}")
if args.flag:
print("[✔] Flag is set.")


Testing or Add Your Command:

To add your command to the CLI, run:

cptd command --add yourcommand.zip

To list all available commands:

cptd list

To view help for your command:

cptd yourcommand --help

To run your command:

cptd yourcommand

To delete your command:

cptd command --del yourcommand


Standards:

  • SYNTAX is required
  • run(argv) is required
  • --help must not use argparse; use print_help(SYNTAX) only
  • Code must be clean, readable, and free from unnecessary dependencies

Required Manifest Files:

Both manifest files must be in the same folder as main.py.

  • manifest.yaml — human-readable
  • manifest.json — machine-readable

Required fields in both manifests:

name: Unique name of the command (must match the archive name)
description: What the command does
version: Version (example: 1.0.0)
entrypoint: Always set to main.py
target: Supported OS (example: all, linux, windows, macos)
dependencies: Required pip libraries
author: Author’s name
email: Contact email
github: GitHub link
website: Website (optional)
license: License (example: MIT, license.md, etc.)


Ready? Submit Your Command to the Official CPTD CLI Repository:

  1. Fork the repository:
    https://github.com/asbjornrasen/cptdcli-plugin

  2. Create a branch: feature/mycommand

  3. Add your ZIP archive to:
    cptdcli-plugin/community_plugin/yourcommand.zip

  4. Ensure that:

    • the structure is correct
    • main.py, manifests, and folders are in the root of the archive
    • --help works
    • no auto-install logic is used
  5. Append your plugin manifest at the end of the community-plugins.json file with the following format:

{
"name": "example",
"description": "example",
"version": "1.0.0",
"target": "Windows",
"entrypoint": "example.py",
"dependencies": ["example"],
"author": "example",
"email": "example@example.com",
"github": "https://github.com/example/example",
"website": "https://example.com",
"license": "example.md"
}

When specifying "target", define the target OS: Windows, Linux, MacOS, or All.

  1. Submit a Pull Request with a description.

Tip: Follow the CPTD philosophy — clarity, modularity, practicality.

Need a template?

cptd newcommand

You’ll get a ready-made project structure with main.py, manifest.yaml, util/, and service/.

Ready to build commands? CPTD CLI awaits your ideas. The best ones may be included in the official release.

Summary

CPTD CLI is more than a tool — it is a foundation for building, validating, and exchanging smart operational utilities. Its flexible architecture, strict security, and transparent model make it the ideal control core for personal and enterprise-level systems.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cptd-2.0.1.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cptd-2.0.1-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file cptd-2.0.1.tar.gz.

File metadata

  • Download URL: cptd-2.0.1.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for cptd-2.0.1.tar.gz
Algorithm Hash digest
SHA256 44944ec23d9826b80bbb12bb3389999ddf6af59b4dae8a62f41249d600cba18b
MD5 d6f1cc4ba295b0f1d49346fce1be55b9
BLAKE2b-256 a5a3ea14122dca1b98c08bfab89b884345ac3a5d5f2d9da0ba69247b3802633b

See more details on using hashes here.

File details

Details for the file cptd-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: cptd-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for cptd-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 460f70e4dec8c5b08648addd27c55416548a6b7b98a2b813928ba4877543d364
MD5 4a9f0f2b4c81d658983ed48cb77ad4b3
BLAKE2b-256 d988a09d7b1858998e331b02c102e56445927cdf7492cda5b328ebc5b9669ef2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page