This file provides guidelines and commands for agentic coding agents operating in this repository.
Autoflow is a monorepo containing:
- Backend: Java 17, Spring Boot, Maven multi-module project
- Frontend: Vue 3, TypeScript, Vite, Vitest
autoflow/
├── autoflow-app/ # Main Spring Boot application
├── autoflow-agent/ # Agent runtime (ReAct, streaming, memory)
├── autoflow-common/ # Common utilities
├── autoflow-core/ # Core workflow engine
├── autoflow-modules/ # Workflow modules (Flowable, LiteFlow)
├── autoflow-plugins/ # Plugin system (HTTP, SQL, LLM, etc.)
├── autoflow-spi/ # Service Provider Interface definitions
├── autoflow-fe/ # Vue 3 frontend application
└── pom.xml # Root Maven configuration
# Build entire project
mvn clean install
# Build without tests
mvn clean install -DskipTests
# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=ReActIntegrationTest
# Run specific test method
mvn test -Dtest=ToolRegistryImplTest#shouldRegisterTool
# Run tests in specific module
mvn -pl autoflow-agent test
# Run checkstyle validation only
mvn checkstyle:check
# Skip checkstyle during build
mvn clean install -Dcheckstyle.skip=true
# Package specific module
mvn -pl autoflow-app clean package
# Build with Maven profile (if defined)
mvn clean install -P<profile-name>cd autoflow-fe
# Install dependencies
npm install
# Start development server (http://localhost:5173)
npm run dev
# Production build
npm run build
# Type-check TypeScript
npm run type-check
# Lint with ESLint (auto-fix)
npm run lint
# Format with Prettier
npm run format
# Run tests (watch mode)
npm run test
# Run tests once
npm run test:run
# Run tests with coverage
npm run test:coverage
# Run single test file
npx vitest run src/stores/chat.test.ts
# Run tests matching pattern
npx vitest run --grep "modelId"Configuration:
- Checkstyle rules in
checkstyle.xml(root directory) - Max line length: 200 characters
- Max method length: 80 lines
- Max method parameters: 8
- Max nested for depth: 3
- Max nested if depth: 3
Naming Conventions:
| Element | Convention | Example |
|---|---|---|
| Package | lowercase | io.autoflow.spi.model |
| Class/Interface | PascalCase | AgentEngine, ServiceData |
| Method | camelCase | executeTool, parseArgs |
| Variable | camelCase | sessionId, toolName |
| Constant | UPPER_SNAKE_CASE | MAX_RETRIES |
| Enum values | UPPER_SNAKE_CASE | GET, POST |
Import Rules:
- No redundant imports
- No unused imports
- No
import java.lang.*(except in specific cases) - Group imports:
java.*,javax.*, third-party, internal
Class Structure (recommended order):
- Fields (public static, public instance, private)
- Constructors
- Public methods
- Private methods
- Inner classes
Error Handling:
- Use specific exception types (
ExecuteException,InputValidateException) - Never swallow exceptions silently
- Always log at appropriate level (ERROR for failures, INFO for significant events, DEBUG for details)
- Use
log.error("message", exception)for caught exceptions
Annotations:
- Use Lombok judiciously (
@Data,@Slf4j,@Service) @Overriderequired when overriding methods- Javadoc required on public classes (Chinese comments acceptable)
Code Patterns:
- Use records for simple DTOs:
public record LlmResult(String text, List<ToolExecutionRequest> requests) {} - Use
Map.of()andList.of()for immutable collections - Prefer
switchexpressions over switch statements - Use
Optionalfor nullable return values
Prettier Configuration:
{
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}ESLint Configuration:
- Extends:
plugin:vue/vue3-essential,eslint:recommended,@vue/eslint-config-typescript,@vue/eslint-config-prettier/skip-formatting - Vue 3 Composition API style
Naming Conventions:
| Element | Convention | Example |
|---|---|---|
| Variable | camelCase | chatSession, activeSession |
| Function | camelCase | createChatSession, chatSSE |
| Type/Interface | PascalCase | ChatSession, ChatSSECallbacks |
| Enum | PascalCase | ContentTypeEnum |
| Enum values | UPPER_SNAKE_CASE | GET, POST |
| File | kebab-case | chat-session.ts, use-chat.ts |
Import Organization:
- Vue/core frameworks (
vue,vue-router,pinia) - External libraries (
axios,@microsoft/fetch-event-source) - Internal aliases (
@/api,@/stores,@/hooks) - Relative imports (
./,../)
TypeScript Patterns:
- Use explicit types for function parameters and return values
- Use
anysparingly - preferunknownfor truly unknown types - Use
interfacefor object shapes,typefor unions/primitives - Use
Record<string, T>instead of{ [key: string]: T }
// Good
export interface ChatSession {
id: string
title?: string
modelId?: string
status: string
}
// Bad - using 'any' unnecessarily
function processData(data: any): any { ... }Vue 3 Composition API:
- Use
<script setup lang="ts">for new components - Use composables (hooks) for reusable logic
- Use Pinia stores for global state
- Prefer
ref/reactiveover Vue 2 options API
Error Handling:
- Always handle async errors with try/catch or
.catch() - Provide meaningful error messages
- Use optional chaining (
?.) to prevent null errors
- Location:
src/test/java/ - Naming:
*Test.javaor*IntegrationTest.java - Use JUnit 5 (
@Test,@BeforeEach,@ParameterizedTest) - Use descriptive test names:
shouldReturnEmptyListWhenNoSessions()
- Location: Same directory as source,
*.test.tsor*.spec.ts - Use
@vue/test-utilsfor Vue component testing - Mock external dependencies with
vi.mock() - Use
describe/itblocks for organization
import { describe, it, expect, vi, beforeEach } from 'vitest'
describe('chat store', () => {
beforeEach(() => {
vi.clearAllMocks()
})
it('should create session with modelId', async () => { ... })
})@/ → autoflow-fe/src/
Standard Maven/Java package structure: io.autoflow.{module}.{package}
- Create module under
autoflow-plugins/autoflow-{plugin-name}/ - Follow SPI interface in
autoflow-spi/ - Add module to
autoflow-plugins/pom.xml - Add to root
pom.xmlmodules list - Implement
Serviceinterface with@Cmpannotation
- Backend: Add controller in
autoflow-app/src/main/java/io/autoflow/app/rest/ - Service layer: Add interface in
.../service/, impl in.../service/impl/ - Frontend: Add API function in
autoflow-fe/src/api/ - Add types in
autoflow-fe/src/types/
- Backend:
mvn spring-boot:run -pl autoflow-app(from autoflow-app directory) - Frontend:
cd autoflow-fe && npm run dev
- SonarCloud:
.github/workflows/sonarcloud.yml - CodeQL:
.github/workflows/codeql.yml - Checkstyle runs during Maven
validatephase - All checks must pass before merge
- No AiServices usage in agent module (see
autoflow_agent_vibecoding.md) - All agent modules must support streaming, multi-session, tool registry
- SPI mechanism is core to extensibility - always use interfaces
- Frontend uses Arco Design Vue component library
This document provides guidance for AI agents working on the OLA Framework codebase.
OLA Framework is a multi-module Java 17 Spring Boot framework for building REST APIs with CRUD operations, security, and RBAC modules.
Modules:
ola-common- Shared utilities and HTTP response typesola-crud- Generic CRUD service and REST API infrastructureola-security- Authentication/authorization with JWTola-modules/ola-rbac- Role-based access controlola-starter- Auto-configuration startersola-server- Application entry point
/**
* CRUD基本接口
*
* @param <ENTITY> 实体类型
* @author yiuman
* @date 2023/7/25
*/
public interface BaseRESTAPI<ENTITY> {Always use the R<T> class for API responses:
// Success
return R.ok();
return R.ok(data);
// Error
return R.badRequest();
return R.badRequest("Custom message");
return R.error();
return R.error(statusCode, "Message");Use Hutool's validation utilities:
import cn.hutool.extra.validation.ValidationUtil;
// With groups for save vs update
BeanValidationResult result = ValidationUtil.warpValidate(entity, validateGroups);
Assert.isTrue(result.isSuccess(), () -> new ValidateException(...));AuthenticationException- Security/authentication failuresNoPermissionException- Authorization failuresValidateException(Hutool) - Input validation failures
- API interfaces define REST endpoints with Spring annotations
- Service interfaces define business logic contracts
- Abstract base classes provide shared implementations
- Implementation suffix:
Impl(e.g.,BaseCrudService)
src/main/java/io/ola/{module}/
├── rest/ # REST API interfaces
├── service/ # Service interfaces
│ └── impl/ # Service implementations
├── model/ # Domain models and entities
├── annotation/ # Custom annotations
├── enums/ # Enumerations
├── properties/ # Configuration properties
├── inject/ # Dependency injection helpers
├── query/ # Query building utilities
└── serializer/ # JSON serializers
Common conventions:
<ENTITY>- Domain entity type<ID extends Serializable>- Entity identifier type<T>- General purpose type parameter<DAO>- Data access object type<S>- Service type
Lombok is used extensively:
@Data- Generates getters, setters, equals, hashCode, toString@SuppressWarnings- Suppress specific warnings when needed@Retention(RetentionPolicy.RUNTIME)- For annotations