Skip to content
Merged
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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @roostorg/coop-integration-example

Example [COOP](https://github.com/roostorg/coop) integration plugin. Reference repository showing how to build a custom integration and signals for use in COOP.
Example [Coop](https://github.com/roostorg/coop) integration plugin. Reference repository showing how to build a custom integration and signals for use in Coop.

- **Integration config** – saving and loading per-org config (e.g. “True percentage”)
- **Routing rules** – using the plugin signal in conditions
Expand Down Expand Up @@ -29,12 +29,12 @@ npm run build
npm install @roostorg/coop-integration-example
```

## Configure in COOP
## Configure in Coop

In your COOP `integrations.config.json` (or `INTEGRATIONS_CONFIG_PATH`), add:
In your Coop `integrations.config.json` (or `INTEGRATIONS_CONFIG_PATH`), add:

**Local path (development):**
If you cloned this repo next to your COOP server directory, use a path relative to the server (e.g. from `server/`):
If you cloned this repo next to your Coop server directory, use a path relative to the server (e.g. from `server/`):

```json
{
Expand All @@ -54,18 +54,18 @@ If you cloned this repo next to your COOP server directory, use a path relative
}
```

Restart the COOP server so it loads the plugin.
Restart the Coop server so it loads the plugin.

## Use in the app

1. **Org settings → Integrations** – you should see “COOP Integration Example”. Open it and set **True percentage (0–100)** (e.g. `70`) for Random Signal Selection. Save.
1. **Org settings → Integrations** – you should see Coop Integration Example”. Open it and set **True percentage (0–100)** (e.g. `70`) for Random Signal Selection. Save.
2. **Rules (routing or enforcement)** – when adding a condition:
- **Random Signal Selection**: Pick that signal; the condition uses your configured percentage (true/false).
- **Random Score**: Pick “Random Score”, then set a **threshold** on the 0–100 scale (e.g. `50`) and choose **above** or **below**. The rule compares the random score to your threshold.

## Contract

This package implements the COOP plugin contract from `@roostorg/types`:
This package implements the Coop plugin contract from `@roostorg/types`:

- **Default export:** `CoopIntegrationPlugin` with `manifest` and `createSignals(context)`.
- **Manifest:** `id`, `name`, `version`, `requiresConfig`, `configurationFields`, `signalTypeIds`, `modelCard` (must include every section id in `REQUIRED_MODEL_CARD_SECTION_IDS` from `@roostorg/types`; call `assertModelCardHasRequiredSections(modelCard)` when registering).
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@roostorg/coop-integration-example",
"version": "2.0.0",
"version": "2.0.1",
"description": "Example package to show how a custom integration and signal can be used in COOP this is meant to be a reference repository and provide basic determination",
"type": "module",
"main": "dist/index.js",
Expand Down
Binary file modified roost-example-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Example COOP integration plugin with two signal types:
* Example Coop integration plugin with two signal types:
* 1. Random Signal Selection – boolean, probability from org config (tests config saving).
* 2. Random Score – numeric 0–100, threshold set in the rule (tests score vs threshold).
*/
Expand All @@ -19,8 +19,8 @@ const INTEGRATION_ID = 'COOP_INTEGRATION_EXAMPLE';
const DEFAULT_TRUE_PERCENTAGE = 50;

const modelCard: ModelCard = {
modelName: 'COOP Integration Example',
version: '2.0.0',
modelName: 'Coop Integration Example',
version: '2.0.1',
releaseDate: 'March 2026',
sections: [
{
Expand Down Expand Up @@ -119,9 +119,9 @@ assertModelCardHasRequiredSections(modelCard);

const manifest: IntegrationManifest = {
id: INTEGRATION_ID,
name: 'COOP Integration Example',
name: 'Coop Integration Example',
/** Same semver as modelCard.version: this plugin’s release, not @roostorg/types. */
version: '2.0.0',
version: '2.0.1',
description:
'Example plugin with two signals: config-driven boolean and a numeric score you compare with a threshold in the rule.',
docsUrl: 'https://roostorg.github.io/coop/INTEGRATIONS_PLUGIN.html',
Expand Down
Loading