Skip to main content

A library for executing CEDARScript, a SQL-like language for code analysis and transformations

Project description

CEDARScript Editor (Python)

PyPI version Python Versions Code style: black License: MIT

CEDARScript Editor (Python) is a CEDARScript runtime for interpreting CEDARScript scripts and performing code analysis and modification operations on a codebase.

CEDARScript enables offloading low-level code syntax and structure concerns, such as indentation and line counting, from the LLMs. The CEDARScript runtime bears the brunt of file editing by locating the exact line numbers and characters to change, which indentation levels to apply to each line and so on, allowing the CEDARScript commands to focus instead on higher levels of abstraction, like identifier names, line markers, relative indentations and positions (AFTER, BEFORE, INSIDE a function, its BODY, at the TOP or BOTTOM of it...).

It acts as an intermediary between the LLM and the codebase, handling the low-level details of code manipulation and allowing the AI to focus on higher-level tasks.

What is CEDARScript?

CEDARScript (Concise Examination, Development, And Refactoring Script) is a domain-specific language that aims to improve how AI coding assistants interact with codebases and communicate their code modification intentions.

It provides a standardized way to express complex code modification and analysis operations, making it easier for AI-assisted development tools to understand and execute these tasks.

Features

  • Given a CEDARScript script and a base directory, executes the script commands on files inside the base directory;
  • Return results in XML format for easier parsing and processing by LLM systems

Installation

You can install CEDARScript Editor using pip:

pip install cedarscript-editor

Usage

Here's a quick example of how to use CEDARScript Editor:

from cedarscript_editor import CEDARScriptEdior

parser = CEDARScriptEdior()
code = """
CREATE FILE "example.py"
UPDATE FILE "example.py"
    INSERT AT END OF FILE
        CONTENT
            print("Hello, World!")
        END CONTENT
END UPDATE
"""

commands, errors = parser.parse_script(code)

if errors:
    for error in errors:
        print(f"Error: {error}")
else:
    for command in commands:
        print(f"Parsed command: {command}")

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

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

cedarscript_editor-1.1.3.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

cedarscript_editor-1.1.3-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file cedarscript_editor-1.1.3.tar.gz.

File metadata

  • Download URL: cedarscript_editor-1.1.3.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for cedarscript_editor-1.1.3.tar.gz
Algorithm Hash digest
SHA256 ba9b39cdc8f3c1dfd5bf6e28bc434cc6f6be791add15d41bba48a57f6168fd98
MD5 2367b5b4fbf0b1c97e3eb4d73c747a27
BLAKE2b-256 bca0603ac8412fe385f7f19d20cbb1ec9d5b9ea96601dec3159431668de0e647

See more details on using hashes here.

File details

Details for the file cedarscript_editor-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for cedarscript_editor-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9e2d0ef12508e556a9fc384de80798e89ebc8db01c75d749ace3c7ee3a98339c
MD5 765aac476d7d432072b0fa93b5c95940
BLAKE2b-256 594352ceb92f8be663c531b3341fa7af98ffbe45756190a8cd08f3d954ba13fe

See more details on using hashes here.

Supported by

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