Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f1c0eb5
init prisma migration
kattsushi Mar 18, 2026
c0d63b3
feat: update dependencies and improve TypeScript configuration
kattsushi Mar 21, 2026
9284585
Refactor RenderService and update template schemas
kattsushi Mar 21, 2026
c1dc005
sync engram memories
kattsushi Mar 21, 2026
78df127
fix: update PrismaClient usage and adjust TypeScript types in schema …
kattsushi Mar 22, 2026
1ad3b61
fix: update pnpm workspace configuration and dependencies
kattsushi Mar 22, 2026
8fdb723
feat: integrate Prisma with the React Router example and update schema
kattsushi Mar 22, 2026
16665d9
feat: add PrismaBetterSqlite3 adapter and enhance auth guard integrat…
kattsushi Mar 22, 2026
4f5fa26
sync engram memories
kattsushi Mar 22, 2026
3d20611
chore: update database file with latest changes
kattsushi Mar 22, 2026
c8e42a9
feat: add release workflow for alpha version and update README for al…
kattsushi Mar 22, 2026
11c0fc8
fix: update import paths and adjust TypeScript configurations
kattsushi Mar 23, 2026
cc2fea6
fix: clean up formatting in GeneratorContext class definition
kattsushi Mar 23, 2026
d9dad35
fix ci
kattsushi Mar 23, 2026
7a9706c
fix: conditional postinstall for prisma binary permissions
kattsushi Mar 23, 2026
b2cafe3
fix: add rootDir for tsgo compatibility in chat-domain
kattsushi Mar 23, 2026
f6d5846
fix: add prisma:generate target and update build dependencies
kattsushi Mar 23, 2026
ffb0479
fix: update prisma:generate script to use direct command
kattsushi Mar 23, 2026
144b051
fix: update effect generator provider to use npx for better compatibi…
kattsushi Mar 23, 2026
3f93fb0
fix: update effect generator provider to use pnpm for better compatib…
kattsushi Mar 23, 2026
52dc8ec
fix: remove unused prisma:generate script from package.json
kattsushi Mar 23, 2026
f236e95
fix: update prisma:generate script and correct effect generator provider
kattsushi Mar 23, 2026
f1918c7
fix: remove prisma:generate target from project.json
kattsushi Mar 23, 2026
52356a4
fix: update effect generator provider to use correct package name
kattsushi Mar 23, 2026
f5c79fc
fix: update effect generator provider to use correct execution command
kattsushi Mar 23, 2026
6b67797
fix: update AuthLayer initialization to use AuthServiceContext
kattsushi Mar 23, 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
195 changes: 195 additions & 0 deletions .agent/skills/effect-pattern-discovery/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
---
name: effect-pattern-discovery
description: >
Effect-TS patterns sourced from effect-smol reference implementation.
Trigger: When implementing Effect, Layer, Schema, Pipe, Context, or error handling patterns.
license: Apache-2.0
metadata:
author: gentleman-programming
version: "1.0"
---

## When to Use

- Implementing Effect-based services or layers
- Creating structured errors with Data.TaggedError or Schema.ErrorClass
- Building pipeable modules with dual functions
- Defining Context/Service patterns with Context.Tag
- Composing Layers with provide/merge

## Critical Patterns

### ❌ FORBIDDEN: try-catch in Effect.gen

```typescript
// ❌ WRONG - Breaks Effect semantics
Effect.gen(function*() {
try {
return yield* someEffect
} catch (error) {
// Never reached!
}
})

// ✅ CORRECT - Use Effect.result or Effect.catchTag
Effect.gen(function*() {
const result = yield* Effect.result(someEffect)
if (result._tag === "Failure") {
return yield* Effect.fail(handleError(result.cause))
}
return result.value
})
```

### ❌ FORBIDDEN: Type Assertions

```typescript
// ❌ FORBIDDEN - These break type safety
const value = something as any
const value = something as never

// ✅ CORRECT - Use proper Effect constructors
const safeValue = Effect.try(() => JSON.parse(jsonString))
```

### ✅ MANDATORY: return yield\* for Terminal Effects

```typescript
Effect.gen(function*() {
if (invalidCondition) {
return yield* Effect.fail("Error") // ✅ correct
}

if (shouldInterrupt) {
return yield* Effect.interrupt // ✅ correct
}

return result // ✅ correct
})
```

