{"id":18814970,"url":"https://github.com/aminesayagh/code-wrangler","last_synced_at":"2025-04-11T07:52:47.754Z","repository":{"id":259071558,"uuid":"864843968","full_name":"aminesayagh/Code-Wrangler","owner":"aminesayagh","description":"CodeWrangler is an extensible documentation automation platform that transforms code repositories into structured knowledge bases. Built with a powerful plugin architecture, it enables seamless integration with AI services, documentation generators, and analysis tools.","archived":false,"fork":false,"pushed_at":"2024-12-11T08:07:43.000Z","size":1248,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-30T19:48:11.909Z","etag":null,"topics":["ai","automation","productivity","prompt-engineering"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aminesayagh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-29T10:12:05.000Z","updated_at":"2025-01-09T10:21:14.000Z","dependencies_parsed_at":"2024-12-01T21:29:54.008Z","dependency_job_id":"8cfb4711-9510-4fe0-8e90-1ffaa444311f","html_url":"https://github.com/aminesayagh/Code-Wrangler","commit_stats":null,"previous_names":["aminesayagh/code-wrangler"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminesayagh%2FCode-Wrangler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminesayagh%2FCode-Wrangler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminesayagh%2FCode-Wrangler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aminesayagh%2FCode-Wrangler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aminesayagh","download_url":"https://codeload.github.com/aminesayagh/Code-Wrangler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239750984,"owners_count":19690759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","automation","productivity","prompt-engineering"],"created_at":"2024-11-07T23:47:12.042Z","updated_at":"2025-02-19T23:27:57.039Z","avatar_url":"https://github.com/aminesayagh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeWrangler\n\nCodeWrangler is an extensible documentation automation platform that transforms code repositories into structured knowledge bases. Built with a powerful plugin architecture, it enables seamless integration with AI services, documentation generators, and analysis tools.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Key Features](#key-features)\n- [Demo](#demo)\n- [Quick Start](#quick-start)\n- [Template System](#template-system)\n- [Command Line Interface](#command-line-interface)\n- [Configuration](#configuration)\n- [Plugin System](#plugin-system)\n- [Advanced Usage](#advanced-usage)\n- [Development](#development)\n- [Contributing](#contributing)\n\n## Overview\n\nCodeWrangler is an intelligent documentation assistant that automatically creates comprehensive knowledge bases from your code repositories. It's designed to bridge the gap between your codebase and AI language models like ChatGPT and Claude, making it easier to have meaningful conversations about your code.\n\n## Future \u0026 Plugin Marketplace\n\nCodeWrangler is evolving into a vibrant ecosystem where developers can both use and create specialized documentation tools. Our plugin marketplace will enable you to transform your code documentation in unlimited ways - from generating architectural diagrams and dependency maps, to creating interactive documentation sites, to producing custom AI training datasets.\n\nEvery development team has different documentation needs. Need to analyze security patterns? Install a security scanning plugin. Want to generate API documentation? There's a plugin for that. Building documentation for a specific framework or language? Use language-specific plugins that understand your code's unique patterns.\n\nThe marketplace will be a platform where documentation solutions come together. Developers can contribute their own plugins, monetize their documentation tools, and help build a community of documentation automation tools. The possibilities are endless - from team onboarding tools to code analysis utilities to specialized AI integration plugins.\n\nWhether you're documenting a small project or a large enterprise codebase, the marketplace will have a plugin to match your specific use case - and if it doesn't, you can build and share your own. Join us in building the future of code documentation automation.\n\n## Development Status and Demo\n\nThis library is currently in active development. The core functionality has been implemented, but there are still some features and improvements that are in progress. We welcome any feedback or contributions from the community as we work towards a stable release.\n\n![Demo](./demo.md)\n\n## Quick Start\n\n### Installation\n\nSupports Node.js 18.x and above\n\n```bash\nnpm install -g codewrangler\n```\n\n### Basic Usage\n\n```bash\n# Generate documentation for TypeScript files\ncw \"\\.ts$\" --output typescript-docs\n\n# Watch mode with custom template\ncw \"\\.js$\" --template-dir ./my-templates --watch\n\n# Generate documentation with AI analysis\ncw \"\\.py$\" --output python-docs --enable-ai-analysis\n```\n\n## Template System\n\nCodeWrangler uses a powerful templating system that supports customization at multiple levels.\n\n### Directory Structure\n\n```\ntemplates/\n├── page.md          # Overall documentation template\n├── directory.md     # Directory entry template\n└── file.md         # File entry template\n```\n\n### Template Variables\n\n#### Page Template\n\n```md\n# Project Documentation: {{PROJECT_NAME}}\n\n## Overview\n\nThis documentation was automatically generated on {{GENERATION_DATE}}.\n\n## Directory Structure\n\n\\`\\`\\`\n{{DIRECTORY_STRUCTURE}}\n\\`\\`\\`\n\n## File Contents\n\n{{DIRECTORY_CONTENT}}\n\n## Summary\n\n- Total Files: {{TOTAL_FILES}}\n- Total Directories: {{TOTAL_DIRECTORIES}}\n- Total Size: {{TOTAL_SIZE}}\n```\n\n#### File Template\n\n```md\n### File: {{NAME}}\n\n- **Path:** {{PATH}}\n- **Extension:** {{EXTENSION}}\n- **Size:** {{SIZE}} bytes\n- **Depth:** {{DEEP}}\n- **Lines:** {{LINES}}\n\n### Content:\n\n\\`\\`\\`{{EXTENSION}}\n{{CONTENT}}\n\\`\\`\\`\n```\n\n#### Directory Template\n\n```md\n### Directory: {{NAME}}\n\n- **Path:** {{PATH}}\n- **Size:** {{SIZE}} bytes\n- **Files:** {{LENGTH}}\n- **Total Files (including subdirectories):** {{DEEP_LENGTH}}\n- **Depth:** {{DEEP}}\n\n#### Contents:\n\n{{CONTENT}}\n```\n\n### Custom Templates\n\nCreate your own templates by placing them in a custom directory:\n\n```bash\nmkdir custom-templates\necho \"# {{PROJECT_NAME}}\" \u003e custom-templates/page.md\ncw \"\\.ts$\" --template-dir ./custom-templates\n```\n\n## Command Line Interface\n\n```bash\nUsage: cw [options] \u003cpattern\u003e\n\nArguments:\n  pattern                         File pattern to match (e.g., \"\\.ts$\")\n\nOptions:\n  -V, --version                  Display version information\n  -d, --dir \u003cdir\u003e               Directory to search (default: current)\n  -o, --output \u003cname\u003e           Output file name (default: \"output\")\n  -t, --template-dir \u003cdir\u003e      Custom templates directory\n  -c, --config \u003cpath\u003e           Config file path\n  --watch                       Watch for file changes\n  -h, --help                    Display help information\n```\n\n## Configuration\n\n### Configuration File (codewrangler.json)\n\n```json\n{\n  \"core\": {\n    \"dir\": \"./src\",\n    \"pattern\": \"\\\\.ts$\",\n    \"outputFile\": \"documentation\"\n  },\n  \"templates\": {\n    \"directory\": \"./templates\",\n    \"variables\": {\n      \"AUTHOR\": \"Your Name\",\n      \"VERSION\": \"1.0.0\"\n    }\n  },\n  \"plugins\": {\n    \"tree-visualizer\": {\n      \"enabled\": true,\n      \"format\": \"ascii\"\n    },\n    \"compress\": {\n      \"enabled\": true\n    },\n    \"ai-summary\": {\n      \"enabled\": true,\n      \"model\": \"gpt-4\"\n    },\n    \"relative-documentation\": {\n      \"enabled\": true\n    }\n  }\n}\n```\n\n## Plugin System\n\nCodeWrangler supports plugins for extending functionality. Plugins can hook into various stages of the documentation process.\n\n### 1. Repository Tree Visualizer\n- Generates visual and textual representations of repository structure\n- Features:\n  - ASCII tree visualization\n  - Interactive HTML tree view\n  - Directory size analysis\n  - Custom ignore patterns\n  - Multiple export formats (ASCII, HTML, JSON)\n- Use Case: Quickly understand project structure and organization\n\n### 2. Smart Prompt Engine\n- Enhances AI interactions by providing contextual code references\n- Features:\n  - Links questions to specific code files and line numbers\n  - Maintains conversation history with code context\n  - Suggests relevant files for current discussion\n  - Tracks code changes during conversation\n  - Generates contextual prompts for better AI responses\n- Use Case: More efficient and context-aware AI assistance\n\n### 3. Documentation Crawler\n- Automatically aggregates and indexes library documentation\n- Features:\n  - Identifies project dependencies\n  - Scrapes official documentation sites\n  - Creates offline documentation cache\n  - Integrates with popular package managers (npm, pip, composer)\n  - Generates dependency graphs\n- Use Case: Centralized documentation access and dependency understanding\n\n### 4. Environment Analyzer\n- Analyzes and reports on development environment configuration\n- Features:\n  - Runtime environment detection\n  - Installed tools and versions\n  - System capabilities assessment\n  - Configuration compatibility checks\n  - Environment-specific recommendations\n- Use Case: Environment-aware assistance and troubleshooting\n\n### 5. Code Summarizer\n- Creates concise versions of code files by removing non-essential parts\n- Features:\n  - Smart comment preservation\n  - Redundant code detection\n  - Configuration file summarization\n  - Custom summarization rules\n  - Diff view support\n- Use Case: Focus on essential code components\n\n### Creating a Plugin (In development)\n\n```typescript\nimport { Plugin, BaseNode } from \"codewrangler\";\n\nexport class CustomPlugin implements Plugin {\n  name = \"custom-plugin\";\n\n  async beforeScan(options: ScanOptions): Promise\u003cvoid\u003e {\n    // Pre-scan setup\n  }\n\n  async afterRender(content: string): Promise\u003cstring\u003e {\n    // Post-render modifications\n    return modifiedContent;\n  }\n}\n```\n\n### Using Plugins\n\n```typescript\nconst pipeline = new DocumentationPipeline()\n  .use(new TypeScriptDocsPlugin())\n  .use(new AIAnalysisPlugin())\n  .use(new CustomPlugin());\n\nawait pipeline.process({\n  input: \"./src\",\n  pattern: \".ts$\",\n});\n```\n\n## Advanced Usage\n\n### AI Integration Example\n\n```typescript\nimport { LangChain } from \"langchain\";\n\nconst pipeline = new DocumentationPipeline().use(\n  new LangChainPlugin({\n    prompt: `\n      Analyze this codebase and provide:\n      1. Architecture overview\n      2. Key components\n      3. Improvement suggestions\n    `,\n    model: \"gpt-4\",\n  })\n);\n```\n\n### Custom Template Example\n\n```typescript\nconst customTemplate = new Template({\n  content: `\n    # {{PROJECT_NAME}}\n    Author: {{AUTHOR}}\n    \n    ## Analysis\n    {{AI_ANALYSIS}}\n    \n    ## Components\n    {{COMPONENTS}}\n  `,\n});\n```\n\n## Development\n\n### Prerequisites\n\n- Node.js 18+\n- TypeScript 4.5+\n- npm or yarn\n\n### Setup\n\n```bash\n# Clone repository\ngit clone https://github.com/aminesayagh/Code-Wrangler\n\n# Install dependencies\ncd codewrangler\nnpm install\n\n# Build project\nnpm run build\n\n# Run tests\nnpm test\n```\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](./documentation/CONTRIBUTING.md) for details\n\n## License\n\nApache 2.0 License - See [LICENSE](LICENSE.md) for details.\n\nBuilt with ❤️ by the CodeWrangler team\n\nFor more information, visit our [Documentation](documentation/CONTRIBUTING.md).\nFor check out the [Demo](demo/demo.md)\nFor communicate with the team, visit our [Discussions](https://github.com/aminesayagh/Code-Wrangler/discussions) or [Issues](https://github.com/aminesayagh/Code-Wrangler/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminesayagh%2Fcode-wrangler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faminesayagh%2Fcode-wrangler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faminesayagh%2Fcode-wrangler/lists"}