├── .eslintrc.json ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE │ └── pull_request_template.md └── workflows │ ├── ci.yml │ └── python-package.yml ├── .gitignore ├── .prettierrc ├── CHANGELOG.md ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── Dockerfile ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.md ├── SECURITY.md ├── assets ├── demo-chat-mode-1.gif ├── demo-oneshot-helloworld.gif ├── demo-sparc-task-1.gif ├── demo.gif └── sparc_cli.png.png ├── configuration ├── CONVENTIONS.md └── aider.md ├── docker-compose.yml ├── docs ├── API.md ├── Developer_Guide.md ├── User_Guide.md └── tutorial.md ├── example ├── Architecture │ └── Architecture.md ├── Completion │ ├── .gitignore │ ├── Dockerfile │ ├── LICENSE │ ├── README.md │ ├── agentic_editor │ │ ├── .gitignore │ │ ├── README.md │ │ ├── aider_projects.db │ │ ├── docs │ │ │ ├── README.md │ │ │ ├── api_reference.md │ │ │ ├── architecture.md │ │ │ ├── configure.md │ │ │ ├── contributing.md │ │ │ ├── error_handling.md │ │ │ ├── install.md │ │ │ ├── introduction.md │ │ │ ├── logging.md │ │ │ └── usage.md │ │ ├── main copy 2.py │ │ ├── main copy.py │ │ ├── main.py │ │ ├── poetry.lock │ │ ├── projects.db │ │ ├── projects │ │ │ ├── cleanup_test │ │ │ │ ├── Dockerfile │ │ │ │ ├── main.py │ │ │ │ ├── requirements.txt │ │ │ │ └── utils.py │ │ │ ├── cost-test_test │ │ │ │ ├── Dockerfile │ │ │ │ ├── api_gateway.py │ │ │ │ ├── auth_service.py │ │ │ │ ├── main.py │ │ │ │ ├── microservice_example.py │ │ │ │ └── utils.py │ │ │ ├── sonnet_test │ │ │ │ ├── Dockerfile │ │ │ │ ├── main.py │ │ │ │ └── utils.py │ │ │ └── sqlalchemy_test │ │ │ │ ├── Dockerfile │ │ │ │ ├── main.py │ │ │ │ ├── requirements.txt │ │ │ │ └── utils.py │ │ ├── pyproject.toml │ │ ├── requirements.txt │ │ └── test.txt │ ├── agentic_preview │ │ ├── .gitignore │ │ ├── README.md │ │ ├── main copy.py │ │ ├── main.py │ │ ├── poetry.lock │ │ ├── pyproject.toml │ │ └── start.sh │ ├── doc │ │ ├── README.md │ │ ├── agentic_editor.md │ │ ├── agentic_preview.md │ │ ├── configuration_files.md │ │ ├── repository_overview.md │ │ └── test_projects.md │ ├── flyio-install.sh │ ├── init.sh │ ├── test.txt │ ├── test │ │ └── main.py │ └── ui │ │ ├── .eslintrc.cjs │ │ ├── .gitignore │ │ ├── .gpt_engineer │ │ ├── get-user-snapshot.js │ │ ├── index.js │ │ ├── report-error.js │ │ └── report-url-change.js │ │ ├── README.md │ │ ├── bun.lockb │ │ ├── components.json │ │ ├── gpt-engineer.toml │ │ ├── index.html │ │ ├── jsconfig.json │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── postcss.config.js │ │ ├── public │ │ ├── favicon.ico │ │ ├── og-image.svg │ │ └── placeholder.svg │ │ ├── src │ │ ├── App.jsx │ │ ├── components │ │ │ ├── Header.jsx │ │ │ └── ui │ │ │ │ ├── accordion.jsx │ │ │ │ ├── alert-dialog.jsx │ │ │ │ ├── alert.jsx │ │ │ │ ├── aspect-ratio.jsx │ │ │ │ ├── avatar.jsx │ │ │ │ ├── badge.jsx │ │ │ │ ├── breadcrumb.jsx │ │ │ │ ├── button.jsx │ │ │ │ ├── calendar.jsx │ │ │ │ ├── card.jsx │ │ │ │ ├── carousel.jsx │ │ │ │ ├── checkbox.jsx │ │ │ │ ├── collapsible.jsx │ │ │ │ ├── command.jsx │ │ │ │ ├── context-menu.jsx │ │ │ │ ├── date-picker.jsx │ │ │ │ ├── dialog.jsx │ │ │ │ ├── drawer.jsx │ │ │ │ ├── dropdown-menu.jsx │ │ │ │ ├── form.jsx │ │ │ │ ├── hover-card.jsx │ │ │ │ ├── input-otp.jsx │ │ │ │ ├── input.jsx │ │ │ │ ├── label.jsx │ │ │ │ ├── menubar.jsx │ │ │ │ ├── navigation-menu.jsx │ │ │ │ ├── pagination.jsx │ │ │ │ ├── popover.jsx │ │ │ │ ├── progress.jsx │ │ │ │ ├── radio-group.jsx │ │ │ │ ├── resizable.jsx │ │ │ │ ├── scroll-area.jsx │ │ │ │ ├── select.jsx │ │ │ │ ├── separator.jsx │ │ │ │ ├── sheet.jsx │ │ │ │ ├── skeleton.jsx │ │ │ │ ├── slider.jsx │ │ │ │ ├── sonner.jsx │ │ │ │ ├── switch.jsx │ │ │ │ ├── table.jsx │ │ │ │ ├── tabs.jsx │ │ │ │ ├── textarea.jsx │ │ │ │ ├── toast.jsx │ │ │ │ ├── toaster.jsx │ │ │ │ ├── toggle-group.jsx │ │ │ │ ├── toggle.jsx │ │ │ │ ├── tooltip.jsx │ │ │ │ └── use-toast.js │ │ ├── index.css │ │ ├── main.jsx │ │ ├── nav-items.jsx │ │ └── pages │ │ │ └── Index.jsx │ │ ├── tailwind.config.js │ │ └── vite.config.js ├── Pseudocode │ └── Pseudocode.md ├── Refinement │ └── Refinement.md ├── Specification │ └── Specification.md └── readme.md ├── install.sh ├── pyproject.toml ├── requirements-dev.txt ├── sample.env ├── scripts ├── extract_changelog.py ├── install_playwright.py └── lion_agi.md ├── sparc_cli ├── .github │ └── workflows │ │ └── python-package.yml ├── Dockerfile ├── README.md ├── __init__.py ├── __main__.py ├── __version__.py ├── agent_utils.py ├── config.py ├── console │ ├── __init__.py │ ├── cowboy_messages.py │ ├── formatting.py │ └── output.py ├── docker-entrypoint.sh ├── docs │ ├── README.md │ ├── advanced.md │ ├── architecture.md │ ├── eval-math.md │ ├── eval.md │ └── usage.md ├── env.py ├── examples │ ├── bug_fixer_example.sh │ ├── chat_example.sh │ ├── cowboy_mode_example.sh │ ├── polaris_example.py │ ├── research_example.sh │ ├── security_enhancer_example.sh │ ├── spec_creator_example.sh │ └── webui_creator_example.sh ├── install.sh ├── llm.py ├── non_interactive.py ├── polaris.py ├── proc │ └── interactive.py ├── prompts.py ├── scripts │ ├── README.md │ ├── fly │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── access.sh │ │ ├── config.template.sh │ │ ├── deploy.sh │ │ ├── install.sh │ │ └── startup.sh │ ├── lion-agi.md │ └── test │ │ ├── README.md │ │ ├── agent_test.sh │ │ ├── automated_test.sh │ │ ├── data_test.sh │ │ ├── debug_test.sh │ │ ├── devops_test.sh │ │ ├── docs_test.sh │ │ ├── framework_test.sh │ │ ├── game_test.sh │ │ ├── git_test.sh │ │ ├── gpu_train.sh │ │ ├── lionagi_test.sh │ │ ├── orchestrator_test.sh │ │ ├── qa_test.sh │ │ ├── scraper_test.sh │ │ ├── security_test.sh │ │ ├── serverless_test.sh │ │ └── temp_config.sh ├── setup.py ├── text │ ├── __init__.py │ └── processing.py ├── tool_configs.py └── tools │ ├── __init__.py │ ├── agent.py │ ├── directory.py │ ├── expert.py │ ├── file_str_replace.py │ ├── fuzzy_find.py │ ├── human.py │ ├── list_directory.py │ ├── math │ ├── README.md │ ├── __init__.py │ ├── agent.py │ ├── evaluator.py │ ├── models.py │ ├── test_agent.py │ ├── test_evaluator.py │ └── validator.py │ ├── memory.py │ ├── polaris.py │ ├── programmer.py │ ├── read_file.py │ ├── research.py │ ├── ripgrep.py │ ├── scape.py │ ├── scrape.py │ ├── shell.py │ └── write_file.py ├── specification ├── Architecture.md ├── Completion.md ├── PolarisOne │ ├── overview.md │ ├── research.md │ ├── spec.md │ └── uses.md ├── Pseudocode.md ├── README.md ├── Refinement.md ├── Specification.md └── sparc.md ├── tests ├── pytest.ini ├── scripts │ └── test_extract_changelog.py └── sparc_cli │ ├── console │ └── test_cowboy_messages.py │ ├── proc │ └── test_interactive.py │ ├── test_calculator.py │ ├── test_env.py │ ├── test_llm.py │ ├── test_tool_configs.py │ ├── test_utils.py │ └── tools │ ├── math │ ├── test_agent.py │ ├── test_evaluator.py │ ├── test_models.py │ └── test_validator.py │ ├── test_expert.py │ ├── test_file_str_replace.py │ ├── test_fuzzy_find.py │ ├── test_list_directory.py │ ├── test_memory.py │ ├── test_polaris.py │ ├── test_read_file.py │ ├── test_scrape.py │ ├── test_shell.py │ └── test_write_file.py ├── ui.zip └── ui ├── .env.template ├── .eslintrc.json ├── .gitignore ├── .prettierrc ├── CODEOWNERS ├── LICENSE ├── README.md ├── app ├── actions │ └── publish.ts ├── api │ ├── anthropic │ │ └── route.ts │ ├── chat-direct │ │ └── route.ts │ ├── chat-o1 │ │ └── route.ts │ ├── chat │ │ └── route.ts │ ├── research-chat │ │ └── route.ts │ ├── research │ │ └── route.ts │ └── sandbox │ │ └── route.ts ├── favicon.ico ├── globals.css ├── layout.tsx ├── page.tsx └── providers.tsx ├── components.json ├── components ├── auth-dialog.tsx ├── auth-form.tsx ├── chat-input.tsx ├── chat-picker.tsx ├── chat-settings.tsx ├── chat.tsx ├── code-chat.tsx ├── code-theme.css ├── code-view.tsx ├── command-picker.tsx ├── deploy-dialog.tsx ├── fragment-code.tsx ├── fragment-interpreter.tsx ├── fragment-preview.tsx ├── fragment-web.tsx ├── logo.tsx ├── navbar.tsx ├── preview.tsx └── ui │ ├── alert.tsx │ ├── avatar.tsx │ ├── button.tsx │ ├── card.tsx │ ├── copy-button.tsx │ ├── dialog.tsx │ ├── dropdown-menu.tsx │ ├── input.tsx │ ├── label.tsx │ ├── select.tsx │ ├── separator.tsx │ ├── skeleton.tsx │ ├── tabs.tsx │ ├── textarea.tsx │ ├── theme-toggle.tsx │ ├── toast.tsx │ ├── toaster.tsx │ ├── tooltip.tsx │ └── use-toast.ts ├── lib ├── auth.ts ├── commands.ts ├── commands │ ├── chat-template.ts │ ├── chat.ts │ ├── coding.ts │ ├── fragment.ts │ ├── help.ts │ ├── plan.ts │ ├── pseudo.ts │ ├── research-template.ts │ ├── research.ts │ ├── spec.ts │ ├── test.ts │ └── types.ts ├── duration.ts ├── messages.ts ├── models.json ├── models.ts ├── prompt.ts ├── ratelimit.ts ├── schema.ts ├── supabase.ts ├── templates.json ├── templates.ts ├── types.ts └── utils.ts ├── middleware.ts ├── next.config.js ├── next.config.mjs ├── package-lock.json ├── package.json ├── postcss.config.mjs ├── preview.png ├── public └── thirdparty │ ├── logos │ ├── anthropic.svg │ ├── fireworks.svg │ ├── fireworksai.svg │ ├── google.svg │ ├── groq.svg │ ├── mistral.svg │ ├── ollama.svg │ ├── openai.svg │ ├── togetherai.svg │ ├── vertex.svg │ └── xai.svg │ └── templates │ ├── code-interpreter-v1.svg │ ├── gradio-developer.svg │ ├── nextjs-developer.svg │ ├── streamlit-developer.svg │ └── vue-developer.svg ├── sandbox-templates ├── README.md ├── gradio-developer │ ├── app.py │ ├── e2b.Dockerfile │ └── e2b.toml ├── nextjs-developer │ ├── _app.tsx │ ├── compile_page.sh │ ├── e2b.Dockerfile │ └── e2b.toml ├── streamlit-developer │ ├── app.py │ ├── e2b.Dockerfile │ └── e2b.toml └── vue-developer │ ├── e2b.Dockerfile │ ├── e2b.toml │ └── nuxt.config.ts ├── src └── index.ts ├── tailwind.config.ts ├── tests └── langgraph.test.ts ├── tsconfig.build.json └── tsconfig.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true, 5 | "node": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:react/recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaFeatures": { 15 | "jsx": true 16 | }, 17 | "ecmaVersion": 12, 18 | "sourceType": "module" 19 | }, 20 | "plugins": [ 21 | "react", 22 | "@typescript-eslint" 23 | ], 24 | "rules": { 25 | // Define your custom rules here 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings 2 | * text=auto 3 | 4 | # Define specific file types as binary to prevent Git from attempting to diff them 5 | *.png binary 6 | *.jpg binary 7 | *.gif binary 8 | *.pdf binary 9 | 10 | # Enforce LF line endings for scripts and config files 11 | *.sh text eol=lf 12 | *.js text eol=lf 13 | *.json text eol=lf 14 | *.md text eol=lf 15 | 16 | # Custom diff for Markdown files 17 | *.md diff=markdown 18 | 19 | # Suppress whitespace errors for specific files 20 | /docs/* -text 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a report to help us improve 4 | title: "[BUG] Short description" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Environment:** 27 | - OS: [e.g., Windows, macOS] 28 | - Browser [e.g., chrome, safari] 29 | - Version [e.g., 22] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE] Short description" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Feature Description** 11 | A clear and concise description of what the feature is and what it aims to achieve. 12 | 13 | **Benefits** 14 | Explain the benefits of this feature and how it improves the project. 15 | 16 | **Possible Implementation** 17 | Describe how this feature could be implemented, including any potential challenges. 18 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Pull Request 2 | 3 | ## Description 4 | 5 | Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. 6 | 7 | Fixes # (issue) 8 | 9 | ## Type of Change 10 | 11 | Please delete options that are not relevant. 12 | 13 | - [ ] Bug fix (non-breaking change which fixes an issue) 14 | - [ ] New feature (non-breaking change which adds functionality) 15 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 16 | - [ ] This change requires a documentation update 17 | 18 | ## How Has This Been Tested? 19 | 20 | Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. 21 | 22 | - [ ] Test A 23 | - [ ] Test B 24 | 25 | **Test Configuration**: 26 | * Firmware version: 27 | * Hardware: 28 | * Toolchain: 29 | * SDK: 30 | 31 | ## Checklist: 32 | 33 | - [ ] My code follows the style guidelines of this project 34 | - [ ] I have performed a self-review of my own code 35 | - [ ] I have commented my code, particularly in hard-to-understand areas 36 | - [ ] I have made corresponding changes to the documentation 37 | - [ ] My changes generate no new warnings 38 | - [ ] I have added tests that prove my fix is effective or that my feature works 39 | - [ ] New and existing unit tests pass locally with my changes 40 | - [ ] Any dependent changes have been merged and published in downstream modules 41 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | strategy: 15 | matrix: 16 | node-version: [14.x, 16.x] 17 | python-version: [3.8, 3.9, 3.10] 18 | 19 | steps: 20 | - uses: actions/checkout@v3 21 | 22 | - name: Set up Node.js 23 | uses: actions/setup-node@v3 24 | with: 25 | node-version: ${{ matrix.node-version }} 26 | 27 | - name: Set up Python 28 | uses: actions/setup-python@v4 29 | with: 30 | python-version: ${{ matrix.python-version }} 31 | 32 | - name: Install Dependencies (Node.js) 33 | run: | 34 | npm install 35 | 36 | - name: Install Dependencies (Python) 37 | run: | 38 | python -m pip install --upgrade pip 39 | pip install -r requirements.txt 40 | 41 | - name: Run Tests (Node.js) 42 | run: | 43 | npm test 44 | 45 | - name: Run Tests (Python) 46 | run: | 47 | pytest 48 | -------------------------------------------------------------------------------- /.github/workflows/python-package.yml: -------------------------------------------------------------------------------- 1 | name: Python package 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Set up Python 13 | uses: actions/setup-python@v2 14 | with: 15 | python-version: '3.x' 16 | - name: Install dependencies 17 | run: | 18 | python -m pip install --upgrade pip 19 | pip install flake8 pytest 20 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi 21 | - name: Lint with flake8 22 | run: | 23 | # stop the build if there are Python syntax errors or undefined names 24 | flake8 . 25 | - name: Test with pytest 26 | run: | 27 | pytest 28 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "trailingComma": "es5", 4 | "singleQuote": true, 5 | "printWidth": 80, 6 | "tabWidth": 4 7 | } 8 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This is a comment 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # Owners for all files 5 | * @yourusername 6 | 7 | # Owners for documentation 8 | /docs/ @docsteam 9 | 10 | # Owners for frontend code 11 | /src/frontend/ @frontendteam 12 | 13 | # Owners for backend code 14 | /src/backend/ @backendteam 15 | 16 | # Specific file type 17 | *.js @javascriptowner 18 | *.py @pythonowner 19 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | - Using welcoming and inclusive language 12 | - Being respectful of differing viewpoints and experiences 13 | - Gracefully accepting constructive criticism 14 | 15 | Examples of unacceptable behavior include: 16 | 17 | - Harassment and intimidation 18 | - Discriminatory language or actions 19 | - Revealing private information without consent 20 | 21 | ## Enforcement 22 | 23 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers responsible for enforcement at [your.email@example.com](mailto:your.email@example.com). All complaints will be reviewed and investigated promptly. 24 | 25 | ## Attribution 26 | 27 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html). 28 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to SPARC Framework 2 | 3 | Thank you for considering contributing to the SPARC Framework! We welcome contributions of all kinds, including bug reports, feature requests, and code enhancements. 4 | 5 | ## Code of Conduct 6 | 7 | Please read our [Code of Conduct](./CODE_OF_CONDUCT.md) to understand the standards we expect from our community members. 8 | 9 | ## How to Contribute 10 | 11 | 1. **Fork the Repository** 12 | 2. **Create a New Branch** 13 | ```bash 14 | git checkout -b feature/YourFeature 15 | ``` 16 | 3. **Make Your Changes** 17 | 4. **Commit Your Changes** 18 | ```bash 19 | git commit -m "Description of your changes" 20 | ``` 21 | 5. **Push to Your Branch** 22 | ```bash 23 | git push origin feature/YourFeature 24 | ``` 25 | 6. **Open a Pull Request** 26 | 27 | ## Coding Standards 28 | 29 | Please adhere to the [Coding Standards](./configuration/CONVENTIONS.md) outlined in the project. 30 | 31 | ## Reporting Issues 32 | 33 | If you encounter any issues, please [open an issue](https://github.com/yourusername/sparc-framework/issues) with detailed information. 34 | 35 | ## Running Tests 36 | 37 | Provide instructions on how to run tests to ensure your changes work as intended. 38 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 | Thank you to all the people who contribute to this project! 4 | 5 | ## [Your Name](https://github.com/yourusername) 6 | - Initial work 7 | - Documentation 8 | - Code reviews 9 | 10 | ## [Contributor One](https://github.com/contributorone) 11 | - Feature development 12 | - Bug fixes 13 | 14 | ## [Contributor Two](https://github.com/contributortwo) 15 | - Testing 16 | - Design improvements 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Node.js runtime as the base image 2 | FROM node:16 3 | 4 | # Set the working directory 5 | WORKDIR /app 6 | 7 | # Copy package.json and package-lock.json 8 | COPY package*.json ./ 9 | 10 | # Install dependencies 11 | RUN npm install 12 | 13 | # Copy the rest of the application code 14 | COPY . . 15 | 16 | # Expose the application port 17 | EXPOSE 3000 18 | 19 | # Define the command to run the application 20 | CMD ["npm", "start"] 21 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | include LICENSE 3 | include requirements*.txt 4 | recursive-include agent_langchain *.py 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | install: 2 | ./install.sh 3 | 4 | test: 5 | poetry run pytest 6 | npm test 7 | 8 | build: 9 | docker build -t sparc-framework . 10 | 11 | deploy: 12 | docker-compose up -d 13 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Provide a table or list of supported versions of your project and their respective end-of-life dates. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | Please report security vulnerabilities by emailing [your.email@example.com](mailto:your.email@example.com). All reports will be handled promptly and responsibly. 10 | 11 | ## Acknowledgements 12 | 13 | Thank you to all contributors who help enhance the security of this project. 14 | -------------------------------------------------------------------------------- /assets/demo-chat-mode-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/assets/demo-chat-mode-1.gif -------------------------------------------------------------------------------- /assets/demo-oneshot-helloworld.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/assets/demo-oneshot-helloworld.gif -------------------------------------------------------------------------------- /assets/demo-sparc-task-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/assets/demo-sparc-task-1.gif -------------------------------------------------------------------------------- /assets/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/assets/demo.gif -------------------------------------------------------------------------------- /assets/sparc_cli.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/assets/sparc_cli.png.png -------------------------------------------------------------------------------- /configuration/CONVENTIONS.md: -------------------------------------------------------------------------------- 1 | # SPARC CLI Conventions 2 | 3 | This document outlines the conventions and usage patterns for the SPARC CLI command-line tool, which integrates with the SPARC framework to provide AI-assisted programming and research capabilities. 4 | 5 | 6 | SPARC CLI follows SPARC's staged approach to problem-solving: 7 | 8 | The basic syntax for sparc is: 9 | ```bash 10 | sparc [options] -m "your task message" 11 | ``` 12 | - Should be a clear, specific description of the task 13 | - Example: `sparc -m "Add error handling to the database module"` 14 | 15 | - Useful for understanding code or exploring concepts 16 | - Example: `sparc -m "Explain the authentication flow" --research-only` 17 | 18 | - Include relevant context in the message 19 | - Example: `sparc -m "Add input validation to user registration function in auth.py"` 20 | 21 | ```bash 22 | sparc -m "Add error handling to the database module" 23 | ``` 24 | ```bash 25 | sparc -m "Explain the authentication flow" --research-only 26 | ``` 27 | ```bash 28 | sparc -m "Refactor user authentication" --hil 29 | ``` 30 | ```bash 31 | sparc -m "Optimize database queries" --provider openai --model gpt-4 32 | ``` 33 | ```bash 34 | sparc -m "Analyze security vulnerabilities" --expert-provider anthropic --expert-model claude-2 35 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | services: 3 | app: 4 | build: . 5 | ports: 6 | - "3000:3000" 7 | volumes: 8 | - .:/app 9 | environment: 10 | - NODE_ENV=development 11 | -------------------------------------------------------------------------------- /docs/API.md: -------------------------------------------------------------------------------- 1 | # API Documentation 2 | 3 | ## Overview 4 | 5 | Provide an overview of the API, including its purpose and main features. 6 | 7 | ## Endpoints 8 | 9 | List and describe each API endpoint, including request and response formats. 10 | 11 | ## Authentication 12 | 13 | Explain the authentication methods used by the API. 14 | 15 | ## Error Handling 16 | 17 | Describe how errors are handled and provide examples of error responses. 18 | 19 | ## Examples 20 | 21 | Include examples of API requests and responses. 22 | -------------------------------------------------------------------------------- /docs/Developer_Guide.md: -------------------------------------------------------------------------------- 1 | # Developer Guide 2 | 3 | ## Introduction 4 | 5 | Provide an introduction to the development environment and tools used. 6 | 7 | ## Setup 8 | 9 | Explain how to set up the development environment, including dependencies and configurations. 10 | 11 | ## Code Structure 12 | 13 | Describe the code structure and organization of the project. 14 | 15 | ## Development Workflow 16 | 17 | Outline the development workflow, including branching strategies and code review processes. 18 | 19 | ## Testing 20 | 21 | Provide instructions on how to run tests and add new test cases. 22 | 23 | ## Deployment 24 | 25 | Explain the deployment process and any specific requirements. 26 | -------------------------------------------------------------------------------- /docs/User_Guide.md: -------------------------------------------------------------------------------- 1 | # User Guide 2 | 3 | ## Introduction 4 | 5 | Provide an introduction to the application and its main features. 6 | 7 | ## Installation 8 | 9 | Explain how to install and set up the application. 10 | 11 | ## Usage 12 | 13 | Describe how to use the application, including step-by-step instructions. 14 | 15 | ## Troubleshooting 16 | 17 | Provide solutions to common issues and errors. 18 | 19 | ## Support 20 | 21 | Include information on how to get support or report issues. 22 | -------------------------------------------------------------------------------- /example/Completion/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Python runtime as a parent image 2 | FROM python:3.8-slim 3 | 4 | # Set the working directory in the container 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container at /app 8 | COPY . /app 9 | 10 | # Install Poetry 11 | RUN pip install poetry 12 | 13 | # Install dependencies 14 | RUN poetry install 15 | 16 | # Expose port 5000 for the FastAPI application 17 | EXPOSE 5000 18 | 19 | # Run the FastAPI application using Uvicorn 20 | CMD ["poetry", "run", "uvicorn", "agentic_preview.main:app", "--host", "0.0.0.0", "--port", "5000"] 21 | -------------------------------------------------------------------------------- /example/Completion/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 rUv 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/.gitignore: -------------------------------------------------------------------------------- 1 | .aider* 2 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/README.md: -------------------------------------------------------------------------------- 1 | # Aider FastAPI Service 2 | 3 | ## Description 4 | 5 | This project provides a FastAPI service to run the Aider tool in a virtual environment. It allows you to execute Aider commands via a RESTful API. 6 | 7 | ## Installation 8 | 9 | 1. Clone the repository: 10 | ```bash 11 | git clone 12 | ``` 13 | 2. Navigate to the project directory: 14 | ```bash 15 | cd your_project_name 16 | ``` 17 | 3. Install dependencies using Poetry: 18 | ```bash 19 | poetry install 20 | ``` 21 | 22 | ## Usage 23 | 24 | To start the FastAPI server, run the following command: 25 | 26 | ```bash 27 | uvicorn main:app --host 0.0.0.0 --port 8000 --reload 28 | ``` 29 | 30 | ### API Endpoint 31 | 32 | - **POST** `/run-aider`: Execute the Aider tool with the provided configuration. 33 | 34 | #### Request Body 35 | 36 | - `chat_mode`: Mode for Aider chat (default: "code"). 37 | - `edit_format`: Format for edits (default: "diff"). 38 | - `model`: Model to use (default: "gpt-4"). 39 | - `prompt`: Optional prompt message. 40 | - `files`: List of files to include. 41 | 42 | #### Example Request 43 | 44 | ```json 45 | { 46 | "chat_mode": "code", 47 | "edit_format": "diff", 48 | "model": "gpt-4", 49 | "prompt": "Initial setup", 50 | "files": ["main.py", "utils.py"] 51 | } 52 | ``` 53 | 54 | ## Contributing 55 | 56 | Guidelines for contributing to the project. 57 | 58 | ## License 59 | 60 | This project is licensed under the MIT License. 61 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/aider_projects.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/aider_projects.db -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/README.md: -------------------------------------------------------------------------------- 1 | # Documentation Overview 2 | 3 | This directory contains comprehensive documentation for the Aider FastAPI Service. Below are the links to each section of the documentation: 4 | 5 | - [Introduction](./introduction.md): Provides an overview of the application's purpose, features, and use cases. 6 | - [Architecture](./architecture.md): Describes the overall architecture of the application, including its components and data flow. 7 | - [Installation](./install.md): Details the prerequisites and steps required to install the application. 8 | - [Configuration](./configure.md): Explains the environment variables and configuration options available for the application. 9 | - [Usage](./usage.md): Offers instructions on how to start the server and use the API endpoints. 10 | - [Logging](./logging.md): Describes the logging system and how to use it for debugging and monitoring. 11 | - [Error Handling](./error_handling.md): Explains how errors are handled and reported in the application. 12 | - [API Reference](./api_reference.md): Provides detailed information about each API endpoint, including request/response formats. 13 | 14 | Each document is designed to guide you through different aspects of using and understanding the Aider FastAPI Service. The documentation has been updated to reflect recent improvements in logging and error handling. 15 | 16 | For developers looking to contribute to the project, please refer to the [Contributing Guidelines](./contributing.md) for information on how to submit pull requests, report issues, and follow coding standards. 17 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/api_reference.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/docs/api_reference.md -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/architecture.md: -------------------------------------------------------------------------------- 1 | # Architecture 2 | 3 | ## Overview 4 | 5 | The Aider FastAPI Service is designed to provide a RESTful API for executing the Aider tool within a virtual environment. The application is structured around FastAPI, a modern web framework for building APIs with Python 3.7+. 6 | 7 | ## Components 8 | 9 | ### 1. FastAPI Application 10 | 11 | - **Purpose**: Serves as the main entry point for the API. 12 | - **Endpoints**: 13 | - `/run-aider`: Executes the Aider tool with the provided configuration. 14 | 15 | ### 2. Virtual Environment Management 16 | 17 | - **Purpose**: Ensures that the Aider tool runs in an isolated environment to avoid conflicts with other Python packages. 18 | - **Functions**: 19 | - `create_venv`: Creates a new virtual environment if one does not exist. 20 | - `run_aider`: Installs the Aider tool and executes it within the virtual environment. 21 | 22 | ### 3. Aider Tool 23 | 24 | - **Purpose**: Provides the core functionality for code editing and interaction. 25 | - **Integration**: Installed and executed within the virtual environment. 26 | 27 | ## Data Flow 28 | 29 | 1. **Request Handling**: The FastAPI application receives a request at the `/run-aider` endpoint. 30 | 2. **Configuration Parsing**: The request body is parsed into an `AiderConfig` object. 31 | 3. **Environment Setup**: The application checks for an existing virtual environment or creates a new one. 32 | 4. **Aider Execution**: The Aider tool is installed and executed with the specified configuration. 33 | 5. **Response Streaming**: The output from the Aider tool is streamed back to the client. 34 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/configure.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | 3 | ## Environment Variables 4 | 5 | - **OPENAI_API_KEY**: Required for authenticating with the OpenAI API. Ensure this is set in your environment. 6 | 7 | ## Configuration Options 8 | 9 | The application uses a configuration model (`AiderConfig`) to specify how the Aider tool should be executed. The following options are available: 10 | 11 | - **chat_mode**: Mode for Aider chat (default: "code"). 12 | - **edit_format**: Format for edits (default: "diff"). 13 | - **model**: Model to use (default: "gpt-4"). 14 | - **prompt**: Optional prompt message. 15 | - **files**: List of files to include. 16 | 17 | ## Example Configuration 18 | 19 | ```json 20 | { 21 | "chat_mode": "code", 22 | "edit_format": "diff", 23 | "model": "gpt-4", 24 | "prompt": "Initial setup", 25 | "files": ["main.py", "utils.py"] 26 | } 27 | ``` 28 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/contributing.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/docs/contributing.md -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/error_handling.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/docs/error_handling.md -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/install.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | ## Prerequisites 4 | 5 | - **Python 3.8+**: Ensure Python is installed on your system. 6 | - **Poetry**: Used for dependency management and packaging. 7 | 8 | ## Steps 9 | 10 | 1. **Clone the Repository** 11 | 12 | ```bash 13 | git clone 14 | cd your_project_name 15 | ``` 16 | 17 | 2. **Install Dependencies** 18 | 19 | Use Poetry to install the project dependencies: 20 | 21 | ```bash 22 | poetry install 23 | ``` 24 | 25 | 3. **Set Environment Variables** 26 | 27 | Ensure the `OPENAI_API_KEY` is set in your environment: 28 | 29 | ```bash 30 | export OPENAI_API_KEY='your_openai_api_key' 31 | ``` 32 | 33 | 4. **Run the Application** 34 | 35 | Start the FastAPI server using Uvicorn: 36 | 37 | ```bash 38 | uvicorn main:app --host 0.0.0.0 --port 8000 --reload 39 | ``` 40 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | ## Purpose 4 | 5 | The Aider FastAPI Service is designed to facilitate the execution of the Aider tool through a RESTful API. It allows developers to interact with the Aider tool programmatically, enabling automated code editing and interaction. 6 | 7 | ## Features 8 | 9 | - **RESTful API**: Provides a simple interface for executing Aider commands. 10 | - **Virtual Environment Management**: Ensures isolated execution of the Aider tool. 11 | - **Configurable Execution**: Supports various configuration options for customizing Aider's behavior. 12 | 13 | ## Use Cases 14 | 15 | - **Automated Code Editing**: Integrate Aider into CI/CD pipelines for automated code modifications. 16 | - **Interactive Development**: Use the API to interact with Aider during development for real-time code changes. 17 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/logging.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/docs/logging.md -------------------------------------------------------------------------------- /example/Completion/agentic_editor/docs/usage.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | 3 | ## Starting the Server 4 | 5 | To start the FastAPI server, run the following command: 6 | 7 | ```bash 8 | uvicorn main:app --host 0.0.0.0 --port 8000 --reload 9 | ``` 10 | 11 | ## API Endpoint 12 | 13 | ### **POST** `/run-aider` 14 | 15 | Execute the Aider tool with the provided configuration. 16 | 17 | #### Request Body 18 | 19 | - `chat_mode`: Mode for Aider chat (default: "code"). 20 | - `edit_format`: Format for edits (default: "diff"). 21 | - `model`: Model to use (default: "gpt-4"). 22 | - `prompt`: Optional prompt message. 23 | - `files`: List of files to include. 24 | 25 | #### Example Request 26 | 27 | ```json 28 | { 29 | "chat_mode": "code", 30 | "edit_format": "diff", 31 | "model": "gpt-4", 32 | "prompt": "Initial setup", 33 | "files": ["main.py", "utils.py"] 34 | } 35 | ``` 36 | 37 | #### Example Response 38 | 39 | The response will stream the output from the Aider tool, providing real-time feedback on the execution process. 40 | 41 | ## Error Handling 42 | 43 | - **500 Internal Server Error**: Indicates a failure in executing the Aider tool or setting up the environment. Check the error message for details. 44 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/poetry.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. 2 | package = [] 3 | 4 | [metadata] 5 | lock-version = "2.0" 6 | python-versions = "^3.8" 7 | content-hash = "935b488be9f11b23f14aa1ce3bed4013d88bd77462534b5e4fe5bb82b485bfe9" 8 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/projects.db -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cleanup_test/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Python runtime as a parent image 2 | FROM python:3.9-slim 3 | 4 | # Set the working directory in the container 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container at /app 8 | COPY . /app 9 | 10 | # Install any needed packages specified in requirements.txt 11 | RUN pip install --no-cache-dir -r requirements.txt 12 | 13 | # Make port 8000 available to the world outside this container 14 | EXPOSE 8000 15 | 16 | # Run main.py when the container launches 17 | CMD ["python", "main.py"] 18 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cleanup_test/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | from sqlalchemy import create_engine, Column, Integer, String 3 | from sqlalchemy.ext.declarative import declarative_base 4 | from sqlalchemy.orm import sessionmaker 5 | 6 | app = FastAPI() 7 | 8 | # Database setup 9 | SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db" 10 | engine = create_engine(SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}) 11 | SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) 12 | Base = declarative_base() 13 | 14 | # Example model 15 | class Item(Base): 16 | __tablename__ = "items" 17 | 18 | id = Column(Integer, primary_key=True, index=True) 19 | name = Column(String, index=True) 20 | 21 | Base.metadata.create_all(bind=engine) 22 | 23 | @app.get("/") 24 | def read_root(): 25 | return {"Hello": "World"} 26 | 27 | @app.get("/items/{item_id}") 28 | def read_item(item_id: int): 29 | db = SessionLocal() 30 | item = db.query(Item).filter(Item.id == item_id).first() 31 | db.close() 32 | if item: 33 | return {"item_name": item.name} 34 | return {"error": "Item not found"} 35 | 36 | if __name__ == "__main__": 37 | import uvicorn 38 | uvicorn.run(app, host="0.0.0.0", port=8000) 39 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cleanup_test/requirements.txt: -------------------------------------------------------------------------------- 1 | fastapi==0.68.0 2 | sqlalchemy==1.4.23 3 | uvicorn==0.15.0 4 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cleanup_test/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/projects/cleanup_test/utils.py -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cost-test_test/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Python runtime as a parent image 2 | FROM python:3.9-slim 3 | 4 | # Set the working directory in the container 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container at /app 8 | COPY . /app 9 | 10 | # Install any needed packages specified in requirements.txt 11 | RUN pip install --no-cache-dir fastapi uvicorn 12 | 13 | # Make port 8000 available to the world outside this container 14 | EXPOSE 8000 15 | 16 | # Run app.py when the container launches 17 | CMD ["python", "main.py"] 18 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cost-test_test/api_gateway.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, jsonify 2 | import jwt 3 | import requests 4 | 5 | app = Flask(__name__) 6 | app.config['SECRET_KEY'] = 'your-secret-key' # Replace with a secure secret key 7 | 8 | def token_required(f): 9 | def decorated(*args, **kwargs): 10 | token = request.headers.get('Authorization') 11 | if not token: 12 | return jsonify({"message": "Token is missing"}), 401 13 | try: 14 | data = jwt.decode(token, app.config['SECRET_KEY'], algorithms=["HS256"]) 15 | except: 16 | return jsonify({"message": "Token is invalid"}), 401 17 | return f(*args, **kwargs) 18 | return decorated 19 | 20 | @app.route('/api/', methods=['GET', 'POST', 'PUT', 'DELETE']) 21 | @token_required 22 | def api_gateway(path): 23 | # Route requests to appropriate microservices 24 | # This is a simplified example; you'd implement actual routing logic here 25 | response = requests.request( 26 | method=request.method, 27 | url=f"http://localhost:5001/{path}", 28 | headers={key: value for (key, value) in request.headers if key != 'Host'}, 29 | data=request.get_data(), 30 | cookies=request.cookies, 31 | allow_redirects=False) 32 | 33 | return (response.content, response.status_code, response.headers.items()) 34 | 35 | if __name__ == '__main__': 36 | app.run(port=5002) 37 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cost-test_test/auth_service.py: -------------------------------------------------------------------------------- 1 | import jwt 2 | from datetime import datetime, timedelta 3 | from flask import Flask, request, jsonify 4 | from werkzeug.security import generate_password_hash, check_password_hash 5 | 6 | app = Flask(__name__) 7 | app.config['SECRET_KEY'] = 'your-secret-key' # Replace with a secure secret key 8 | 9 | # Mock user database (replace with actual database in production) 10 | users_db = {} 11 | 12 | @app.route('/register', methods=['POST']) 13 | def register(): 14 | data = request.get_json() 15 | username = data.get('username') 16 | password = data.get('password') 17 | 18 | if username in users_db: 19 | return jsonify({"message": "User already exists"}), 400 20 | 21 | hashed_password = generate_password_hash(password) 22 | users_db[username] = hashed_password 23 | 24 | return jsonify({"message": "User registered successfully"}), 201 25 | 26 | @app.route('/login', methods=['POST']) 27 | def login(): 28 | data = request.get_json() 29 | username = data.get('username') 30 | password = data.get('password') 31 | 32 | if username not in users_db: 33 | return jsonify({"message": "Invalid credentials"}), 401 34 | 35 | if check_password_hash(users_db[username], password): 36 | token = jwt.encode({ 37 | 'user': username, 38 | 'exp': datetime.utcnow() + timedelta(hours=1) 39 | }, app.config['SECRET_KEY']) 40 | 41 | return jsonify({"token": token}), 200 42 | 43 | return jsonify({"message": "Invalid credentials"}), 401 44 | 45 | if __name__ == '__main__': 46 | app.run(port=5000) 47 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cost-test_test/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | 3 | app = FastAPI() 4 | 5 | @app.get("/") 6 | async def root(): 7 | return {"message": "Hello World"} 8 | 9 | if __name__ == "__main__": 10 | import uvicorn 11 | uvicorn.run(app, host="0.0.0.0", port=8000) 12 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cost-test_test/microservice_example.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, jsonify 2 | 3 | app = Flask(__name__) 4 | 5 | @app.route('/api/data', methods=['GET']) 6 | def get_data(): 7 | # This is a protected route that requires a valid JWT 8 | return jsonify({"data": "This is protected data"}) 9 | 10 | if __name__ == '__main__': 11 | app.run(port=5001) 12 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/cost-test_test/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/projects/cost-test_test/utils.py -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/sonnet_test/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Python runtime as a parent image 2 | FROM python:3.11-slim 3 | 4 | # Set the working directory in the container 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container at /app 8 | COPY . /app 9 | 10 | # Install FastAPI and Uvicorn 11 | RUN pip install fastapi uvicorn 12 | 13 | # Make port 80 available to the world outside this container 14 | EXPOSE 80 15 | 16 | # Run app.py when the container launches 17 | CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"] 18 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/sonnet_test/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | 3 | app = FastAPI() 4 | 5 | @app.get("/") 6 | async def read_root(): 7 | return {"Hello": "World"} 8 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/sonnet_test/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/projects/sonnet_test/utils.py -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/sqlalchemy_test/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Python runtime as a parent image 2 | FROM python:3.9-slim 3 | 4 | # Set the working directory in the container 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container at /app 8 | COPY . /app 9 | 10 | # Install any needed packages specified in requirements.txt 11 | RUN pip install --no-cache-dir -r requirements.txt 12 | 13 | # Make port 8000 available to the world outside this container 14 | EXPOSE 8000 15 | 16 | # Run main.py when the container launches 17 | CMD ["python", "main.py"] 18 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/sqlalchemy_test/main.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI 2 | from sqlalchemy import create_engine, Column, Integer, String 3 | from sqlalchemy.ext.declarative import declarative_base 4 | from sqlalchemy.orm import sessionmaker 5 | 6 | app = FastAPI() 7 | 8 | # Database setup 9 | SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db" 10 | engine = create_engine(SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}) 11 | SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) 12 | Base = declarative_base() 13 | 14 | # Example model 15 | class Item(Base): 16 | __tablename__ = "items" 17 | 18 | id = Column(Integer, primary_key=True, index=True) 19 | name = Column(String, index=True) 20 | 21 | Base.metadata.create_all(bind=engine) 22 | 23 | @app.get("/") 24 | def read_root(): 25 | return {"Hello": "World"} 26 | 27 | @app.get("/items/{item_id}") 28 | def read_item(item_id: int): 29 | db = SessionLocal() 30 | item = db.query(Item).filter(Item.id == item_id).first() 31 | db.close() 32 | if item: 33 | return {"item_name": item.name} 34 | return {"error": "Item not found"} 35 | 36 | if __name__ == "__main__": 37 | import uvicorn 38 | uvicorn.run(app, host="0.0.0.0", port=8000) 39 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/sqlalchemy_test/requirements.txt: -------------------------------------------------------------------------------- 1 | fastapi==0.68.0 2 | sqlalchemy==1.4.23 3 | uvicorn==0.15.0 4 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/projects/sqlalchemy_test/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/agentic_editor/projects/sqlalchemy_test/utils.py -------------------------------------------------------------------------------- /example/Completion/agentic_editor/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "your_project_name" 3 | version = "0.1.0" 4 | description = "A brief description of your project" 5 | authors = ["Your Name "] 6 | license = "MIT" 7 | 8 | [tool.poetry.dependencies] 9 | python = "^3.8" 10 | aider-chat = "^1.0.0" 11 | sqlalchemy = "^1.4.0" 12 | fastapi = "^0.68.0" 13 | 14 | [build-system] 15 | requires = ["poetry-core>=1.0.0"] 16 | build-backend = "poetry.core.masonry.api" 17 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/requirements.txt: -------------------------------------------------------------------------------- 1 | fastapi 2 | pydantic 3 | uvicorn 4 | -------------------------------------------------------------------------------- /example/Completion/agentic_editor/test.txt: -------------------------------------------------------------------------------- 1 | This is a test file. 2 | It has been updated with some content. 3 | Feel free to modify this file as needed. 4 | -------------------------------------------------------------------------------- /example/Completion/agentic_preview/README.md: -------------------------------------------------------------------------------- 1 | # Agentic Preview 2 | 3 | Agentic Preview is an asynchronous FastAPI backend service that allows users to deploy preview environments using Fly.io. 4 | 5 | ## Features 6 | 7 | - Deploys GitHub repositories to Fly.io 8 | - Asynchronous operations for improved performance 9 | - Configurable runtime limit for deployments 10 | - Cleans up resources after usage 11 | 12 | ## Requirements 13 | 14 | - Python 3.8 or higher 15 | - Git 16 | - Fly.io CLI (`flyctl`) 17 | 18 | ## Installation 19 | 20 | Run the `install.sh` script to set up the project environment: 21 | 22 | ```bash 23 | bash install.sh 24 | ``` 25 | -------------------------------------------------------------------------------- /example/Completion/agentic_preview/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "agentic-preview" 3 | version = "0.1.0" 4 | description = "Agentic Preview Backend Service" 5 | authors = ["Your Name"] 6 | readme = "README.md" 7 | 8 | [tool.poetry.dependencies] 9 | python = "^3.8" 10 | fastapi = "^0.115.0" 11 | uvicorn = {extras = ["standard"], version = "^0.31.0"} 12 | pydantic = "^2.9.2" 13 | python-dotenv = "^0.21.0" 14 | 15 | [build-system] 16 | requires = ["poetry-core"] 17 | build-backend = "poetry.core.masonry.api" 18 | -------------------------------------------------------------------------------- /example/Completion/agentic_preview/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script starts the FastAPI application using Uvicorn with Poetry. 4 | 5 | set -e 6 | 7 | # Navigate to the directory where this script is located 8 | SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 9 | cd "$SCRIPT_DIR" 10 | 11 | # Check if Poetry is installed, if not, install it 12 | if ! command -v poetry &> /dev/null 13 | then 14 | echo "Poetry not found, installing Poetry..." 15 | curl -sSL https://install.python-poetry.org | python3 - 16 | export PATH="$HOME/.local/bin:$PATH" 17 | fi 18 | 19 | # Install required Python packages using Poetry 20 | if [ -f "pyproject.toml" ]; then 21 | echo "Installing Python dependencies with Poetry..." 22 | poetry install 23 | else 24 | echo "No pyproject.toml found, skipping Python dependency installation." 25 | fi 26 | 27 | # Run the FastAPI application using Poetry with auto-reload 28 | poetry run uvicorn main:app --host 0.0.0.0 --port 5000 --reload 29 | 30 | # Note: 31 | # Ensure that 'main.py' contains the FastAPI app instance named 'app', and this script is located in the same directory as 'main.py'. -------------------------------------------------------------------------------- /example/Completion/doc/README.md: -------------------------------------------------------------------------------- 1 | # Repository Documentation 2 | 3 | Welcome to the documentation for this repository. This folder contains detailed information about the structure, components, and files in the project. 4 | 5 | ## Table of Contents 6 | 7 | 1. [Repository Overview](./repository_overview.md) 8 | 2. [Agentic Editor](./agentic_editor.md) 9 | 3. [Agentic Preview](./agentic_preview.md) 10 | 4. [Test Projects](./test_projects.md) 11 | 5. [Configuration Files](./configuration_files.md) 12 | 13 | Please refer to the individual files for more detailed information on each component. 14 | -------------------------------------------------------------------------------- /example/Completion/doc/agentic_editor.md: -------------------------------------------------------------------------------- 1 | # Agentic Editor 2 | 3 | The Agentic Editor is a main component of this repository, located in the `agentic_editor/` directory. It is responsible for editing and managing projects. 4 | 5 | ## Key Components 6 | 7 | 1. **Main Application File**: `main.py` 8 | - Contains the core functionality of the Agentic Editor 9 | 10 | 2. **Database Files**: 11 | - `projects.db` 12 | - `aider_projects.db` 13 | 14 | 3. **Models**: 15 | - `User` 16 | - `Project` 17 | 18 | 4. **Configuration**: 19 | - `AiderConfig` 20 | 21 | ## Key Functions 22 | 23 | 1. **Database Operations**: 24 | - `init_db()`: Initialize the database 25 | - `get_db()`: Get a database session 26 | 27 | 2. **Project Management**: 28 | - `update_project_user_data(project_name: str, user_id: str, db: Session)`: Update project user data 29 | - `remove_old_projects(db: Session, age: Optional[timedelta] = None, user_id: Optional[str] = None)`: Remove old projects 30 | - `cleanup_projects(db: Session)`: Clean up projects 31 | 32 | 3. **Output Processing**: 33 | - `stream_aider_output(process)`: Stream output from Aider 34 | - `process_aider_output(output_lines)`: Process Aider output 35 | 36 | 4. **Cost Tracking**: 37 | - `update_project_cost(db: Session, project_name: str, user_id: str, cost: float)`: Update project cost 38 | 39 | For more detailed information on the implementation of these components and functions, please refer to the `main.py` file in the `agentic_editor/` directory. 40 | -------------------------------------------------------------------------------- /example/Completion/doc/agentic_preview.md: -------------------------------------------------------------------------------- 1 | # Agentic Preview 2 | 3 | The Agentic Preview is another main component of this repository, located in the `agentic_preview/` directory. It is responsible for deploying and previewing projects. 4 | 5 | ## Key Components 6 | 7 | 1. **Main Application File**: `main.py` 8 | - Contains the core functionality of the Agentic Preview 9 | 10 | ## Key Functions 11 | 12 | 1. **Command Execution**: 13 | - `execute_command(cmd: List[str], cwd: Optional[str] = None)`: Execute a command 14 | 15 | 2. **App Deployment and Management**: 16 | - `deploy_app(repo: str, branch: str, args: List[str], app_name: str, repo_dir: str, memory: int)`: Deploy an application 17 | - `stop_instance(app_name: str)`: Stop an instance of an application 18 | 19 | 3. **File Operations**: 20 | - `explore_directory(path)`: Explore a directory 21 | - `modify_file(path, content)`: Modify a file 22 | - `create_file(path, content)`: Create a new file 23 | - `remove_file(path)`: Remove a file 24 | 25 | 4. **Dockerfile Creation**: 26 | - `create_dockerfile(repo_path)`: Create a Dockerfile 27 | 28 | 5. **Logging Functionality**: 29 | - `stream_logs(app_name: str)`: Stream logs for an application 30 | 31 | For more detailed information on the implementation of these functions, please refer to the `main.py` file in the `agentic_preview/` directory. 32 | -------------------------------------------------------------------------------- /example/Completion/doc/configuration_files.md: -------------------------------------------------------------------------------- 1 | # Configuration Files 2 | 3 | This repository contains several configuration and setup files that are crucial for project management, dependency handling, and deployment. Here's an overview of the key configuration files: 4 | 5 | 1. **pyproject.toml** 6 | - Location: Root directory 7 | - Purpose: Defines the project metadata, dependencies, and build system requirements 8 | - Used by: Poetry (Python dependency management tool) 9 | 10 | 2. **poetry.lock** 11 | - Location: Root directory 12 | - Purpose: Locks the versions of all dependencies to ensure consistent installations 13 | - Used by: Poetry 14 | 15 | 3. **start.sh** 16 | - Location: Root directory 17 | - Purpose: Shell script to start the application or perform initial setup 18 | 19 | 4. **flyio-install.sh** 20 | - Location: Root directory 21 | - Purpose: Shell script for installing and setting up the application on Fly.io platform 22 | 23 | 5. **.gitignore** 24 | - Location: Root directory and `agentic_editor/` directory 25 | - Purpose: Specifies files and directories that Git should ignore 26 | 27 | These configuration files play a crucial role in maintaining the project's structure, managing dependencies, and facilitating deployment processes. Always refer to these files when setting up the project environment or making changes to the project structure. 28 | 29 | For more detailed information on each file's contents and usage, please refer to the files directly in the repository root. 30 | -------------------------------------------------------------------------------- /example/Completion/doc/repository_overview.md: -------------------------------------------------------------------------------- 1 | # Repository Overview 2 | 3 | This git repository contains multiple projects and components, primarily focused on the Agentic Editor and Agentic Preview applications. Below is a high-level overview of the repository structure: 4 | 5 | ## Main Components 6 | 7 | 1. **Agentic Editor** (agentic_editor/) 8 | - Main application for editing and managing projects 9 | - Includes database management, user and project models, and various utility functions 10 | 11 | 2. **Agentic Preview** (agentic_preview/) 12 | - Application for deploying and previewing projects 13 | - Includes functions for command execution, app deployment, and file operations 14 | 15 | 3. **Test Projects** 16 | - Various test projects to demonstrate and validate functionality 17 | 18 | 4. **Configuration and Setup Files** 19 | - Files for project configuration, dependency management, and setup scripts 20 | 21 | ## Key Files 22 | 23 | - `test.txt`: Contains a brief overview of the repository structure 24 | - `main.py`: Main application files for both Agentic Editor and Agentic Preview 25 | - `projects.db` and `aider_projects.db`: Database files for project management 26 | - `pyproject.toml` and `poetry.lock`: Python project configuration and dependency management 27 | - `start.sh` and `flyio-install.sh`: Setup and installation scripts 28 | 29 | For more detailed information on each component, please refer to the specific documentation files in this folder. 30 | -------------------------------------------------------------------------------- /example/Completion/doc/test_projects.md: -------------------------------------------------------------------------------- 1 | # Test Projects 2 | 3 | This repository contains several test projects that demonstrate and validate the functionality of the Agentic Editor and Agentic Preview applications. These projects are located in the `agentic_editor/projects/` directory. 4 | 5 | ## List of Test Projects 6 | 7 | 1. **cleanup_test** 8 | - Purpose: Test project cleanup functionality 9 | 10 | 2. **cost-test_test** 11 | - Purpose: Test cost tracking and reporting 12 | - Key files: 13 | - `Dockerfile` 14 | - `api_gateway.py` 15 | - `microservice_example.py` 16 | - `utils.py` 17 | 18 | 3. **sonnet_test** 19 | - Purpose: Test poetry generation or analysis 20 | - Key files: 21 | - `Dockerfile` 22 | - `main.py` 23 | 24 | 4. **sqlalchemy_test** 25 | - Purpose: Test SQLAlchemy integration and database operations 26 | - Key files: 27 | - `Dockerfile` 28 | - `requirements.txt` 29 | 30 | Each of these test projects serves a specific purpose in validating different aspects of the main applications. They may include their own Dockerfiles, Python scripts, and configuration files as needed for their specific testing purposes. 31 | 32 | For more detailed information on each test project, please refer to their respective directories and files within the `agentic_editor/projects/` folder. 33 | -------------------------------------------------------------------------------- /example/Completion/test.txt: -------------------------------------------------------------------------------- 1 | hello 2 | 3 | Created by ruv 4 | 5 | Repository Overview 6 | 7 | This git repository contains multiple projects and components: 8 | 9 | 1. Agentic Editor (agentic_editor/) 10 | - Main application file: main.py 11 | - Database: projects.db, aider_projects.db 12 | - Models: User, Project 13 | - Configuration: AiderConfig 14 | - Key functions: 15 | - Database operations (init_db, get_db) 16 | - Project management (update_project_user_data, remove_old_projects, cleanup_projects) 17 | - Output processing (stream_aider_output, process_aider_output) 18 | - Cost tracking (update_project_cost) 19 | 20 | 2. Agentic Preview (agentic_preview/) 21 | - Main application file: main.py 22 | - Key functions: 23 | - Command execution (execute_command) 24 | - App deployment and management (deploy_app, stop_instance) 25 | - File operations (explore_directory, modify_file, create_file, remove_file) 26 | - Dockerfile creation (create_dockerfile) 27 | - Logging functionality (stream_logs) 28 | 29 | 3. Various test projects: 30 | - cleanup_test 31 | - cost-test_test 32 | - sonnet_test 33 | - sqlalchemy_test 34 | 35 | 4. Configuration and setup files: 36 | - pyproject.toml 37 | - poetry.lock 38 | - start.sh 39 | - flyio-install.sh 40 | 41 | Last updated: 2024-10-07 42 | This overview is part of a git repository. 43 | -------------------------------------------------------------------------------- /example/Completion/test/main.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/test/main.py -------------------------------------------------------------------------------- /example/Completion/ui/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { browser: true, es2020: true }, 4 | extends: [ 5 | "eslint:recommended", 6 | "plugin:react/recommended", 7 | "plugin:react/jsx-runtime", 8 | "plugin:react-hooks/recommended", 9 | ], 10 | ignorePatterns: ["dist", ".eslintrc.cjs"], 11 | parserOptions: { ecmaVersion: "latest", sourceType: "module" }, 12 | settings: { react: { version: "18.2" } }, 13 | plugins: ["react-refresh"], 14 | rules: { 15 | "react/jsx-no-target-blank": "off", 16 | "react/prop-types": "off", 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /example/Completion/ui/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | .aider* 26 | -------------------------------------------------------------------------------- /example/Completion/ui/.gpt_engineer/get-user-snapshot.js: -------------------------------------------------------------------------------- 1 | import { toPng } from "html-to-image"; 2 | 3 | export const loadGetUserSnapshotEventListener = () => { 4 | window.addEventListener("blur", () => { 5 | toPng(document.body).then((url) => { 6 | window.top.postMessage({ type: "USER_SNAPSHOT", snapshot: url }, "http://localhost:3000"); 7 | window.top.postMessage({ type: "USER_SNAPSHOT", snapshot: url }, "https://gptengineer.app"); 8 | }); 9 | }); 10 | }; 11 | -------------------------------------------------------------------------------- /example/Completion/ui/.gpt_engineer/index.js: -------------------------------------------------------------------------------- 1 | import { loadGetUserSnapshotEventListener } from "./get-user-snapshot"; 2 | import { loadReportUrlChangeEventListener } from "./report-url-change"; 3 | import { loadReportErrorEventListener } from "./report-error"; 4 | 5 | const main = () => { 6 | if (window.top === window.self) { 7 | return; 8 | } 9 | loadGetUserSnapshotEventListener(); 10 | loadReportUrlChangeEventListener(); 11 | loadReportErrorEventListener(); 12 | }; 13 | 14 | main(); 15 | -------------------------------------------------------------------------------- /example/Completion/ui/.gpt_engineer/report-url-change.js: -------------------------------------------------------------------------------- 1 | export const loadReportUrlChangeEventListener = () => { 2 | /** 3 | * Listen to URL changes and report them to the parent window 4 | * 5 | * See https://stackoverflow.com/a/46428962 6 | * The Navigation API https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API seemed promising, 7 | * but it is not supported in all major browsers. 8 | */ 9 | const observeUrlChange = () => { 10 | let oldHref = document.location.href; 11 | const body = document.querySelector("body"); 12 | const observer = new MutationObserver(() => { 13 | if (oldHref !== document.location.href) { 14 | oldHref = document.location.href; 15 | window.top.postMessage({ type: "URL_CHANGED", url: document.location.href }, "https://run.gptengineer.app"); 16 | window.top.postMessage({ type: "URL_CHANGED", url: document.location.href }, "http://localhost:3000"); 17 | } 18 | }); 19 | observer.observe(body, { childList: true, subtree: true }); 20 | }; 21 | 22 | window.addEventListener("load", observeUrlChange); 23 | }; -------------------------------------------------------------------------------- /example/Completion/ui/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/ui/bun.lockb -------------------------------------------------------------------------------- /example/Completion/ui/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": false, 5 | "tsx": false, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "src/index.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /example/Completion/ui/gpt-engineer.toml: -------------------------------------------------------------------------------- 1 | [run] 2 | build = "npm run build" 3 | 4 | [gptengineer-app] 5 | project_id = "..." -------------------------------------------------------------------------------- /example/Completion/ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | cosmic-sparkle-ui 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /example/Completion/ui/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "paths": { 4 | "@/*": ["./src/*"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /example/Completion/ui/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /example/Completion/ui/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruvnet/sparc/a8d7dae14ec541bd86ea9075d41c8ef064afdc57/example/Completion/ui/public/favicon.ico -------------------------------------------------------------------------------- /example/Completion/ui/src/App.jsx: -------------------------------------------------------------------------------- 1 | import { Toaster } from "@/components/ui/sonner"; 2 | import { TooltipProvider } from "@/components/ui/tooltip"; 3 | import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; 4 | import { BrowserRouter, Routes, Route } from "react-router-dom"; 5 | import { navItems } from "./nav-items"; 6 | 7 | const queryClient = new QueryClient(); 8 | 9 | const App = () => ( 10 | 11 | 12 | 13 | 14 | 15 | {navItems.map(({ to, page }) => ( 16 | 17 | ))} 18 | 19 | 20 | 21 | 22 | ); 23 | 24 | export default App; -------------------------------------------------------------------------------- /example/Completion/ui/src/components/Header.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Button } from "@/components/ui/button"; 3 | 4 | const Header = () => { 5 | return ( 6 |
7 |
8 |
9 | {/* Replace logo with icon */} 10 | 11 | 12 | 13 | 20 |
21 |
22 | 27 | 32 |
33 |
34 |
35 | ); 36 | }; 37 | 38 | export default Header; 39 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/accordion.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as AccordionPrimitive from "@radix-ui/react-accordion" 3 | import { ChevronDown } from "lucide-react" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const Accordion = AccordionPrimitive.Root 8 | 9 | const AccordionItem = React.forwardRef(({ className, ...props }, ref) => ( 10 | 11 | )) 12 | AccordionItem.displayName = "AccordionItem" 13 | 14 | const AccordionTrigger = React.forwardRef(({ className, children, ...props }, ref) => ( 15 | 16 | svg]:rotate-180", 20 | className 21 | )} 22 | {...props}> 23 | {children} 24 | 25 | 26 | 27 | )) 28 | AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName 29 | 30 | const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => ( 31 | 35 |
{children}
36 |
37 | )) 38 | 39 | AccordionContent.displayName = AccordionPrimitive.Content.displayName 40 | 41 | export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } 42 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/alert.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { cva } from "class-variance-authority"; 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const alertVariants = cva( 7 | "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", 8 | { 9 | variants: { 10 | variant: { 11 | default: "bg-background text-foreground", 12 | destructive: 13 | "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", 14 | }, 15 | }, 16 | defaultVariants: { 17 | variant: "default", 18 | }, 19 | } 20 | ) 21 | 22 | const Alert = React.forwardRef(({ className, variant, ...props }, ref) => ( 23 |
28 | )) 29 | Alert.displayName = "Alert" 30 | 31 | const AlertTitle = React.forwardRef(({ className, ...props }, ref) => ( 32 |
36 | )) 37 | AlertTitle.displayName = "AlertTitle" 38 | 39 | const AlertDescription = React.forwardRef(({ className, ...props }, ref) => ( 40 |
44 | )) 45 | AlertDescription.displayName = "AlertDescription" 46 | 47 | export { Alert, AlertTitle, AlertDescription } 48 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/aspect-ratio.jsx: -------------------------------------------------------------------------------- 1 | import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" 2 | 3 | const AspectRatio = AspectRatioPrimitive.Root 4 | 5 | export { AspectRatio } 6 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/avatar.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as AvatarPrimitive from "@radix-ui/react-avatar" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Avatar = React.forwardRef(({ className, ...props }, ref) => ( 7 | 11 | )) 12 | Avatar.displayName = AvatarPrimitive.Root.displayName 13 | 14 | const AvatarImage = React.forwardRef(({ className, ...props }, ref) => ( 15 | 19 | )) 20 | AvatarImage.displayName = AvatarPrimitive.Image.displayName 21 | 22 | const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => ( 23 | 30 | )) 31 | AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName 32 | 33 | export { Avatar, AvatarImage, AvatarFallback } 34 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/badge.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { cva } from "class-variance-authority"; 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const badgeVariants = cva( 7 | "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", 8 | { 9 | variants: { 10 | variant: { 11 | default: 12 | "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", 13 | secondary: 14 | "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", 15 | destructive: 16 | "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", 17 | outline: "text-foreground", 18 | }, 19 | }, 20 | defaultVariants: { 21 | variant: "default", 22 | }, 23 | } 24 | ) 25 | 26 | function Badge({ 27 | className, 28 | variant, 29 | ...props 30 | }) { 31 | return (
); 32 | } 33 | 34 | export { Badge, badgeVariants } 35 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/button.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { Slot } from "@radix-ui/react-slot" 3 | import { cva } from "class-variance-authority"; 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const buttonVariants = cva( 8 | "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", 9 | { 10 | variants: { 11 | variant: { 12 | default: "bg-primary text-primary-foreground hover:bg-primary/90", 13 | destructive: 14 | "bg-destructive text-destructive-foreground hover:bg-destructive/90", 15 | outline: 16 | "border border-input bg-background hover:bg-accent hover:text-accent-foreground", 17 | secondary: 18 | "bg-secondary text-secondary-foreground hover:bg-secondary/80", 19 | ghost: "hover:bg-accent hover:text-accent-foreground", 20 | link: "text-primary underline-offset-4 hover:underline", 21 | }, 22 | size: { 23 | default: "h-10 px-4 py-2", 24 | sm: "h-9 rounded-md px-3", 25 | lg: "h-11 rounded-md px-8", 26 | icon: "h-10 w-10", 27 | }, 28 | }, 29 | defaultVariants: { 30 | variant: "default", 31 | size: "default", 32 | }, 33 | } 34 | ) 35 | 36 | const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => { 37 | const Comp = asChild ? Slot : "button" 38 | return ( 39 | () 43 | ); 44 | }) 45 | Button.displayName = "Button" 46 | 47 | export { Button, buttonVariants } 48 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/card.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | const Card = React.forwardRef(({ className, ...props }, ref) => ( 6 |
10 | )) 11 | Card.displayName = "Card" 12 | 13 | const CardHeader = React.forwardRef(({ className, ...props }, ref) => ( 14 |
18 | )) 19 | CardHeader.displayName = "CardHeader" 20 | 21 | const CardTitle = React.forwardRef(({ className, ...props }, ref) => ( 22 |

26 | )) 27 | CardTitle.displayName = "CardTitle" 28 | 29 | const CardDescription = React.forwardRef(({ className, ...props }, ref) => ( 30 |

34 | )) 35 | CardDescription.displayName = "CardDescription" 36 | 37 | const CardContent = React.forwardRef(({ className, ...props }, ref) => ( 38 |

39 | )) 40 | CardContent.displayName = "CardContent" 41 | 42 | const CardFooter = React.forwardRef(({ className, ...props }, ref) => ( 43 |
47 | )) 48 | CardFooter.displayName = "CardFooter" 49 | 50 | export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } 51 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/checkbox.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as CheckboxPrimitive from "@radix-ui/react-checkbox" 3 | import { Check } from "lucide-react" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const Checkbox = React.forwardRef(({ className, ...props }, ref) => ( 8 | 15 | 16 | 17 | 18 | 19 | )) 20 | Checkbox.displayName = CheckboxPrimitive.Root.displayName 21 | 22 | export { Checkbox } 23 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/collapsible.jsx: -------------------------------------------------------------------------------- 1 | import * as CollapsiblePrimitive from "@radix-ui/react-collapsible" 2 | 3 | const Collapsible = CollapsiblePrimitive.Root 4 | 5 | const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger 6 | 7 | const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent 8 | 9 | export { Collapsible, CollapsibleTrigger, CollapsibleContent } 10 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/date-picker.jsx: -------------------------------------------------------------------------------- 1 | import { format } from "date-fns"; 2 | import { Calendar as CalendarIcon } from "lucide-react"; 3 | 4 | import { cn } from "@/lib/utils"; 5 | import { Button } from "@/components/ui/button"; 6 | import { Calendar } from "@/components/ui/calendar"; 7 | import { 8 | Popover, 9 | PopoverContent, 10 | PopoverTrigger, 11 | } from "@/components/ui/popover"; 12 | 13 | export function DatePicker({ date, onDateChange, className }) { 14 | return ( 15 | 16 | 17 | 28 | 29 | 30 | 36 | 37 | 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/hover-card.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as HoverCardPrimitive from "@radix-ui/react-hover-card" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const HoverCard = HoverCardPrimitive.Root 7 | 8 | const HoverCardTrigger = HoverCardPrimitive.Trigger 9 | 10 | const HoverCardContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( 11 | 20 | )) 21 | HoverCardContent.displayName = HoverCardPrimitive.Content.displayName 22 | 23 | export { HoverCard, HoverCardTrigger, HoverCardContent } 24 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/input.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | const Input = React.forwardRef(({ className, type, ...props }, ref) => { 6 | return ( 7 | () 15 | ); 16 | }) 17 | Input.displayName = "Input" 18 | 19 | export { Input } 20 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/label.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as LabelPrimitive from "@radix-ui/react-label" 3 | import { cva } from "class-variance-authority"; 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const labelVariants = cva( 8 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" 9 | ) 10 | 11 | const Label = React.forwardRef(({ className, ...props }, ref) => ( 12 | 13 | )) 14 | Label.displayName = LabelPrimitive.Root.displayName 15 | 16 | export { Label } 17 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/popover.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as PopoverPrimitive from "@radix-ui/react-popover" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Popover = PopoverPrimitive.Root 7 | 8 | const PopoverTrigger = PopoverPrimitive.Trigger 9 | 10 | const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( 11 | 12 | 21 | 22 | )) 23 | PopoverContent.displayName = PopoverPrimitive.Content.displayName 24 | 25 | export { Popover, PopoverTrigger, PopoverContent } 26 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/progress.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as ProgressPrimitive from "@radix-ui/react-progress" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Progress = React.forwardRef(({ className, value, ...props }, ref) => ( 7 | 11 | 14 | 15 | )) 16 | Progress.displayName = ProgressPrimitive.Root.displayName 17 | 18 | export { Progress } 19 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/radio-group.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as RadioGroupPrimitive from "@radix-ui/react-radio-group" 3 | import { Circle } from "lucide-react" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const RadioGroup = React.forwardRef(({ className, ...props }, ref) => { 8 | return (); 9 | }) 10 | RadioGroup.displayName = RadioGroupPrimitive.Root.displayName 11 | 12 | const RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => { 13 | return ( 14 | ( 21 | 22 | 23 | 24 | ) 25 | ); 26 | }) 27 | RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName 28 | 29 | export { RadioGroup, RadioGroupItem } 30 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/resizable.jsx: -------------------------------------------------------------------------------- 1 | import { GripVertical } from "lucide-react" 2 | import * as ResizablePrimitive from "react-resizable-panels" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const ResizablePanelGroup = ({ 7 | className, 8 | ...props 9 | }) => ( 10 | 16 | ) 17 | 18 | const ResizablePanel = ResizablePrimitive.Panel 19 | 20 | const ResizableHandle = ({ 21 | withHandle, 22 | className, 23 | ...props 24 | }) => ( 25 | div]:rotate-90", 28 | className 29 | )} 30 | {...props}> 31 | {withHandle && ( 32 |
34 | 35 |
36 | )} 37 |
38 | ) 39 | 40 | export { ResizablePanelGroup, ResizablePanel, ResizableHandle } 41 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/scroll-area.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => ( 7 | 11 | 12 | {children} 13 | 14 | 15 | 16 | 17 | )) 18 | ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName 19 | 20 | const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => ( 21 | 33 | 34 | 35 | )) 36 | ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName 37 | 38 | export { ScrollArea, ScrollBar } 39 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/separator.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as SeparatorPrimitive from "@radix-ui/react-separator" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Separator = React.forwardRef(( 7 | { className, orientation = "horizontal", decorative = true, ...props }, 8 | ref 9 | ) => ( 10 | 20 | )) 21 | Separator.displayName = SeparatorPrimitive.Root.displayName 22 | 23 | export { Separator } 24 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/skeleton.jsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils" 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }) { 7 | return (
); 8 | } 9 | 10 | export { Skeleton } 11 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/slider.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as SliderPrimitive from "@radix-ui/react-slider" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Slider = React.forwardRef(({ className, ...props }, ref) => ( 7 | 11 | 13 | 14 | 15 | 17 | 18 | )) 19 | Slider.displayName = SliderPrimitive.Root.displayName 20 | 21 | export { Slider } 22 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/sonner.jsx: -------------------------------------------------------------------------------- 1 | import { useTheme } from "next-themes" 2 | import { Toaster as Sonner } from "sonner" 3 | 4 | const Toaster = ({ 5 | ...props 6 | }) => { 7 | const { theme = "system" } = useTheme() 8 | 9 | return ( 10 | () 25 | ); 26 | } 27 | 28 | export { Toaster } 29 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/switch.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as SwitchPrimitives from "@radix-ui/react-switch" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Switch = React.forwardRef(({ className, ...props }, ref) => ( 7 | 14 | 18 | 19 | )) 20 | Switch.displayName = SwitchPrimitives.Root.displayName 21 | 22 | export { Switch } 23 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/tabs.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as TabsPrimitive from "@radix-ui/react-tabs" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Tabs = TabsPrimitive.Root 7 | 8 | const TabsList = React.forwardRef(({ className, ...props }, ref) => ( 9 | 16 | )) 17 | TabsList.displayName = TabsPrimitive.List.displayName 18 | 19 | const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => ( 20 | 27 | )) 28 | TabsTrigger.displayName = TabsPrimitive.Trigger.displayName 29 | 30 | const TabsContent = React.forwardRef(({ className, ...props }, ref) => ( 31 | 38 | )) 39 | TabsContent.displayName = TabsPrimitive.Content.displayName 40 | 41 | export { Tabs, TabsList, TabsTrigger, TabsContent } 42 | -------------------------------------------------------------------------------- /example/Completion/ui/src/components/ui/textarea.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | const Textarea = React.forwardRef(({ className, ...props }, ref) => { 6 | return ( 7 | (