@cdoing/opentuicli 0.1.21 → 0.1.26
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/README.md +22 -13
- package/dist/cdoing-tui-darwin-arm64/bin/cdoing-tui +0 -0
- package/package.json +12 -9
- package/dist/index.js +0 -64
- package/dist/index.js.map +0 -7
- package/esbuild.config.cjs +0 -45
- package/src/app.tsx +0 -787
- package/src/components/dialog-command.tsx +0 -207
- package/src/components/dialog-help.tsx +0 -151
- package/src/components/dialog-model.tsx +0 -142
- package/src/components/dialog-status.tsx +0 -84
- package/src/components/dialog-theme.tsx +0 -318
- package/src/components/input-area.tsx +0 -380
- package/src/components/loading-spinner.tsx +0 -28
- package/src/components/message-list.tsx +0 -546
- package/src/components/permission-prompt.tsx +0 -72
- package/src/components/session-browser.tsx +0 -231
- package/src/components/session-footer.tsx +0 -30
- package/src/components/session-header.tsx +0 -39
- package/src/components/setup-wizard.tsx +0 -542
- package/src/components/sidebar.tsx +0 -183
- package/src/components/status-bar.tsx +0 -76
- package/src/components/toast.tsx +0 -139
- package/src/context/sdk.tsx +0 -40
- package/src/context/theme.tsx +0 -640
- package/src/index.ts +0 -50
- package/src/lib/autocomplete.ts +0 -262
- package/src/lib/context-providers.ts +0 -98
- package/src/lib/history.ts +0 -164
- package/src/lib/terminal-title.ts +0 -15
- package/src/routes/home.tsx +0 -148
- package/src/routes/session.tsx +0 -1309
- package/src/store/settings.ts +0 -107
- package/tsconfig.json +0 -23
package/src/store/settings.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings Store — Zustand + persist (file-backed)
|
|
3
|
-
*
|
|
4
|
-
* Persists user preferences to ~/.cdoing/tui-settings.json so they
|
|
5
|
-
* survive across sessions: theme, mode, provider, model, sidebar, etc.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as fs from "fs";
|
|
9
|
-
import * as path from "path";
|
|
10
|
-
import * as os from "os";
|
|
11
|
-
import { create } from "zustand";
|
|
12
|
-
import { persist, createJSONStorage, type StateStorage } from "zustand/middleware";
|
|
13
|
-
|
|
14
|
-
// ── File-backed storage adapter ─────────────────────────
|
|
15
|
-
|
|
16
|
-
const SETTINGS_PATH = path.join(os.homedir(), ".cdoing", "tui-settings.json");
|
|
17
|
-
|
|
18
|
-
const fileStorage: StateStorage = {
|
|
19
|
-
getItem: (name: string): string | null => {
|
|
20
|
-
try {
|
|
21
|
-
if (!fs.existsSync(SETTINGS_PATH)) return null;
|
|
22
|
-
const data = JSON.parse(fs.readFileSync(SETTINGS_PATH, "utf-8"));
|
|
23
|
-
return JSON.stringify(data[name] ?? null);
|
|
24
|
-
} catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
setItem: (name: string, value: string): void => {
|
|
29
|
-
try {
|
|
30
|
-
const dir = path.dirname(SETTINGS_PATH);
|
|
31
|
-
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
32
|
-
let data: Record<string, unknown> = {};
|
|
33
|
-
try {
|
|
34
|
-
if (fs.existsSync(SETTINGS_PATH)) {
|
|
35
|
-
data = JSON.parse(fs.readFileSync(SETTINGS_PATH, "utf-8"));
|
|
36
|
-
}
|
|
37
|
-
} catch {}
|
|
38
|
-
data[name] = JSON.parse(value);
|
|
39
|
-
fs.writeFileSync(SETTINGS_PATH, JSON.stringify(data, null, 2), "utf-8");
|
|
40
|
-
} catch {}
|
|
41
|
-
},
|
|
42
|
-
removeItem: (name: string): void => {
|
|
43
|
-
try {
|
|
44
|
-
if (!fs.existsSync(SETTINGS_PATH)) return;
|
|
45
|
-
const data = JSON.parse(fs.readFileSync(SETTINGS_PATH, "utf-8"));
|
|
46
|
-
delete data[name];
|
|
47
|
-
fs.writeFileSync(SETTINGS_PATH, JSON.stringify(data, null, 2), "utf-8");
|
|
48
|
-
} catch {}
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// ── Settings State ──────────────────────────────────────
|
|
53
|
-
|
|
54
|
-
export interface SettingsState {
|
|
55
|
-
// Appearance
|
|
56
|
-
themeId: string;
|
|
57
|
-
mode: "dark" | "light";
|
|
58
|
-
syncTerminalBg: boolean;
|
|
59
|
-
sidebarMode: "auto" | "show" | "hide";
|
|
60
|
-
|
|
61
|
-
// Provider / model
|
|
62
|
-
provider: string;
|
|
63
|
-
model: string;
|
|
64
|
-
|
|
65
|
-
// Actions
|
|
66
|
-
setThemeId: (id: string) => void;
|
|
67
|
-
setMode: (mode: "dark" | "light") => void;
|
|
68
|
-
setSyncTerminalBg: (sync: boolean) => void;
|
|
69
|
-
setSidebarMode: (mode: "auto" | "show" | "hide") => void;
|
|
70
|
-
setProvider: (provider: string) => void;
|
|
71
|
-
setModel: (model: string) => void;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const useSettingsStore = create<SettingsState>()(
|
|
75
|
-
persist(
|
|
76
|
-
(set) => ({
|
|
77
|
-
// Defaults
|
|
78
|
-
themeId: "vercel",
|
|
79
|
-
mode: "dark",
|
|
80
|
-
syncTerminalBg: true,
|
|
81
|
-
sidebarMode: "auto",
|
|
82
|
-
provider: "anthropic",
|
|
83
|
-
model: "",
|
|
84
|
-
|
|
85
|
-
// Actions
|
|
86
|
-
setThemeId: (themeId) => set({ themeId }),
|
|
87
|
-
setMode: (mode) => set({ mode }),
|
|
88
|
-
setSyncTerminalBg: (syncTerminalBg) => set({ syncTerminalBg }),
|
|
89
|
-
setSidebarMode: (sidebarMode) => set({ sidebarMode }),
|
|
90
|
-
setProvider: (provider) => set({ provider }),
|
|
91
|
-
setModel: (model) => set({ model }),
|
|
92
|
-
}),
|
|
93
|
-
{
|
|
94
|
-
name: "tui-settings",
|
|
95
|
-
storage: createJSONStorage(() => fileStorage),
|
|
96
|
-
// Only persist these keys (not actions)
|
|
97
|
-
partialize: (state) => ({
|
|
98
|
-
themeId: state.themeId,
|
|
99
|
-
mode: state.mode,
|
|
100
|
-
syncTerminalBg: state.syncTerminalBg,
|
|
101
|
-
sidebarMode: state.sidebarMode,
|
|
102
|
-
provider: state.provider,
|
|
103
|
-
model: state.model,
|
|
104
|
-
}),
|
|
105
|
-
},
|
|
106
|
-
),
|
|
107
|
-
);
|
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": "src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"declarationMap": true,
|
|
13
|
-
"sourceMap": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"jsx": "react-jsx",
|
|
16
|
-
"jsxImportSource": "@opentui/react",
|
|
17
|
-
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
|
18
|
-
"types": [],
|
|
19
|
-
"noEmit": true
|
|
20
|
-
},
|
|
21
|
-
"include": ["src/**/*"],
|
|
22
|
-
"exclude": ["node_modules", "dist"]
|
|
23
|
-
}
|