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
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ scaffold.

## Where things stand

Phase 3 lands `@pegma/flags-launchdarkly` beside the Phase 1 packages
and `@pegma/flags-azure-appconfig` at `0.1.0` (unpublished). Remaining
vendor adapters (AWS AppConfig, Cloudflare Flagship, flagd) are still
later.
Phase 3 lands `@pegma/flags-launchdarkly` and
`@pegma/flags-aws-appconfig` beside the Phase 1 packages and
`@pegma/flags-azure-appconfig` at `0.1.0` (unpublished). Remaining
vendor adapters (Cloudflare Flagship, flagd) are still later.

Siblings: [spine](https://github.com/pegma-dev/spine),
[health](https://github.com/pegma-dev/health),
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ const detail = await client.evaluate("checkoutEnabled", {
| `@pegma/flags-core` | Schema, client, cache, timeout, health helper |
| `@pegma/flags-static` | In-memory provider for tests and local development |
| `@pegma/flags-azure-appconfig` | Azure App Configuration provider |
| `@pegma/flags-aws-appconfig` | AWS AppConfig provider |
| `@pegma/flags-launchdarkly` | LaunchDarkly provider |

Remaining vendor adapters (AWS AppConfig, Cloudflare Flagship, flagd)
are named in [the plan](docs/PROJECT_PLAN.md) and stay later.
Remaining vendor adapters (Cloudflare Flagship, flagd) are named in
[the plan](docs/PROJECT_PLAN.md) and stay later.

## Development

Expand Down
29 changes: 15 additions & 14 deletions docs/PROJECT_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

## Status

**Stage:** Phase 3 LaunchDarkly adapter implemented in-tree; unpublished.
Public API unstable (`0.x`).
**Stage:** Phase 3 LaunchDarkly and AWS AppConfig adapters implemented
in-tree; unpublished. Public API unstable (`0.x`).

**First named consumers:** RetireGolden.org (Azure App Configuration).
Remaining vendor adapters (AWS AppConfig, Cloudflare Flagship, flagd)
are still later.
Remaining vendor adapters (Cloudflare Flagship, flagd) are still later.

**License:** MIT

Expand Down Expand Up @@ -105,8 +104,7 @@ package here would invite the wrong extractions.

- Flag authoring, admin UI, or a Pegma-owned flag store.
- A custom expression / rule language or AppConfig document evaluator.
- AWS AppConfig, Cloudflare Flagship, or flagd adapter packages in this
phase.
- Cloudflare Flagship or flagd adapter packages in this phase.
- Metrics, experiment assignment, or percentage math in the core.

## Package architecture
Expand All @@ -118,14 +116,15 @@ package here would invite the wrong extractions.
| `@pegma/flags-static` | Zero-dep in-memory provider | 1 |
| `@pegma/flags-launchdarkly` | LaunchDarkly adapter | 3 |
| `@pegma/flags-azure-appconfig` | Azure App Configuration adapter | 2 |
| `@pegma/flags-aws-appconfig` | AWS AppConfig adapter | later |
| `@pegma/flags-aws-appconfig` | AWS AppConfig adapter | 3 |
| `@pegma/flags-cloudflare-flagship` | Cloudflare Flagship adapter | later |
| `@pegma/flags-flagd` | flagd / OpenFeature adapter | later |

Dependencies: `@pegma/spine` pinned exactly. `@pegma/flags-static`,
`@pegma/flags-azure-appconfig`, and `@pegma/flags-launchdarkly` depend
only on `@pegma/flags-contracts` (no vendor SDK). Adapters pin contracts
(and spine, if they need `Logger` / `Clock`) exactly.
`@pegma/flags-azure-appconfig`, `@pegma/flags-aws-appconfig`, and
`@pegma/flags-launchdarkly` depend only on `@pegma/flags-contracts` (no
vendor SDK). Adapters pin contracts (and spine, if they need `Logger` /
`Clock`) exactly.

## Delivery phases

Expand All @@ -147,10 +146,12 @@ still carries those rules. Do not pre-build the other vendors.

### Phase 3 — remaining adapters

`@pegma/flags-launchdarkly` is in-tree. It translates an injected
LaunchDarkly `variationDetail` result and must pass the Phase 1
conformance suite. It does not import the LaunchDarkly SDK or evaluate
targeting rules. AWS AppConfig, Cloudflare Flagship, and flagd remain
`@pegma/flags-launchdarkly` and `@pegma/flags-aws-appconfig` are
in-tree. Each translates an injected reader result and must pass the
Phase 1 conformance suite. Neither imports a vendor SDK nor evaluates
targeting rules. The AWS adapter maps an already-evaluated value or an
unconditional feature-flag setting and rejects an enabled document that
still carries multi-variant rules. Cloudflare Flagship and flagd remain
later, each as its own package.

### Phase 4 — publish
Expand Down
7 changes: 4 additions & 3 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release operations

`@pegma/flags-contracts`, `@pegma/flags-core`, `@pegma/flags-static`,
`@pegma/flags-azure-appconfig`, and `@pegma/flags-launchdarkly` publish
`@pegma/flags-azure-appconfig`, `@pegma/flags-aws-appconfig`, and
`@pegma/flags-launchdarkly` publish
only from a stable GitHub release. Merging a pull request never
publishes, and the workflow has no manual-dispatch or npm-token
fallback. Phase 3 does not publish; this runbook exists so the first
Expand All @@ -12,8 +13,8 @@ release does not invent a lane.
Before the first release through this workflow:

- configure `@pegma/flags-contracts`, `@pegma/flags-core`,
`@pegma/flags-static`, `@pegma/flags-azure-appconfig`, and
`@pegma/flags-launchdarkly` on npm with
`@pegma/flags-static`, `@pegma/flags-azure-appconfig`,
`@pegma/flags-aws-appconfig`, and `@pegma/flags-launchdarkly` on npm with
the GitHub Actions trusted publisher
`pegma-dev/flags-core`, workflow `publish.yml`, environment
`npm-publish`, and allowed action `npm publish`;
Expand Down
21 changes: 21 additions & 0 deletions packages/flags-aws-appconfig/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 RetireGolden, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
68 changes: 68 additions & 0 deletions packages/flags-aws-appconfig/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# `@pegma/flags-aws-appconfig`

AWS AppConfig `FlagProvider` for Pegma hosts.

> [!IMPORTANT]
> Pegma is in early `0.x` development. This package's public API is unstable.

The host constructs and injects an AppConfig reader. This package never
imports the AWS SDK, never owns a client singleton, and does not evaluate
multi-variant rules or percentage splits. It translates an already-evaluated
value — or a setting this package can map without becoming a second targeting
engine — into a `FlagResolution`.

Prefer a reader that returns a value AppConfig already evaluated (the
AppConfig Agent `?flag=` response, or `GetLatestConfiguration` after the
host applied context). This package can also map:

- ordinary typed values (string as-is; boolean, number, and json via JSON)
- a feature-flag document marked `type: AWS.AppConfig.FeatureFlags`, or
one that carries AWS `_variants` metadata
- a stored default variant that has no `rule`

A JSON object that happens to include `enabled` is a payload, not a
feature-flag document. Set `type: AWS.AppConfig.FeatureFlags` when the
reader returns AppConfig feature-flag data or a retrieved flag map. An
enabled document that still carries `_variants` with a `rule` is
rejected. Wrap AppConfig evaluation in the injected reader if the host
needs those rules.

```ts
import {
AWS_APPCONFIG_FEATURE_FLAGS_TYPE,
awsAppConfigFlagValue,
createAwsAppConfigFlagProvider,
} from "@pegma/flags-aws-appconfig";
import { createFlagsClient, declareFlags, flag } from "@pegma/flags-core";
import type { Logger } from "@pegma/spine";

const schema = declareFlags({
checkoutEnabled: flag.boolean({ defaultValue: false }),
});

const logger: Logger = {
log(level, message, fields) {
console.log(level, message, fields);
},
};

const provider = createAwsAppConfigFlagProvider({
reader: {
async getConfiguration({ key }) {
const document = await appConfig.getLatestConfiguration();
const value = awsAppConfigFlagValue(document, key);
if (value === undefined) {
return undefined;
}
return { key, value, type: AWS_APPCONFIG_FEATURE_FLAGS_TYPE };
},
},
});

const client = createFlagsClient({ schema, logger, provider });
```

Import `awsAppConfigFlagValue` when the host fetched a whole
`AWS.AppConfig.FeatureFlags` document or a retrieved flag map and needs
the stored object for one key. A missing key is `DEFAULT_FALLBACK`. A
feature flag with `enabled: false` is `DISABLED`.
39 changes: 39 additions & 0 deletions packages/flags-aws-appconfig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@pegma/flags-aws-appconfig",
"version": "0.1.0",
"description": "AWS AppConfig FlagProvider for Pegma hosts.",
"license": "MIT",
"type": "module",
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"files": [
"dist/**/*.d.ts",
"dist/**/*.d.ts.map",
"dist/**/*.js",
"dist/**/*.js.map"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"engines": {
"node": ">=22"
},
"repository": {
"type": "git",
"url": "git+https://github.com/pegma-dev/flags-core.git",
"directory": "packages/flags-aws-appconfig"
},
"dependencies": {
"@pegma/flags-contracts": "0.1.0"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"prepack": "pnpm run build"
}
}
Loading
Loading