Skip to content

Latest commit

 

History

History
200 lines (148 loc) · 9.88 KB

AGENTS.md

File metadata and controls

200 lines (148 loc) · 9.88 KB

AGENTS.md

This file provides guidance to AI coding agents (Claude Code, Codex, GitHub Copilot, OpenCode and others) when working with code in this repository.

Repository Overview

Spring Tools is a comprehensive IDE tooling suite for Spring Boot development. It provides extensions for Eclipse IDE, Visual Studio Code, and Eclipse Theia. The core architecture uses the Language Server Protocol (LSP): Java language servers run as separate processes, with thin client integrations for each IDE.

Directory Structure

sts4/
├── headless-services/          # Java Language Servers (Maven-based)
│   ├── commons/                # Shared libraries and LSP infrastructure
│   ├── spring-boot-language-server/      # Core Spring Boot language server (with JDT LS)
│   ├── spring-boot-language-server-standalone/  # Standalone variant (Jandex, no JDT LS)
│   ├── manifest-yaml-language-server/   # Cloud Foundry manifest YAML support
│   ├── concourse-language-server/       # Concourse CI pipeline support
│   ├── bosh-language-server/            # BOSH configuration support
│   ├── jdt-ls-extension/       # Eclipse JDT Language Server extensions
│   └── xml-ls-extension/       # XML language server extension
├── eclipse-extensions/         # Eclipse IDE Plugin Extensions (Tycho/Maven)
├── eclipse-language-servers/   # Eclipse LSP4E Integration (Tycho/Maven)
├── eclipse-distribution/       # Pre-packaged Eclipse distribution (Tycho/Maven)
├── vscode-extensions/          # TypeScript VSCode Extensions (npm-based)
│   ├── vscode-spring-boot/     # Main Spring Boot extension
│   ├── vscode-concourse/       # Concourse CI extension
│   ├── vscode-manifest-yaml/   # Cloud Foundry manifest extension
│   ├── vscode-bosh/            # BOSH configuration extension
│   ├── commons-vscode/         # Shared TypeScript utilities
│   └── boot-dev-pack/          # Extension pack bundling Spring Boot extensions
├── nodejs-packages/            # Shared Node.js utilities
└── agent-plugins/              # Agent plugin (standalone LS + MCP server) for Claude Code, Codex, GitHub Copilot and OpenCode
    ├── spring-tools/           # Plugin source (skills, agents, hooks, explanations/<CODE>.md playbooks)
    ├── tools/                  # Node.js checkers, tests and behavioral evals
    ├── research-notes/         # TODO_quickfixes.md: problem code → quick fix → playbook coverage table
    └── update-local-jars.sh    # Rebuilds the standalone LS JAR for the plugin

Build System Architecture

The project uses three independent build systems:

Java Language Servers (Maven)

cd headless-services
./mvnw clean install                    # Full build with tests
./mvnw clean install -DskipTests=true   # Skip tests
./mvnw clean install -pl spring-boot-language-server -am  # Single module + deps
  • Parent POM: headless-services/pom.xml (aggregator)
  • Commons parent: headless-services/commons/pom.xml (defines Spring Boot parent, Java 21 source/target)
  • CI runs with JDK 25; source/target compatibility is Java 21
  • Main entry point: org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp

Eclipse Plugins (Tycho/Maven)

cd eclipse-language-servers
./mvnw -Pe439 clean install              # Eclipse 2026-03 (4.39)
./mvnw -Pe440 clean install              # Eclipse 2026-06 (4.40)

cd eclipse-distribution
./mvnw -Pe439 -Psnapshot clean package   # Full Eclipse distribution

Eclipse profile options: e439 (2026-03), e440 (2026-06).

VSCode Extensions (npm)

Each extension is built independently. The Spring Boot extension build also compiles the language server:

cd vscode-extensions/vscode-spring-boot
./scripts/preinstall.sh    # First-time: builds commons-vscode and the language server JAR
npm install
npm run compile            # Compile TypeScript
npm run watch              # Watch mode
npm run lint               # ESLint
npm run vsce-package       # Package as .vsix
npm run vsce-pre-release-package

preinstall.sh packs commons-vscode locally, then builds the Spring Boot language server fat JAR and extracts it into language-server/.

Agent Plugin

The agent-plugins/spring-tools plugin uses the standalone language server (no JDT LS, uses Jandex for type indexing):

cd agent-plugins
./update-local-jars.sh    # Rebuild and copy the standalone LS JAR into the plugin

The same plugin source serves every host: plugin.json and mcp.json for Claude Code, com.github.copilot/ for GitHub Copilot, opencode/ for OpenCode, and .agents/plugins/marketplace.json as the Codex catalog pointing to it (not a second implementation). Plugin JavaScript uses four-space indentation; plugin tests use Node's node:test with *.test.mjs filenames.

