Java straight-conversion runtime for miku-grep.
This repository ports the upstream Node.js / TypeScript miku-grep CLI into a
Java 1.8-compatible Maven runtime while preserving the upstream search contract
and stdin / stdout JSON interface for machine-readable automation.
The Java CLI contract is documented in docs/miku-grep-cli-spec.md.
Build the executable runtime jar:
mvn packageRun the CLI:
java -jar target/miku-grep.jar TODO .
java -jar target/miku-grep.jar TODO . --context 2
java -jar target/miku-grep.jar TODO . --files
java -jar target/miku-grep.jar TODO . --agent
java -jar target/miku-grep.jar TODO . --format json
java -jar target/miku-grep.jar --files .
java -jar target/miku-grep.jar < request.json > result.json
java -jar target/miku-grep.jar --version
java -jar target/miku-grep.jar --helpWith query arguments, the default output is human-readable text. Use
--format json for structured result JSON. With no arguments, stdin JSON is
still accepted and stdout is result JSON. --version and --help are
stdin-free metadata commands.
{
"version": 1,
"root": ".",
"query": {
"type": "literal",
"text": "RepositoryMap"
},
"search": {
"targets": ["content"],
"recursive": true,
"maxDepth": 8
}
}mvn package creates:
target/miku-grep.jar- executable shaded runtime jar
target/miku-grep-sources.jar- source jar
target/miku-grep-0.10.0-dist.zip- distribution zip containing the versioned runtime jar, README, LICENSE, and runtime-oriented docs
Primary verification:
mvn test
mvn packageRepository-specific migration state is tracked in
docs/remaining-migration-items.md.
CLI JSON compatibility policy is tracked in docs/cli-json-parity.md.
The Java runtime intentionally documents these accepted differences:
- regex search uses Java
Patterninstead of Node.jsRegExp - Shift_JIS decoding uses Java charset handling instead of upstream Node dependencies
Other observable JSON contract differences should be treated as regressions unless explicitly recorded in the follow-up log.
- Search targets are specified as
search.targets, a non-empty array ofcontent,filepath, and/ordirectory. - Summary output mode is
output.mode: "summary". - Detail content matches can include
contextBeforeandcontextAfterwhen context line options are requested. - Detail filepath / directory matches return at most one representative hit per matched path.
- Ignore file handling is enabled by default for
.gitignore,.ignore, and.git/info/exclude; useignore.mode: "none"to disable it. mode: "listFiles"lists candidate files and returnsfilesplusfileSummary; an optional glob query can filter paths.output.mode: "agent"returns agent-oriented file and directory matches.output.sort: "relevance"annotates summary / agent matches with relevance score information and sorts by score.query.type: "glob"is supported for filepath / directory-oriented matching, includinglistFilespath filtering.query.case: "insensitive"enables case-insensitive literal and regex matching.