mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-30 21:01:54 +08:00
Refactor environment and configuration files
- Removed outdated comments from `.env.development`, `.eslintrc.cjs`, and `schema.prisma` for clarity. - Cleaned up import statements in `local-emulator.ts` and `repo-agent.ts` to improve code organization. - Adjusted import order in `ssrf-protection.ts` and `cli.test.ts` for consistency. - Updated `init.ts` to streamline imports and enhance readability. - Minor adjustments in `admin-interface.ts` and `schema-fields.ts` to maintain code quality. These changes aim to enhance maintainability and readability across the codebase.
This commit is contained in:
parent
913f98484f
commit
47319f221d
@ -79,9 +79,6 @@ HEXCLAVE_INTEGRATION_CLIENTS_CONFIG='[{"client_id": "neon-local", "client_secret
|
||||
CRON_SECRET=mock_cron_secret
|
||||
HEXCLAVE_FREESTYLE_API_KEY=mock_stack_freestyle_key
|
||||
HEXCLAVE_VERCEL_SANDBOX_TOKEN=vercel_sandbox_disabled_for_local_development
|
||||
# Shared base snapshot (node + Claude Agent SDK) the config agent warm-boots from,
|
||||
# in place of a custom Docker image. Build it with `tsx scripts/config-agent/build-image.ts`
|
||||
# and paste the printed id here. Leave empty to cold-install the SDK on each run.
|
||||
HEXCLAVE_CONFIG_AGENT_BASE_SNAPSHOT_ID=
|
||||
HEXCLAVE_OPENAI_API_KEY=mock_openai_api_key
|
||||
HEXCLAVE_STRIPE_SECRET_KEY=sk_test_mockstripekey
|
||||
|
||||
@ -3,9 +3,6 @@ const publicVars = require("../../configs/eslint/extra-rules.js");
|
||||
|
||||
module.exports = {
|
||||
extends: ["../../configs/eslint/defaults.js", "../../configs/eslint/next.js"],
|
||||
// `/scripts` is linted, except throwaway e2e spikes: they're `.mts` (the only
|
||||
// such files in the repo, so the parser isn't set up with extraFileExtensions
|
||||
// and typed rules crash on them) and intentionally hit real external services.
|
||||
ignorePatterns: ["/*", "!/src", "!/scripts", "!/prisma", "/scripts/spike-*.mts"],
|
||||
rules: {
|
||||
"no-restricted-syntax": [
|
||||
|
||||
@ -138,9 +138,6 @@ model BranchConfigOverride {
|
||||
config Json
|
||||
source Json?
|
||||
pushedConfigError Json?
|
||||
// Ephemeral state of the most recent dashboard→GitHub config agent run (status,
|
||||
// progress, diff, …). Kept out of `source` so the source descriptor stays a pure
|
||||
// "where the config came from" value; runs no longer serialize anything.
|
||||
configAgentRun Json?
|
||||
|
||||
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||
|
||||
@ -14,10 +14,10 @@
|
||||
* token in `origin` dies with it.
|
||||
*/
|
||||
|
||||
import { buildCompleteConfigAgentPrompt, CONFIG_AGENT_REPO_TOOLS } from "@hexclave/shared-backend/config-agent";
|
||||
import { getEnvVariable } from "@hexclave/shared/dist/utils/env";
|
||||
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
||||
import { Sandbox } from "@vercel/sandbox";
|
||||
import { buildCompleteConfigAgentPrompt, CONFIG_AGENT_REPO_TOOLS } from "@hexclave/shared-backend/config-agent";
|
||||
import { PRODUCTION_AI_PROXY_BASE_URL } from "../ai/proxy-url";
|
||||
|
||||
const AGENT_SDK_VERSION = "0.2.73";
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { globalPrismaClient } from "@/prisma-client";
|
||||
import { showOnboardingHexclaveConfigValue } from "@hexclave/shared/dist/config-authoring";
|
||||
import { renderConfigFileContent } from "@hexclave/shared/dist/config-rendering";
|
||||
import { detectImportPackageFromDir, evalConfigFileContent, type ParsedConfigValue } from "@hexclave/shared/dist/config-eval";
|
||||
import { isValidConfig } from "@hexclave/shared/dist/config/format";
|
||||
import { renderConfigFileContent } from "@hexclave/shared/dist/config-rendering";
|
||||
import { LOCAL_EMULATOR_ADMIN_EMAIL, LOCAL_EMULATOR_ADMIN_PASSWORD } from "@hexclave/shared/dist/local-emulator";
|
||||
import { getEnvVariable } from "@hexclave/shared/dist/utils/env";
|
||||
import { StatusError } from "@hexclave/shared/dist/utils/errors";
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { getNodeEnvironment } from "@hexclave/shared/dist/utils/env";
|
||||
import { StatusError } from "@hexclave/shared/dist/utils/errors";
|
||||
import dns from "node:dns";
|
||||
import net from "node:net";
|
||||
import { StatusError } from "@hexclave/shared/dist/utils/errors";
|
||||
import { getNodeEnvironment } from "@hexclave/shared/dist/utils/env";
|
||||
|
||||
const OAUTH_SSRF_PROTECTION_ERROR = "OAuth provider URLs must use HTTPS and resolve only to public internet addresses.";
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
buildWorkflowYaml,
|
||||
GITHUB_PROJECT_ID_SECRET_NAME,
|
||||
GITHUB_SECRET_SERVER_KEY_SECRET_NAME,
|
||||
normalizeConfigPath,
|
||||
WORKFLOW_FILE_PATH,
|
||||
buildWorkflowYaml,
|
||||
GITHUB_PROJECT_ID_SECRET_NAME,
|
||||
GITHUB_SECRET_SERVER_KEY_SECRET_NAME,
|
||||
normalizeConfigPath,
|
||||
WORKFLOW_FILE_PATH,
|
||||
} from "./link-existing-onboarding-workflow";
|
||||
|
||||
describe("buildWorkflowYaml", () => {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { StackAdminApp } from "@hexclave/js";
|
||||
import { getEnvVariable } from "@hexclave/shared/dist/utils/env";
|
||||
import { Result } from "@hexclave/shared/dist/utils/results";
|
||||
import { execFile } from "child_process";
|
||||
import * as fs from "fs";
|
||||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
import { StackAdminApp } from "@hexclave/js";
|
||||
import { getEnvVariable } from "@hexclave/shared/dist/utils/env";
|
||||
import { Result } from "@hexclave/shared/dist/utils/results";
|
||||
import { describe, beforeAll, afterAll } from "vitest";
|
||||
import { it, niceFetch, STACK_BACKEND_BASE_URL, STACK_INTERNAL_PROJECT_CLIENT_KEY, STACK_INTERNAL_PROJECT_SERVER_KEY, STACK_INTERNAL_PROJECT_ADMIN_KEY } from "../helpers";
|
||||
import { afterAll, beforeAll, describe } from "vitest";
|
||||
import { it, niceFetch, STACK_BACKEND_BASE_URL, STACK_INTERNAL_PROJECT_ADMIN_KEY, STACK_INTERNAL_PROJECT_CLIENT_KEY, STACK_INTERNAL_PROJECT_SERVER_KEY } from "../helpers";
|
||||
|
||||
const isLocalEmulator = getEnvVariable("NEXT_PUBLIC_STACK_IS_LOCAL_EMULATOR", "") === "true";
|
||||
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
import { Command } from "commander";
|
||||
import { select, input, checkbox, confirm } from "@inquirer/prompts";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { StackClientApp } from "@hexclave/js";
|
||||
import { ALL_APPS } from "@hexclave/shared/dist/apps/apps-config";
|
||||
import { resolveLoginConfig, resolveSessionAuth, DEFAULT_PUBLISHABLE_CLIENT_KEY } from "../lib/auth.js";
|
||||
import { detectImportPackageFromDir } from "@hexclave/shared/dist/config-eval";
|
||||
import { renderConfigFileContent } from "@hexclave/shared/dist/config-rendering";
|
||||
import { throwErr } from "@hexclave/shared/dist/utils/errors";
|
||||
import { checkbox, confirm, input, select } from "@inquirer/prompts";
|
||||
import { Command } from "commander";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { getInternalUser } from "../lib/app.js";
|
||||
import { writeConfigValue } from "../lib/config.js";
|
||||
import { CliError, AuthError } from "../lib/errors.js";
|
||||
import { isNonInteractiveEnv } from "../lib/interactive.js";
|
||||
import { createInitPrompt } from "../lib/init-prompt.js";
|
||||
import { createProjectInteractively } from "../lib/create-project.js";
|
||||
import { DEFAULT_PUBLISHABLE_CLIENT_KEY, resolveLoginConfig, resolveSessionAuth } from "../lib/auth.js";
|
||||
import { runClaudeAgent } from "../lib/claude-agent.js";
|
||||
import { resolveConfigFilePathOption } from "../lib/config-file-path.js";
|
||||
import { renderConfigFileContent } from "@hexclave/shared/dist/config-rendering";
|
||||
import { detectImportPackageFromDir } from "@hexclave/shared/dist/config-eval";
|
||||
import { throwErr } from "@hexclave/shared/dist/utils/errors";
|
||||
import { writeConfigValue } from "../lib/config.js";
|
||||
import { createProjectInteractively } from "../lib/create-project.js";
|
||||
import { AuthError, CliError } from "../lib/errors.js";
|
||||
import { createInitPrompt } from "../lib/init-prompt.js";
|
||||
import { isNonInteractiveEnv } from "../lib/interactive.js";
|
||||
|
||||
const VALID_INIT_MODES = ["create", "create-cloud", "link-config", "link-cloud"] as const;
|
||||
type InitMode = typeof VALID_INIT_MODES[number];
|
||||
|
||||
@ -5,3 +5,4 @@
|
||||
// "@hexclave/shared-backend/config-agent" subpath)
|
||||
export * from "./config-file";
|
||||
export * from "./config-updater";
|
||||
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
import * as yup from "yup";
|
||||
import { KnownErrors } from "../known-errors";
|
||||
import type { EnvironmentConfigOverrideOverride } from "../config/schema";
|
||||
import { KnownErrors } from "../known-errors";
|
||||
import { branchConfigSourceSchema, type ConfigAgentRunApi, type RestrictedReason } from "../schema-fields";
|
||||
import { AccessToken, InternalSession, RefreshToken } from "../sessions";
|
||||
import type { MoneyAmount } from "../utils/currency-constants";
|
||||
import type { Json } from "../utils/json";
|
||||
import { Result } from "../utils/results";
|
||||
import { urlString } from "../utils/urls";
|
||||
import type { PlanUsageResponse } from "./plan-usage";
|
||||
import type { AnalyticsClickmapDevice, AnalyticsClickmapKind, AnalyticsClickmapResponse, AnalyticsClickmapTokenResponse, MetricsResponse, MetricsUserCounts, UserActivityResponse } from "./admin-metrics";
|
||||
import type { AnalyticsQueryOptions, AnalyticsQueryResponse } from "./crud/analytics";
|
||||
import { EmailOutboxCrud } from "./crud/email-outbox";
|
||||
@ -16,18 +14,19 @@ import { InternalApiKeysCrud } from "./crud/internal-api-keys";
|
||||
import { ProjectPermissionDefinitionsCrud } from "./crud/project-permissions";
|
||||
import { ProjectsCrud } from "./crud/projects";
|
||||
import type {
|
||||
AdminGetSessionReplayResponse,
|
||||
AdminGetSessionReplayAllEventsResponse,
|
||||
AdminGetSessionReplayChunkEventsResponse,
|
||||
AdminListSessionReplayChunksOptions,
|
||||
AdminListSessionReplayChunksResponse,
|
||||
AdminListSessionReplaysOptions,
|
||||
AdminListSessionReplaysResponse
|
||||
AdminGetSessionReplayAllEventsResponse,
|
||||
AdminGetSessionReplayChunkEventsResponse,
|
||||
AdminGetSessionReplayResponse,
|
||||
AdminListSessionReplayChunksOptions,
|
||||
AdminListSessionReplayChunksResponse,
|
||||
AdminListSessionReplaysOptions,
|
||||
AdminListSessionReplaysResponse
|
||||
} from "./crud/session-replays";
|
||||
import { SvixTokenCrud } from "./crud/svix-token";
|
||||
import { TeamPermissionDefinitionsCrud } from "./crud/team-permissions";
|
||||
import type { Transaction, TransactionType } from "./crud/transactions";
|
||||
import { ServerAuthApplicationOptions, HexclaveServerInterface } from "./server-interface";
|
||||
import type { PlanUsageResponse } from "./plan-usage";
|
||||
import { HexclaveServerInterface, ServerAuthApplicationOptions } from "./server-interface";
|
||||
|
||||
export type { PlanUsageResponse } from "./plan-usage";
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import * as yup from "yup";
|
||||
import { KnownErrors } from "./known-errors";
|
||||
import { isBase64 } from "./utils/bytes";
|
||||
import { isValidCountryCode, normalizeCountryCode } from "./utils/country-codes";
|
||||
import { SUPPORTED_CURRENCIES, type Currency, type MoneyAmount } from "./utils/currency-constants";
|
||||
import type { DayInterval, Interval } from "./utils/dates";
|
||||
import { getProcessEnv } from "./utils/env";
|
||||
@ -9,7 +10,6 @@ import { decodeBasicAuthorizationHeader } from "./utils/http";
|
||||
import { allProviders } from "./utils/oauth";
|
||||
import { deepPlainClone, omit, typedFromEntries } from "./utils/objects";
|
||||
import { deindent } from "./utils/strings";
|
||||
import { isValidCountryCode, normalizeCountryCode } from "./utils/country-codes";
|
||||
import { isValidHostnameWithWildcards, isValidUrl } from "./utils/urls";
|
||||
import { isUuid } from "./utils/uuids";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user