Building a Cross-Platform File Search and Workspace Inspection Utility in Go
A practical command-line engineering project focused on deterministic behavior, memory-efficient file processing, cross-platform reliability, and automation-friendly output.
Author: Soroush Neyestani
Language: Go
CLI framework: Cobra
Latest stable release: v0.1.1
Platforms: Windows amd64, Linux amd64, macOS arm64
License: MIT
Status: Completed — Public Open Source Release
Release date: November 19, 2026
Source code: https://github.com/soroushneyestani/developer-cli-toolkit
Download: https://github.com/soroushneyestani/developer-cli-toolkit/releases/tag/v0.1.1
Project Overview
Developer CLI Toolkit is an open-source, cross-platform command-line application designed to search file contents and inspect filesystem workspaces through a predictable, automation-friendly interface.
Written in Go, the application provides two primary operations: recursive literal-text searching and structured file inspection.
Its command-line executable, dct, allows developers, system administrators, and automation scripts to search UTF-8 files, filter results by file extension, examine file metadata, and produce structured output in newline-delimited JSON (NDJSON).
The project was developed around a specific engineering principle:
A useful command-line tool must do more than produce the correct output. It must also provide predictable behavior, explicit error semantics, reproducible results, and an implementation that can be tested across operating systems.
Rather than attempting to reproduce the extensive capabilities of established search utilities, Developer CLI Toolkit focuses on a deliberately defined feature set with documented behavior and limitations.
The result is a small but complete software product with independently testable components, automated cross-platform verification, reproducible release packaging, technical documentation, and publicly available source code.
The Problem
Searching a source-code workspace or collecting information about its files is a common requirement in software development.
Developers frequently need to locate configuration values, inspect source directories, identify files with particular extensions, or extract structured information for use in another program.
Existing tools can solve many of these problems, but integrating command-line utilities into automated workflows introduces additional considerations.
For example:
- How can a script distinguish between a search with no results and a search that failed?
- How should file paths be represented consistently across Windows and Unix-like operating systems?
- What happens when a directory contains binary files or invalid UTF-8 data?
- How can file inspection results be consumed without parsing ambiguous human-readable text?
- How can an implementation avoid excessive memory consumption when processing large files?
- How can the same behavior be verified on multiple operating systems?
Developer CLI Toolkit addresses these questions through a defined command contract, explicit output formats, controlled filesystem traversal, and automated verification.
The project takes conceptual inspiration from the usability of recursive search tools such as ripgrep. However, its source code, interface contract, and implementation are independent. It does not claim feature compatibility or performance parity with ripgrep.
Core Features
1. Recursive Literal Search
The dct search command recursively searches regular files beneath a selected directory.
The search is case-sensitive and uses literal-text matching rather than regular expressions.
For example:
dct search TODO ./workspace
This command searches for the exact text TODO in files beneath the workspace directory.
A matching line produces one record, even if the searched expression appears multiple times on that same line.
When producing plain-text output, the application reports the relative file path, line number, and matching line content.
This design makes the results suitable for both interactive inspection and downstream processing.
2. File Extension Filtering
Both primary commands support repeatable --ext options.
For example:
dct search TODO ./workspace --ext .go --ext .md
Only files with matching extensions are selected.
Extension filters are case-sensitive and must begin with a period. Multiple filters use OR semantics.
This allows searches to be restricted to relevant file types without requiring separate commands for each extension.
3. Workspace Inspection
The dct inspect command provides a recursive inventory of regular files.
For example:
dct inspect ./workspace
Instead of reading file contents for search matches, inspection reports relative file paths and file sizes in bytes.
The command can also apply extension filters:
dct inspect ./workspace --ext .go
Potential applications include workspace inventories, file-distribution analysis, automation pipelines, and lightweight development utilities.
4. Machine-Readable NDJSON
Both commands support the --json option.
For example:
dct search TODO ./workspace --ext .go --json
Search results contain the fields path, line, and text.
An illustrative output record is:
{"path":"src/main.go","line":12,"text":"// TODO: review"}
The inspection command produces records containing path and bytes.
For example:
{"path":"src/main.go","bytes":2048}
These examples demonstrate the output schema; they are not benchmark results or claims about the contents of a particular repository.
NDJSON was chosen because each line represents one independently parseable JSON object.
Compared with plain-text formats containing delimiters, structured output is easier to process reliably when paths or matching content contain punctuation and other special characters.
This makes dct suitable for integration into scripts, CI jobs, and custom developer workflows.
5. Explicit Exit Codes
A significant design objective was to distinguish normal outcomes from errors.
The application uses three principal exit codes:
| Exit code | Meaning |
|---|---|
0 | Search found matching content, or inspection completed successfully |
1 | Search completed successfully but found no matches |
2 | Invalid invocation, filesystem failure, or output error |
This distinction matters in automation.
A search returning no matches does not necessarily indicate a defective program or an infrastructure failure.
Likewise, a search that prints some results before encountering a filesystem error must not be silently treated as a completely successful operation.
Diagnostic messages are directed to standard error, while normal results are written to standard output.
This separation supports more dependable integration with external processes.
Software Architecture
The application is implemented in Go, using Cobra for command definition and argument processing.
The architecture separates command handling from filesystem operations and search logic.
Command Layer
The command layer is responsible for:
- Registering supported commands and options.
- Validating user-supplied arguments.
- Selecting the required operation.
- Formatting results as text or NDJSON.
- Directing diagnostics to standard error.
- Mapping operation outcomes to exit codes.
Separating these concerns helps prevent command parsing and presentation logic from becoming tightly coupled to file-processing behavior.
Filesystem and Workspace Layer
The workspace layer handles directory traversal, file selection, path normalization, and metadata collection.
It applies several important rules.
First, paths are represented relative to the selected search root and use forward slashes in generated output.
Second, selected file paths are sorted lexicographically to provide deterministic ordering for a stable directory tree.
Third, symbolic links are not followed during ordinary traversal, and symbolic-link roots are rejected.
The implementation also distinguishes regular files from other filesystem entries.
These choices make the scope of an operation more explicit and reduce unexpected traversal behavior.
Search and Validation Layer
Search correctness requires more than finding matching bytes.
The application is designed to avoid returning text from files containing NUL bytes or invalid UTF-8 content.
This is important because the tool’s search contract concerns UTF-8 text files, rather than arbitrary binary data.
A file must therefore satisfy the relevant validity requirements before its search results are accepted.
The newer streaming implementation preserves this behavior while reducing the need to hold entire large files in memory.
Results may be staged until the file has been fully validated, which introduces a deliberate trade-off between memory usage, temporary storage, and output timing.
Engineering Decisions
The architecture emphasizes:
Predictability: identical, stable inputs should produce consistently ordered output.
Correctness: invalid input, filesystem problems, and incomplete execution must be distinguishable from successful operations.
Maintainability: command processing, file traversal, matching, and output formatting have identifiable responsibilities.
Testability: behavior can be exercised through the compiled executable, not merely through internal function calls.
Portability: the same source code can be compiled and verified across the supported platforms.
Memory-Efficient Streaming in v0.1.1
A central improvement in version 0.1.1 was the redesign of large-file processing.
The earlier implementation could hold substantial file contents in memory during searching.
Although this approach was straightforward, it made memory consumption more sensitive to the size of the files being processed.
The streaming implementation instead processes file content incrementally.
For long lines without a match, the application avoids retaining the entire line unnecessarily.
At the same time, it must preserve the original validation and output rules.
This creates several engineering challenges.
UTF-8 validation: a multibyte character may span internal read boundaries. The processing logic must not incorrectly classify valid content because of how the input is divided.
Binary-content detection: a file containing NUL bytes must not produce accepted text-search results.
Output integrity: matching records should not be released prematurely if later content invalidates the file.
Line handling: LF, CRLF, and a final unterminated line must be handled according to the command contract.
Memory management: reducing the input buffer does not automatically eliminate memory costs associated with long matching lines, accumulated paths, or output staging.
The revised implementation therefore focuses on reducing memory use while preserving documented behavior.
It does not claim constant memory consumption for all possible inputs.
Performance Evaluation
To evaluate the streaming changes, I compared the original implementation and the revised implementation using reproducible synthetic input scenarios.
The measurements included peak memory consumption and execution time.
Three representative Windows benchmark scenarios are summarized below.
Median Peak Memory Consumption
| Scenario | v0.1.0 | Revised implementation |
|---|---|---|
| 96 MiB file with few matches | 57.24 MiB | 7.57 MiB |
| 48 MiB unmatched long line | 56.31 MiB | 7.32 MiB |
| 16 MiB matching long line | 56.93 MiB | 41.28 MiB |
In the first two scenarios, the revised implementation reduced measured median peak memory consumption by approximately 87%.
The third scenario also showed reduced memory consumption, but the improvement was smaller because preserving and emitting very long matching content still requires resources.
Median Execution Time
| Scenario | v0.1.0 | Revised implementation |
|---|---|---|
| 96 MiB file with few matches | 67.403 ms | 56.175 ms |
| 48 MiB unmatched long line | 41.872 ms | 50.269 ms |
| 16 MiB matching long line | 40.292 ms | 69.589 ms |
These results demonstrate an important engineering trade-off.
The revised version completed the first scenario faster, but the two long-line scenarios took longer.
The optimization was therefore not a universal speed improvement.
Instead, it was a targeted reduction in memory consumption while maintaining the required behavior.
All benchmark values relate to the reported synthetic Windows test scenarios. They should not be interpreted as universal throughput guarantees or direct comparisons with other search tools.
Benchmark methodology and further measurements are documented in the project repository.
Testing and Quality Assurance
The release process was designed around repeatable automated verification.
The testing approach includes several levels.
Behavioral and Contract Testing
Tests verify that the executable follows its documented command contract.
Coverage includes literal search, case sensitivity, matching-line behavior, file-extension filters, path ordering, NDJSON output, argument validation, and exit codes.
Filesystem Edge Cases
Additional scenarios exercise:
- Empty and nested directories.
- Hidden files.
- Unicode input.
- LF and CRLF line endings.
- Files without a final newline.
- Invalid UTF-8 and NUL-containing files.
- Symbolic-link handling.
- Invalid roots and unsupported arguments.
- Filesystem read failures.
Where a platform cannot reliably create a particular test condition, the test framework records the limitation rather than pretending the behavior was verified.
Regression Verification
The streaming changes were compared with previously verified behavior to detect unintended differences in output and exit-code semantics.
Reported regression testing included 72 comparison cases during the release-candidate review.
This helped verify that improvements to memory processing did not change the externally documented behavior of the application.
Cross-Platform CI
GitHub Actions is used to verify the project on Windows, Linux, and macOS.
The workflow includes native build and test execution, followed by release packaging.
The stable v0.1.1 release was built from a verified source commit and checked against the corresponding CI evidence.
This distinction matters: compiling software for a target operating system demonstrates build compatibility, but native execution is required to verify platform-specific behavior.
Packaging and Distribution
Developer CLI Toolkit is distributed through GitHub Releases.
The stable release provides separate packages for:
- Windows on amd64.
- Linux on amd64.
- macOS on arm64.
Each package contains the executable and applicable licensing information.
SHA-256 checksums are supplied so users can compare downloaded archives against the published release manifest.
The source code is also available directly through the public repository and GitHub’s source archives associated with the release tag.
Users downloading a precompiled executable do not need to install the Go toolchain merely to run the application.
Developers who want to inspect, modify, or rebuild the software can obtain the complete source code and run the documented build and test procedures.
The published binaries are not digitally signed. Checksums provide integrity verification against the published manifest but are not, by themselves, proof of the identity of the publisher.
Security and Scope
The project follows a deliberately constrained operating model.
It searches files beneath a selected directory and does not follow symbolic links during traversal.
The application does not require a background service, remote account, or persistent central database to perform its primary operations.
It is intended to work directly with local filesystem content supplied by the user.
The repository includes security documentation and a published policy for reporting potential vulnerabilities.
However, the existence of security-related tests and documentation should not be interpreted as a formal independent security certification.
Current Limitations
The scope of v0.1.1 is intentionally specific.
The application does not include regular-expression search, advanced ignore-file processing, standard-input search, or full compatibility with established search utilities.
Its matching behavior is case-sensitive and literal.
The in-memory inventory of selected file paths still consumes resources proportional to the number of selected paths.
Large matching results can require additional memory, and output staging may use temporary disk space.
Execution time also varies according to input structure, filesystem characteristics, and output volume.
These limitations are documented so that developers can assess whether the tool is appropriate for their workflows.
Open-Source Licensing
Developer CLI Toolkit is distributed under the MIT License.
The complete original source code is publicly accessible.
The license permits use, modification, redistribution, and commercial use subject to its conditions.
Applicable third-party dependency notices and licenses are maintained separately.
I chose this distribution model to make the implementation accessible to developers interested in practical CLI engineering, filesystem processing, automation, and cross-platform software development.
Engineering Perspective
For me, the most valuable aspect of this project is not the number of commands it provides.
It is the discipline required to turn a small command-line utility into a verifiable software release.
The work involved defining behavior before implementation, separating architectural responsibilities, testing real executable behavior, handling filesystem edge cases, investigating memory usage, measuring performance trade-offs, and publishing traceable release artifacts.
The streaming optimization was particularly instructive.
It showed that an improvement in one engineering dimension can introduce costs in another.
Reducing memory usage does not automatically reduce execution time, and optimizing implementation details should never silently change the public contract of an application.
These are principles that also matter in larger backend systems and enterprise software.
A dependable application should have clearly defined behavior, reproducible verification, understandable limitations, and a release process that can be audited.
Developer CLI Toolkit represents a practical implementation of those principles.
Source Code and Downloads
Developer CLI Toolkit is available free of charge.
The public GitHub repository contains source code, tests, technical documentation, and release information.
GitHub repository
https://github.com/soroushneyestani/developer-cli-toolkit
Latest stable release — v0.1.1
https://github.com/soroushneyestani/developer-cli-toolkit/releases/tag/v0.1.1
License: MIT
Supported release platforms: Windows, Linux, and macOS.
Developed and published by Soroush Neyestani — November 2026.