fix(coding-agent): use APP_NAME in export-html and tools-manager

This commit is contained in:
Mario Zechner 2025-12-03 16:27:49 +01:00
parent d4d5051940
commit 6cd8bcdeb3
2 changed files with 9 additions and 9 deletions

View file

@ -3,7 +3,7 @@ import type { AssistantMessage, Message, ToolResultMessage, UserMessage } from "
import { existsSync, readFileSync, writeFileSync } from "fs"; import { existsSync, readFileSync, writeFileSync } from "fs";
import { homedir } from "os"; import { homedir } from "os";
import { basename } from "path"; import { basename } from "path";
import { VERSION } from "./config.js"; import { APP_NAME, VERSION } from "./config.js";
import type { SessionManager } from "./session-manager.js"; import type { SessionManager } from "./session-manager.js";
/** /**
@ -333,7 +333,7 @@ export function exportSessionToHtml(sessionManager: SessionManager, state: Agent
// Use pi-session- prefix + session filename + .html if no output path provided // Use pi-session- prefix + session filename + .html if no output path provided
if (!outputPath) { if (!outputPath) {
const sessionBasename = basename(sessionFile, ".jsonl"); const sessionBasename = basename(sessionFile, ".jsonl");
outputPath = `pi-session-${sessionBasename}.html`; outputPath = `${APP_NAME}-session-${sessionBasename}.html`;
} }
// Read and parse session data // Read and parse session data
@ -783,7 +783,7 @@ export function exportSessionToHtml(sessionManager: SessionManager, state: Agent
<body> <body>
<div class="container"> <div class="container">
<div class="header"> <div class="header">
<h1>pi v${VERSION}</h1> <h1>${APP_NAME} v${VERSION}</h1>
<div class="header-info"> <div class="header-info">
<div class="info-item"> <div class="info-item">
<span class="info-label">Session:</span> <span class="info-label">Session:</span>
@ -894,7 +894,7 @@ export function exportSessionToHtml(sessionManager: SessionManager, state: Agent
</div> </div>
<div class="footer"> <div class="footer">
Generated by pi coding-agent on ${new Date().toLocaleString()} Generated by ${APP_NAME} coding-agent on ${new Date().toLocaleString()}
</div> </div>
</div> </div>
</body> </body>
@ -1464,7 +1464,7 @@ function generateHtml(data: ParsedSessionData, inputFilename: string): string {
<body> <body>
<div class="container"> <div class="container">
<div class="header"> <div class="header">
<h1>pi v${VERSION}</h1> <h1>${APP_NAME} v${VERSION}</h1>
<div class="header-info"> <div class="header-info">
<div class="info-item"> <div class="info-item">
<span class="info-label">Session:</span> <span class="info-label">Session:</span>
@ -1569,7 +1569,7 @@ function generateHtml(data: ParsedSessionData, inputFilename: string): string {
</div> </div>
<div class="footer"> <div class="footer">
Generated by pi coding-agent on ${new Date().toLocaleString()} Generated by ${APP_NAME} coding-agent on ${new Date().toLocaleString()}
</div> </div>
</div> </div>
</body> </body>
@ -1605,7 +1605,7 @@ export function exportFromFile(inputPath: string, outputPath?: string): string {
// Generate output path if not provided // Generate output path if not provided
if (!outputPath) { if (!outputPath) {
const inputBasename = basename(inputPath, ".jsonl"); const inputBasename = basename(inputPath, ".jsonl");
outputPath = `pi-session-${inputBasename}.html`; outputPath = `${APP_NAME}-session-${inputBasename}.html`;
} }
const html = generateHtml(data, basename(inputPath)); const html = generateHtml(data, basename(inputPath));

View file

@ -5,7 +5,7 @@ import { arch, platform } from "os";
import { join } from "path"; import { join } from "path";
import { Readable } from "stream"; import { Readable } from "stream";
import { finished } from "stream/promises"; import { finished } from "stream/promises";
import { getToolsDir } from "./config.js"; import { APP_NAME, getToolsDir } from "./config.js";
const TOOLS_DIR = getToolsDir(); const TOOLS_DIR = getToolsDir();
@ -93,7 +93,7 @@ export function getToolPath(tool: "fd" | "rg"): string | null {
// Fetch latest release version from GitHub // Fetch latest release version from GitHub
async function getLatestVersion(repo: string): Promise<string> { async function getLatestVersion(repo: string): Promise<string> {
const response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, { const response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, {
headers: { "User-Agent": "pi-coding-agent" }, headers: { "User-Agent": `${APP_NAME}-coding-agent` },
}); });
if (!response.ok) { if (!response.ok) {