Move config.ts from utils/ to src/

This commit is contained in:
Mario Zechner 2025-12-09 01:28:06 +01:00
parent 0c1a9c3091
commit 14d99b5f86
15 changed files with 14 additions and 14 deletions

View file

@ -4,8 +4,8 @@
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
import chalk from "chalk";
import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "../config.js";
import { allTools, type ToolName } from "../core/tools/index.js";
import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "../utils/config.js";
export type Mode = "text" | "json" | "rpc";

View file

@ -15,7 +15,7 @@
import type { Agent, AgentEvent, AgentState, AppMessage, Attachment, ThinkingLevel } from "@mariozechner/pi-agent-core";
import type { AssistantMessage, Model } from "@mariozechner/pi-ai";
import { getModelsPath } from "../utils/config.js";
import { getModelsPath } from "../config.js";
import { type BashResult, executeBash as executeBashCommand } from "./bash-executor.js";
import { calculateContextTokens, compact, shouldCompact } from "./compaction.js";
import { exportSessionToHtml } from "./export-html.js";

View file

@ -3,7 +3,7 @@ import type { AssistantMessage, Message, ToolResultMessage, UserMessage } from "
import { existsSync, readFileSync, writeFileSync } from "fs";
import { homedir } from "os";
import { basename } from "path";
import { APP_NAME, VERSION } from "../utils/config.js";
import { APP_NAME, VERSION } from "../config.js";
import { type BashExecutionMessage, isBashExecutionMessage } from "./messages.js";
import type { SessionManager } from "./session-manager.js";

View file

@ -2,7 +2,7 @@ import { type Api, getApiKey, getModels, getProviders, type KnownProvider, type
import { type Static, Type } from "@sinclair/typebox";
import AjvModule from "ajv";
import { existsSync, readFileSync } from "fs";
import { getModelsPath } from "../utils/config.js";
import { getModelsPath } from "../config.js";
import { getOAuthToken, type SupportedOAuthProvider } from "./oauth/index.js";
import { loadOAuthCredentials } from "./oauth/storage.js";

View file

@ -1,5 +1,5 @@
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
import { getAgentDir, getOAuthPath } from "../../utils/config.js";
import { getAgentDir, getOAuthPath } from "../../config.js";
export interface OAuthCredentials {
type: "oauth";

View file

@ -2,7 +2,7 @@ import type { AgentState, AppMessage } from "@mariozechner/pi-agent-core";
import { randomBytes } from "crypto";
import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync } from "fs";
import { join, resolve } from "path";
import { getAgentDir } from "../utils/config.js";
import { getAgentDir } from "../config.js";
function uuidv4(): string {
const bytes = randomBytes(16);

View file

@ -1,6 +1,6 @@
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
import { dirname, join } from "path";
import { getAgentDir } from "../utils/config.js";
import { getAgentDir } from "../config.js";
export interface CompactionSettings {
enabled?: boolean; // default: true

View file

@ -1,6 +1,6 @@
import { existsSync, readdirSync, readFileSync } from "fs";
import { join, resolve } from "path";
import { CONFIG_DIR_NAME, getCommandsDir } from "../utils/config.js";
import { CONFIG_DIR_NAME, getCommandsDir } from "../config.js";
/**
* Represents a custom slash command loaded from a file

View file

@ -5,7 +5,7 @@
import chalk from "chalk";
import { existsSync, readFileSync } from "fs";
import { join, resolve } from "path";
import { getAgentDir, getReadmePath } from "../utils/config.js";
import { getAgentDir, getReadmePath } from "../config.js";
import type { ToolName } from "./tools/index.js";
/** Tool descriptions for system prompt */

View file

@ -7,6 +7,7 @@ import chalk from "chalk";
import { type Args, parseArgs, printHelp } from "./cli/args.js";
import { processFileArguments } from "./cli/file-processor.js";
import { selectSession } from "./cli/session-picker.js";
import { getModelsPath, VERSION } from "./config.js";
import { AgentSession } from "./core/agent-session.js";
import { exportFromFile } from "./core/export-html.js";
import { messageTransformer } from "./core/messages.js";
@ -20,7 +21,6 @@ import { allTools, codingTools } from "./core/tools/index.js";
import { InteractiveMode, runPrintMode, runRpcMode } from "./modes/index.js";
import { initTheme } from "./modes/interactive/theme/theme.js";
import { getChangelogPath, getNewEntries, parseChangelog } from "./utils/changelog.js";
import { getModelsPath, VERSION } from "./utils/config.js";
import { ensureTool } from "./utils/tools-manager.js";
/** Check npm registry for new version (non-blocking) */

View file

@ -23,6 +23,7 @@ import {
visibleWidth,
} from "@mariozechner/pi-tui";
import { exec } from "child_process";
import { APP_NAME, getDebugLogPath, getOAuthPath } from "../../config.js";
import type { AgentSession } from "../../core/agent-session.js";
import { isBashExecutionMessage } from "../../core/messages.js";
import { invalidateOAuthCache } from "../../core/model-config.js";
@ -31,7 +32,6 @@ import { getLatestCompactionEntry, SUMMARY_PREFIX, SUMMARY_SUFFIX } from "../../
import type { TruncationResult } from "../../core/tools/truncate.js";
import { getChangelogPath, parseChangelog } from "../../utils/changelog.js";
import { copyToClipboard } from "../../utils/clipboard.js";
import { APP_NAME, getDebugLogPath, getOAuthPath } from "../../utils/config.js";
import { AssistantMessageComponent } from "./components/assistant-message.js";
import { BashExecutionComponent } from "./components/bash-execution.js";
import { CompactionComponent } from "./components/compaction.js";

View file

@ -4,7 +4,7 @@ import type { EditorTheme, MarkdownTheme, SelectListTheme } from "@mariozechner/
import { type Static, Type } from "@sinclair/typebox";
import { TypeCompiler } from "@sinclair/typebox/compiler";
import chalk from "chalk";
import { getCustomThemesDir, getThemesDir } from "../../../utils/config.js";
import { getCustomThemesDir, getThemesDir } from "../../../config.js";
// ============================================================================
// Types & Schema

View file

@ -96,4 +96,4 @@ export function getNewEntries(entries: ChangelogEntry[], lastVersion: string): C
}
// Re-export getChangelogPath from paths.ts for convenience
export { getChangelogPath } from "./config.js";
export { getChangelogPath } from "../config.js";

View file

@ -5,7 +5,7 @@ import { arch, platform } from "os";
import { join } from "path";
import { Readable } from "stream";
import { finished } from "stream/promises";
import { APP_NAME, getToolsDir } from "./config.js";
import { APP_NAME, getToolsDir } from "../config.js";
const TOOLS_DIR = getToolsDir();