Every diagnostic code needs a playbook agent-plugins/spring-tools/explanations/<CODE>.md and a row in agent-plugins/research-notes/TODO_quickfixes.md. Every MCP tool (boot/mcp/*Tools.java) must be reachable through a skill or hook and have a behavioral eval with a mock. When adding or renaming a problem type or an MCP tool, run from the repository root (details in agent-plugins/spring-tools/README.md):

node agent-plugins/tools/check-explanations.mjs --require-all --todo --links
node agent-plugins/tools/check-plugin-config.mjs
npm --prefix agent-plugins/tools test

After changing launcher.js, install.js, hooks/hooks.json or the standalone LS, run the end-to-end MCP smoke test (needs the rebuilt JAR from update-local-jars.sh and Java 21+): node agent-plugins/tools/smoke/mcp-smoke.mjs.

Running Tests

# Java: all tests
cd headless-services && ./mvnw test

# Java: single test class
./mvnw test -pl spring-boot-language-server -Dtest=BootLanguageServerTest

# Java: single test method
./mvnw test -pl spring-boot-language-server -Dtest=BootLanguageServerTest#myTestMethod

# VSCode extension tests
cd vscode-extensions/vscode-spring-boot && npm test

Debugging: Connect Local Language Server to IDE

The language server can be started standalone (port 5007) and connected to from either VSCode or Eclipse:

Start standalone server:

cd headless-services
./mvnw clean install -DskipTests -pl spring-boot-language-server -am
java -Dlanguageserver.standalone=true -jar spring-boot-language-server/target/*-exec.jar

Connect VSCode extension:

  1. cd vscode-extensions/vscode-spring-boot && ./scripts/preinstall.sh && npm install
  2. Open in VSCode: code .
  3. In lib/Main.ts, set CONNECT_TO_LS: true
  4. Press F5 to launch the extension workbench — it connects to port 5007

Connect Eclipse runtime:

  • Import eclipse-language-servers projects into Eclipse workspace
  • Run Eclipse runtime workbench with VM arg: -Dboot-java-ls-port=5007

Architecture

Language Server Protocol Flow

IDE Client (VSCode/Eclipse) ←—LSP over stdio/socket—→ Java Language Server Process
  • The full Spring Boot LS (spring-boot-language-server) requires JDT Language Server in the same process for Java type resolution
  • The standalone variant (spring-boot-language-server-standalone) resolves types via Maven/Gradle classpath + Jandex indexing — used by the agent plugin
  • In the plugin the LSP transport is disabled (-Dlanguageserver.enabled=false), so no document is ever "open": the getProjectDiagnostics MCP tool only sees what the indexers produce — Java diagnostics from SpringIndexerJava, config-file diagnostics (application*, bootstrap*, *.factories) from SpringIndexerConfigFiles, plus the build-file version validation

Key Commons Modules

Module Purpose
commons-language-server Base LSP server infrastructure
commons-java Java AST parsing and analysis
commons-rewrite OpenRewrite recipe integration (quickfixes)
commons-maven / commons-gradle Project model analysis
commons-yaml YAML parsing (shared across YAML-based language servers)
language-server-test-harness Testing utilities for LSP servers
jpql JPQL query validation

Code Transformations (OpenRewrite)

Quick fixes that transform Java source code are implemented as OpenRewrite recipes in headless-services/commons/commons-rewrite. Tests live in commons-rewrite-test. The overall goal is to move from OpenRewrite recipes to JDT-based refactoring implementation, so new recipes or refactorings should be implemented using JDT.

Coding Guidelines

  • whenever you change a file, make sure the current year is mentioned in the copyright statement at the top of each source file.

CI/CD Workflows

GitHub Actions workflows in .github/workflows/:

  • snapshot-all.yml — Main nightly build: language servers, Eclipse plugins, Eclipse distributions, all VSCode extensions
  • multiplatform-ls-build.yml — Reusable: builds headless-services on Linux/macOS/Windows
  • eclipse-ls-extensions-build.yml — Reusable: builds Eclipse language server plugins with Tycho
  • build-vscode-extension.yml / snapshot-vscode-extension.yml — Individual VSCode extension builds
  • release-standalone-ls.yml — Publishes standalone LS to CDN (cdn.spring.io/spring-tools)

Version numbers:

  • headless-services: X.Y.Z-SNAPSHOT (commons parent POM)
  • eclipse-language-servers / eclipse-distribution: X.Y.Z-SNAPSHOT
  • VSCode extensions: X.Y.Z (in package.json)

Contribution Notes

  • License: Eclipse Public License v1.0 — add EPL header to all new Java files (see java-copyright-header.txt)
  • DCO: Commits must include Signed-off-by trailer (no CLA required)
  • HTTPS enforcement: Run ./nohttp.sh to verify all URLs in source use HTTPS
  • Commit messages: Reference issues as GH-XXXX; add @author tag to new Java classes; create a one-line commit message (not a long description) and do not include co-authored or signed-off tags