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 stdin / stdout JSON
contract as the primary compatibility target.
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 < request.json > result.json
java -jar target/miku-grep.jar --version
java -jar target/miku-grep.jar --helpThe primary input is stdin JSON. The primary output is stdout JSON.
stdout is reserved for result JSON except for --version and --help.
{
"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.9.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.