## Code Examples

### Service Definition with Context.Tag

```typescript
import { Context, Effect, Layer } from "effect"

class DatabaseService extends Context.Tag("DatabaseService")<
DatabaseService,
{
readonly query: (
sql: string,
) => Effect.Effect<unknown[], DatabaseError, never>
}
>() {}

class UserService extends Context.Tag("UserService")<
UserService,
{
readonly getUser: (id: string) => Effect.Effect<User, UserError, never>
}
>() {}

// Layer implementation
const DatabaseServiceLive = Layer.succeed(
DatabaseService,
DatabaseService.of({
query: (sql) =>
Effect.tryPromise({
try: () => db.execute(sql),
catch: (e) => new DatabaseError({ cause: e }),
}),
}),
)
```

### Structured Errors with Data.TaggedError

```typescript
import { Data, Effect } from "effect"

class ValidationError extends Data.TaggedError("ValidationError")<{
field: string
message: string
}> {}

class NetworkError extends Data.TaggedError("NetworkError")<{
status: number
url: string
cause?: unknown
}> {}

// Usage with catchTag
const program = operation().pipe(
Effect.catchTag("ValidationError", (e) => Console.log(`Invalid field: ${e.field}`)),
)
```

### Schema.ErrorClass for Serializable Errors

```typescript
import { Schema } from "effect"

class ApiError extends Schema.ErrorClass("@effectify/ApiError")({
_tag: Schema.tag("ApiError"),
code: Schema.String,
message: Schema.String,
}) {
get message() {
return `[${this.code}] ${this.message}`
}
}
```

### Effect.fn vs Effect.fnUntraced

| Function | Use Case | Tracing |
| ------------------------- | -------------------------- | ----------- |
| `Effect.fn("name")(fn)` | Public API, reusable | ✅ Yes |
| `Effect.fnUntraced(fn)` | Internal hot paths | ❌ No |
| `Effect.gen(function*())` | One-off inline composition | Uses parent |

### Dual Function Pattern

```typescript
import { dual } from "effect"

export const map = dual<
<A, B>(f: (a: A) => B) => (self: Module<A>) => Module<B>,
<A, B>(self: Module<A>, f: (a: A) => B) => Module<B>
>(2, (self, f) => /* implementation */)
```

### Layer Composition

```typescript
const AppLayer = UserServiceLive.pipe(
Layer.provide(DatabaseServiceLive),
Layer.launch,
)

// Or with merge
const CombinedLayer = Layer.merge(UserServiceLive, DatabaseServiceLive)
```

## Commands

```bash
# Scan for similar patterns in effect-smol
ls .effect-reference/packages/effect/src/

# Check internal implementations
cat .effect-reference/packages/effect/src/internal/effect.ts

# Look at module exports
cat .effect-reference/packages/effect/src/index.ts
```

## Resources

