Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ webviews/codex-webviews/vite.config.ts.timestamp-*.mjs

# AI coding agents
.claude/

# Glance memory shards
.glance/
16 changes: 10 additions & 6 deletions src/exportHandler/audioExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const initializeAudioExporter = (context: vscode.ExtensionContext): void
extensionContext = context;
};

export function getAudioExporterContext(): vscode.ExtensionContext | undefined {
return extensionContext;
}

// Debug logging for audio export diagnostics
const DEBUG = false;
function debug(...args: any[]) {
Expand All @@ -28,7 +32,7 @@ type ExportAudioOptions = {
};


function sanitizeFileComponent(input: string): string {
export function sanitizeFileComponent(input: string): string {
return input
.replace(/\s+/g, "_")
.replace(/[^a-zA-Z0-9._-]/g, "-")
Expand Down Expand Up @@ -108,7 +112,7 @@ function formatTimeRangeSuffix(start?: number, end?: number): string {
return `_${s || ""}-${e || ""}`;
}

function getTargetLanguageCode(): string {
export function getTargetLanguageCode(): string {
const projectConfig = vscode.workspace.getConfiguration("codex-project-manager");
const lang = projectConfig.get<any>("targetLanguage") || {};
const code: string = lang.tag || lang.refName || "lang";
Expand Down Expand Up @@ -430,19 +434,19 @@ async function prepareAudioForExport(
return { bytes: original, ext };
}

async function readNotebook(uri: vscode.Uri): Promise<CodexNotebookAsJSONData> {
export async function readNotebook(uri: vscode.Uri): Promise<CodexNotebookAsJSONData> {
const bytes = await vscode.workspace.fs.readFile(uri);
return JSON.parse(Buffer.from(bytes).toString());
}

function isActiveCell(cell: any): boolean {
export function isActiveCell(cell: any): boolean {
const data = cell?.metadata?.data;
const isMerged = !!(data && data.merged);
const isDeleted = !!(data && data.deleted);
return !isMerged && !isDeleted;
}

function pickAudioAttachmentForCell(cell: any): { id: string; url: string; start?: number; end?: number; } | null {
export function pickAudioAttachmentForCell(cell: any): { id: string; url: string; start?: number; end?: number; } | null {
const attachments = cell?.metadata?.attachments || {};
if (!attachments || typeof attachments !== "object") return null;
const selectedId: string | undefined = cell?.metadata?.selectedAudioId;
Expand All @@ -467,7 +471,7 @@ function pickAudioAttachmentForCell(cell: any): { id: string; url: string; start
return candidates[0];
}

async function pathExists(uri: vscode.Uri): Promise<boolean> {
export async function pathExists(uri: vscode.Uri): Promise<boolean> {
try { await vscode.workspace.fs.stat(uri); return true; } catch { return false; }
}

Expand Down
Loading
Loading