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
2 changes: 1 addition & 1 deletion .github/workflows/register.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [main]
paths:
- 'deploy/registration/**'
- 'deploy/system-wrangler.toml'
- 'deploy/system-wrangler.jsonc'
- '.github/workflows/register.yml'
workflow_dispatch:
inputs:
Expand Down
179 changes: 179 additions & 0 deletions deploy/system-wrangler.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
// Cloudflare Workers configuration for ChittyFinance (System Mode)
// Deploys to Cloudflare Workers for ChittyOS ecosystem integration
//
// Canonical model: 3 explicit environments (dev, staging, production).
// Bindings (KV, R2, DO, tail_consumers) do NOT inherit from top-level
// into env blocks — each env must carry its own explicit bindings.
//
// Secrets (set per-env with: wrangler secret put SECRET_NAME --env <env>)
// Required:
// DATABASE_URL — Neon PostgreSQL connection string
// CHITTY_AUTH_SERVICE_TOKEN — ChittyAuth service token
// JWT_SECRET — JWT signing secret
// OAUTH_STATE_SECRET — HMAC secret for OAuth CSRF protection
// Integrations (optional):
// OPENAI_API_KEY, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET,
// WAVE_CLIENT_ID, WAVE_CLIENT_SECRET, CHITTYCONNECT_API_TOKEN
{
"name": "chittyfinance",
"main": "../server/worker.ts",
"compatibility_date": "2026-03-01",
"compatibility_flags": ["nodejs_compat"],
"account_id": "0bc21e3a5a9de1a4cc843be9c3e98121",
"workers_dev": false,

"routes": [
{ "pattern": "finance.chitty.cc/*", "zone_name": "chitty.cc" }
],

// Hyperdrive binding for fractal scope projection into ChittyOS-Core
"hyperdrive": [
{ "binding": "CHITTYOS_CORE_DB", "id": "1d126444cff1416cb415447e6cc6d15a" }
],

// Cloudflare Email Service binding (beta, Workers Paid plan)
// Domain: chitty.cc — onboard at dashboard → Email Sending
"send_email": [
{ "name": "EMAIL", "allowed_sender_addresses": ["finance@chitty.cc", "noreply@chitty.cc"] }
],

"vars": {
"MODE": "system",
"NODE_ENV": "production",
"APP_VERSION": "2.0.0",
"CHITTYCONNECT_API_BASE": "https://connect.chitty.cc"
},

"observability": { "enabled": true },

"tail_consumers": [
{ "service": "chittytrack" }
],

"build": {
"command": "npx vite build --outDir dist/public"
},

"assets": {
"directory": "../dist/public",
"binding": "ASSETS"
},

"triggers": {
"crons": ["0 9 * * *"] // Daily at 9:00 AM UTC — lease expiration check
},

"limits": { "cpu_ms": 50 },

"kv_namespaces": [
{
"binding": "FINANCE_KV",
"id": "517b63be4d7144c197b5bdf851f12041",
"preview_id": "89d0b3bc875e49c4a3a9091de6a080aa"
}
],

"r2_buckets": [
{
"binding": "FINANCE_R2",
"bucket_name": "chittyfinance-storage",
"preview_bucket_name": "chittyfinance-storage-preview"
}
],

"durable_objects": {
"bindings": [
{ "name": "CF_AGENT", "class_name": "ChittyAgent" }
]
},

"migrations": [
{ "tag": "v1", "new_sqlite_classes": ["ChittyAgent"] }
],

// ─── env.dev — local development via `wrangler dev --env dev` ───
"env": {
"dev": {
"name": "chittyfinance-dev",
"workers_dev": true,
"send_email": [
{ "name": "EMAIL" }
],
"vars": {
"MODE": "system",
"NODE_ENV": "development",
"APP_VERSION": "2.0.0",
"CHITTYCONNECT_API_BASE": "https://connect.chitty.cc"
},
"triggers": { "crons": ["0 9 * * *"] },
"tail_consumers": [{ "service": "chittytrack" }],
"kv_namespaces": [
{ "binding": "FINANCE_KV", "id": "89d0b3bc875e49c4a3a9091de6a080aa" }
],
"r2_buckets": [
{ "binding": "FINANCE_R2", "bucket_name": "chittyfinance-storage-preview" }
],
"durable_objects": {
"bindings": [
{ "name": "CF_AGENT", "class_name": "ChittyAgent" }
]
}
},

// ─── env.staging — `wrangler deploy --env staging` ───
"staging": {
"name": "chittyfinance-staging",
"workers_dev": true,
"vars": {
"MODE": "system",
"NODE_ENV": "staging",
"APP_VERSION": "2.0.0",
"CHITTYCONNECT_API_BASE": "https://connect.chitty.cc"
},
"triggers": { "crons": ["0 9 * * *"] },
"tail_consumers": [{ "service": "chittytrack" }],
"kv_namespaces": [
{ "binding": "FINANCE_KV", "id": "517b63be4d7144c197b5bdf851f12041" }
],
"r2_buckets": [
{ "binding": "FINANCE_R2", "bucket_name": "chittyfinance-storage" }
],
"durable_objects": {
"bindings": [
{ "name": "CF_AGENT", "class_name": "ChittyAgent" }
]
}
},

// ─── env.production — `wrangler deploy --env production` ───
"production": {
"name": "chittyfinance",
"workers_dev": false,
"routes": [
{ "pattern": "finance.chitty.cc/*", "zone_name": "chitty.cc" }
],
"send_email": [
{ "name": "EMAIL", "allowed_sender_addresses": ["finance@chitty.cc", "noreply@chitty.cc"] }
],
"vars": {
"MODE": "system",
"NODE_ENV": "production",
"APP_VERSION": "2.0.0",
"CHITTYCONNECT_API_BASE": "https://connect.chitty.cc"
},
"triggers": { "crons": ["0 9 * * *"] },
"tail_consumers": [{ "service": "chittytrack" }],
"kv_namespaces": [
{ "binding": "FINANCE_KV", "id": "517b63be4d7144c197b5bdf851f12041" }
],
"r2_buckets": [
{ "binding": "FINANCE_R2", "bucket_name": "chittyfinance-storage" }
],
"durable_objects": {
"bindings": [
{ "name": "CF_AGENT", "class_name": "ChittyAgent" }
]
}
}
}
}
187 changes: 0 additions & 187 deletions deploy/system-wrangler.toml

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"test:run": "vitest run"
},
"dependencies": {
"@chittyos/schema": "file:../../CHITTYFOUNDATION/chittyschema",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Replace local schema path with installable dependency

The new dependency specifier points to a filesystem path outside this repository (file:../../CHITTYFOUNDATION/chittyschema), so a normal checkout cannot install dependencies unless that exact sibling directory exists; in CI this breaks pnpm install (and with the current unchanged lockfile it also fails --frozen-lockfile immediately). Because server/lib/central-workflows.ts now imports from @chittyos/schema/scope-projector, this makes build/test pipelines fail before compilation in environments that only have this repo.

Useful? React with 👍 / 👎.

Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a local file:../../CHITTYFOUNDATION/chittyschema dependency makes installs non-reproducible and will break in any environment where that external path doesn’t exist (including most CI/checkouts). Consider switching to a published/versioned dependency (registry or git URL), or vendor/workspace the package within this repo so dependency resolution works from a clean checkout.

Suggested change
"@chittyos/schema": "file:../../CHITTYFOUNDATION/chittyschema",
"@chittyos/schema": "2.0.0",

Copilot uses AI. Check for mistakes.
"@hookform/resolvers": "^3.9.1",
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package.json was updated to add a new dependency, but pnpm-lock.yaml wasn’t updated in this PR. CI runs pnpm install --frozen-lockfile (see .github/workflows/security-gates.yml:91), so this will fail until the lockfile is regenerated and committed.

Suggested change
"@hookform/resolvers": "^3.9.1",

Copilot uses AI. Check for mistakes.
"@jridgewell/trace-mapping": "^0.3.25",
"@modelcontextprotocol/sdk": "^1.27.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/detect-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function detectMode() {
// Check for system mode indicators
const hasSystemDatabase = process.env.DATABASE_URL && process.env.DATABASE_URL.includes('neon');
const hasChittyIdToken = !!process.env.CHITTY_ID_SERVICE_TOKEN;
const hasSystemConfig = fs.existsSync(path.join(__dirname, '../deploy/system-wrangler.toml'));
const hasSystemConfig = fs.existsSync(path.join(__dirname, '../deploy/system-wrangler.jsonc')) || fs.existsSync(path.join(__dirname, '../deploy/system-wrangler.toml'));

if (hasSystemDatabase || hasChittyIdToken || hasSystemConfig) {
console.log('🔧 Auto-detected: SYSTEM mode (ChittyOS integration)');
Expand Down
Loading
Loading