- **effect-smol source**: `.effect-reference/packages/effect/src/`
- **Pattern docs**: `.effect-reference/.patterns/`
- **Error handling**: `.effect-reference/.patterns/error-handling.md`
- **Module organization**: `.effect-reference/.patterns/module-organization.md`
- **Library development**: `.effect-reference/.patterns/effect-library-development.md`
Binary file added .engram/chunks/3775ed35.jsonl.gz
Binary file not shown.
Binary file added .engram/chunks/a266fb9e.jsonl.gz
Binary file not shown.
16 changes: 16 additions & 0 deletions .engram/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
"sessions": 9,
"memories": 20,
"prompts": 0
},
{
"id": "3775ed35",
"created_by": "andres",
"created_at": "2026-03-21T07:05:04Z",
"sessions": 30,
"memories": 21,
"prompts": 0
},
{
"id": "a266fb9e",
"created_by": "andres",
"created_at": "2026-03-22T18:01:37Z",
"sessions": 29,
"memories": 20,
"prompts": 0
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 🚀 Release Beta
name: 🚀 Release Alpha

on:
push:
Expand All @@ -13,8 +13,8 @@ env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/effectify"

jobs:
release-beta:
name: 🚀 Release Beta
release-alpha:
name: 🚀 Release Alpha
runs-on: ubuntu-latest
permissions:
contents: write # Needed for git operations
Expand Down Expand Up @@ -120,20 +120,20 @@ jobs:
pnpm nx run-many -t test --projects=${{ steps.affected.outputs.projects }} --parallel=3 --passWithNoTests || true

# Release: version bump + publish (skipped if no affected projects)
- name: 🚀 Version & Publish Beta
- name: 🚀 Version & Publish Alpha
if: ${{ steps.affected.outputs.has_projects == 'true' }}
run: |
PROJECTS="${{ steps.affected.outputs.projects }}"
echo "Releasing: $PROJECTS"

# Version bump with preid=beta → creates versions like 0.0.5-beta.0
pnpm nx release version --projects=$PROJECTS --preid=beta
# Version bump with preid=alpha → creates versions like 0.0.5-alpha.0
pnpm nx release version --projects=$PROJECTS --preid=alpha

# Rebuild with new versions (version bump updates package.json)
pnpm nx run-many -t build --projects=$PROJECTS --parallel=3

# Publish to npm with beta tag
pnpm nx release publish --projects=$PROJECTS --tag=beta
# Publish to npm with alpha tag
pnpm nx release publish --projects=$PROJECTS --tag=alpha

# Push git tags and version commits
git push origin HEAD --follow-tags
Expand All @@ -146,7 +146,7 @@ jobs:
- name: 📊 Release Summary
if: always()
run: |
echo "## 🚀 Beta Release Summary" >> $GITHUB_STEP_SUMMARY
echo "## 🚀 Alpha Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.affected.outputs.has_projects }}" = "true" ]; then
echo "✅ **Release Completed**" >> $GITHUB_STEP_SUMMARY
Expand All @@ -157,11 +157,11 @@ jobs:
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Detect Affected | ✅ |" >> $GITHUB_STEP_SUMMARY
echo "| Build | ✅ |" >> $GITHUB_STEP_SUMMARY
echo "| Version Bump | ✅ With preid=beta |" >> $GITHUB_STEP_SUMMARY
echo "| NPM Tag | beta |" >> $GITHUB_STEP_SUMMARY
echo "| Version Bump | ✅ With preid=alpha |" >> $GITHUB_STEP_SUMMARY
echo "| NPM Tag | alpha |" >> $GITHUB_STEP_SUMMARY
echo "| Provenance | ✅ Enabled |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📦 Packages published with \"@beta\" dist-tag and semver prerelease versions (x.x.x-beta.x)." >> $GITHUB_STEP_SUMMARY
echo "📦 Packages published with \"@alpha\" dist-tag and semver prerelease versions (x.x.x-alpha.x)." >> $GITHUB_STEP_SUMMARY
else
echo "⏭️ **Skipped - No affected projects**" >> $GITHUB_STEP_SUMMARY
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ node_modules
# misc
/.sass-cache
/connect.lock
/coverage
coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
Expand Down
1 change: 1 addition & 0 deletions .nxignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.effect-reference/
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@
"files.readonlyInclude": {
"**/routeTree.gen.ts": true
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "dprint.dprint",
"[javascript][typescript][javascriptreact][typescriptreact][json][jsonc][css][graphql]": {
"editor.defaultFormatter": "dprint.dprint"
},
"editor.formatOnPaste": true,
"emmet.showExpandedAbbreviation": "never"
"emmet.showExpandedAbbreviation": "never",
"typescript.experimental.useTsgo": true,
"typescript.native-preview.tsdk": "node_modules/@typescript/native-preview"
}
10 changes: 10 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ If the user wants help with fixing an error in their CI pipeline, use the follow
- Make sure that the problem is fixed by running the task that you passed into the `nx_cloud_fix_cipe_failure` tool

<!-- nx configuration end-->

## Effect-TS Pattern Discovery

This project uses effect-smol as the canonical source for Effect patterns.

| Skill | Description | Location |
| -------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------- |
| `effect-pattern-discovery` | Effect-TS patterns from effect-smol | [.agent/skills/effect-pattern-discovery](.agent/skills/effect-pattern-discovery/SKILL.md) |

**Reference Directory**: `.effect-reference/` contains the effect-smol source code mounted as a git worktree.
Loading
Loading