A small Go CLI that packs a software repository into a single AI-friendly file โ XML, Markdown, JSON, or plain text โ with a gitignore-aware walker, an embedded secret scanner, an approximate token counter, and built-in remote-repo cloning.
Default ignore patterns plus per-directory .gitignore,
.ignore, and .gophercramignore rules, all
merged with last-match-wins semantics.
XML (CDATA-wrapped), Markdown (fenced blocks with language hints), JSON (stable shape, easy to post-process), and plain text.
Regex-driven detection of AWS, GitHub, Stripe, Slack, Google, JWT, PEM, and connection-string secrets โ with entropy-based false-positive filtering.
Calibrated against GPT-4 tokenizers; matches tiktoken
within ~6% on the bundled fixture without shipping a vocabulary
file.
Language-aware comment lexers for C-style, hash, Lua, SQL, and XML comments. Optional compression keeps signatures and drops function bodies for skim-only context.
Pass --remote owner/repo or any clone URL; GopherCram
clones into a temp dir, packs, and cleans up after itself.
Sort files by change frequency, append working-tree / staged diffs, and embed a recent commit log.
Chunk the packed file at a configured size cap
(--split-output 2mb) when you need to ship it through
size-limited channels.
No third-party dependencies. One static binary, no surprises.
Pre-built binaries are not shipped yet โ build from source:
<gophercram>
<summary>
<producer>GopherCram v0.1.0</producer>
<stats files="38" tokens="66356"/>
</summary>
<directory_structure><![CDATA[
src/
api/
users.ts
products.ts
utils/
format.ts
]]></directory_structure>
<files>
<file path="src/api/users.ts">
<![CDATA[ ...content... ]]>
</file>
</files>
</gophercram>
# GopherCram Output
> Packed by **GopherCram** v0.1.0
| Metric | Value |
|---|---|
| Files | 38 |
| Tokens (approx) | 66356 |
## Files
### `src/api/users.ts`
```ts
export async function fetchUsers() { ... }
```
Run gophercram --init to drop a defaulted config in your
project root. Every field is optional; omitted fields inherit the
defaults.
{
"$schema": "https://gophercram.dev/schema.json",
"input": { "maxFileSize": 52428800 },
"output": {
"filePath": "gophercram-output.xml",
"style": "xml",
"fileSummary": true,
"directoryStructure": true,
"files": true,
"topFilesLength": 5,
"git": {
"sortByChanges": true,
"sortByChangesMaxCommits": 100,
"includeLogsCount": 50
}
},
"include": [],
"ignore": {
"useGitignore": true,
"useDotIgnore": true,
"useDefaultPatterns": true,
"customPatterns": []
},
"security": { "enableSecurityCheck": true },
"tokenCount": { "encoding": "approx" }
}
The repository ships a synthetic TypeScript fixture
(test/fixtures/dummy-ts-repo) plus an opt-in integration
suite that runs npx repomix on the same fixture and
cross-checks the file list and token totals.