426e9eeabd
Voice Workbench / headless workbench (mocked backends) (push) Has been cancelled
Voice Workbench / real acoustic lane (nightly, provisioned only) (push) Has been cancelled
ci / test (push) Has been cancelled
ci / lint-and-format (push) Has been cancelled
ci / build (push) Has been cancelled
ci / dev-startup (push) Has been cancelled
gitleaks / gitleaks (push) Has been cancelled
Markdown Links / Relative Markdown Links (push) Has been cancelled
Quality (Extended) / Homepage Build (PR smoke) (push) Has been cancelled
Quality (Extended) / Comment-only diff guard (push) Has been cancelled
Quality (Extended) / Format + Type Safety Ratchet (push) Has been cancelled
Quality (Extended) / Develop Gate (secret scan + UI determinism) (push) Has been cancelled
Quality (Extended) / Develop Gate (lint) (push) Has been cancelled
Chat shell gestures / Chat shell gesture + parity e2e (push) Has been cancelled
Cloud Gateway Discord / Test (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx @biomejs/biome check packages/lifeops-bench/src, benchmark-lint) (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx vitest run --config packages/lifeops-bench/vitest.config.ts --root packages/lifeops-bench --passWithNoTests, benchmark-tests) (push) Has been cancelled
Build Agent Image / build-and-push (push) Has been cancelled
Dev Smoke / bun run dev onboarding chat (push) Has been cancelled
Dev Smoke / Vite HMR dependency-level smoke (push) Has been cancelled
Electrobun Submodule Guard / electrobun gitlink is fetchable (push) Has been cancelled
Publish @elizaos/example-code / check_npm (push) Has been cancelled
Publish @elizaos/example-code / publish_npm (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / verify_version (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / publish_npm (push) Has been cancelled
Sandbox Live Smoke / Sandbox live smoke (push) Has been cancelled
Snap Build & Test / Build Snap (amd64) (push) Has been cancelled
Snap Build & Test / Build Snap (arm64) (push) Has been cancelled
Test Packaging / elizaos CLI global-install smoke (node + bun) (push) Has been cancelled
Cloud Gateway Webhook / Test (push) Has been cancelled
Cloud Tests / lint-and-types (push) Has been cancelled
Cloud Tests / unit-tests (push) Has been cancelled
Cloud Tests / integration-tests (push) Has been cancelled
Cloud Tests / e2e-tests (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Apps Worker (Product 2) / Determine environment (push) Has been cancelled
Deploy Apps Worker (Product 2) / Deploy apps worker to apps-control host (${{ needs.determine-env.outputs.environment }}) (push) Has been cancelled
Deploy Eliza Provisioning Worker / Determine environment (push) Has been cancelled
Deploy Eliza Provisioning Worker / Deploy worker to Hetzner host (${{ needs.determine-env.outputs.environment }} @ ${{ needs.determine-env.outputs.deployment_sha }}) (push) Has been cancelled
Dev Smoke / Classify changed paths (push) Has been cancelled
supply-chain / sbom (push) Has been cancelled
supply-chain / vulnerability-scan (push) Has been cancelled
Build, Push & Deploy to Phala Cloud / build-and-push (push) Has been cancelled
Test Packaging / Validate Packaging Configs (push) Has been cancelled
Test Packaging / Build & Test PyPI Package (push) Has been cancelled
Test Packaging / PyPI on Python ${{ matrix.python }} (push) Has been cancelled
Test Packaging / Pack & Test JS Tarballs (push) Has been cancelled
UI Fixture E2E / ui-fixture-e2e (push) Has been cancelled
UI Fixture E2E / fixture-e2e (push) Has been cancelled
UI Story Gate / story-gate (push) Has been cancelled
vault-ci / test (macos-latest) (push) Has been cancelled
vault-ci / test (ubuntu-latest) (push) Has been cancelled
vault-ci / test (windows-latest) (push) Has been cancelled
vault-ci / app-core wiring tests (push) Has been cancelled
verify-patches / verify patches/CHECKSUMS.sha256 (push) Has been cancelled
Voice Benchmark Smoke / voice-emotion fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voiceagentbench fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench-quality unit smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench TypeScript unit (no audio) (push) Has been cancelled
Voice Benchmark Smoke / voice bench smoke summary (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/app-core test bun run --cwd packages/elizaos test bun run --cwd packages/cloud/shared test], app-and-cli) (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/scenario-runner test bun run --cwd packages/vault test bun run --cwd packages/security test bun run --cwd plugins/plugin-coding-tools test], framework-packages) (push) Has been cancelled
Windows CI / windows ([bun run --cwd plugins/plugin-elizacloud test bun run --cwd plugins/plugin-discord test bun run --cwd plugins/plugin-anthropic test bun run --cwd plugins/plugin-openai test bun run --cwd plugins/plugin-app-control test bun run --cwd plugins/pl… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run build --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/agent --concurrency=4 node packages/scripts/run-bash-linux-only.mjs scripts/verify-riscv64-buildpaths.sh node packages/scripts/run… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run typecheck --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/cloud-shared --concurrency=4 bun run --cwd packages/core test bun run --cwd packages/shared test], core-runtime, 75) (push) Has been cancelled
261 lines
8.0 KiB
TypeScript
261 lines
8.0 KiB
TypeScript
#!/usr/bin/env bun
|
|
/**
|
|
* Setup Script for Eliza Cloud
|
|
*
|
|
* Handles complete development environment setup with minimal configuration:
|
|
* 1. Checks and creates .env.local with defaults
|
|
* 2. Validates local configuration
|
|
* 3. Shows missing Steward/x402-related configuration
|
|
*
|
|
* Usage:
|
|
* bun run setup # Full setup
|
|
* bun run setup --check # Just validate current config
|
|
*/
|
|
|
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
import { createPublicClient, formatUnits, http } from "viem";
|
|
import { privateKeyToAccount } from "viem/accounts";
|
|
import { base, baseSepolia } from "viem/chains";
|
|
import {
|
|
isPlaceholderValue,
|
|
parseEnvFile,
|
|
updateEnvFile,
|
|
} from "./local-dev-helpers";
|
|
|
|
const ENV_FILE = ".env.local";
|
|
const EXAMPLE_ENV = ".env.example";
|
|
|
|
// ============================================================================
|
|
// Environment Helpers
|
|
// ============================================================================
|
|
|
|
function readEnvFile(): Record<string, string> {
|
|
return parseEnvFile(ENV_FILE);
|
|
}
|
|
|
|
function ensureEnvFile(): Record<string, string> {
|
|
if (!existsSync(ENV_FILE) && existsSync(EXAMPLE_ENV)) {
|
|
console.log(" Creating .env.local from example...");
|
|
const example = readFileSync(EXAMPLE_ENV, "utf-8");
|
|
writeFileSync(ENV_FILE, example);
|
|
}
|
|
|
|
return readEnvFile();
|
|
}
|
|
|
|
// ============================================================================
|
|
// Configuration Status
|
|
// ============================================================================
|
|
|
|
interface ConfigStatus {
|
|
database: { configured: boolean; connected?: boolean; error?: string };
|
|
auth: { configured: boolean; provider: string };
|
|
payments: { stripe: boolean; x402: boolean };
|
|
wallet: { configured: boolean; address?: string; balance?: string };
|
|
}
|
|
|
|
async function checkConfiguration(
|
|
env: Record<string, string>,
|
|
): Promise<ConfigStatus> {
|
|
const status: ConfigStatus = {
|
|
database: { configured: false },
|
|
auth: { configured: false, provider: "steward" },
|
|
payments: { stripe: false, x402: false },
|
|
wallet: { configured: false },
|
|
};
|
|
|
|
// Database
|
|
if (env.DATABASE_URL) {
|
|
status.database.configured = true;
|
|
}
|
|
|
|
// Auth (Steward)
|
|
if (
|
|
env.NEXT_PUBLIC_STEWARD_API_URL &&
|
|
env.STEWARD_SESSION_SECRET &&
|
|
!isPlaceholderValue(env.NEXT_PUBLIC_STEWARD_API_URL) &&
|
|
!isPlaceholderValue(env.STEWARD_SESSION_SECRET)
|
|
) {
|
|
status.auth.configured = true;
|
|
}
|
|
|
|
// Stripe
|
|
if (env.STRIPE_SECRET_KEY && env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY) {
|
|
status.payments.stripe = true;
|
|
}
|
|
|
|
// x402
|
|
if (env.X402_RECIPIENT_ADDRESS) {
|
|
status.payments.x402 = true;
|
|
}
|
|
|
|
// Wallet
|
|
const privateKey = env.DEPLOYER_PRIVATE_KEY;
|
|
if (privateKey) {
|
|
status.wallet.configured = true;
|
|
const account = privateKeyToAccount(privateKey as `0x${string}`);
|
|
status.wallet.address = account.address;
|
|
|
|
// Check balance
|
|
const network = env.X402_NETWORK || "base-sepolia";
|
|
const chain = network === "base" ? base : baseSepolia;
|
|
const rpcUrl =
|
|
network === "base"
|
|
? "https://mainnet.base.org"
|
|
: "https://sepolia.base.org";
|
|
|
|
try {
|
|
const client = createPublicClient({ chain, transport: http(rpcUrl) });
|
|
const balance = await client.getBalance({ address: account.address });
|
|
status.wallet.balance = formatUnits(balance, 18);
|
|
} catch {
|
|
status.wallet.balance = "unknown";
|
|
}
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Display Functions
|
|
// ============================================================================
|
|
|
|
function displayStatus(status: ConfigStatus): void {
|
|
console.log("\n📊 Configuration Status");
|
|
console.log("========================");
|
|
|
|
// Database
|
|
const dbIcon = status.database.configured ? "✅" : "❌";
|
|
console.log(
|
|
`${dbIcon} Database: ${status.database.configured ? "Configured" : "Not configured"}`,
|
|
);
|
|
|
|
// Auth
|
|
const authIcon = status.auth.configured ? "✅" : "❌";
|
|
console.log(
|
|
`${authIcon} Auth (${status.auth.provider}): ${status.auth.configured ? "Configured" : "Not configured"}`,
|
|
);
|
|
|
|
// Payments
|
|
const stripeIcon = status.payments.stripe ? "✅" : "⬜";
|
|
const x402Icon = status.payments.x402 ? "✅" : "⬜";
|
|
console.log(
|
|
`${stripeIcon} Stripe: ${status.payments.stripe ? "Configured" : "Optional"}`,
|
|
);
|
|
console.log(
|
|
`${x402Icon} x402 Crypto: ${status.payments.x402 ? "Enabled" : "Disabled"}`,
|
|
);
|
|
|
|
// Wallet
|
|
if (status.wallet.configured) {
|
|
console.log(`✅ Wallet: ${status.wallet.address?.slice(0, 10)}...`);
|
|
console.log(` └── Balance: ${status.wallet.balance} ETH`);
|
|
} else {
|
|
console.log(`⬜ Wallet: Not configured (needed for deployments)`);
|
|
}
|
|
}
|
|
|
|
// ============================================================================
|
|
// Setup Steps
|
|
// ============================================================================
|
|
|
|
async function setupDefaults(env: Record<string, string>): Promise<void> {
|
|
console.log("\n⚙️ Setting up defaults...");
|
|
|
|
const defaults: Record<string, string> = {
|
|
NEXT_PUBLIC_APP_URL: "http://localhost:3000",
|
|
NEXT_PUBLIC_API_URL: "http://localhost:3000",
|
|
X402_NETWORK: "base-sepolia",
|
|
CACHE_ENABLED: "true",
|
|
CACHE_BACKEND: "wadis",
|
|
};
|
|
|
|
for (const [key, value] of Object.entries(defaults)) {
|
|
if (!env[key] || isPlaceholderValue(env[key])) {
|
|
updateEnvFile(ENV_FILE, key, value);
|
|
console.log(` Set ${key}=${value}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
async function promptForMissing(env: Record<string, string>): Promise<void> {
|
|
// DATABASE_URL is intentionally not required: local dev falls back to
|
|
// embedded PGlite at .eliza/.pgdata. Cloud deployments set it to a Neon URL.
|
|
const required = [
|
|
{
|
|
key: "NEXT_PUBLIC_STEWARD_API_URL",
|
|
hint: "Steward API base URL (e.g. http://localhost:8787/steward)",
|
|
},
|
|
{
|
|
key: "STEWARD_SESSION_SECRET",
|
|
hint: "HS256 secret used by Steward to sign session JWTs (must match Steward host)",
|
|
},
|
|
];
|
|
|
|
const missing = required.filter(
|
|
(r) => !env[r.key] || isPlaceholderValue(env[r.key]),
|
|
);
|
|
|
|
if (missing.length > 0) {
|
|
console.log("\n⚠️ Required configuration missing:");
|
|
for (const m of missing) {
|
|
console.log(` ${m.key} - ${m.hint}`);
|
|
}
|
|
console.log(
|
|
"\n Edit .env.local to add these values, then run setup again.",
|
|
);
|
|
}
|
|
}
|
|
|
|
// ============================================================================
|
|
// Main
|
|
// ============================================================================
|
|
|
|
async function main() {
|
|
console.log("╔══════════════════════════════════════════════════════════╗");
|
|
console.log("║ Eliza Cloud Setup ║");
|
|
console.log("╚══════════════════════════════════════════════════════════╝");
|
|
|
|
const args = process.argv.slice(2);
|
|
const checkOnly = args.includes("--check");
|
|
|
|
// Step 1: Ensure .env.local exists
|
|
console.log("\n📁 Environment File");
|
|
console.log("====================");
|
|
let env = ensureEnvFile();
|
|
console.log(` Using: ${ENV_FILE}`);
|
|
|
|
// Step 2: Set defaults
|
|
if (!checkOnly) {
|
|
await setupDefaults(env);
|
|
env = readEnvFile(); // Re-read after updates
|
|
}
|
|
|
|
// Step 3: Check configuration
|
|
const status = await checkConfiguration(env);
|
|
displayStatus(status);
|
|
|
|
// Step 4: Show what's missing
|
|
await promptForMissing(env);
|
|
|
|
// Summary
|
|
console.log("\n🚀 Next Steps");
|
|
console.log("==============");
|
|
|
|
const missingRequired =
|
|
!status.database.configured || !status.auth.configured;
|
|
|
|
if (missingRequired) {
|
|
console.log(" 1. Add required configuration to .env.local");
|
|
console.log(" 2. Run: bun run setup --check");
|
|
console.log(" 3. Run: bun run dev");
|
|
} else {
|
|
console.log(" ✅ Ready! Run: bun run dev");
|
|
}
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error(error);
|
|
process.exitCode = 1;
|
|
});
|