@percepta/create 3.1.2 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/dist/{chunk-CG7IJSB4.js → chunk-CO3YWUD6.js} +2 -2
- package/dist/{chunk-WMJT7CB5.js → chunk-V5EJIUBJ.js} +5 -2
- package/dist/index.js +21 -53
- package/dist/{init-XDWSYHYK.js → init-EQZ2TCSJ.js} +2 -2
- package/dist/{status-BTHGN6QH.js → status-QW5TQDYY.js} +1 -1
- package/dist/{sync-3Q27L7XZ.js → sync-RLBZDOFB.js} +1 -1
- package/dist/{upstream-C5KFAHVR.js → upstream-TQFVPMEG.js} +1 -1
- package/package.json +1 -1
- package/templates/monorepo/.dockerignore +18 -0
- package/templates/webapp/.github/workflows/__APP_NAME__-ryvn-release.yaml +6 -2
- package/templates/webapp/.github/workflows/__APP_NAME__-terraform-ryvn-release.yaml +98 -0
- package/templates/webapp/AGENTS.md +18 -6
- package/templates/webapp/Dockerfile +16 -7
- package/templates/webapp/README.md +65 -3
- package/templates/webapp/agent-skills/database.md +5 -1
- package/templates/webapp/agent-skills/deploy.md +49 -64
- package/templates/webapp/agent-skills/inngest.md +17 -12
- package/templates/webapp/agent-skills/langfuse.md +15 -14
- package/templates/webapp/agent-skills/llm.md +59 -0
- package/templates/webapp/agent-skills/oneshot.md +15 -2
- package/templates/webapp/agent-skills/ryvn.md +1 -1
- package/templates/webapp/deploy/README.md +34 -33
- package/templates/webapp/deploy/ryvn/__APP_NAME__-terraform.service.yaml +10 -0
- package/templates/webapp/deploy/ryvn/__APP_NAME__.service.yaml +2 -2
- package/templates/webapp/deploy/ryvn/environments/percepta-test/installations/__APP_NAME__-terraform.env.percepta-test.serviceinstallation.yaml +11 -0
- package/templates/webapp/deploy/ryvn/environments/percepta-test/installations/__APP_NAME__.env.percepta-test.serviceinstallation.yaml +45 -9
- package/templates/webapp/env.example.template +20 -2
- package/templates/webapp/eslint.config.mjs +6 -0
- package/templates/webapp/next.config.ts +9 -0
- package/templates/webapp/package.json.template +8 -4
- package/templates/webapp/scripts/deploy-percepta-test.ts +1112 -0
- package/templates/webapp/scripts/generate-migrations.ts +28 -0
- package/templates/webapp/scripts/migrate.ts +3 -0
- package/templates/webapp/scripts/open-ryvn-deploy-pr.ts +5 -3
- package/templates/webapp/scripts/with-local-env.ts +75 -0
- package/templates/webapp/src/config/getEnvConfig.ts +14 -0
- package/templates/webapp/src/drizzle/__tests__/migrationSql.test.ts +24 -0
- package/templates/webapp/src/drizzle/migrationSql.ts +8 -0
- package/templates/webapp/src/instrumentation.ts +102 -10
- package/templates/webapp/src/services/inngest/AppWorkflowService.ts +19 -0
- package/templates/webapp/src/services/inngest/__tests__/AppWorkflowService.test.ts +19 -0
- package/templates/webapp/src/services/inngest/events/AppEvents.ts +7 -13
- package/templates/webapp/src/services/inngest/events/payloads/ExampleEventPayload.ts +1 -3
- package/templates/webapp/src/services/llm/LLMService.ts +88 -0
- package/templates/webapp/src/services/llm/LlmProviderService.ts +85 -0
- package/templates/webapp/terraform/schema/main.tf +4 -0
- package/templates/webapp/terraform/schema/outputs.tf +9 -0
- package/templates/webapp/terraform/schema/variables.tf +19 -0
- package/templates/webapp/terraform/schema/versions.tf +38 -0
- package/templates/webapp/.github/workflows/__APP_NAME__-terraform.yml +0 -28
|
@@ -1,65 +1,66 @@
|
|
|
1
1
|
# Deploy
|
|
2
2
|
|
|
3
|
-
This directory holds infrastructure-as-code for deploying __APP_TITLE__ to Percepta environments.
|
|
3
|
+
This directory holds Ryvn infrastructure-as-code for deploying __APP_TITLE__ to Percepta environments.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
deploy/
|
|
7
7
|
└── ryvn/
|
|
8
|
-
├── __APP_NAME__.service.yaml
|
|
8
|
+
├── __APP_NAME__.service.yaml
|
|
9
|
+
├── __APP_NAME__-terraform.service.yaml
|
|
9
10
|
└── environments/
|
|
10
11
|
└── percepta-test/
|
|
11
12
|
└── installations/
|
|
12
|
-
|
|
13
|
+
├── __APP_NAME__.env.percepta-test.serviceinstallation.yaml
|
|
14
|
+
└── __APP_NAME__-terraform.env.percepta-test.serviceinstallation.yaml
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
These files
|
|
17
|
+
These files deploy to `https://__APP_NAME__.percepta-test.aitco.dev`.
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Tell Claude "deploy this app to percepta-test" — it'll follow [`agent-skills/deploy.md`](../agent-skills/deploy.md), which runs the generated PR helper and then verifies Ryvn.
|
|
19
|
+
The default deploy helper performs the existing-environment deploy motion: it assumes the target Ryvn environment already has the shared platform services installed, then wires this app into them. For `percepta-test`, that means shared Postgres, Inngest, the OTEL collector, the LGTM stack, and Langfuse must already exist before app deploy starts. Fresh-environment platform bootstrap is a separate motion and should be handled by a Ryvn blueprint or environment-specific platform rollout.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
The helper talks directly to Ryvn: it preflights the existing platform services, creates/updates the services, runs the GitHub Actions release workflows, creates the schema installation, approves the schema Terraform plan, creates or updates app-scoped Ryvn secrets, creates the web installation, waits for health, and verifies the health and app routes.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Deploying
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Tell Claude "deploy this app to percepta-test" or run:
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
```bash
|
|
28
|
+
pnpm deploy:percepta-test -- --yes
|
|
29
|
+
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
The helper expects a clean, committed git worktree because GitHub Actions builds from the pushed repo. It can create `Percepta-Core/__REPO_NAME__` if it does not exist yet, and it pushes the current branch to `main` before triggering releases.
|
|
32
32
|
|
|
33
|
-
##
|
|
33
|
+
## What's in these files
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
**`__APP_NAME__.service.yaml`** — Ryvn server service for the web app. It points at `Percepta-Core/__REPO_NAME__` and builds from `packages/__APP_NAME__/`.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
**`__APP_NAME__-terraform.service.yaml`** — Ryvn Terraform service that owns the per-app Postgres schema in the shared `demos` database.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
pnpm deploy:percepta-test -- --phase service --yes
|
|
41
|
-
```
|
|
39
|
+
**`__APP_NAME__.env.percepta-test.serviceinstallation.yaml`** — web app installation for `percepta-test`. It wires the shared platform services, ingress, health probes, database connection, Inngest, OTEL/LGTM telemetry, the Langfuse base URL, and the shared demo variable group.
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
**`__APP_NAME__-terraform.env.percepta-test.serviceinstallation.yaml`** — schema installation for `percepta-test`.
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
**`percepta-test.secrets.env`** — generated locally and ignored by git. The deploy helper injects app-specific auth/encryption secrets into the Ryvn installation create manifest so the first pod starts with auth configured; shared Langfuse and LLM demo keys are inherited from a Ryvn variable group.
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
## Platform Wiring
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
pnpm deploy:percepta-test -- --phase installation --yes
|
|
51
|
-
```
|
|
47
|
+
`pnpm deploy:percepta-test` checks these existing `percepta-test` installations before it mutates GitHub or Ryvn app resources:
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
- `percepta-internal-terraform` for the shared Postgres instance.
|
|
50
|
+
- `inngest-test` for background jobs and function callbacks.
|
|
51
|
+
- `otel-collector` for trace, metric, and log collection.
|
|
52
|
+
- `lgtm-stack-helm` for Loki, Grafana, Tempo, and Mimir.
|
|
53
|
+
- `langfuse` for LLM tracing and eval observability.
|
|
54
|
+
- `demos-commons` variable group for shared demo configuration, including the Anthropic API key and Langfuse demo project keys.
|
|
54
55
|
|
|
55
|
-
The
|
|
56
|
+
The service installation sets `LANGFUSE_BASE_URL` to the shared `percepta-test` Langfuse URL, sets `LLM_PROVIDER=anthropic`, and attaches `demos-commons` for `ANTHROPIC_API_KEY`, `LANGFUSE_PUBLIC_KEY`, and sensitive `LANGFUSE_SECRET_KEY`. Individual demo apps do not need LLM or Langfuse keys in `percepta-test.secrets.env`.
|
|
56
57
|
|
|
57
|
-
##
|
|
58
|
+
## Notes
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
The release workflows live at the repo root under `.github/workflows/`. The web workflow uses the org-level `NPM_TOKEN` secret for private `@percepta/*` packages; do not add a repo-level token unless the org secret is unavailable.
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
For the old GitOps PR path, use `pnpm deploy:percepta-test:pr -- --phase service --yes` and then `pnpm deploy:percepta-test:pr -- --phase installation --yes`.
|
|
62
63
|
|
|
63
|
-
## Adding
|
|
64
|
+
## Adding More Environments
|
|
64
65
|
|
|
65
|
-
Copy `
|
|
66
|
+
Copy the two `percepta-test` installation manifests to `environments/<env>/installations/`, then change the `environment:`, host, and environment-specific config.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
kind: ServiceInstallation
|
|
2
|
+
metadata:
|
|
3
|
+
name: __APP_NAME__-terraform
|
|
4
|
+
spec:
|
|
5
|
+
service: __APP_NAME__-terraform
|
|
6
|
+
environment: percepta-test
|
|
7
|
+
config: |
|
|
8
|
+
aws_region: {{ .ryvn.env.state.cluster_region }}
|
|
9
|
+
database_secret_name: {{ .ryvn.installations.percepta_internal_terraform.outputs.percepta_internal_secrets_manager_secret_name }}
|
|
10
|
+
database_name: demos
|
|
11
|
+
schema_name: __APP_NAME_SNAKE__
|
|
@@ -54,8 +54,9 @@ spec:
|
|
|
54
54
|
|
|
55
55
|
env:
|
|
56
56
|
# Database — shared `demos` DB on the percepta-internal Postgres instance.
|
|
57
|
-
# Tables live under a per-app schema created by the
|
|
58
|
-
# pins the connection search_path so Drizzle
|
|
57
|
+
# Tables live under a per-app schema created by the __APP_NAME__-terraform
|
|
58
|
+
# Ryvn service. DATABASE_SCHEMA pins the connection search_path so Drizzle
|
|
59
|
+
# migrations + queries land there.
|
|
59
60
|
- name: DATABASE_HOST
|
|
60
61
|
valueFrom:
|
|
61
62
|
secretKeyRef:
|
|
@@ -93,11 +94,11 @@ spec:
|
|
|
93
94
|
value: https://__APP_NAME__.percepta-test.aitco.dev
|
|
94
95
|
- key: BETTER_AUTH_URL
|
|
95
96
|
value: https://__APP_NAME__.percepta-test.aitco.dev
|
|
96
|
-
#
|
|
97
|
-
# deploy/ryvn/percepta-test.secrets.env
|
|
98
|
-
#
|
|
97
|
+
# deploy:percepta-test injects BETTER_AUTH_SECRET and ENCRYPTION_SECRET_KEY
|
|
98
|
+
# from deploy/ryvn/percepta-test.secrets.env into the create request.
|
|
99
|
+
# Secret values are intentionally not declared here.
|
|
99
100
|
|
|
100
|
-
# Inngest (shared percepta-test
|
|
101
|
+
# Inngest (shared percepta-test platform service)
|
|
101
102
|
- key: INNGEST_BASE_URL
|
|
102
103
|
value: http://inngest.percepta-test.svc.cluster.local:8288
|
|
103
104
|
- key: INNGEST_EVENT_KEY
|
|
@@ -109,10 +110,45 @@ spec:
|
|
|
109
110
|
- key: INNGEST_SERVE_HOST
|
|
110
111
|
value: http://__APP_NAME__-web-server.percepta-test.svc.cluster.local:3000/api/inngest
|
|
111
112
|
|
|
112
|
-
#
|
|
113
|
-
|
|
113
|
+
# Observability (shared percepta-test OTEL collector + LGTM stack)
|
|
114
|
+
# Application logs are emitted to stdout and collected by the shared OTEL
|
|
115
|
+
# collector. Traces and metrics are exported over OTLP HTTP.
|
|
116
|
+
- key: OTEL_SERVICE_NAME
|
|
117
|
+
value: __APP_NAME__
|
|
118
|
+
- key: OTEL_RESOURCE_ATTRIBUTES
|
|
119
|
+
value: service.namespace=__REPO_NAME__,deployment.environment=percepta-test
|
|
120
|
+
- key: OTEL_TRACES_EXPORTER
|
|
121
|
+
value: otlp
|
|
122
|
+
- key: OTEL_METRICS_EXPORTER
|
|
123
|
+
value: otlp
|
|
124
|
+
- key: OTEL_LOGS_EXPORTER
|
|
125
|
+
value: none
|
|
126
|
+
- key: OTEL_EXPORTER_OTLP_PROTOCOL
|
|
127
|
+
value: http/protobuf
|
|
128
|
+
- key: OTEL_EXPORTER_OTLP_ENDPOINT
|
|
129
|
+
value: http://otel-collector-opentelemetry-collector.percepta-test.svc.cluster.local:4318
|
|
130
|
+
- key: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
|
|
131
|
+
value: http://otel-collector-opentelemetry-collector.percepta-test.svc.cluster.local:4318/v1/traces
|
|
132
|
+
- key: OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
|
|
114
133
|
value: http://otel-collector-opentelemetry-collector.percepta-test.svc.cluster.local:4318/v1/metrics
|
|
115
|
-
- key:
|
|
134
|
+
- key: OTEL_METRIC_EXPORT_INTERVAL
|
|
116
135
|
value: "60000"
|
|
136
|
+
- key: NEXT_PUBLIC_FARO_APP_NAME
|
|
137
|
+
value: __APP_NAME__
|
|
138
|
+
- key: NEXT_PUBLIC_FARO_APP_VERSION
|
|
139
|
+
value: "0.1.0"
|
|
140
|
+
- key: NEXT_PUBLIC_FARO_APP_ENVIRONMENT
|
|
141
|
+
value: percepta-test
|
|
117
142
|
- key: LOG_LEVEL
|
|
118
143
|
value: debug
|
|
144
|
+
|
|
145
|
+
# Langfuse (shared percepta-test platform service). Project keys come from
|
|
146
|
+
# the demos-commons Ryvn variable group below.
|
|
147
|
+
- key: LANGFUSE_BASE_URL
|
|
148
|
+
value: https://langfuse.percepta-test.aitco.dev
|
|
149
|
+
|
|
150
|
+
# LLM provider (shared demo Anthropic key comes from demos-commons).
|
|
151
|
+
- key: LLM_PROVIDER
|
|
152
|
+
value: anthropic
|
|
153
|
+
variableGroups:
|
|
154
|
+
- name: demos-commons
|
|
@@ -19,9 +19,9 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
19
19
|
ENCRYPTION_SECRET_KEY=generate-with-node-e-console-log-require-crypto-randomBytes-16-toString-hex
|
|
20
20
|
|
|
21
21
|
# Inngest (Background Jobs)
|
|
22
|
-
|
|
22
|
+
INNGEST_BASE_URL=http://localhost:8288
|
|
23
23
|
# INNGEST_SIGNING_KEY=
|
|
24
|
-
|
|
24
|
+
INNGEST_EVENT_KEY=local
|
|
25
25
|
|
|
26
26
|
# Grafana Faro (client-side observability)
|
|
27
27
|
# Leave NEXT_PUBLIC_FARO_COLLECTOR_URL empty to disable in local development.
|
|
@@ -36,6 +36,24 @@ NEXT_PUBLIC_FARO_APP_ENVIRONMENT=development
|
|
|
36
36
|
# LANGFUSE_PUBLIC_KEY=
|
|
37
37
|
# LANGFUSE_SECRET_KEY=
|
|
38
38
|
|
|
39
|
+
# LLM providers
|
|
40
|
+
# Deployed percepta-test apps inherit ANTHROPIC_API_KEY from the demos-commons
|
|
41
|
+
# Ryvn variable group. For local LLM testing, set ANTHROPIC_API_KEY once in your
|
|
42
|
+
# shell profile or ~/.config/percepta/create.env.
|
|
43
|
+
# ANTHROPIC_API_KEY=
|
|
44
|
+
# OPENAI_API_KEY=
|
|
45
|
+
# LLM_PROVIDER=anthropic
|
|
46
|
+
# LLM_MODEL=claude-sonnet-4-5-20250929
|
|
47
|
+
|
|
48
|
+
# OpenTelemetry (server-side traces and metrics)
|
|
49
|
+
# OTEL_SERVICE_NAME=__APP_NAME__
|
|
50
|
+
# OTEL_TRACES_EXPORTER=otlp
|
|
51
|
+
# OTEL_METRICS_EXPORTER=otlp
|
|
52
|
+
# OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
|
53
|
+
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
|
|
54
|
+
# OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/v1/traces
|
|
55
|
+
# OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://localhost:4318/v1/metrics
|
|
56
|
+
|
|
39
57
|
# AWS (uses default credential chain in development)
|
|
40
58
|
# AWS_REGION=us-east-1
|
|
41
59
|
# AWS_ACCESS_KEY_ID=
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
1
3
|
import type { NextConfig } from "next";
|
|
2
4
|
|
|
5
|
+
const appDir = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const monorepoRoot = path.resolve(appDir, "../..");
|
|
7
|
+
|
|
3
8
|
const nextConfig: NextConfig = {
|
|
4
9
|
// Enable standalone output for Docker:
|
|
5
10
|
output: "standalone",
|
|
11
|
+
outputFileTracingRoot: monorepoRoot,
|
|
12
|
+
turbopack: {
|
|
13
|
+
root: monorepoRoot,
|
|
14
|
+
},
|
|
6
15
|
};
|
|
7
16
|
|
|
8
17
|
export default nextConfig;
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
"node": ">=18.0.0"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"dev": "next dev --turbopack",
|
|
9
|
+
"dev": "tsx ./scripts/with-local-env.ts next dev --turbopack",
|
|
10
10
|
"build": "next build",
|
|
11
11
|
"start": "next start",
|
|
12
12
|
"lint": "eslint .",
|
|
13
13
|
"setup": "pnpm docker:up && pnpm db:setup-and-migrate && pnpm db:seed",
|
|
14
|
-
"docker:up": "docker compose up -d",
|
|
14
|
+
"docker:up": "docker compose up -d --wait",
|
|
15
15
|
"docker:down": "docker compose down",
|
|
16
|
-
"
|
|
16
|
+
"inngest:dev": "pnpm dlx inngest-cli@latest dev -u http://localhost:3000/api/inngest",
|
|
17
|
+
"db:generate": "tsx ./scripts/generate-migrations.ts",
|
|
17
18
|
"db:migrate": "tsx ./scripts/migrate.ts",
|
|
18
19
|
"db:setup": "tsx ./scripts/setup-database.ts",
|
|
19
20
|
"db:setup-and-migrate": "pnpm db:setup && pnpm db:migrate",
|
|
@@ -21,11 +22,13 @@
|
|
|
21
22
|
"db:studio": "drizzle-kit studio",
|
|
22
23
|
"db:create-user": "tsx ./scripts/create-user.ts",
|
|
23
24
|
"db:seed": "tsx ./scripts/seed.ts",
|
|
24
|
-
"deploy:percepta-test": "tsx ./scripts/
|
|
25
|
+
"deploy:percepta-test": "tsx ./scripts/deploy-percepta-test.ts",
|
|
26
|
+
"deploy:percepta-test:pr": "tsx ./scripts/open-ryvn-deploy-pr.ts",
|
|
25
27
|
"test": "vitest run",
|
|
26
28
|
"test:watch": "vitest"
|
|
27
29
|
},
|
|
28
30
|
"dependencies": {
|
|
31
|
+
"@ai-sdk/anthropic": "^2.0.23",
|
|
29
32
|
"@ai-sdk/openai": "^2.0.23",
|
|
30
33
|
"@aws-sdk/client-s3": "^3.888.0",
|
|
31
34
|
"@aws-sdk/client-secrets-manager": "^3.914.0",
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
"@next/env": "^15.3.5",
|
|
48
51
|
"@opentelemetry/api": "^1.9.0",
|
|
49
52
|
"@opentelemetry/auto-instrumentations-node": "^0.62.1",
|
|
53
|
+
"@opentelemetry/exporter-trace-otlp-proto": "^0.203.0",
|
|
50
54
|
"@opentelemetry/sdk-node": "^0.203.0",
|
|
51
55
|
"@percepta/design": "0.3.2",
|
|
52
56
|
"@percepta/logger": "0.0.6",
|