
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@johnlindquist/file-forge
Advanced tools
File Forge is a powerful CLI tool for deep analysis of codebases, generating markdown reports to feed AI reasoning models.
File Forge is a powerful command‑line tool for deep analysis of codebases. It scans your project (or GitHub repository) and generates comprehensive markdown reports that include a summary, a visual directory structure, file contents, and even dependency graphs. These reports are designed to feed AI reasoning models and support a variety of advanced use cases.
Note: File Forge works both with GitHub URLs (by cloning/updating a cached repository) and local directories. It also supports filtering files by patterns, searching for specific content, and advanced output options like piping, clipboard copy, and XML wrapping.
--include and --exclude to select exactly which files to analyze.--find (OR behavior) or require specific strings in file content using --require (AND behavior).--branch) or commits (--commit) for GitHub-hosted repositories.--graph flag.--pipe--open--clipboard--markdown (default output is XML)--whitespace--dry-run / -D--bulk--debug or --verbose--templateInstall File Forge globally with your favorite package manager:
# Using pnpm:
pnpm add -g @johnlindquist/file-forge
# Or using npm:
npm install -g @johnlindquist/file-forge
# Analyze all files in current directory
ffg
# Analyze specific directory/files in current directory
ffg src
ffg "src/**/*.ts"
ffg https://github.com/owner/repo --branch develop
ffg /path/to/local/project
Use glob patterns to precisely control which files are included or excluded.
# Include only TypeScript files in the root of the current directory
ffg --include "*.ts"
# Include TypeScript files recursively in all subdirectories
ffg --include "**/*.ts"
# Exclude node_modules and test files recursively
ffg --exclude "**/*test.*,node_modules/**"
# Combine include and exclude for specific filtering in the 'src' directory
ffg src --include "**/*.ts" --exclude "**/*.spec.ts,**/__tests__/**"
Note:
*.ts matches files only in the immediate directory being scanned.**/* to match files recursively through all subdirectories (e.g., **/*.ts)."*.ts,*.js") or by using multiple --include / --exclude flags (e.g., --include "*.ts" --include "*.js").ffg --include "**/*.ts,/Users/me/Documents/important_config.json").ffg src --find "console,debug"
ffg src --require "console,log"
ffg --graph src/index.js
ffg src --pipe
ffg src --clipboard
ffg src --markdown
ffg src --whitespace
ffg src --dry-run
# Alias
ffg src -D
ffg src --bulk
ffg src --debug
ffg src --verbose
<project>
<source>/path/to/source</source>
<timestamp>20240324-123456</timestamp>
<command>ffg src --verbose</command>
</project>
# List all available templates
ffg --list-templates
# Apply a specific template
ffg src --template refactor
# Combine with other options
ffg src --template test --include "*.js" --exclude "*.test.js"
File Forge includes a set of prompt templates that can be applied to your analysis results. These templates are designed to guide AI models (like GPT-4 or Claude) in performing specific tasks on your code.
Documentation & Explanation
explain: Summarize what a code file does in plain languagedocument: Insert explanatory comments into the codeRefactoring & Improvement
refactor: Improve code clarity and maintainability without changing behavioroptimize: Improve code efficiency without changing behaviorfix: Find potential bugs or issues and fix themCode Generation
test: Generate unit tests for the given codeList all available templates:
ffg --list-templates
Apply a template to your analysis:
ffg src --template refactor
The template will be included in the output, with your code analysis inserted in the appropriate place.
When you view the output in an editor or copy it to the clipboard, you can then paste it to an AI assistant to get the desired result.
You can create your own templates or override the built-in ones by creating individual template files in your File Forge configuration directory:
~/Library/Preferences/@johnlindquist/file-forge/templates/~/.config/@johnlindquist/file-forge/templates/%APPDATA%/@johnlindquist/file-forge/templates/Each template is a Markdown (.md) file with front-matter containing metadata and a body containing the template content. Here's an example template custom-explain.md:
---
name: custom-explain
category: documentation
description: My custom explanation template
---
**Goal:** Explain this code in simple terms.
**Context:**
{{ code }}
<instructions>
- Explain what this code does in simple language
- Focus on the main functionality
</instructions>
<task>
Provide a clear explanation of the code for a non-technical audience.
</task>
When you run File Forge, it will automatically load and merge your custom templates with the built-in ones.
For a complete list of options and examples, run:
ffg --help
Analysis results and configuration are stored in:
~/Library/Preferences/@johnlindquist/file-forge/config/~/.config/@johnlindquist/file-forge/config/%APPDATA%/@johnlindquist/file-forge/config/To contribute or run File Forge locally:
git clone https://github.com/johnlindquist/file-forge.git
cd @johnlindquist/file-forge
pnpm install
pnpm build
This project is licensed under the MIT License – see the LICENSE file for details.
The test suite has been optimized to run faster using several strategies:
Tests can now run concurrently, leveraging multiple CPU cores for faster test execution. This is enabled in vitest.config.ts by removing the sequence: { concurrent: false } option.
Instead of spawning a new process for each test (which is slow), many tests now use the direct function testing approach through utils/directTestRunner.ts. This utility allows tests to call the main application functions directly while capturing their output.
Benefits:
To migrate an existing test to use direct function testing:
Run the test analysis to see candidates for optimization:
pnpm test:optimize:analyze
Migrate a specific test file:
pnpm test:optimize test/your-test-file.test.ts
Verify the test still passes and check the performance improvement.
To optimize multiple tests at once, you can use the batch processing options:
Analyze and run a dry-run batch (no changes applied):
pnpm test:optimize:batch:dry
Fast batch migration (skips performance measurement):
pnpm test:optimize:batch:fast
Full batch migration with performance measurements:
pnpm test:optimize:batch
Additional options:
--force to re-optimize already migrated files--dry-run to see what would be changed without making actual changes--skip-measure to skip performance measurements (faster)beforeAll instead of beforeEach when the setup only needs to be done once for all tests in a describe blockwaitForFile helper with appropriate timeouts for file-based testspnpm test:direct to verify they still workscripts/optimize-tests.js: Helper script to analyze and optimize test filesutils/directTestRunner.ts: Direct function execution utilitytest/helpers/fileWaiter.ts: Optimized file waiting utility with adaptive pollingFAQs
File Forge is a powerful CLI tool for deep analysis of codebases, generating markdown reports to feed AI reasoning models.
The npm package @johnlindquist/file-forge receives a total of 440 weekly downloads. As such, @johnlindquist/file-forge popularity was classified as not popular.
We found that @johnlindquist/file-forge 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.