fix: cli tool page to update the config correctly

This commit is contained in:
2026-07-12 18:16:52 +07:00
parent be7c210161
commit 268e2ac21f
13 changed files with 141 additions and 34 deletions
@@ -6,6 +6,7 @@ import { promisify } from "util";
import fs from "fs/promises";
import path from "path";
import os from "os";
import { redactSecrets } from "@/lib/security/redactSecrets";
const execAsync = promisify(exec);
@@ -68,7 +69,7 @@ export async function GET() {
return NextResponse.json({
installed: true,
settings: settings,
settings: redactSecrets(settings),
has9Router: has9Router,
settingsPath: getClaudeSettingsPath(),
});
@@ -7,6 +7,7 @@ import fs from "fs/promises";
import path from "path";
import os from "os";
import { parseTOML, stringifyTOML } from "confbox";
import { redactSecretsInText } from "@/lib/security/redactSecrets";
const execAsync = promisify(exec);
@@ -96,7 +97,7 @@ export async function GET() {
return NextResponse.json({
installed: true,
config,
config: redactSecretsInText(config),
has9Router: has9RouterConfig(config),
configPath: getCodexConfigPath(),
});
@@ -4,6 +4,7 @@ import { NextResponse } from "next/server";
import fs from "fs/promises";
import path from "path";
import os from "os";
import { redactSecrets } from "@/lib/security/redactSecrets";
// Resolve chatLanguageModels.json path per OS
const getConfigPath = () => {
@@ -48,7 +49,7 @@ export async function GET() {
return NextResponse.json({
installed: true,
config,
config: redactSecrets(config),
has9Router: has9RouterConfig(config),
configPath: getConfigPath(),
currentModel: entry?.models?.[0]?.id || null,
@@ -8,6 +8,7 @@ import crypto from "crypto";
import { DEFAULT_PLUGINS, LOCAL_STDIO_PLUGINS, buildManagedMcpServers } from "@/shared/constants/coworkPlugins";
import { UPDATER_CONFIG } from "@/shared/constants/config";
import { getConsistentMachineId } from "@/shared/utils/machineId";
import { redactSecrets } from "@/lib/security/redactSecrets";
const APP_PORT = UPDATER_CONFIG.appPort;
const CLI_TOKEN_HEADER = "x-9r-cli-token";
@@ -273,7 +274,7 @@ export async function GET() {
return NextResponse.json({
installed: true,
config,
config: redactSecrets(config),
has9Router,
configPath,
cowork: {
@@ -6,6 +6,7 @@ import { promisify } from "util";
import fs from "fs/promises";
import path from "path";
import os from "os";
import { redactSecretsInText } from "@/lib/security/redactSecrets";
const execAsync = promisify(exec);
@@ -112,7 +113,7 @@ export async function GET() {
const config = parseToml(toml);
return NextResponse.json({
installed: true,
settings: config,
settings: redactSecretsInText(config),
has9Router: has9RouterConfig(config),
configPath: getDeepSeekConfigPath(),
});
@@ -6,6 +6,7 @@ import { promisify } from "util";
import fs from "fs/promises";
import path from "path";
import os from "os";
import { redactSecrets } from "@/lib/security/redactSecrets";
const execAsync = promisify(exec);
@@ -69,7 +70,7 @@ export async function GET() {
return NextResponse.json({
installed: true,
settings,
settings: redactSecrets(settings),
has9Router: has9RouterConfig(settings),
settingsPath: getDroidSettingsPath(),
});
@@ -7,6 +7,7 @@ import os from "os";
import { exec } from "child_process";
import { promisify } from "util";
import { parseTOML, stringifyTOML } from "confbox";
import { redactSecrets } from "@/lib/security/redactSecrets";
const execAsync = promisify(exec);
@@ -122,7 +123,7 @@ export async function GET() {
return NextResponse.json({
installed: true,
config,
config: redactSecrets(config),
has9Router,
configPath: getConfigPath(),
});
@@ -6,6 +6,7 @@ import { promisify } from "util";
import fs from "fs/promises";
import path from "path";
import os from "os";
import { redactSecrets } from "@/lib/security/redactSecrets";
const execAsync = promisify(exec);
@@ -103,8 +104,8 @@ export async function GET() {
return NextResponse.json({
installed: true,
settings,
agents: enrichedAgents,
settings: redactSecrets(settings),
agents: redactSecrets(enrichedAgents),
has9Router: has9RouterConfig(settings),
settingsPath: getOpenClawSettingsPath(),
});
@@ -6,6 +6,7 @@ import { promisify } from "util";
import fs from "fs/promises";
import path from "path";
import os from "os";
import { redactSecrets } from "@/lib/security/redactSecrets";
const execAsync = promisify(exec);
@@ -72,7 +73,7 @@ export async function GET() {
return NextResponse.json({
installed: true,
config,
config: redactSecrets(config),
has9Router: has9RouterConfig(config),
configPath: getConfigPath(),
opencode: {