├── website ├── public │ ├── CNAME │ ├── assets │ │ ├── css │ │ │ ├── images │ │ │ │ ├── header.jpg │ │ │ │ ├── overlay1.png │ │ │ │ ├── overlay2.png │ │ │ │ ├── overlay3.svg │ │ │ │ └── overlay4.svg │ │ │ └── marquee.css │ │ ├── webfonts │ │ │ ├── fa-brands-400.eot │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-solid-900.eot │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff │ │ │ ├── fa-brands-400.woff │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.eot │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff │ │ │ ├── fa-solid-900.woff2 │ │ │ └── fa-regular-400.woff2 │ │ ├── js │ │ │ ├── jquery.scrolly.min.js │ │ │ └── main.js │ │ └── images │ │ │ ├── Mistral2.svg │ │ │ ├── Groq.svg │ │ │ ├── OpenAI.svg │ │ │ ├── Qwen.svg │ │ │ ├── Mistral.svg │ │ │ ├── Claude.svg │ │ │ └── Deepseek.svg │ └── prism-theme.css ├── src │ ├── assets │ │ ├── examples │ │ │ ├── node_app │ │ │ │ ├── question.txt │ │ │ │ ├── node_app │ │ │ │ │ ├── README.md │ │ │ │ │ ├── src │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── utils.js │ │ │ │ │ └── data │ │ │ │ │ │ └── sample.json │ │ │ │ └── prompt.md │ │ │ ├── recipe_list │ │ │ │ ├── my_recipes │ │ │ │ │ ├── pantry │ │ │ │ │ │ └── my_ingredients.txt │ │ │ │ │ └── recipes │ │ │ │ │ │ ├── pizza.txt │ │ │ │ │ │ ├── pasta.txt │ │ │ │ │ │ ├── salad.txt │ │ │ │ │ │ └── soup.txt │ │ │ │ ├── question.txt │ │ │ │ └── prompt.md │ │ │ └── history_notes │ │ │ │ ├── question.txt │ │ │ │ ├── history_notes │ │ │ │ ├── history │ │ │ │ │ ├── ww2.txt │ │ │ │ │ ├── medieval.txt │ │ │ │ │ └── renaissance.txt │ │ │ │ └── meta │ │ │ │ │ └── my_revision_goals.txt │ │ │ │ └── prompt.md │ │ ├── filter.png │ │ ├── houston.webp │ │ ├── architecture.png │ │ ├── CLI.svg │ │ ├── MCP.svg │ │ └── SDK.svg │ ├── components │ │ ├── Footer.astro │ │ ├── Section4.astro │ │ ├── Header.astro │ │ ├── Section2.astro │ │ └── Section1.astro │ ├── content │ │ └── docs │ │ │ └── docs │ │ │ ├── references │ │ │ ├── default_template.md │ │ │ └── command_line_options.md │ │ │ ├── how_to │ │ │ ├── ssh.md │ │ │ ├── install.md │ │ │ └── filter_files.md │ │ │ ├── explanations │ │ │ ├── glob_pattern_filter.mdx │ │ │ ├── tokenizers.md │ │ │ └── glob_patterns.md │ │ │ ├── tutorials │ │ │ ├── getting_started.mdx │ │ │ ├── using_templates.md │ │ │ └── use_filter.mdx │ │ │ ├── vision.mdx │ │ │ └── welcome.mdx │ ├── content.config.ts │ ├── styles │ │ └── global.css │ ├── pages │ │ ├── robots.txt.ts │ │ └── index.astro │ └── layouts │ │ └── BaseLayout.astro ├── .vscode │ ├── extensions.json │ └── launch.json ├── tsconfig.json ├── .gitignore ├── package.json ├── README.md └── astro.config.mjs ├── crates ├── code2prompt-python │ ├── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_config.py │ │ ├── test_special_feature.py │ │ └── test_generation.py │ ├── .python-version │ ├── src │ │ └── lib.rs │ ├── Cargo.toml │ ├── requirements.lock │ ├── python-sdk │ │ ├── __init__.py │ │ ├── code2prompt_rs │ │ │ ├── __init__.py │ │ │ └── code2prompt.py │ │ ├── examples │ │ │ └── basic_usage.py │ │ ├── README.md │ │ └── .gitignore │ ├── requirements-dev.lock │ └── pyproject.toml ├── code2prompt-core │ ├── src │ │ ├── lib.rs │ │ ├── default_template_md.hbs │ │ ├── default_template_xml.hbs │ │ ├── util.rs │ │ ├── tokenizer.rs │ │ ├── configuration.rs │ │ ├── template.rs │ │ ├── sort.rs │ │ └── filter.rs │ ├── build.rs │ ├── templates │ │ ├── claude-xml.hbs │ │ ├── document-the-code.hbs │ │ ├── write-github-readme.hbs │ │ ├── write-git-commit.hbs │ │ ├── clean-up-code.hbs │ │ ├── fix-bugs.hbs │ │ ├── cryptography-ctf-solver.hbs │ │ ├── web-ctf-solver.hbs │ │ ├── improve-performance.hbs │ │ ├── write-github-pull-request.hbs │ │ ├── reverse-engineering-ctf-solver.hbs │ │ ├── refactor.hbs │ │ ├── binary-exploitation-ctf-solver.hbs │ │ └── find-security-vulnerabilities.hbs │ ├── tests │ │ ├── clipboard_test.rs │ │ ├── util_test.rs │ │ └── template_test.rs │ └── Cargo.toml └── code2prompt │ ├── Cargo.toml │ └── src │ ├── args.rs │ └── clipboard.rs ├── .assets ├── CLI.png └── code2prompt-screenshot.png ├── .github └── workflows │ ├── ci.yml │ ├── website.yml │ └── release.yml ├── Cargo.toml ├── LICENSE ├── llms-install.md ├── README.md └── .gitignore /website/public/CNAME: -------------------------------------------------------------------------------- 1 | code2prompt.dev -------------------------------------------------------------------------------- /crates/code2prompt-python/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /crates/code2prompt-python/.python-version: -------------------------------------------------------------------------------- 1 | 3.13.1 2 | -------------------------------------------------------------------------------- /crates/code2prompt-python/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod python; 2 | -------------------------------------------------------------------------------- /website/src/assets/examples/node_app/question.txt: -------------------------------------------------------------------------------- 1 | Add me a this cool feature -------------------------------------------------------------------------------- /.assets/CLI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/.assets/CLI.png -------------------------------------------------------------------------------- /website/src/assets/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/src/assets/filter.png -------------------------------------------------------------------------------- /website/src/assets/examples/recipe_list/my_recipes/pantry/my_ingredients.txt: -------------------------------------------------------------------------------- 1 | Available: pasta, tomato sauce, cheese 2 | -------------------------------------------------------------------------------- /website/src/assets/examples/recipe_list/question.txt: -------------------------------------------------------------------------------- 1 | Based on the ingredients in my pantry, what recipe can I cook tonight? -------------------------------------------------------------------------------- /website/src/assets/houston.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/src/assets/houston.webp -------------------------------------------------------------------------------- /website/src/components/Footer.astro: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /.assets/code2prompt-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/.assets/code2prompt-screenshot.png -------------------------------------------------------------------------------- /website/src/assets/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/src/assets/architecture.png -------------------------------------------------------------------------------- /website/src/assets/examples/history_notes/question.txt: -------------------------------------------------------------------------------- 1 | Help me revising for my history exam, make flashcards based on my notes. -------------------------------------------------------------------------------- /website/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["astro-build.astro-vscode"], 3 | "unwantedRecommendations": [] 4 | } 5 | -------------------------------------------------------------------------------- /website/public/assets/css/images/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/css/images/header.jpg -------------------------------------------------------------------------------- /website/public/assets/css/images/overlay1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/css/images/overlay1.png -------------------------------------------------------------------------------- /website/public/assets/css/images/overlay2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/css/images/overlay2.png -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-regular-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-regular-400.eot -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-regular-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-regular-400.woff -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /website/public/assets/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuilenren/code2prompt/main/website/public/assets/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /website/src/assets/examples/node_app/node_app/README.md: -------------------------------------------------------------------------------- 1 | Simple Node.js app to process JSON data. 2 | Feature idea: Add a filter function to sort users by age. 3 | -------------------------------------------------------------------------------- /website/src/assets/examples/node_app/node_app/src/index.js: -------------------------------------------------------------------------------- 1 | const { processData } = require("./utils"); 2 | 3 | console.log("App started"); 4 | processData(); 5 | -------------------------------------------------------------------------------- /website/src/assets/examples/history_notes/history_notes/history/ww2.txt: -------------------------------------------------------------------------------- 1 | Key events: D-Day, Hiroshima, End of War 2 | Leaders: Churchill, Roosevelt, Hitler, Stalin 3 | -------------------------------------------------------------------------------- /website/src/assets/examples/history_notes/history_notes/meta/my_revision_goals.txt: -------------------------------------------------------------------------------- 1 | Focus: Memorize key events, understand causes & consequences 2 | Deadline: 2 weeks 3 | -------------------------------------------------------------------------------- /website/src/assets/examples/recipe_list/my_recipes/recipes/pizza.txt: -------------------------------------------------------------------------------- 1 | Ingredients: flour, tomato sauce, cheese, oregano 2 | Instructions: Make dough, add toppings, bake. 3 | -------------------------------------------------------------------------------- /website/src/assets/examples/history_notes/history_notes/history/medieval.txt: -------------------------------------------------------------------------------- 1 | Key events: Fall of Rome, Viking raids, Magna Carta 2 | Important dates: 476 AD, 793 AD, 1215 AD 3 | -------------------------------------------------------------------------------- /website/src/assets/examples/node_app/node_app/src/utils.js: -------------------------------------------------------------------------------- 1 | function processData() { 2 | console.log("Processing data..."); 3 | } 4 | 5 | module.exports = { processData }; 6 | -------------------------------------------------------------------------------- /website/src/assets/examples/recipe_list/my_recipes/recipes/pasta.txt: -------------------------------------------------------------------------------- 1 | Ingredients: pasta, tomato sauce, garlic, basil 2 | Instructions: Boil pasta, heat sauce, mix, serve. 3 | -------------------------------------------------------------------------------- /website/src/assets/examples/recipe_list/my_recipes/recipes/salad.txt: -------------------------------------------------------------------------------- 1 | Ingredients: lettuce, tomato, cucumber, olive oil 2 | Instructions: Chop ingredients, mix, drizzle oil. 3 | -------------------------------------------------------------------------------- /website/src/assets/examples/recipe_list/my_recipes/recipes/soup.txt: -------------------------------------------------------------------------------- 1 | Ingredients: carrots, potatoes, chicken broth, onions 2 | Instructions: Boil broth, add vegetables, simmer. 3 | -------------------------------------------------------------------------------- /website/src/assets/examples/history_notes/history_notes/history/renaissance.txt: -------------------------------------------------------------------------------- 1 | Key figures: Leonardo da Vinci, Michelangelo, Copernicus 2 | Cultural shifts: Humanism, art revival, printing press 3 | -------------------------------------------------------------------------------- /website/src/content/docs/docs/references/default_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Default Template for Code2Prompt 3 | description: Learn about the default template structure used in Code2Prompt. 4 | --- 5 | 6 | # Default Template 7 | -------------------------------------------------------------------------------- /website/src/content/docs/docs/references/command_line_options.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Code2Prompt Command-Line Options 3 | description: A reference guide for all available CLI options in Code2Prompt. 4 | --- 5 | 6 | # Command-Line Options 7 | -------------------------------------------------------------------------------- /crates/code2prompt-core/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Core library for code2prompt. 2 | pub mod configuration; 3 | pub mod filter; 4 | pub mod git; 5 | pub mod path; 6 | pub mod session; 7 | pub mod sort; 8 | pub mod template; 9 | pub mod tokenizer; 10 | pub mod util; 11 | -------------------------------------------------------------------------------- /website/src/assets/examples/node_app/node_app/data/sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "users": [ 3 | { 4 | "name": "Alice", 5 | "age": 25 6 | }, 7 | { 8 | "name": "Bob", 9 | "age": 30 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /website/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "command": "./node_modules/.bin/astro dev", 6 | "name": "Development server", 7 | "request": "launch", 8 | "type": "node-terminal" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /website/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "astro/tsconfigs/strict", 3 | "include": [ 4 | ".astro/types.d.ts", 5 | "**/*" 6 | ], 7 | "exclude": [ 8 | "dist" 9 | ], 10 | "compilerOptions": { 11 | "jsx": "react-jsx", 12 | "jsxImportSource": "react" 13 | } 14 | } -------------------------------------------------------------------------------- /crates/code2prompt-core/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | // Check if we're compiling for macOS 3 | if cfg!(target_os = "macos") { 4 | // Add the necessary flags for PyO3 on macOS 5 | println!("cargo:rustc-link-arg=-undefined"); 6 | println!("cargo:rustc-link-arg=dynamic_lookup"); 7 | } 8 | } -------------------------------------------------------------------------------- /website/src/content.config.ts: -------------------------------------------------------------------------------- 1 | import { defineCollection } from 'astro:content'; 2 | import { docsLoader } from '@astrojs/starlight/loaders'; 3 | import { docsSchema } from '@astrojs/starlight/schema'; 4 | 5 | export const collections = { 6 | docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), 7 | }; 8 | -------------------------------------------------------------------------------- /crates/code2prompt-core/src/default_template_md.hbs: -------------------------------------------------------------------------------- 1 | Project Path: {{ absolute_code_path }} 2 | 3 | Source Tree: 4 | 5 | ```txt 6 | {{ source_tree }} 7 | ``` 8 | 9 | {{#each files}} 10 | {{#if code}} 11 | `{{path}}`: 12 | 13 | {{code}} 14 | 15 | {{/if}} 16 | {{/each}} 17 | 18 | {{#if git_diff}} 19 | Git Diff: 20 | {{ git_diff }} 21 | {{/if}} -------------------------------------------------------------------------------- /crates/code2prompt-python/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "code2prompt-python" 3 | version = "3.2.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | name = "code2prompt_rs" 8 | crate-type = ["cdylib"] 9 | 10 | [dependencies] 11 | serde_json = { workspace = true } 12 | code2prompt_core = { path = "../code2prompt-core" } 13 | pyo3 = { workspace = true } 14 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | # build output 2 | dist/ 3 | # generated types 4 | .astro/ 5 | 6 | # dependencies 7 | node_modules/ 8 | 9 | # logs 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | 16 | # environment variables 17 | .env 18 | .env.production 19 | 20 | # macOS-specific files 21 | .DS_Store 22 | 23 | .yarn 24 | 25 | .yarnrc.yml -------------------------------------------------------------------------------- /website/src/styles/global.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | /* Basic typography improvements */ 4 | h1, 5 | h2, 6 | h3, 7 | h4, 8 | h5, 9 | h6 { 10 | @apply font-bold tracking-tight; 11 | } 12 | 13 | h1 { 14 | @apply text-4xl md:text-5xl mb-6; 15 | } 16 | 17 | h2 { 18 | @apply text-3xl md:text-4xl mb-4; 19 | } 20 | 21 | p { 22 | @apply leading-relaxed; 23 | } 24 | -------------------------------------------------------------------------------- /website/src/pages/robots.txt.ts: -------------------------------------------------------------------------------- 1 | import type { APIRoute } from "astro"; 2 | 3 | const getRobotsTxt = (sitemapURL: URL) => ` 4 | User-agent: * 5 | Allow: / 6 | 7 | Sitemap: ${sitemapURL.href} 8 | `; 9 | 10 | export const GET: APIRoute = ({ site }) => { 11 | const sitemapURL = new URL("sitemap-index.xml", site); 12 | return new Response(getRobotsTxt(sitemapURL)); 13 | }; 14 | -------------------------------------------------------------------------------- /website/src/assets/CLI.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /crates/code2prompt-core/src/default_template_xml.hbs: -------------------------------------------------------------------------------- 1 | 2 | {{ absolute_code_path }} 3 | 4 | 5 | {{ source_tree }} 6 | 7 | 8 | 9 | {{#each files}} 10 | {{#if code}} 11 | 12 | {{ code }} 13 | 14 | {{/if}} 15 | {{/each}} 16 | 17 | 18 | {{#if git_diff}} 19 | 20 | {{ git_diff }} 21 | 22 | {{/if}} -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # Run tests for code2prompt 2 | name: Code2prompt Continuous Integration 3 | 4 | on: 5 | push: 6 | branches: [ "main" ] 7 | pull_request: 8 | branches: [ "main" ] 9 | 10 | env: 11 | CARGO_TERM_COLOR: always 12 | 13 | jobs: 14 | build: 15 | 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Run tests 21 | run: cargo test --verbose 22 | -------------------------------------------------------------------------------- /crates/code2prompt-python/requirements.lock: -------------------------------------------------------------------------------- 1 | # generated by rye 2 | # use `rye lock` or `rye sync` to update this lockfile 3 | # 4 | # last locked with the following flags: 5 | # pre: false 6 | # features: [] 7 | # all-features: false 8 | # with-sources: false 9 | # generate-hashes: false 10 | # universal: false 11 | 12 | -e file:. 13 | patchelf==0.17.2.1 14 | # via code2prompt-rs 15 | pip==25.0.1 16 | # via code2prompt-rs 17 | -------------------------------------------------------------------------------- /crates/code2prompt-python/python-sdk/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | code2prompt is a Python library for generating LLM prompts from codebases. 3 | 4 | It provides a simple interface to the Rust-based code2prompt library, allowing you to: 5 | - Generate prompts from code directories 6 | - Filter files using glob patterns 7 | - Get git diffs and logs 8 | - Count tokens for different models 9 | """ 10 | 11 | # Import the Python wrapper class from the renamed file 12 | from .code2prompt_rs import Code2Prompt 13 | 14 | __all__ = ['Code2Prompt'] -------------------------------------------------------------------------------- /crates/code2prompt-python/python-sdk/code2prompt_rs/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | code2prompt is a Python library for generating LLM prompts from codebases. 3 | 4 | It provides a simple interface to the Rust-based code2prompt library, allowing you to: 5 | - Generate prompts from code directories 6 | - Filter files using glob patterns 7 | - Get git diffs and logs 8 | - Count tokens for different models 9 | """ 10 | 11 | # Import the Python wrapper class from the renamed file 12 | from .code2prompt import Code2Prompt 13 | 14 | __all__ = ['Code2Prompt'] -------------------------------------------------------------------------------- /crates/code2prompt-python/requirements-dev.lock: -------------------------------------------------------------------------------- 1 | # generated by rye 2 | # use `rye lock` or `rye sync` to update this lockfile 3 | # 4 | # last locked with the following flags: 5 | # pre: false 6 | # features: [] 7 | # all-features: false 8 | # with-sources: false 9 | # generate-hashes: false 10 | # universal: false 11 | 12 | -e file:. 13 | iniconfig==2.0.0 14 | # via pytest 15 | maturin==1.8.2 16 | packaging==24.2 17 | # via pytest 18 | patchelf==0.17.2.1 19 | # via code2prompt-rs 20 | pip==25.0.1 21 | # via code2prompt-rs 22 | pluggy==1.5.0 23 | # via pytest 24 | pytest==8.3.5 25 | -------------------------------------------------------------------------------- /crates/code2prompt-core/src/util.rs: -------------------------------------------------------------------------------- 1 | //! This module contains util functions 2 | 3 | /// Removes a UTF‑8 Byte Order Mark (BOM) from the beginning of a byte slice if present. 4 | /// 5 | /// The UTF‑8 BOM is the byte sequence `[0xEF, 0xBB, 0xBF]`. This function checks whether 6 | /// the provided slice starts with these bytes and, if so, returns a subslice without them. 7 | /// Otherwise, it returns the original slice. 8 | pub fn strip_utf8_bom(data: &[u8]) -> &[u8] { 9 | const BOM: &[u8] = &[0xEF, 0xBB, 0xBF]; 10 | if data.starts_with(BOM) { 11 | &data[BOM.len()..] 12 | } else { 13 | data 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /website/src/pages/index.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import BaseLayout from "../layouts/BaseLayout.astro"; 3 | import Header from "../components/Header.astro"; 4 | import SectionZero from "../components/Section0.astro"; 5 | import SectionOne from "../components/Section1.astro"; 6 | import SectionTwo from "../components/Section2.astro"; 7 | import SectionThree from "../components/Section3.astro"; 8 | import SectionFour from "../components/Section4.astro"; 9 | import Footer from "../components/Footer.astro"; 10 | --- 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 |