Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4f5044c
docs: add spec for data transformation CEL functions (#14)
michaelmcnees Mar 25, 2026
a07483a
docs: add implementation plan for data transformation CEL functions (…
michaelmcnees Mar 25, 2026
d1b4959
test(cel): add coverage for built-in map/filter/exists/all macros
michaelmcnees Mar 25, 2026
c1b7879
feat(cel): add toLower, toUpper, trim string functions
michaelmcnees Mar 25, 2026
a4f6744
feat(cel): add replace and split string functions
michaelmcnees Mar 25, 2026
3913d47
feat(cel): add parseInt, parseFloat, toString type coercion functions
michaelmcnees Mar 25, 2026
0e5d8e9
feat(cel): add obj() map construction function
michaelmcnees Mar 25, 2026
ccb63e5
feat(cel): add default() null coalescing and flatten() functions
michaelmcnees Mar 25, 2026
b0e4d64
feat(cel): add jsonEncode and jsonDecode functions
michaelmcnees Mar 25, 2026
a636201
feat(cel): add timestamp and formatTimestamp date/time functions
michaelmcnees Mar 25, 2026
3f42c17
docs: add custom CEL functions and macros to expressions reference (#14)
michaelmcnees Mar 25, 2026
e735241
feat: add data transformation and AI enrichment example workflows (#14)
michaelmcnees Mar 25, 2026
7085f68
docs: add data transformation patterns guide (#14)
michaelmcnees Mar 25, 2026
ee7f873
fix: address CodeRabbit review — null handling, date formats, docs, t…
michaelmcnees Mar 25, 2026
3473d2a
fix: address PR #21 review — non-strict default, jsonDecode precision…
michaelmcnees Mar 25, 2026
2d826be
fix: address PR #21 review round 3 — test coverage, trailing JSON, do…
michaelmcnees Mar 25, 2026
9a70a0e
fix: address PR #21 review round 4 — EOF trailing check, docs, plan c…
michaelmcnees Mar 25, 2026
ed5845c
fix: address PR #21 review round 5 — precision, flatten, plan accuracy
michaelmcnees Mar 25, 2026
7ca272a
fix(plan): correct test selector to TestFunc_ParseTimestamp
michaelmcnees Mar 25, 2026
2fd37e9
chore: remove force-added superpowers docs from tracking
michaelmcnees Mar 25, 2026
c4788c3
📝 CodeRabbit Chat: Add generated unit tests
coderabbitai[bot] Mar 25, 2026
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
981 changes: 0 additions & 981 deletions docs/superpowers/plans/2026-03-24-init-connection-recovery.md

This file was deleted.

174 changes: 0 additions & 174 deletions docs/superpowers/specs/2026-03-24-init-connection-recovery-design.md

This file was deleted.

65 changes: 65 additions & 0 deletions examples/ai-data-enrichment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: ai-data-enrichment
description: >
Fetches support tickets, uses an AI model to classify priority and
extract key entities, then stores the enriched data. Demonstrates
using AI for transforms that require interpretation rather than
simple structural mapping.

inputs:
ticket_api_url:
type: string
description: URL to fetch support tickets from

steps:
- name: fetch-tickets
action: http/request
timeout: "15s"
params:
method: GET
url: "{{ inputs.ticket_api_url }}"
headers:
Accept: "application/json"

- name: classify
action: ai/completion
credential: openai
timeout: "60s"
params:
model: gpt-4o
system_prompt: >
You are a support ticket classifier. Given a ticket, determine
the priority (critical, high, medium, low), category, and extract
any mentioned product names or error codes.
prompt: "Classify this ticket: {{ steps['fetch-tickets'].output.body }}"
output_schema:
type: object
properties:
priority:
type: string
enum: [critical, high, medium, low]
category:
type: string
products:
type: array
items:
type: string
error_codes:
type: array
items:
type: string
required: [priority, category, products, error_codes]
additionalProperties: false

- name: store-enriched
action: postgres/query
credential: app-db
if: "steps.classify.output.json.priority == 'critical' || steps.classify.output.json.priority == 'high'"
params:
query: >
INSERT INTO urgent_tickets (priority, category, products, raw_body)
VALUES ($1, $2, $3, $4)
args:
- "{{ steps.classify.output.json.priority }}"
- "{{ steps.classify.output.json.category }}"
- "{{ jsonEncode(steps.classify.output.json.products) }}"
- "{{ steps['fetch-tickets'].output.body }}"
25 changes: 25 additions & 0 deletions examples/data-transform-api-to-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: data-transform-api-to-db
description: >
Fetches a user from an API, transforms the record using CEL expressions
to match a database schema, and inserts the normalized data into Postgres.
Demonstrates toLower() and string functions without requiring an AI model.

steps:
- name: fetch-user
action: http/request
timeout: "15s"
params:
method: GET
url: "https://jsonplaceholder.typicode.com/users/1"
headers:
Accept: "application/json"

- name: store-user
action: postgres/query
credential: app-db
params:
query: "INSERT INTO users (username, email, city) VALUES ($1, $2, $3)"
args:
- "{{ steps['fetch-user'].output.json.username.toLower() }}"
- "{{ steps['fetch-user'].output.json.email.toLower() }}"
- "{{ steps['fetch-user'].output.json.address.city }}"
7 changes: 5 additions & 2 deletions internal/cel/cel.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ type Evaluator struct {

// NewEvaluator creates a CEL evaluator with the standard Mantle expression environment.
func NewEvaluator() (*Evaluator, error) {
env, err := cel.NewEnv(
opts := []cel.EnvOption{
cel.Variable("steps", cel.MapType(cel.StringType, cel.DynType)),
cel.Variable("inputs", cel.MapType(cel.StringType, cel.DynType)),
cel.Variable("env", cel.MapType(cel.StringType, cel.StringType)),
cel.Variable("trigger", cel.MapType(cel.StringType, cel.DynType)),
)
}
opts = append(opts, customFunctions()...)

env, err := cel.NewEnv(opts...)
if err != nil {
return nil, fmt.Errorf("creating CEL environment: %w", err)
}
Expand Down
Loading
Loading