Skip to content

igapyon/miku-grep-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miku-grep-java

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.

Usage

Build the executable runtime jar:

mvn package

Run 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 --help

The primary input is stdin JSON. The primary output is stdout JSON. stdout is reserved for result JSON except for --version and --help.

Minimal Request

{
  "version": 1,
  "root": ".",
  "query": {
    "type": "literal",
    "text": "RepositoryMap"
  },
  "search": {
    "targets": ["content"],
    "recursive": true,
    "maxDepth": 8
  }
}

Build Outputs

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

Development

Primary verification:

mvn test
mvn package

Repository-specific migration state is tracked in docs/remaining-migration-items.md.

CLI JSON compatibility policy is tracked in docs/cli-json-parity.md.

Runtime Differences

The Java runtime intentionally documents these accepted differences:

  • regex search uses Java Pattern instead of Node.js RegExp
  • 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.

v0.9.0 Contract Notes

  • Search targets are specified as search.targets, a non-empty array of content, filepath, and/or directory.
  • Summary output mode is output.mode: "summary".
  • Detail content matches can include contextBefore and contextAfter when 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; use ignore.mode: "none" to disable it.
  • mode: "listFiles" lists candidate files and returns files plus fileSummary; 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, including listFiles path filtering.
  • query.case: "insensitive" enables case-insensitive literal and regex matching.

About

Java 1.8-compatible Maven runtime for the miku-grep CLI, preserving its stdin/stdout JSON contract.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages