ctx-prompt-cli
v1.12.0
Published
Context-aware CLI tool for prompt generation
Readme
CTX CLI - Context-Aware Prompt Generation Tool
A powerful command-line interface tool for managing context-aware prompts, rules, and change tracking in development projects. CTX CLI helps developers maintain consistent prompt structures with standardized rules and category-specific guidelines.
🚀 Core Functionality
- Project Initialization: Set up a new project with predefined standard rules and categories.
- Rule Management: Create and organize rules by categories for consistent prompt generation.
- Prompt Generation: Generate context-aware prompts that combine standard and category-specific rules.
- Change Tracking: Log and track changes made during development with prompt association.
- History Management: View and filter change history by categories.
- History Clearing: Reset change history while preserving configuration.
📋 Standard Rules
Every project comes with built-in standard rules:
- Change Logging: Automatically reminds to log changes after task completion (144 char limit).
- Task Comprehension: Ensures task requirements are understood and summarized (512 char limit).
- Change Review: Reviews recent changes to avoid repetition and ensure correctness.
🏷️ Default Categories
- General: Universal tasks and guidelines.
- UI: User interface and frontend-related tasks.
- Logic: Backend logic and business rules.
- Testing: Testing strategies and implementation.
Installation
Global Installation
npm install -g ctx-cliLocal Installation
npm install --save-dev ctx-cliUsage
Initialize a New Project
ctx initCreates a ctx.json configuration file with:
- Standard rules
- Default categories
- Empty arrays for custom rules, prompts, and changes
Create New Rules
ctx new rulesInteractive prompts to:
- Enter rule description
- Select existing category or create new one
- Automatically prevents duplicate rules
Generate New Prompts
ctx new promptCreates context-aware prompts by:
- Selecting a category
- Entering task description
- Automatically combining standard rules with category-specific rules
- Generating formatted prompt text
Log Changes
ctx new changeTrack development progress by:
- Selecting associated prompt
- Describing the change made
- Automatically timestamping and categorizing
View Change History
# View all recent changes (last 5)
ctx history
# Filter by category
ctx history --UI
ctx history --Logic
ctx history --TestingClear Change History
ctx history clearRemoves all change history while preserving:
- Standard rules
- Custom rules
- Categories
- Prompts
Configuration File Structure
The ctx.json file structure:
{
"standardRules": [
{
"id": "standard-1",
"description": "After completing the task, use the CLI command `new change` to log a description of what you did, limited to 144 characters."
}
],
"categories": ["General", "UI", "Logic", "Testing"],
"rules": [
{
"id": "uuid",
"description": "Custom rule description",
"category": "UI"
}
],
"prompts": [
{
"id": "uuid",
"category": "UI",
"task": "Create responsive navbar",
"createdAt": "2024-01-01T00:00:00.000Z",
"rules": ["standard-1", "standard-2", "ui-rule-1"],
"promptText": "Task: Create responsive navbar\n\nRules:\n- Standard rule 1\n- UI specific rule"
}
],
"changes": [
{
"id": "uuid",
"promptId": "prompt-uuid",
"category": "UI",
"timestamp": "2024-01-01T00:00:00.000Z",
"description": "Implemented responsive navbar with mobile breakpoints"
}
]
}Error Handling
The CLI provides clear error messages for common scenarios:
- Missing ctx.json: Prompts to run
ctx initfirst. - No prompts available: Suggests creating a prompt before logging changes.
- Invalid categories: Lists available categories
- Duplicate rules: Prevents creation of duplicate rule descriptions.
- File operation errors: Detailed error messages for debugging.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
support me
If you find this tool helpful, please consider supporting me:
- Buy Me a Coffee: PayPal
