@alexzeitler/session-md 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +187 -0
- package/package.json +20 -0
- package/session-md +49 -0
- package/src/app.ts +603 -0
- package/src/components/ConversationList.ts +243 -0
- package/src/components/MessageView.ts +241 -0
- package/src/components/SearchResultsView.ts +146 -0
- package/src/components/SourcePicker.ts +87 -0
- package/src/components/StatusBar.ts +70 -0
- package/src/components/TargetPicker.ts +174 -0
- package/src/config.ts +85 -0
- package/src/file-ops.ts +23 -0
- package/src/import/claude-code-to-md.ts +184 -0
- package/src/import/claude-export-to-md.ts +122 -0
- package/src/import/loader.ts +86 -0
- package/src/import/memorizer-to-md.ts +117 -0
- package/src/import/opencode-to-md.ts +176 -0
- package/src/import/parse-worker.ts +28 -0
- package/src/import/types.ts +56 -0
- package/src/index.ts +282 -0
- package/src/mcp/http.ts +264 -0
- package/src/mcp/server.ts +330 -0
- package/src/search/index.ts +235 -0
- package/src/search/plaintext.ts +47 -0
- package/src/theme.ts +111 -0
package/src/theme.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { existsSync } from "fs";
|
|
4
|
+
import { parse } from "smol-toml";
|
|
5
|
+
|
|
6
|
+
export interface Theme {
|
|
7
|
+
accent: string;
|
|
8
|
+
foreground: string;
|
|
9
|
+
background: string;
|
|
10
|
+
muted: string;
|
|
11
|
+
error: string;
|
|
12
|
+
success: string;
|
|
13
|
+
title: string;
|
|
14
|
+
selection_bg: string;
|
|
15
|
+
selection_fg: string;
|
|
16
|
+
selection_desc: string;
|
|
17
|
+
border_active: string;
|
|
18
|
+
border_inactive: string;
|
|
19
|
+
spinner: string;
|
|
20
|
+
// Markdown syntax
|
|
21
|
+
heading: string;
|
|
22
|
+
strong: string;
|
|
23
|
+
italic: string;
|
|
24
|
+
code: string;
|
|
25
|
+
link: string;
|
|
26
|
+
link_url: string;
|
|
27
|
+
list: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const DEFAULT_THEME: Theme = {
|
|
31
|
+
accent: "#fab283",
|
|
32
|
+
foreground: "#eeeeee",
|
|
33
|
+
background: "#1a1a1a",
|
|
34
|
+
muted: "#808080",
|
|
35
|
+
error: "#e06c75",
|
|
36
|
+
success: "#7fd88f",
|
|
37
|
+
title: "#fab283",
|
|
38
|
+
selection_bg: "#264f78",
|
|
39
|
+
selection_fg: "#ffffff",
|
|
40
|
+
selection_desc: "#a0c4e8",
|
|
41
|
+
border_active: "cyan",
|
|
42
|
+
border_inactive: "gray",
|
|
43
|
+
spinner: "#00cccc",
|
|
44
|
+
heading: "#9d7cd8",
|
|
45
|
+
strong: "#f5a742",
|
|
46
|
+
italic: "#e5c07b",
|
|
47
|
+
code: "#7fd88f",
|
|
48
|
+
link: "#56b6c2",
|
|
49
|
+
link_url: "#fab283",
|
|
50
|
+
list: "#fab283",
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function loadOmarchyColors(): Partial<Theme> | null {
|
|
54
|
+
const colorsPath = join(
|
|
55
|
+
homedir(),
|
|
56
|
+
".config",
|
|
57
|
+
"omarchy",
|
|
58
|
+
"current",
|
|
59
|
+
"theme",
|
|
60
|
+
"colors.toml",
|
|
61
|
+
);
|
|
62
|
+
if (!existsSync(colorsPath)) return null;
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const raw = require("fs").readFileSync(colorsPath, "utf-8");
|
|
66
|
+
const colors = parse(raw) as Record<string, string>;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
accent: colors.accent,
|
|
70
|
+
foreground: colors.foreground,
|
|
71
|
+
background: colors.background,
|
|
72
|
+
muted: colors.color7,
|
|
73
|
+
error: colors.color1,
|
|
74
|
+
success: colors.color2,
|
|
75
|
+
title: colors.accent,
|
|
76
|
+
selection_bg: colors.selection_background,
|
|
77
|
+
selection_fg: colors.selection_foreground,
|
|
78
|
+
selection_desc: colors.color7,
|
|
79
|
+
border_active: colors.accent,
|
|
80
|
+
border_inactive: colors.color7,
|
|
81
|
+
spinner: colors.color6,
|
|
82
|
+
heading: colors.color5,
|
|
83
|
+
strong: colors.color3,
|
|
84
|
+
italic: colors.color3,
|
|
85
|
+
code: colors.color2,
|
|
86
|
+
link: colors.color6,
|
|
87
|
+
link_url: colors.accent,
|
|
88
|
+
list: colors.accent,
|
|
89
|
+
};
|
|
90
|
+
} catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function loadConfigTheme(
|
|
96
|
+
configSources: Record<string, string> | undefined,
|
|
97
|
+
): Partial<Theme> | null {
|
|
98
|
+
if (!configSources || Object.keys(configSources).length === 0) return null;
|
|
99
|
+
return configSources as unknown as Partial<Theme>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function loadTheme(configTheme?: Record<string, string>): Theme {
|
|
103
|
+
const omarchy = loadOmarchyColors();
|
|
104
|
+
const config = loadConfigTheme(configTheme);
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
...DEFAULT_THEME,
|
|
108
|
+
...(omarchy ?? {}),
|
|
109
|
+
...(config ?? {}),
|
|
110
|
+
};
|
|
111
|
+
}
|