Repository navigation
CTX release v0.2.2
Highlights
- Repository owner rename and module path alignment. The project now lives at
github.com/tyemirov/ctx, and every import, configuration default, and installer reference has been migrated so downstream builds keep working after the move.
Improvements ⚙️
- Raised the minimum Go toolchain to 1.25, matching the repository relocation and ensuring
go install github.com/tyemirov/ctx@latestsucceeds with the updated module path.
Docs 📚
- Updated README badges, installation instructions, and call chain examples to point to the new
tyemirovGitHub namespace.
Highlights
- Consistent CLI booleans and clipboard flag rename. All commands now share a single boolean flag parser that understands true/false, yes/no, on/off, and 1/0
literals, and the former--clipboardflag has been renamed to--copywith configuration defaults preserved.
Improvements ⚙️
- Replaced every direct
BoolVarregistration with the shared registrar, eliminating bespoke parsers and ensuring--flag noworks everywhere. (improvement/CT-22-
bool-flags) - Stopped normalizing boolean flags after the
--sentinel so dash-prefixed filenames (e.g.,ctx tree -- --summary) are handled correctly. (improvement/CT-22-
bool-flags) - Updated configuration loading to honor both legacy
clipboardand newcopykeys, retaining overrides from user config. (maintenance/CT-21-copy-flag)
Docs 📚
- Documented the expanded boolean syntax and the new
--copyflag in the README, along with guidance for enabling automatic copy via config.
Testing ✅
- Added unit coverage for the boolean flag registrar, including argument normalization around the
--terminator and non-boolean trailing values.
Highlights
- GitHub-backed documentation retrieval via
ctx doc. A dedicated command now walks repository directories through the GitHub Contents API, applies rule-driven cleanup, and renders curated documentation in raw, JSON, or XML formats with clipboard support. (feature/CT-16-github-docs) - Human-readable CLI diagnostics. Fatal errors surface as plain text alongside richer flag guidance, keeping workflows approachable for operators and MCP clients alike. (bugfix/CT-doc-help)
Features ✨
- Added
internal/docs/githubdocwith recursive fetchers, rule set loaders, and sorting to deliver deterministic documentation bundles for remote repositories. (feature/CT-16-github-docs) - Introduced the
doc/dCobra command with flags for owner, repo, ref, rules, documentation mode, and clipboard usage, seamlessly reusing configuration defaults. (feature/CT-16-github-docs)
Improvements ⚙️
- Removed the deprecated static documentation rule scaffolding in favor of runtime rule evaluation sourced from local files. (feature/CT-16-github-docs)
- Redesigned
ctx docerror handling and help text to spell out unified--pathcoordinates and clipboard options. (bugfix/CT-doc-help) - Switched zap to console encoding without metadata noise so
application execution failedlines print as a single human-readable sentence. (bugfix/CT-doc-help) - Consolidated doc command coordinates behind a single
--pathflag that acceptsowner/repo[/path]specs or GitHub URLs while preserving explicit--refoverrides. (maintenance/CT-19-doc-path)
Docs 📚
- Documented doc command parameters in README, outlining required coordinates, optional flags, and clipboard behavior. (bugfix/CT-doc-help)
Testing ✅
- Added integration tests that spin up a GitHub mock server and verify
ctx docacross full and relevant modes for jspreadsheet, marked.js, and beer.css fixtures. (feature/CT-16-github-docs)
Maintenance 🛠️
- Removed
PLAN.mdfrom version control and added a guard test that fails when the file becomes tracked again. (maintenance/CT-20-plan-guard)
Highlights
- CGO-enabled builds across CI and release targets. Test and release workflows now compile with
CGO_ENABLED=1, ensuring Python and JavaScript call-chain analyzers are always included. Windows releases automatically install a MinGW toolchain so tree-sitter bindings build deterministically. (maintenance/CT-15-enable-cgo)
Improvements ⚙️
- Switched the test workflow to run with CGO enabled, preventing accidental regressions in language analyzers. (maintenance/CT-15-enable-cgo)
- Reworked the release pipeline to build per-platform artifacts on native runners, upload them as artifacts, generate checksums, and publish consistently. (maintenance/CT-15-enable-cgo)
- Hardened release note extraction so publishing succeeds even when the changelog entry is missing. (maintenance/CT-15-enable-cgo)
Maintenance 🛠️
- Installed the MinGW toolchain on Windows release runners, guaranteeing CGO builds succeed without manual setup. (maintenance/CT-15-enable-cgo)
Highlights
- Richer MCP contract with advertised workspace metadata. The MCP server now exposes
/environmentand includes the root directory in/capabilities, guiding agents to send absolute paths. (ba36898) - Comprehensive MCP end-to-end coverage. A new integration test starts
ctx --mcp, queries capabilities, and exercises tree/content commands over HTTP against a seeded project. (ecdacec)
Features ✨
- Documented workflow for registering
ctxwith Claude Desktop and Codex, including JSON-only semantics and environment probing. (69165c4, daec63f)
Improvements ⚙️
- Expanded capability descriptions to list supported flags and JSON-only behavior, making the MCP surface self-descriptive for agents. (daec63f)
Docs 📚
- Added instructions for resolving paths via
/environmentand registering MCP servers with popular clients. (69165c4)
Testing ✅
- Added an automated MCP end-to-end test that launches the server, inspects capabilities, and runs tree/content commands using absolute paths. (ecdacec)
Highlights
- Run ctx as an MCP server with JSON endpoints. The CLI now exposes tree, content, and callchain commands over HTTP with structured capability metadata and an environment probe, ready for orchestrators. (615e90e, 245efa5, 9a6a099, ba36898, daec63f)
- Cross-language callchain analysis with documentation harvesting. Go, Python, and JavaScript analyzers collaborate with a new collector to surface external docs alongside call graphs. (cc2fc6f, 2d6c9c5, 47d0498)
Features ✨
- Introduced the
--mcpflag to launch an MCP server that accepts JSON payloads, dispatches built-in commands, and returns normalized responses with warning streams. (615e90e, 245efa5, 9a6a099) - Added configuration bootstrap and discovery:
--initscaffolds local or global config,--forcehandles overwrites, and--configloads per-command defaults via Viper. (5e9f0d9, f95f300) - Enabled multi-language documentation extraction so content listings can enrich files with Go, Python, and JavaScript API references. (2d6c9c5)
- Registered language-specific callchain analyzers and a dispatcher to resolve symbols across Go, Python, and JavaScript projects. (cc2fc6f)
Improvements ⚙️
- Unified tree and content streaming through a shared event dispatcher to keep raw, JSON, and XML outputs synchronized. (f95f300)
- Hardened MCP command handling by enforcing JSON formats and per-command defaults for inputs and warnings. (9a6a099, 245efa5)
- Added a clipboard service abstraction so
--clipboardcopies output without leaking platform specifics. (f95f300) - Fell back to rune-based counting when tokenizer models are unavailable, while reporting the requested model name. (2d6c9c5)
Fixes 🐛
- Blocked nested call capture in Python and JavaScript analyzers to remove duplicate edges from call graphs. (47d0498)
Docs 📚
- Expanded MCP documentation with local server workflows, Claude and Codex integration notes, and JSON contract details. (69165c4, 2530046, c620c45)
- Captured future roadmap and portability notes for CT-01 and CT-02 scenarios. (2d59656, cc7a681, 76fef18)
- Refined README formatting and release linkage for improved navigation. (527ad95, b0272f8, 446e414)
Testing ✅
- Added an end-to-end MCP test suite that provisions sample projects and verifies command execution over HTTP. (ecdacec)
Highlights
- Real-time, schema-valid streaming across all formats. Tree and content commands now share a single streaming
pipeline that emits per-directory and per-file events, producing identical results for raw/JSON/XML while displaying
output incrementally. (3f80e9d, e858f67, 5d8895b, da3f01a) - Resilient tokenizer integration. Python helpers are autodetected via
uv, sentencepiece models download on demand,
and Claude model aliases map automatically so token counting “just works” without manual setup. (6af6a24, b8a6330,
a7b3354, 979e156, 909039b)
Features ✨
- Added automatic
uvinvocation for helper scripts, including on-demand sentencepiece downloads for Llama models and
self-contained Anthropic helpers. (6af6a24, b8a6330, a7b3354, 979e156) - Tokenizer metadata is now surfaced in both tree and content summaries, with default summaries enabled for every run.
(d4e42c5, 46b982f, ea3098e)
Improvements ⚙️
- Unified tree/content streaming walker captures file contents, streams chunks, and keeps JSON/XML renderers in sync
while maintaining pretty-printed output. (3f80e9d, 5d8895b, da3f01a) - CLI displays streaming progress while helpers count tokens and ensures trailing newlines so prompts resume cleanly.
(509805a, d02f35c, e858f67) - Fixed double counting in summaries and guaranteed
doneevents even when traversal encounters errors. (9c511ab)
Fixes 🐛
- Removed spurious helper bootstrap output and normalized Anthropic payloads, preventing API failures. (7f09f1a,
b8f3737, 2962cf9) - Dropped stale llama warning suppression and ensured Anthropic helpers require a valid API key with helpful messaging.
(e96e07c, 9c73429)
Docs 📚
- Documented tokenizer model support, uv requirements, and the need to quote shell wildcards when excluding files.
(663c7f9, edce64b, dee8da2)
Maintenance 🛠️
- Updated the toolchain to the latest Go release. (e15aa61)
Tests ✅
- Expanded streaming coverage, including helper-driven tokenization and end-to-end CLI fixtures for raw/JSON/XML output.
(748785c, 4b84cbb, e14ea9c)
Upgrade notes: Ensure uv is on PATH; the CLI will fetch helper dependencies and models automatically. Provide an
ANTHROPIC_API_KEY when requesting Claude token counts.
Highlights
- Consistent logging with Zap. Integrated
zapstructured logging across the codebase for clearer and more reliable
log output. (#86 b5ac3d5, #88 ddeb310, #89 7579eef) - Error and constant refactoring. Centralized error messages and shared constants for better maintainability and
consistency. (#76 2684689, #79 80cdb67, #81 dd4e06a, #87 2188b4d) - Tree builder improvements. Introduced a
TreeBuilderstruct, removed duplication, and optimized MIME type
detection. (#74 9b48d0c, #84 e77abaa, aec289e, 588d81a)
Features ✨
- Added
zaplogging integration with structured fields and standardized log output. (#86 b5ac3d5, #88 ddeb310, #89
7579eef)
Improvements ⚙️
- Centralized and reused error message constants across multiple packages. (#76 2684689, #81 dd4e06a, #87 2188b4d,
fec2804) - Introduced
TreeBuilderabstraction and improved binary/MIME type detection logic. (#74 9b48d0c, #84 e77abaa,
aec289e, 588d81a, b551cee) - Refactored variable and parameter names for clarity (e.g.,
lastDotIndex, descriptive sort params, call chain
vars). (#78 a01f6cb, #79 80cdb67, #83 b4e47fa) - Shared constants for documentation entry prefixes and error log formatting. (#68 d4caa16, #70 8bdd50b, #71 991ec54,
c2247ba, 790c401) - Improved output helpers and sorting of documentation entries. (44861a7, afc08e3, 5bd553f)
- More robust error handling for working directory resolution in CLI. (#69 a547738, dd1128a)
Docs 📚
- Expanded CLI help text and clarified
--docflag behavior. (#64 aaf807b, #65 23929a1, 391b01a, 0a73f97) - Added Quick Start guide and documented default JSON output format. (#66 ca4831d, #67 124f2af, 159e62c, 81ebfe2)
- Documented XML output format. (44da621)
Maintenance 🛠️
- Removed unused constants (e.g.,
xmlCallchainName,gitDirName). (#72 50ce9ae, #87 2188b4d) - Fixed branch naming inconsistency (
masteras default). (914a72b)
Upgrade notes: No breaking changes. Logging is now structured with Zap; existing CLI flags and outputs remain
compatible.
Highlights
- Repository structure improvements. Exposed a root-level
main.gofor easier CLI builds, with shared Cobra setup
for consistency. (#60 2686dae, c63e0af) - More flexible exclusion handling. Multiple adhoc exclusion patterns are now supported in a single run. (#61
fec03ce, 6aa9093) - Streamlined release flow. Documented release steps for contributors and automated CI to run only on Go file
changes. (#62 822d428, d9c9cd5, #63 7900db2, 30c2263)
Features ✨
Improvements ⚙️
Docs 📚
CI & Maintenance
Upgrade notes: No breaking changes. Builds, flags, and outputs remain compatible.
Highlights
- End-to-end MIME detection. All files now get a detected MIME type;
treenodes includemimefor file entries. (
#57 e7ad015, #56 c587e9c, b58837c, b628a44) - CLI UX overhaul. Custom usage template, improved help layout, and command aliases shown in help; help displays
when no command is provided. (#55 a99dc40, a93b618, #47 aa8f792, #45 3de79fb, 60f0d10) - Ignore system hardening. Refined path-based ignore logic, centralized ignore constants, clarified docs, and added
[binary]section support in.ignore. (#54 14b5190, #51 ff3756a, #52 96c691c, #32 a6f07cb, 31d4603) - Stricter output validation. Centralized output-format checks. (#35 e2b78f7, c83a8b4)
- XML output format. Added
xmlto supported output formats. (#20 da50618, 8f72db5) - Much broader test coverage. New and expanded tests across
content/ctx, ignore handling (including nested
.gitignore), MIME detection, utilities, and output. (#53 1f7585b, #50 048a866, #48 0267170, #30 52fb374, #27
7a98f75, 9203bbb, a117010, 6fe58e4, 73b7b01)
Features ✨
- Detect MIME type for all files and surface MIME in
treefile nodes. (#57 e7ad015, #56 c587e9c, b58837c, b628a44) - Add
xmlto list of output formats. (#20 da50618, 8f72db5)
Improvements ⚙️
- Support repeatable exclusion flag with glob pattern matching for tree and content commands.
- Improve help output and adopt a custom usage template. (#55 a99dc40, a93b618, #47 aa8f792)
- Show command aliases in help (Cobra help template override). (#45 3de79fb, c311f97)
- Refine path-based ignore handling and centralize ignore constants/messages. (#51 ff3756a, #41 ac2da74, 22bb964,
a64d9cd, 59c829b) - Extract common path flags and flag-registration helpers for consistency. (#44 cab1575, 101c207)
- Validate output formats via a single function. (#35 e2b78f7, c83a8b4)
Fixes 🐛
Docs 📚
- Clarify ignore pattern handling and document related utilities. (#52 96c691c, 31d4603)
- Document call-chain depth flag and related behavior. (#29 ed3382f, f29acd5)
- Add GoDoc comment for
findGitDirectory. (#34 2004ec2, ee5d754) - Update README with new features; remove manual changelog fragment. (#25 541caeb, 47834ad)
Tests ✅
- Add content command test for nested
.gitignoreand broaderShouldIgnorecoverage. (#53 1f7585b, f6d517c, 1abe325) - Add fixtures (incl. Google Sheets add-on) and extend
ctx_test.go. (#50 048a866, a117010) - Add tests for internal utils and output functions; call-chain depth tests; binary MIME tests. (#48 0267170, 6adc791,
9203bbb, 73b7b01)
Refactors 🧹
- Use descriptive loop/variable names across codebase. (#40 5d44468, #38 066afa0, f52116b, e73466f)
- Remove unused constants and legacy/binary patterns from tree handling. (#39 c0cf7cd, 24f6ce6, 77a27f0)
- Remove legacy
show-binary-contentdirective (now superseded by[binary]in.ignore). (446504c)
CI & Maintenance
Upgrade notes: No breaking changes expected in this release. Existing CLI flags and outputs remain compatible; the
new XML format and richer help/alias displays are additive.
Features ✨
- Binary Section in
.ignore.ignorefiles now support a[binary]section listing patterns whose binary contents are base64-encoded in
output.- The legacy
show-binary-content:directive has been removed.
Features ✨
- Documentation Extraction (
--docflag)- Added the
--docboolean flag to thecontent(c) andcallchain(cc) commands. - When enabled, ctx collects and embeds documentation for imported third‑party packages and referenced functions.
- Documentation is available in both raw and json output formats.
- Added the
Improvements ⚙️
- Tests Package Renaming
- All integration tests are now consolidated under the
testspackage to simplify discovery.
- All integration tests are now consolidated under the
- Table‑Driven Tests
- Introduced table‑based patterns for new test cases to improve readability and maintenance.
Internal
- README Update
- Added details about the new
--docflag and updated flag tables and examples.
- Added details about the new
What's New 🎉
- JSON is a default output format
What's New 🎉
- Renamed
contenttoctx
Features ✨
- Call Chain Analysis Command (
callchain,cc):- Added a new command
callchain(aliascc) to analyze the call graph for a specified function within the
repository. - Usage:
content callchain <function_name> [--format <raw|json>] - The
<function_name>argument should be a fully qualified name (e.g.,github.com/org/repo/pkg.MyFunction) or a
unique suffix. - Raw Output (
--format rawor default): Displays the target function, its direct callers, and its direct
callees in a human-readable format, followed by the source code of these functions. - JSON Output (
--format json): Outputs a JSON object containing thetargetFunction, arrays ofcallersand
callees(fully qualified names), and afunctionsmap where keys are function names and values are their source
code strings.
- Added a new command
Features ✨
- Version Flag: Added a
--versionflag to display the application version.
Bug Fixes 🐛
- Version Verbiage: Corrected the wording used when displaying the version information.
Features ✨
- JSON Output Format:
- Added a
--format <type>flag. - Supported types are
raw(default) andjson. --format jsonoutputs results in a structured JSON format suitable for machine processing (e.g., by AI tools).content content --format json: Outputs an array of objects, each withpath,type("file"), andcontentfor
successfully read files.content tree --format json: Outputs an array representing input paths. Files havepathandtype. Directories
havepath,type, and nestedchildren.- The default
rawformat preserves the original human-readable text output.
- Added a
Features ✨
-
Multi-Directory Support:
The tool now accepts multiple directory paths as positional arguments.
content <command> [dir1] [dir2] ... [flags].ignoreand.gitignorefiles are loaded relative to each specified directory.- The
-e/--eexclusion flag applies to direct children within any of the specified directories. - Output for
treeshows separate trees for each directory. - Output for
contentconcatenates file contents from all specified directories sequentially. - Duplicate input directories (after resolving paths) are processed only once.
- If no directories are specified, it defaults to the current directory (
.).
-
Mixed File/Directory Input:
The tool now accepts both file and directory paths as positional arguments.
content <command> [path1] [path2] ... [flags]- For the
contentcommand:- Explicitly listed files have their content printed directly.
- Directories are traversed recursively, printing content of non-ignored files within them.
- For the
treecommand:- Directories are traversed, displaying their structure.
- Explicitly listed files are shown with a
[File]marker and their absolute path.
- Ignore rules (
.ignore,.gitignore,-e) only apply during the traversal of directory arguments. Explicitly
listed files are never filtered by ignore rules.
- For the
What's New 🎉
-
Using
.ignoreInstead of.ignore:
The tool now looks for a file named .ignore for exclusion patterns. -
Processing
.gitignoreby Default:
The tool loads .gitignore by default if present. Use the--no-gitignoreflag to disable this. -
Folder Exclusion Flags:
Both -e and --e flags now work for specifying an exclusion folder. The folder is excluded only when it
appears as a direct child of the working directory. -
Disabling Ignore File Logic:
- --no-gitignore: Prevents the tool from reading the .gitignore file.
- --no-ignore: Prevents the tool from reading the .ignore file.
-
Command Abbreviations:
Short forms t for tree and c for content are now supported.