
Research
/Security News
Popular npm Packages in the keyv and Cacheable Namespaces Compromised in Active Supply Chain Attack
Popular npm packages keyv and cacheable compromised.
Command-line interface for Codefetch - convert any codebase or website into AI-friendly markdown documentation.
npm install -g codefetch
# or
yarn global add codefetch
# or
pnpm add -g codefetch
npm install --save-dev codefetch
# or
yarn add -D codefetch
# or
pnpm add -D codefetch
npx codefetch
# Generate markdown from current directory
codefetch
# Generate from specific directory
codefetch /path/to/project
# Fetch from a website
codefetch --url https://example.com
# Fetch from a Git repository
codefetch --url https://github.com/user/repo
Convert local codebases into structured markdown:
# Include only specific file types
codefetch -e ts,tsx,js,jsx
# Set token limit
codefetch --max-tokens 100000
# Output to specific file
codefetch -o my-codebase.md
# Dry run (output to console)
codefetch --dry-run
# Output as JSON for structured data
codefetch --format json
# Output JSON to specific file
codefetch --format json -o codebase.json
Fetch and convert Git repositories from GitHub or GitLab:
# Analyze a GitHub repository (uses API by default - faster!)
codefetch --url https://github.com/facebook/react --branch main
# Analyze a GitLab repository
codefetch --url https://gitlab.com/gitlab-org/gitlab-foss --branch master
# Fetch private GitHub repo with token
codefetch --url https://github.com/org/private-repo --github-token ghp_xxxxx
# Or set GITHUB_TOKEN environment variable
export GITHUB_TOKEN=ghp_xxxxx
codefetch --url https://github.com/org/private-repo
# Force git clone instead of API
codefetch --url https://github.com/user/repo --no-api
# Fetch repository without cache
codefetch --url https://github.com/user/repo --no-cache
# Set cache TTL for repository (hours)
codefetch --url https://github.com/user/repo --cache-ttl 24
Create a .codefetchrc file for project-specific settings:
{
"extensions": [".ts", ".tsx", ".js", ".jsx"],
"excludeFiles": ["*.test.ts", "*.spec.js"],
"excludeDirs": ["__tests__", "coverage"],
"maxTokens": 100000,
"outputFile": "codebase.md",
"outputPath": "./docs",
"tokenEncoder": "cl100k",
"projectTree": 2
}
-h, --help - Show help information-v, --verbose - Increase verbosity (use multiple times: -vvv)--dry-run, -d - Output to console instead of file-o, --output - Output filename (default: codefetch-output-[timestamp].md)--output-path - Output directory path--max-tokens - Maximum token limit--token-encoder - Token encoder model (cl100k, p50k, r50k, o200k)--token-count-only, -c - Only output token count--disable-line-numbers - Disable line numbers in code blocks-e, --extension - File extensions to include (e.g., ts,js,py)--include-files - Patterns for files to include--exclude-files - Patterns for files to exclude--include-dir - Directories to include--exclude-dir - Directories to exclude--url - URL to fetch (website or git repository)--max-pages - Maximum pages to crawl (default: 50)--max-depth - Maximum crawl depth (default: 2)--no-cache - Disable cache for this request--cache-ttl - Cache time-to-live in hours (default: 1)--branch - Git branch to fetch (for repositories)--ignore-robots - Ignore robots.txt restrictions--ignore-cors - Ignore CORS restrictions--no-api - Disable GitHub API and use git clone instead--github-token - GitHub API token for private repos-t, --project-tree - Show project tree (0=off, 1+=depth)--tracked-models - Show token counts for specific models--format - Output format (markdown, json) (default: markdown)-p, --prompt - Use a built-in prompt template--var - Set template variables (e.g., --var PROJECT_NAME="My App")--token-limiter - Token limiting strategy (truncated, spread)codefetch -e ts,tsx --exclude-dir node_modules,dist \
--max-tokens 50000 -o typescript-analysis.md
codefetch --url https://github.com/org/docs \
--branch main \
--max-pages 100 \
--max-depth 5 \
--output docs-analysis.md
# Uses GitHub API by default (faster, no git required)
codefetch --url https://github.com/expressjs/express \
--branch master \
-e js --exclude-dir test,examples
# For private repositories
codefetch --url https://github.com/myorg/private-repo \
--github-token ghp_your_token_here
# Code review
codefetch -p review --var PROJECT_NAME="MyApp" -o review.md
# Generate tests
codefetch -p testgen -e ts,tsx --include-dir src
# Improve code quality
codefetch -p improve --max-tokens 30000
codefetch --tracked-models gpt-4,claude-3-opus,gpt-3.5-turbo
# Generate JSON output for programmatic access
codefetch --format json -o codebase.json
# Use with jq to query specific files
codefetch --format json | jq '.root.children[] | select(.name == "src")'
Create a .codefetchignore file to exclude files:
# Dependencies
node_modules/
vendor/
.pnpm-store/
# Build outputs
dist/
build/
out/
*.min.js
*.min.css
# Test files
*.test.ts
*.spec.js
__tests__/
coverage/
# Environment and logs
.env*
*.log
.DS_Store
# IDE
.vscode/
.idea/
*.swp
The generated markdown includes:
Example output structure:
Project Structure:
├── src/
│ ├── index.ts
│ ├── utils/
│ │ └── helpers.ts
│ └── components/
│ └── Button.tsx
└── package.json
src/index.ts:
\`\`\`typescript
1 | import { helper } from './utils/helpers';
2 |
3 | export function main() {
4 | console.log('Hello, world!');
5 | }
\`\`\`
[... more files ...]
Web fetching results are cached to improve performance:
~/.codefetch/cache/--no-cache to bypass--cache-ttl to set custom expiration-e ts,tsx is faster than processing all files--exclude-files "*.test.ts,*.spec.js"--max-depth 2 for faster website fetching--max-pages 50 to avoid excessive crawling"Token limit exceeded"
--max-tokens to set a higher limit-e to include only specific file types--exclude-dir to skip large directories"Failed to crawl URL"
--ignore-robots if blocked by robots.txt--no-cache if cached data is stale"Command not found"
npm install -g codefetchnpx codefetchUse maximum verbosity for debugging:
codefetch -vvv --url example.com
{
"scripts": {
"docs:generate": "codefetch -e ts,tsx -o docs/codebase.md",
"docs:analyze": "codefetch --token-count-only",
"review": "codefetch -p review -o review.md"
}
}
# GitHub Actions example
- name: Generate Documentation
run: |
npx codefetch \
-e ts,tsx,js,jsx \
--exclude-dir node_modules,coverage \
-o codebase-docs.md
See the main repository for contribution guidelines.
MIT
FAQs
Fetches all files in the current directory and outputs them in a Markdown file.
The npm package codefetch receives a total of 1,071 weekly downloads. As such, codefetch popularity was classified as popular.
We found that codefetch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.