fix(cli): address CodeRabbit review findings

Co-Authored-By: mantra <mantra@stack-auth.com>
This commit is contained in:
Devin AI 2026-07-14 03:06:41 +00:00
parent bc49ce80bf
commit 5cfe16f764
7 changed files with 19 additions and 19 deletions

View File

@ -135,7 +135,7 @@ function buildConfigPushSource(configFilePath: string, flags: SourceFlagOptions)
repo: repository.repo,
branch,
commit_hash: sha,
config_file_path: configFilePath,
config_file_path: normalizeRepoRelativePath(configFilePath, "--config-file"),
};
}

View File

@ -4,11 +4,7 @@ import { randomBytes } from "node:crypto";
import { runClaudeAgent } from "../lib/claude-agent.js";
import { CliError } from "../lib/errors.js";
import { isNonInteractiveEnv } from "../lib/interactive.js";
type FixOptions = {
error?: string,
yes?: boolean,
};
import type { FixOptions } from "./fix.js";
const MAX_ERROR_LENGTH = 8000;
const MAX_STDIN_BYTES = MAX_ERROR_LENGTH * 4;

View File

@ -1,6 +1,6 @@
import { Command } from "commander";
type FixOptions = { error?: string, yes?: boolean };
export type FixOptions = { error?: string, yes?: boolean };
export function registerFixCommand(program: Command) {
program.command("fix").description("Use an AI agent to fix a Hexclave error in your project").option("--error <text>", "The error message to fix (also accepts stdin)").option("-y, --yes", "Skip the confirmation prompt").action(async (opts: FixOptions) => {

View File

@ -20,7 +20,7 @@ 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];
type InitOptions = {
export type InitOptions = {
mode?: InitMode, apps?: string, configFile?: string, selectProjectId?: string, outputDir?: string, agent?: boolean, displayName?: string,
};

View File

@ -1,6 +1,5 @@
import { Command } from "commander";
type InitOptions = { mode?: "create" | "create-cloud" | "link-config" | "link-cloud", apps?: string, configFile?: string, selectProjectId?: string, outputDir?: string, agent?: boolean, displayName?: string };
import type { InitOptions } from "./init.impl.js";
export function registerInitCommand(program: Command) {
program.command("init").description("Initialize Hexclave in your project").option("--mode <mode>", "Mode: create, create-cloud, link-config, or link-cloud (skips interactive prompts)").option("--apps <apps>", "Comma-separated app IDs to enable (for create mode)").option("--config-file <path>", "Path to existing config file (for link-config mode)").option("--select-project-id <id>", "Project ID to link (for link-cloud mode)").option("--output-dir <dir>", "Directory to write output files (defaults to cwd)").option("--no-agent", "Skip Claude agent and print setup instructions instead").option("--display-name <name>", "Project display name (used by create-cloud mode)").action(async (opts: InitOptions) => {

View File

@ -21,7 +21,6 @@ export async function runList(program: Command, opts: ProjectListFlags) {
export async function runCreate(program: Command, opts: { cloud?: boolean, displayName?: string }) {
if (!opts.cloud) throw new CliError("hexclave project create currently only creates cloud projects. Pass --cloud to confirm.");
const [{ getInternalUser }, { resolveLoginConfig, resolveSessionAuth }, { createProjectInteractively }] = await Promise.all([import("../lib/app.js"), import("../lib/auth.js"), import("../lib/create-project.js")]);
const auth = resolveSessionAuth();
const user = await getInternalUser(auth);
const { dashboardUrl } = resolveLoginConfig();

View File

@ -64,14 +64,20 @@ async function initializeSentry(): Promise<void> {
}
export function initSentry(): void {
registrationPromise ??= import("@hexclave/shared/dist/utils/errors").then(({ registerErrorSink }) => registerErrorSink((location, error, level) => {
capturePromise = (async () => {
await initializeSentry();
const Sentry = await loadSentry();
Sentry.captureException(error, { extra: { location }, level });
await Sentry.flush(2000);
})();
}));
registrationPromise ??= import("@hexclave/shared/dist/utils/errors")
.then(({ registerErrorSink }) => registerErrorSink((location, error, level) => {
capturePromise = (async () => {
await initializeSentry();
const Sentry = await loadSentry();
Sentry.captureException(error, { extra: { location }, level });
await Sentry.flush(2000);
})().catch(() => {
// Optional telemetry failures must not create unhandled rejections or affect CLI errors.
});
}))
.catch(() => {
// Optional telemetry registration failures must not create unhandled rejections or affect CLI errors.
});
}
export async function captureFatalError(location: string, error: unknown, timeoutMs = 2000): Promise<void> {