|
| 1 | +# Quick Start |
| 2 | + |
| 3 | +Getting started with Context Generator is straightforward. Follow these simple steps to create your first context file |
| 4 | +for LLMs. |
| 5 | + |
| 6 | +## 1. Install Context Generator |
| 7 | + |
| 8 | +Download and install the tool using our installation script: |
| 9 | + |
| 10 | +```bash |
| 11 | +curl -sSL https://raw.githubusercontent.com/butschster/context-generator/main/download-latest.sh | sh |
| 12 | +``` |
| 13 | + |
| 14 | +This installs the `ctx` command to your system (typically in `/usr/local/bin`). |
| 15 | + |
| 16 | +> **Want more options?** See the complete [Installation Guide](/getting-started) for alternative installation methods. |
| 17 | +
|
| 18 | +## 2. Initialize a Configuration File |
| 19 | + |
| 20 | +Create a new configuration file in your project directory: |
| 21 | + |
| 22 | +```bash |
| 23 | +ctx init |
| 24 | +``` |
| 25 | + |
| 26 | +This generates a `context.yaml` file with a basic structure to get you started. |
| 27 | + |
| 28 | +> **Pro tip:** Run `ctx init --type=json` if you prefer JSON configuration format. |
| 29 | +> Check the [Command Reference](/getting-started/command-reference) for all available commands and options. |
| 30 | +
|
| 31 | +## 3. Describe Your Project Structure |
| 32 | + |
| 33 | +Edit the generated `context.yaml` file to specify what code or content you want to include. For example: |
| 34 | + |
| 35 | +```yaml |
| 36 | +documents: |
| 37 | + - description: "User Authentication System" |
| 38 | + outputPath: "auth-context.md" |
| 39 | + sources: |
| 40 | + - type: file |
| 41 | + description: "Authentication Controllers" |
| 42 | + sourcePaths: |
| 43 | + - src/Auth |
| 44 | + filePattern: "*.php" |
| 45 | + |
| 46 | + - type: file |
| 47 | + description: "Authentication Models" |
| 48 | + sourcePaths: |
| 49 | + - src/Models |
| 50 | + filePattern: "*User*.php" |
| 51 | +``` |
| 52 | +
|
| 53 | +This configuration will gather all PHP files from the `src/Auth` directory and any PHP files containing "User" in their |
| 54 | +name from the `src/Models` directory. |
| 55 | + |
| 56 | +#### Need more advanced configuration? |
| 57 | + |
| 58 | + - Learn about [Document Structure](/documents) and properties |
| 59 | + - Explore different source types like [GitHub](/sources/github-source), [Git Diff](/sources/git-diff-source), |
| 60 | + or [URL](/sources/url-source) |
| 61 | + - Apply [Modifiers](/modifiers) to transform your content (like extracting PHP signatures) |
| 62 | + - Discover how to use [Environment Variables](/environment-variables) in your config |
| 63 | + - Use [IDE Integration](/getting-started/ide-integration) for autocompletion and validation |
| 64 | + |
| 65 | +## 4. Build the Context |
| 66 | + |
| 67 | +Generate your context file by running: |
| 68 | + |
| 69 | +```bash |
| 70 | +ctx |
| 71 | +``` |
| 72 | + |
| 73 | +The tool will process your configuration and create the specified output file (`auth-context.md` in our example). |
| 74 | + |
| 75 | +> **Tip**: Configure [Logging](/advanced/logging) with `-v`, `-vv`, or `-vvv` for detailed output |
| 76 | + |
| 77 | +## 5. Share with an LLM |
| 78 | + |
| 79 | +Upload or paste the generated context file to your favorite LLM (like ChatGPT or Claude). Now you can ask specific |
| 80 | +questions about your codebase, and the LLM will have the necessary context to provide accurate assistance. |
| 81 | + |
| 82 | +Example prompt: |
| 83 | + |
| 84 | +> I've shared my authentication system code with you. Can you help me identify potential security vulnerabilities in the |
| 85 | +> user registration process? |
| 86 | + |
| 87 | +> **Next steps:** Check out [Development with Context Generator](/advanced/development-process) for best practices on |
| 88 | +> integrating context generation into your AI-powered development workflow. |
| 89 | + |
| 90 | +That's it! You're now ready to leverage LLMs with proper context about your codebase. |
| 91 | + |
| 92 | +## JSON Schema |
| 93 | + |
| 94 | +For better editing experience, Context Generator provides a JSON schema for autocompletion and validation in your IDE: |
| 95 | + |
| 96 | +```bash |
| 97 | +# Show schema URL |
| 98 | +ctx schema |
| 99 | +
|
| 100 | +# Download schema to current directory |
| 101 | +ctx schema --download |
| 102 | +``` |
| 103 | + |
| 104 | +> **Learn more:** See [IDE Integration](/getting-started/ide-integration) for detailed setup instructions for VSCode, |
| 105 | +> PhpStorm, and other editors. |
0 commit comments