Skip to content

bernardladenthin/srcmorph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

550 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

srcmorph

Note

No IDE or local setup required. This repository is optimized for fully AI-assisted development using Claude Code. No local toolchain, no IDE, nothing to install — everything works completely through Claude.

AI:
Claude

Build:
Java 8+
JPMS
JUnit
JSpecify
NullAway
Checker Framework
Error Prone
Maven Enforcer
Lombok
jqwik
ArchUnit
SpotBugs
jcstress
Lincheck
vmlens
JMH
Publish
CodeQL

Coverage:
Coverage Status
codecov
JaCoCo
PIT Mutation

Quality:
Quality Gate
Code Smells
Security Rating

Security:
Known Vulnerabilities
FOSSA Status
Dependencies
OSV-Scanner

Package:
Maven Central
Snapshot
Release Date
Last Commit

License:
License

Community:
OpenSSF Best Practices
Contribute with Gitpod
OpenSSF Scorecard
Dependabot
Conventional Commits
Keep a Changelog
SemVer
REUSE
Maintained?
Issues
Pull Requests
GitHub Stars
Treeware
Stand With Ukraine

srcmorph

srcmorph is a prompt-driven source-tree transformer: it walks a source tree and processes each file through a configurable local LLM prompt — via llama.cpp GGUF models, entirely local, no cloud calls — producing layered output: per-file, then per-package, then per-project. Today it emits structured, AI-readable .ai.md Markdown summaries for fast semantic code navigation; the same rule-routed pipeline (composable file-matching conditions, per-rule model + prompt, oversize handling) is generic enough to eventually emit wikis, architecture docs, diagrams, or even source-to-source transformations.

Migration note. This repository was restructured from a single Maven plugin into a reactor of three artifacts — see "Module overview" below. As part of that migration the Maven plugin was renamed from net.ladenthin:llamacpp-ai-index-maven-plugin to net.ladenthin:srcmorph-maven-plugin (goal prefix srcmorph, properties srcmorph.*). Existing consumers who still declare the old coordinates are not broken: the old artifactId was published once, at version 1.0.4, as a tiny relocation-stub POM (<distributionManagement><relocation>) that redirects Maven to the new coordinates automatically — verified working end-to-end from a clean environment. No consumer action is required, though updating your own POM to the new coordinates directly is recommended. See CLAUDE.md for the full migration history.

Module overview

Module Artifact What it is
srcmorph/ net.ladenthin:srcmorph The core library: a framework-free Java API (no Maven dependency) — the shared SrcMorphConfiguration plus the generate/aggregate-packages/aggregate-project/calibrate engines. Use this to embed srcmorph in your own tooling.
srcmorph-cli/ net.ladenthin:srcmorph-cli A standalone CLI driven by one JSON or YAML configuration file (ships as a java -jar-ready fat jar). No Maven project required.
srcmorph-maven-plugin/ net.ladenthin:srcmorph-maven-plugin The Maven plugin, a thin wrapper around srcmorphrenamed from net.ladenthin:llamacpp-ai-index-maven-plugin (goal prefix srcmorph, was ai-index; properties srcmorph.*, were aiIndex.*).

All three modules (plus the reactor parent pom) are released together from this one repository at the same version. (A fourth, independently-versioned relocation-stub module for the retired net.ladenthin:llamacpp-ai-index-maven-plugin coordinates was part of this reactor through the 1.1.1 release and has since been removed — its published 1.0.4 artifact remains permanently on Maven Central regardless; see CLAUDE.md.)

Quickstart

1. Maven plugin

<plugin>
    <groupId>net.ladenthin</groupId>
    <artifactId>srcmorph-maven-plugin</artifactId>
    <version>1.1.1</version>
    <configuration>
        <generationProvider>mock</generationProvider>
        <promptDefinitions>
            <promptDefinition>
                <key>file-body</key>
                <template><![CDATA[Summarize this file:
%s]]></template>
            </promptDefinition>
        </promptDefinitions>
        <fieldGenerations>
            <fieldGeneration>
                <promptKey>file-body</promptKey>
                <aiDefinitionKey>coder</aiDefinitionKey>
                <fallback>true</fallback>
            </fieldGeneration>
        </fieldGenerations>
        <aiDefinitions>
            <aiDefinition>
                <key>coder</key>
                <modelPath>/path/to/model.gguf</modelPath>
            </aiDefinition>
        </aiDefinitions>
    </configuration>
</plugin>

Run with mvn srcmorph:generate. Full goal/parameter reference, routing rules, GPU acceleration, and model recommendations: srcmorph-maven-plugin/README.md.

Deprecated: old net.ladenthin:llamacpp-ai-index-maven-plugin coordinates (auto-relocates)
<plugin>
    <groupId>net.ladenthin</groupId>
    <artifactId>llamacpp-ai-index-maven-plugin</artifactId>
    <version>1.0.4</version>
    <!-- Maven Central redirects this artifact to net.ladenthin:srcmorph-maven-plugin:1.1.1 via a
         published <distributionManagement><relocation> POM. Prefer declaring the new coordinates
         above directly in new/updated POMs. -->
</plugin>

2. Standalone CLI

java -jar srcmorph-cli-<version>-jar-with-dependencies.jar examples/config_All.json

Every examples/config_*.json/.yaml file works out of the box with the mock provider (no GGUF model required) — see examples/ for the full set plus paired run_*.sh/run_*.bat launcher scripts, and srcmorph-cli/README.md for the config-file reference.

3. Library dependency

<dependency>
    <groupId>net.ladenthin</groupId>
    <artifactId>srcmorph</artifactId>
    <version>1.1.1</version>
</dependency>
SrcMorphConfiguration config = new SrcMorphConfiguration();
config.setBaseDirectory(new File("."));
// ... set outputDirectory, promptDefinitions, aiDefinitions, fieldGenerations ...
new GenerateEngine(config).execute();

See srcmorph/README.md for the full API tour (the four engines, exception types, and a complete embedding example).

How It Works

srcmorph runs in three phases, building a navigable index from fine to coarse — see each module's own README for the full details (routing rules, oversize strategies, exact-count facts, the project overview) and CLAUDE.md for the architecture.

  1. File generation — scans configured source directories, writes one .ai.md file per source file (deterministic metadata header + AI-generated Markdown body).
  2. Package aggregation — traverses the generated .ai.md files, writes one package.ai.md per directory with a deterministic child-link list plus an AI-generated summary.
  3. Project index — harvests the one-line lead from every package.ai.md into a single project.ai.md table of contents (deterministic; an optional one-call AI overview paragraph can be enabled).

Each phase is independently switchable and incremental (checksums skip unchanged files); a rule-based router lets one run send different files to different models and prompts by extension, size, age, or path.

Snapshot builds

Snapshots are published to the Central Snapshots repository on every push to main:

https://central.sonatype.com/repository/maven-snapshots/net/ladenthin/

Current reactor version: 1.2.0-SNAPSHOT. Last released version: 1.1.1.

A Note on History

Somewhere in early 2026, the same idea apparently occurred more than once. This repository started with an implementation on March 15, 2026. Andrej Karpathy published his "LLM wiki" gist on April 4, 2026. Google Cloud eventually formalized the very same pattern into the Open Knowledge Format, announced on June 12, 2026.

License

Apache License 2.0

About

Maven plugin for generating hierarchical AI-readable code index trees using llama.cpp-compatible local models.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages