# Hamelin

A pipe-based query language for security event analytics. Yay!

## Installation

```toml
[dependencies]
hamelin = "0.3"
```

## Features

- `trino` - Trino backend support

## Documentation

- [Documentation](https://hamelin.sh/docs/introduction)
- [Homepage](https://hamelin.sh)

## Adding a New Crate

When adding a new publishable crate to the workspace:

1. **Add required metadata** to the crate's `Cargo.toml`:
   ```toml
   [package]
   name = "hamelin_newcrate"
   description = "Description of the crate"
   version.workspace = true
   edition.workspace = true
   readme.workspace = true
   repository.workspace = true
   homepage.workspace = true
   documentation.workspace = true
   license-file.workspace = true
   ```

2. **Publish an initial version** below the current workspace version. For example, if the workspace is at `0.3.9`, publish `0.3.8`:
   ```bash
   # Temporarily set version to 0.3.8 in root Cargo.toml, then:
   cargo publish -p hamelin_newcrate --allow-dirty
   # Revert the version change after publishing
   ```

3. **Configure trusted publishing** on crates.io:
   - Go to the crate's settings page on crates.io
   - Click "Add" under Trusted Publishing
   - Configure with:
     - Repository: `perpetualsystems/hamelin`
     - Workflow: `hamelin-release.yaml`
     - Environment: `release`
   - Enable "Require trusted publishing for all new versions"

   ![Trusted Publishing Configuration](docs/images/trusted-publishing.png)

4. **Add to workspace** in root `Cargo.toml`:
   - Add to `members` list
   - Add to `[workspace.dependencies]` with the current workspace version

The CI will verify that all publishable crates exist on crates.io before allowing PRs to merge.

## Releasing a New Version

To cut a new release of Hamelin:

1. **Update the Cargo version** - Update the version in the root [`Cargo.toml`](Cargo.toml) under `[workspace.package]`, along with each `[workspace.dependencies]`
2. **Update the pnpm version** - Update the version in the root [`package.json`](package.json)
3. **Sync pnpm package versions** - Run `pnpm version:sync` to update all `@hamelin.sh/*` package versions
4. **Merge to main** - Create a PR and merge to main to trigger the release workflows
