Initial commit: Velum Raycast extension
Pseudonymize-and-AI workflow for handling PII-sensitive text via the Velum API and Raycast AI. Commands cover end-to-end email summary and reply, briefing/action-items/structured-data extraction, manual pseudonymize/depseudonymize on selection or clipboard, and session management. Includes Raycast 2.0 Beta workarounds for selection capture and rich-text clipboard. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
57
src/ui.ts
Normal file
57
src/ui.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import type { PlaceholderMapping, VelumSession } from "./types";
|
||||
|
||||
export const NEW_SESSION_ID = "__new_session__";
|
||||
|
||||
export function markdownCodeBlock(value: string): string {
|
||||
return `\`\`\`text\n${value.replace(/```/g, "`\u200b``")}\n\`\`\``;
|
||||
}
|
||||
|
||||
function escapeMarkdownTableCell(value: string): string {
|
||||
return value.replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
|
||||
}
|
||||
|
||||
export function mappingDetailTable(mapping: PlaceholderMapping): string {
|
||||
const rows = Object.entries(mapping)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(
|
||||
([placeholder, entry]) =>
|
||||
`| \`${placeholder}\` | ${escapeMarkdownTableCell(entry.original)} | ${entry.type} |`,
|
||||
);
|
||||
|
||||
if (rows.length === 0) {
|
||||
return "Keine Einträge.";
|
||||
}
|
||||
|
||||
return [
|
||||
"| Platzhalter | Original | Typ |",
|
||||
"| --- | --- | --- |",
|
||||
...rows,
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
export function mappingSummary(mapping: PlaceholderMapping): string {
|
||||
const counts = Object.values(mapping).reduce<Record<string, number>>(
|
||||
(acc, entry) => {
|
||||
acc[entry.type] = (acc[entry.type] ?? 0) + 1;
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
const rows = Object.entries(counts)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([type, count]) => `| ${type} | ${count} |`);
|
||||
|
||||
if (rows.length === 0) {
|
||||
return "Keine Einträge.";
|
||||
}
|
||||
|
||||
return ["| Typ | Anzahl |", "| --- | ---: |", ...rows].join("\n");
|
||||
}
|
||||
|
||||
export function sessionSubtitle(session: VelumSession): string {
|
||||
const entries = Object.keys(session.mapping).length;
|
||||
return `${entries} ${entries === 1 ? "Zuordnung" : "Zuordnungen"} · aktualisiert ${new Date(
|
||||
session.updatedAt,
|
||||
).toLocaleString()}`;
|
||||
}
|
||||
Reference in New Issue
Block a user