Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,13 @@ dynamodb-local-metadata*
# Claude Code configuration files
.claude/settings.local.json

/flamingock-cli-dist
/flamingock-cli-dist

# SQLite test DB files generated by tests
test_*.db
test_*.db-wal
test_*.db-shm

# Generic SQLite artifacts
*.db-wal
*.db-shm
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ This is a multi-module Gradle project using Kotlin DSL.

**Core Modules** (`core/`):
- `flamingock-core` - Core engine and orchestration logic
- `flamingock-core-api` - Public API annotations (`@Change`, `@Execution`)
- `flamingock-core-api` - Public API annotations (`@Change`, `@Apply`)
- `flamingock-core-commons` - Shared internal utilities
- `flamingock-processor` - Annotation processor for pipeline generation
- `flamingock-graalvm` - GraalVM native image support
Expand Down
14 changes: 7 additions & 7 deletions RECOVERY_EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
@Recovery(strategy = RecoveryStrategy.ALWAYS_RETRY)
public class ExampleChangeWithRetry {

@Execution
public void execute() {
@Apply
public void apply() {
// This change will be retried automatically if it fails
System.out.println("Executing change that will be retried on failure");
}

@RollbackExecution
@Rollback
public void rollback() {
System.out.println("Rolling back change");
}
Expand All @@ -25,8 +25,8 @@ public class ExampleChangeWithRetry {
@Recovery(strategy = RecoveryStrategy.MANUAL_INTERVENTION) // This is the default
public class ExampleChangeWithManualIntervention {

@Execution
public void execute() {
@Apply
public void apply() {
// This change requires manual intervention if it fails (default behavior)
System.out.println("Executing change requiring manual intervention on failure");
}
Expand All @@ -38,8 +38,8 @@ public class ExampleChangeWithManualIntervention {
// No @Recovery annotation = defaults to MANUAL_INTERVENTION
public class ExampleChangeWithDefaultRecovery {

@Execution
public void execute() {
@Apply
public void apply() {
// This change defaults to manual intervention
System.out.println("Executing change with default recovery strategy");
}
Expand Down
28 changes: 21 additions & 7 deletions cli/flamingock-cli/CLI-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ After building, `flamingock-cli-dist/` contains:
- **`flamingock-cli.jar`** - Self-contained executable JAR with all dependencies
- **`flamingock`** - Unix/Linux/macOS executable shell script
- **`flamingock.bat`** - Windows executable batch file
- **`flamingock.yml`** - Sample configuration file
- **`flamingock-cli.yml`** - Sample configuration file

## Configuration

Expand Down Expand Up @@ -115,9 +115,22 @@ flamingock:
# secret-key: "your-secret" # Optional, uses AWS credential chain
```

### Couchbase Example
```yaml
flamingock:
service-identifier: "flamingock-cli"
audit:
couchbase:
endpoint: "http://localhost:8000"
username: "your-username"
password: "your-password"
bucket-name: "test"
table: "flamingockAuditLog" # Optional, defaults to "flamingockAuditLog"
```

### Configuration File Resolution
1. Command line argument: `--config /path/to/file.yml`
2. Default: `flamingock.yml` in current directory
2. Default: `flamingock-cli.yml` in bin directory

## Architecture

Expand All @@ -144,6 +157,7 @@ client.markAsRolledBack(changeId);
### Database Support
- **MongoDB**: Uses MongoDB Sync driver (not Spring Data)
- **DynamoDB**: Uses AWS SDK v2
- **Couchbase**: Uses Couchbase driver v3.7.3
- **Auto-detection**: Based on YAML configuration structure
- **Validation**: Connection testing during client creation

Expand Down Expand Up @@ -179,12 +193,12 @@ Uses SLF4J with simple implementation for clean, professional output.
## Build System Integration

### Gradle Tasks
| Task | Description |
|------|-------------|
| `:cli:flamingock-cli:build` | Full build with distribution |
| `:cli:flamingock-cli:uberJar` | Create self-contained JAR only |
| Task | Description |
|--------------------------------------------|----------------------------------|
| `:cli:flamingock-cli:build` | Full build with distribution |
| `:cli:flamingock-cli:uberJar` | Create self-contained JAR only |
| `:cli:flamingock-cli:generateDistribution` | Generate executable scripts only |
| `:cli:flamingock-cli:clean` | Remove all CLI artifacts |
| `:cli:flamingock-cli:clean` | Remove all CLI artifacts |

### Automatic Distribution
The build process automatically:
Expand Down
34 changes: 17 additions & 17 deletions cli/flamingock-cli/CLI_SPECIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ flamingock [command] [operation] [options]

## General Principles

- The CLI is **lightweight**:
- It only builds an `OpsClient` via the `OpsClientBuilder`.
- All business logic is delegated to the `OpsClient` (or components it delegates to).
- The CLI is **lightweight**:
- It only builds an `OpsClient` via the `OpsClientBuilder`.
- All business logic is delegated to the `OpsClient` (or components it delegates to).
- The CLI only parses input, calls `OpsClient`, and formats output.
- Default behavior:
- `flamingock audit list` (with no flags) → shows the **current snapshot** (latest state per change).

- Default behavior:
- `flamingock audit list` (with no flags) → shows the **current snapshot** (latest state per change).
- Flags modify or filter the behavior.

---
Expand All @@ -31,11 +31,11 @@ flamingock audit list
```

**Options:**
- `--issues` (boolean, no value) → only audits with issues
- `--history` (boolean, no value) → full chronological audit history (all states, ordered by time)
- `--since <date>` (string, ISO-8601, e.g. `2025-01-01T00:00:00`) → list audits since a given date
- `--limit <n>` (integer) → pagination limit
- `--page <n>` (integer) → pagination page
- `--issues` (boolean, no value) → only audits with issues
- `--history` (boolean, no value) → full chronological audit history (all states, ordered by time)
- `--since <date>` (string, ISO-8601, e.g. `2025-01-01T00:00:00`) → list audits since a given date
- `--limit <n>` (integer) → pagination limit
- `--page <n>` (integer) → pagination page

**Examples:**
```bash
Expand All @@ -58,8 +58,8 @@ flamingock audit mark --change-unit <id> --state <state>
```

**Options:**
- `--change-unit <id>` / `-c <id>` → the changeId (required)
- `--state <state>` / `-s <state>` → the state to mark (`APPLIED` or `ROLLED_BACK`) (required)
- `--change-unit <id>` / `-c <id>` → the changeId (required)
- `--state <state>` / `-s <state>` → the state to mark (`APPLIED` or `ROLLED_BACK`) (required)

**Examples:**
```bash
Expand All @@ -71,7 +71,7 @@ flamingock audit mark -c CU123 -s ROLLED_BACK

## Global Options

- `--config <file>` / `-c <file>` → path to configuration file (default: `flamingock.yml`)
- `--config <file>` / `-c <file>` → path to configuration file (default: `flamingock-cli.yml`)
- `--help` / `-h` → show help information
- `--version` / `-V` → show version information

Expand All @@ -80,8 +80,8 @@ flamingock audit mark -c CU123 -s ROLLED_BACK
## Summary

- Command structure: `flamingock [command] [operation] [options]`
- For now, only the `audit` command is implemented with:
- `list` (default snapshot, optional filters `--issues`, `--history`, `--since`, pagination)
- For now, only the `audit` command is implemented with:
- `list` (default snapshot, optional filters `--issues`, `--history`, `--since`, pagination)
- `mark` (force a state for a change)
- The CLI is a thin layer: config → build OpsClient → call → format result.

Expand All @@ -93,4 +93,4 @@ flamingock audit mark -c CU123 -s ROLLED_BACK
- **History flag**: Use `--history` to get the full chronological audit history.
- **Issues flag**: Use `--issues` to filter for only entries with problems.
- **Since flag**: Use `--since` with ISO-8601 format to filter by date.
- **Pagination**: Client-side pagination is supported with `--limit` and `--page` flags.
- **Pagination**: Client-side pagination is supported with `--limit` and `--page` flags.
4 changes: 2 additions & 2 deletions cli/flamingock-cli/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ curl http://localhost:8000/shell/
**"Configuration file not found"**
```bash
# Debug: Check working directory
./gradlew :cli:flamingock-cli:debugCli --args="--config $PWD/flamingock-cli-dist/flamingock.yml audit list"
./gradlew :cli:flamingock-cli:debugCli --args="--config $PWD/flamingock-cli-dist/flamingock-cli.yml audit list"
```

**"Failed to create OpsClient"**
Expand All @@ -226,7 +226,7 @@ export JAVA_OPTS="-Dorg.mongodb.driver.level=DEBUG"
**"Multiple database configurations"**
```bash
# Validate YAML structure
cat flamingock-cli-dist/flamingock.yml | grep -A5 "audit:"
cat flamingock-cli-dist/flamingock-cli.yml | grep -A5 "audit:"
```

#### Debug Log Analysis
Expand Down
16 changes: 8 additions & 8 deletions cli/flamingock-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cd flamingock-java
```bash
# Linux/macOS
tar -xzf flamingock-cli-{version}.tar.gz

# Windows (or use any ZIP tool)
unzip flamingock-cli-{version}.zip
```
Expand All @@ -56,7 +56,7 @@ cd flamingock-java
```bash
# Linux/macOS
./flamingock-cli-{version}/bin/flamingock --help

# Windows
flamingock-cli-{version}\bin\flamingock.bat --help
```
Expand All @@ -81,18 +81,18 @@ java -jar flamingock-cli.jar --help

## Configuration

Create a `flamingock.yml` configuration file (see `flamingock-sample.yml` for reference):
Modify `flamingock-cli.yml` configuration file:

```yaml
flamingock:
service-identifier: "my-service"

# For MongoDB
audit:
mongodb:
connection-string: "mongodb://localhost:27017"
database: "myapp"

# For DynamoDB
# audit:
# dynamodb:
Expand All @@ -112,7 +112,7 @@ flamingock audit list # List all audit entries
flamingock audit get -c <change-id> # Get specific audit entry
flamingock audit fix -c <change-id> # Fix audit issue

# Issue operations
# Issue operations
flamingock issue list # List all issues
flamingock issue get # Get next issue (or specific with -c)
flamingock issue get -c <change-id> # Get specific issue
Expand Down Expand Up @@ -206,7 +206,7 @@ cli/flamingock-cli/
│ │ ├── config/ # Configuration handling
│ │ └── util/ # Utilities
│ └── dist/ # Distribution resources
│ └── flamingock-sample.yml # Sample configuration
│ └── flamingock-cli.yml # Sample configuration
└── build.gradle.kts # Build configuration
```

Expand Down Expand Up @@ -264,4 +264,4 @@ Apache License 2.0 - See [LICENSE](../../LICENSE) file for details.

- Documentation: https://docs.flamingock.io/cli
- Issues: https://github.com/flamingock/flamingock-java/issues
- Discussions: https://github.com/flamingock/flamingock-java/discussions
- Discussions: https://github.com/flamingock/flamingock-java/discussions
12 changes: 9 additions & 3 deletions cli/flamingock-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies {
// Database clients (community edition)
implementation("org.mongodb:mongodb-driver-sync:4.9.1")
implementation("software.amazon.awssdk:dynamodb:2.20.0")
implementation ("com.couchbase.client:java-client:3.7.3")

// SLF4J API - needed for interface compatibility (provided by flamingock-core)
// implementation("org.slf4j:slf4j-api:1.7.36") // Already provided by core dependencies
Expand All @@ -36,6 +37,7 @@ dependencies {
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.testcontainers:junit-jupiter:1.19.3")
testImplementation("org.testcontainers:mongodb:1.19.3")
testImplementation("org.testcontainers:couchbase:1.21.3")
testImplementation("com.github.stefanbirkner:system-lambda:1.2.1")

}
Expand Down Expand Up @@ -86,7 +88,7 @@ val distImage by tasks.registering(Sync::class) {
into("lib")
}
from("src/dist") {
into(".")
into("bin")
}
}

Expand All @@ -95,7 +97,9 @@ val distZip by tasks.registering(Zip::class) {
description = "Builds the ZIP distribution"
dependsOn(distImage)

from(distImage.get().destinationDir)
from(distImage.get().destinationDir) {
into("flamingock-cli")
}

archiveBaseName.set("flamingock-cli")
archiveVersion.set("")
Expand All @@ -109,7 +113,9 @@ val distTar by tasks.registering(Tar::class) {
description = "Builds the TAR distribution"
dependsOn(distImage)

from(distImage.get().destinationDir)
from(distImage.get().destinationDir) {
into("flamingock-cli")
}

archiveBaseName.set("flamingock-cli")
archiveVersion.set("")
Expand Down
28 changes: 28 additions & 0 deletions cli/flamingock-cli/src/dist/flamingock-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Flamingock CLI Configuration Sample
# Modify this file as needed

flamingock:
service-identifier: "flamingock-cli"
audit:

# MongoDB Configuration (comment to use other or modify to use)
mongodb:
connection-string: "mongodb://localhost:27017"
database: "test"
collection: "flamingockAuditLog" # Optional, defaults to "flamingockAuditLog"

# DynamoDB Configuration (uncomment and modify to use)
# dynamodb:
# region: "us-east-1"
# table: "flamingockAuditLog" # Optional, defaults to "flamingockAuditLog"
# # endpoint: "http://localhost:8000" # Optional for local DynamoDB
# # access-key: "your-access-key" # Optional if using IAM roles
# # secret-key: "your-secret-key" # Optional if using IAM roles

# Couchbase Configuration (uncomment and modify to use)
# couchbase:
# endpoint: "couchbase://localhost:12110"
# username: "your-username"
# password: "your-password"
# bucket-name: "test"
# table: "flamingockAuditLog" # Optional, defaults to "flamingockAuditLog"
19 changes: 0 additions & 19 deletions cli/flamingock-cli/src/dist/flamingock-sample.yml

This file was deleted.

Loading
Loading