REPL Commands

Core Commands

These commands are always available in the Enkan REPL.

/start

Start the Enkan system. All components are started in dependency order.

/stop

Stop the Enkan system. All components are stopped in reverse dependency order.

/reset

Stop and restart the Enkan system. This triggers class reloading
when META-INF/reload.xml is present in the classpath.

/shutdown

Shut down the Enkan system and exit the REPL process.

/help

Show the list of available commands.

/middleware [app] list

Show the middleware stack for the specified application component.

Client-Local Commands

These commands run inside the REPL client (enkan-repl-client) itself and do
not require a connection to a running Enkan server.

/init

Scaffold a new Enkan project using an AI assistant. Interactively collects the
project description, name, group ID, and output directory; shows a plan for
review (which can be revised or cancelled); writes a compilable project
skeleton; runs mvn validate then mvn compile -Pdev with an automatic fix
loop; and optionally launches the generated app and auto-connects the REPL to
it.

Default stack

Unless your description explicitly asks for something else, /init generates a
project wired with:

  • Web: Jetty (virtual threads) + Kotowari MVC + Jackson JSON
  • Persistence: HikariCP → H2 in-memory → jOOQ DSLContext → Flyway migrations
  • Row → domain decoding: Raoh — type-safe,
    error-accumulating decoders via JooqRecordDecoders

To opt into a different persistence stack, mention it in your description:

  • "A REST API using JPA/Hibernate" — allows jakarta.persistence.* imports
  • "A guestbook app with Doma2" — allows org.seasar.doma.* imports

The generator still installs the default POM in those cases; add the
corresponding enkan-component-jpa / enkan-component-doma2 dependency
manually after generation.

Fixed vs. generated files

The generator writes the following files deterministically from templates, so
the AI is only responsible for application-specific code:

Fixed (template-generated) Generated by the AI
pom.xml RoutesDef.java (route table)
DevMain.java *Controller.java
*SystemFactory.java Domain records + Raoh decoders
*ApplicationFactory.java V1__*.sql Flyway migrations
jaxrs/JsonBodyReader.java, JsonBodyWriter.java Unit tests

This split guarantees that the parts of the project that need to be correct for
Enkan to even start up are never subject to LLM hallucinations.

Configuration

Requires the following environment variables (or system properties):

Env var System property Default
ENKAN_AI_API_URL enkan.ai.apiUrl https://api.anthropic.com/v1
ENKAN_AI_API_KEY enkan.ai.apiKey (required)
ENKAN_AI_MODEL enkan.ai.model claude-sonnet-4-5
ENKAN_VERSION enkan.version (read from jar pom.properties)

ENKAN_VERSION / enkan.version overrides the version stamped into the
generated pom.xml. Normally you do not need to set it — it is auto-detected
from the packaged enkan-repl-client.jar — but running /init from a raw class
directory (e.g. during development of the init command itself) requires the
override.

Works with any OpenAI-compatible chat completion endpoint (OpenAI, Anthropic’s
OpenAI-compatible endpoint, LM Studio, Ollama, vLLM, etc.). See
Getting Started for a full walkthrough.

/help [command]

List all client-local commands, or show the detail for a single command
(e.g. /help init).

/connect [host] port

Connect the client to a running Enkan REPL server on the given port (host
defaults to localhost).

/exit

Exit the REPL client.

Devel Commands

Registered by DevelCommandRegister. Requires the enkan-devel dependency.

/autoreset

Watch compiled class files for changes and automatically reset the application
when a modification is detected. Uses WatchService to monitor all
directories marked with META-INF/reload.xml.

See Development Tools for details on the class reloading mechanism.

/compile

Compile the project using the configured build tool.
By default, uses Maven (MavenCompiler). Can be configured to use Gradle
by passing a GradleCompiler to DevelCommandRegister.

Kotowari Commands

Registered by KotowariCommandRegister. Available when using the Kotowari web framework.

/routes [app]

Show the routing table for the specified application component.

Metrics Commands

Registered by MetricsCommandRegister. Requires the enkan-component-metrics dependency.

/metrics

Display collected application metrics from the Metrics component.