termcast 1.3.30 → 1.3.32
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/dist/apis/cache.d.ts.map +1 -1
- package/dist/apis/cache.js +4 -39
- package/dist/apis/cache.js.map +1 -1
- package/dist/apis/hud.d.ts.map +1 -1
- package/dist/apis/hud.js +13 -31
- package/dist/apis/hud.js.map +1 -1
- package/dist/apis/localstorage.d.ts.map +1 -1
- package/dist/apis/localstorage.js +3 -27
- package/dist/apis/localstorage.js.map +1 -1
- package/dist/apis/toast.d.ts +16 -43
- package/dist/apis/toast.d.ts.map +1 -1
- package/dist/apis/toast.js +78 -177
- package/dist/apis/toast.js.map +1 -1
- package/dist/build.d.ts +3 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +52 -2
- package/dist/build.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +206 -25
- package/dist/cli.js.map +1 -1
- package/dist/colors.d.ts.map +1 -1
- package/dist/colors.js +1 -0
- package/dist/colors.js.map +1 -1
- package/dist/compile.d.ts +0 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +18 -23
- package/dist/compile.js.map +1 -1
- package/dist/components/actions.d.ts.map +1 -1
- package/dist/components/actions.js +30 -15
- package/dist/components/actions.js.map +1 -1
- package/dist/components/animation-tick.d.ts +12 -0
- package/dist/components/animation-tick.d.ts.map +1 -0
- package/dist/components/animation-tick.js +63 -0
- package/dist/components/animation-tick.js.map +1 -0
- package/dist/components/detail.d.ts.map +1 -1
- package/dist/components/detail.js +10 -13
- package/dist/components/detail.js.map +1 -1
- package/dist/components/dropdown.d.ts +1 -0
- package/dist/components/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown.js +27 -26
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/extension-preferences.d.ts.map +1 -1
- package/dist/components/extension-preferences.js +15 -10
- package/dist/components/extension-preferences.js.map +1 -1
- package/dist/components/footer.d.ts +13 -0
- package/dist/components/footer.d.ts.map +1 -0
- package/dist/components/footer.js +106 -0
- package/dist/components/footer.js.map +1 -0
- package/dist/components/form/file-autocomplete.d.ts +19 -4
- package/dist/components/form/file-autocomplete.d.ts.map +1 -1
- package/dist/components/form/file-autocomplete.js +56 -55
- package/dist/components/form/file-autocomplete.js.map +1 -1
- package/dist/components/form/file-picker.d.ts.map +1 -1
- package/dist/components/form/file-picker.js +26 -15
- package/dist/components/form/file-picker.js.map +1 -1
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +17 -15
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/form/with-left-border.d.ts.map +1 -1
- package/dist/components/form/with-left-border.js +4 -12
- package/dist/components/form/with-left-border.js.map +1 -1
- package/dist/components/list.d.ts.map +1 -1
- package/dist/components/list.js +126 -86
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-bar.d.ts.map +1 -1
- package/dist/components/loading-bar.js +5 -22
- package/dist/components/loading-bar.js.map +1 -1
- package/dist/components/loading-text.d.ts.map +1 -1
- package/dist/components/loading-text.js +3 -22
- package/dist/components/loading-text.js.map +1 -1
- package/dist/components/theme-picker.d.ts +2 -0
- package/dist/components/theme-picker.d.ts.map +1 -0
- package/dist/components/theme-picker.js +37 -0
- package/dist/components/theme-picker.js.map +1 -0
- package/dist/descendants.d.ts +6 -0
- package/dist/descendants.d.ts.map +1 -1
- package/dist/descendants.js +74 -8
- package/dist/descendants.js.map +1 -1
- package/dist/examples/internal/descendants-rerender.d.ts +14 -0
- package/dist/examples/internal/descendants-rerender.d.ts.map +1 -0
- package/dist/examples/internal/descendants-rerender.js +145 -0
- package/dist/examples/internal/descendants-rerender.js.map +1 -0
- package/dist/examples/internal/simple-dialog.js +4 -1
- package/dist/examples/internal/simple-dialog.js.map +1 -1
- package/dist/examples/internal/simple-scrollbox.js +1 -1
- package/dist/examples/internal/simple-scrollbox.js.map +1 -1
- package/dist/examples/list-with-dropdown.js +1 -1
- package/dist/examples/list-with-dropdown.js.map +1 -1
- package/dist/examples/miscellaneous.js +1 -1
- package/dist/examples/miscellaneous.js.map +1 -1
- package/dist/examples/toast-action.d.ts +2 -0
- package/dist/examples/toast-action.d.ts.map +1 -0
- package/dist/examples/toast-action.js +76 -0
- package/dist/examples/toast-action.js.map +1 -0
- package/dist/examples/toast-variations.js +38 -36
- package/dist/examples/toast-variations.js.map +1 -1
- package/dist/extensions/dev.d.ts +1 -1
- package/dist/extensions/dev.d.ts.map +1 -1
- package/dist/extensions/dev.js +62 -30
- package/dist/extensions/dev.js.map +1 -1
- package/dist/extensions/home.d.ts.map +1 -1
- package/dist/extensions/home.js +4 -3
- package/dist/extensions/home.js.map +1 -1
- package/dist/extensions/react-refresh-init.d.ts +5 -0
- package/dist/extensions/react-refresh-init.d.ts.map +1 -0
- package/dist/extensions/react-refresh-init.js +52 -0
- package/dist/extensions/react-refresh-init.js.map +1 -0
- package/dist/internal/date-picker-widget.js +1 -1
- package/dist/internal/date-picker-widget.js.map +1 -1
- package/dist/internal/dialog.d.ts +8 -3
- package/dist/internal/dialog.d.ts.map +1 -1
- package/dist/internal/dialog.js +37 -53
- package/dist/internal/dialog.js.map +1 -1
- package/dist/internal/navigation.d.ts +1 -0
- package/dist/internal/navigation.d.ts.map +1 -1
- package/dist/internal/navigation.js +25 -1
- package/dist/internal/navigation.js.map +1 -1
- package/dist/internal/providers.d.ts.map +1 -1
- package/dist/internal/providers.js +9 -197
- package/dist/internal/providers.js.map +1 -1
- package/dist/internal/scrollbox.d.ts.map +1 -1
- package/dist/internal/scrollbox.js +1 -0
- package/dist/internal/scrollbox.js.map +1 -1
- package/dist/release.d.ts +1 -0
- package/dist/release.d.ts.map +1 -1
- package/dist/release.js +16 -9
- package/dist/release.js.map +1 -1
- package/dist/state.d.ts +27 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +6 -0
- package/dist/state.js.map +1 -1
- package/dist/theme.d.ts +6 -19
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +76 -45
- package/dist/theme.js.map +1 -1
- package/dist/themes/aura.json +69 -0
- package/dist/themes/ayu.json +80 -0
- package/dist/themes/catppuccin-frappe.json +233 -0
- package/dist/themes/catppuccin-macchiato.json +233 -0
- package/dist/themes/catppuccin.json +112 -0
- package/dist/themes/cobalt2.json +228 -0
- package/dist/themes/cursor.json +249 -0
- package/dist/themes/dracula.json +219 -0
- package/dist/themes/everforest.json +241 -0
- package/dist/themes/flexoki.json +237 -0
- package/dist/themes/github-light.json +56 -0
- package/dist/themes/github.json +241 -0
- package/dist/themes/gruvbox.json +95 -0
- package/dist/themes/kanagawa.json +77 -0
- package/dist/themes/lucent-orng.json +227 -0
- package/dist/themes/material.json +235 -0
- package/dist/themes/matrix.json +77 -0
- package/dist/themes/mercury.json +245 -0
- package/dist/themes/monokai.json +221 -0
- package/dist/themes/nightowl.json +221 -0
- package/dist/themes/nord.json +223 -0
- package/dist/themes/one-dark.json +84 -0
- package/dist/themes/opencode-light.json +62 -0
- package/dist/themes/opencode.json +245 -0
- package/dist/themes/orng.json +245 -0
- package/dist/themes/palenight.json +222 -0
- package/dist/themes/rosepine.json +234 -0
- package/dist/themes/solarized.json +223 -0
- package/dist/themes/synthwave84.json +226 -0
- package/dist/themes/termcast.json +226 -0
- package/dist/themes/tokyonight.json +243 -0
- package/dist/themes/vercel.json +255 -0
- package/dist/themes/vesper.json +218 -0
- package/dist/themes/zenburn.json +223 -0
- package/dist/themes.d.ts +57 -0
- package/dist/themes.d.ts.map +1 -0
- package/dist/themes.js +181 -0
- package/dist/themes.js.map +1 -0
- package/dist/utils/run-command.d.ts +2 -1
- package/dist/utils/run-command.d.ts.map +1 -1
- package/dist/utils/run-command.js +20 -10
- package/dist/utils/run-command.js.map +1 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +90 -17
- package/dist/utils.js.map +1 -1
- package/dist/watcher.d.ts +3 -0
- package/dist/watcher.d.ts.map +1 -0
- package/dist/watcher.js +16 -0
- package/dist/watcher.js.map +1 -0
- package/package.json +16 -10
- package/src/apis/cache.tsx +5 -44
- package/src/apis/hud.tsx +17 -62
- package/src/apis/localstorage.tsx +3 -32
- package/src/apis/toast.tsx +91 -275
- package/src/build.test.tsx +10 -0
- package/src/build.tsx +61 -1
- package/src/cli.tsx +365 -103
- package/src/colors.tsx +1 -0
- package/src/compile.tsx +21 -29
- package/src/compile.vitest.tsx +300 -0
- package/src/components/actions.tsx +64 -45
- package/src/components/animation-tick.tsx +85 -0
- package/src/components/detail.tsx +31 -35
- package/src/components/dropdown.tsx +32 -21
- package/src/components/extension-preferences.tsx +14 -10
- package/src/components/footer.tsx +241 -0
- package/src/components/form/file-autocomplete.tsx +80 -60
- package/src/components/form/file-picker.tsx +37 -25
- package/src/components/form/index.tsx +45 -41
- package/src/components/form/with-left-border.tsx +4 -14
- package/src/components/list.tsx +181 -121
- package/src/components/loading-bar.tsx +5 -25
- package/src/components/loading-text.tsx +4 -23
- package/src/components/theme-picker.tsx +57 -0
- package/src/descendants.tsx +98 -9
- package/src/examples/actions-dialog-layout.vitest.tsx +112 -0
- package/src/examples/file-autocomplete.vitest.tsx +131 -122
- package/src/examples/form-basic.vitest.tsx +463 -644
- package/src/examples/form-dropdown.vitest.tsx +553 -571
- package/src/examples/form-scroll.vitest.tsx +112 -102
- package/src/examples/form-tagpicker.vitest.tsx +364 -338
- package/src/examples/internal/descendants-rerender.tsx +273 -0
- package/src/examples/internal/descendants-rerender.vitest.tsx +194 -0
- package/src/examples/internal/simple-dialog.tsx +4 -4
- package/src/examples/internal/simple-scrollbox.tsx +2 -2
- package/src/examples/internal/simple-scrollbox.vitest.tsx +43 -31
- package/src/examples/list-detail-metadata.vitest.tsx +34 -30
- package/src/examples/list-dropdown-default.vitest.tsx +84 -72
- package/src/examples/list-empty-view.vitest.tsx +93 -0
- package/src/examples/list-fetch-data.vitest.tsx +36 -30
- package/src/examples/list-scrollbox.vitest.tsx +59 -39
- package/src/examples/list-with-detail.vitest.tsx +339 -314
- package/src/examples/list-with-dropdown.tsx +1 -0
- package/src/examples/list-with-dropdown.vitest.tsx +176 -150
- package/src/examples/list-with-sections.vitest.tsx +289 -270
- package/src/examples/list-with-toast.vitest.tsx +44 -44
- package/src/examples/miscellaneous.tsx +10 -0
- package/src/examples/simple-file-picker.vitest.tsx +90 -86
- package/src/examples/simple-grid.vitest.tsx +275 -249
- package/src/examples/simple-navigation.vitest.tsx +192 -168
- package/src/examples/store.vitest.tsx +6 -4
- package/src/examples/swift-extension.vitest.tsx +31 -19
- package/src/examples/synonyms.vitest.tsx +93 -83
- package/src/examples/toast-action.tsx +160 -0
- package/src/examples/toast-action.vitest.tsx +404 -0
- package/src/examples/toast-variations.tsx +58 -57
- package/src/examples/toast-variations.vitest.tsx +186 -166
- package/src/extensions/dev.tsx +74 -33
- package/src/extensions/dev.vitest.tsx +162 -69
- package/src/extensions/home.tsx +5 -6
- package/src/extensions/react-refresh-init.tsx +59 -0
- package/src/internal/date-picker-widget.tsx +1 -1
- package/src/internal/dialog.tsx +59 -83
- package/src/internal/navigation.tsx +37 -4
- package/src/internal/providers.tsx +27 -315
- package/src/internal/scrollbox.tsx +1 -0
- package/src/release.tsx +16 -10
- package/src/state.tsx +36 -3
- package/src/theme.tsx +82 -51
- package/src/themes/aura.json +69 -0
- package/src/themes/ayu.json +80 -0
- package/src/themes/catppuccin-frappe.json +233 -0
- package/src/themes/catppuccin-macchiato.json +233 -0
- package/src/themes/catppuccin.json +112 -0
- package/src/themes/cobalt2.json +228 -0
- package/src/themes/cursor.json +249 -0
- package/src/themes/dracula.json +219 -0
- package/src/themes/everforest.json +241 -0
- package/src/themes/flexoki.json +237 -0
- package/src/themes/github-light.json +56 -0
- package/src/themes/github.json +241 -0
- package/src/themes/gruvbox.json +95 -0
- package/src/themes/kanagawa.json +77 -0
- package/src/themes/lucent-orng.json +227 -0
- package/src/themes/material.json +235 -0
- package/src/themes/matrix.json +77 -0
- package/src/themes/mercury.json +252 -0
- package/src/themes/monokai.json +221 -0
- package/src/themes/nightowl.json +221 -0
- package/src/themes/nord.json +223 -0
- package/src/themes/one-dark.json +84 -0
- package/src/themes/opencode-light.json +62 -0
- package/src/themes/opencode.json +245 -0
- package/src/themes/orng.json +245 -0
- package/src/themes/palenight.json +222 -0
- package/src/themes/rosepine.json +234 -0
- package/src/themes/solarized.json +223 -0
- package/src/themes/synthwave84.json +226 -0
- package/src/themes/termcast.json +227 -0
- package/src/themes/tokyonight.json +243 -0
- package/src/themes/vercel.json +255 -0
- package/src/themes/vesper.json +218 -0
- package/src/themes/zenburn.json +223 -0
- package/src/themes.ts +291 -0
- package/src/utils/run-command.tsx +23 -12
- package/src/utils.tsx +115 -18
- package/src/watcher.tsx +19 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watcher.js","sourceRoot":"","sources":["../src/watcher.tsx"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,iFAAiF;AACjF,2DAA2D;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAGvD,IAAI,QAA0C,CAAA;AAE9C,MAAM,UAAU,UAAU;IACxB,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAA;IAC7B,oFAAoF;IACpF,sDAAsD;IACtD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3D,MAAM,OAAO,GAAG,OAAO,CACrB,mBAAmB,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,GAAG,MAAM,EAAE,CAC/D,CAAA;IACD,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,QAAS,CAAA;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "termcast",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.32",
|
|
4
4
|
"description": "Raycast for the terminal",
|
|
5
5
|
"repository": "https://github.com/remorses/termcast",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc && bun run binary",
|
|
8
|
-
"prepublishOnly": "tsc",
|
|
8
|
+
"prepublishOnly": "tsc && chmod +x dist/cli.js",
|
|
9
9
|
"release": "cd .. && bun changeset version && /Users/morse/Documents/GitHub/changesets/packages/cli/bin.js publish # my own fork to support github releases",
|
|
10
10
|
"binary": "bun build ./src/cli.tsx --env-file=\"\" --compile --outfile bin",
|
|
11
11
|
"see-raycast-types": "zed node_modules/@raycast/api/types/index.d.ts",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"test": "bun test && bun e2e",
|
|
14
14
|
"e2e": "vitest -u"
|
|
15
15
|
},
|
|
16
|
-
"bin":
|
|
16
|
+
"bin": {
|
|
17
|
+
"termcast": "./dist/cli.js"
|
|
18
|
+
},
|
|
17
19
|
"exports": {
|
|
18
20
|
".": {
|
|
19
21
|
"bun": "./src/index.tsx",
|
|
@@ -31,9 +33,11 @@
|
|
|
31
33
|
"author": "Tommaso De Rossi, morse <beats.by.morse@gmail.com>",
|
|
32
34
|
"license": "",
|
|
33
35
|
"dependencies": {
|
|
34
|
-
"@opentui/core": "0.1.
|
|
35
|
-
"@opentui/react": "0.1.
|
|
36
|
+
"@opentui/core": "0.1.68",
|
|
37
|
+
"@opentui/react": "0.1.68",
|
|
36
38
|
"@parcel/watcher": "^2.5.1",
|
|
39
|
+
"@swc/core": "^1.15.7",
|
|
40
|
+
"@swc/wasm": "^1.15.8",
|
|
37
41
|
"@tanstack/react-query": "^5.85.5",
|
|
38
42
|
"@tanstack/react-query-persist-client": "^5.85.5",
|
|
39
43
|
"cac": "^6.7.14",
|
|
@@ -44,6 +48,7 @@
|
|
|
44
48
|
"nanoid": "^5.1.5",
|
|
45
49
|
"node-diff3": "^3.2.0",
|
|
46
50
|
"react-hook-form": "^7.62.0",
|
|
51
|
+
"react-refresh": "^0.18.0",
|
|
47
52
|
"string-dedent": "^3.0.2",
|
|
48
53
|
"zustand": "^5.0.8"
|
|
49
54
|
},
|
|
@@ -51,15 +56,16 @@
|
|
|
51
56
|
"react": "*"
|
|
52
57
|
},
|
|
53
58
|
"devDependencies": {
|
|
54
|
-
"tuistory": "workspace:*",
|
|
55
|
-
"react": "^19.2.0",
|
|
56
|
-
"@types/bun": "^1.3.5",
|
|
57
|
-
"@types/node": "^25.0.3",
|
|
58
59
|
"@raycast/api": "^1.102.5",
|
|
59
60
|
"@raycast/utils": "^2.2.1",
|
|
61
|
+
"@types/bun": "^1.3.5",
|
|
62
|
+
"@types/node": "^25.0.3",
|
|
60
63
|
"@xterm/addon-serialize": "^0.13.0",
|
|
61
64
|
"@xterm/headless": "^5.5.0",
|
|
62
|
-
"bun-pty": "
|
|
65
|
+
"bun-pty": "0.4.2",
|
|
66
|
+
"node-pty": "^1.1.0",
|
|
67
|
+
"react": "^19.2.0",
|
|
68
|
+
"tuistory": "workspace:*",
|
|
63
69
|
"vitest": "^4.0.16"
|
|
64
70
|
}
|
|
65
71
|
}
|
package/src/apis/cache.tsx
CHANGED
|
@@ -5,64 +5,25 @@ import * as fs from 'fs'
|
|
|
5
5
|
import { logger } from '../logger'
|
|
6
6
|
import { useStore } from '../state'
|
|
7
7
|
|
|
8
|
-
// Detect install directory for compiled extensions from binary path
|
|
9
|
-
// Binary is at ~/.termcast/compiled/{name}/bin/{name}, data goes in ~/.termcast/compiled/{name}/
|
|
10
|
-
function getCompiledExtensionDir(): string | null {
|
|
11
|
-
const execPath = process.execPath
|
|
12
|
-
const homeDir = os.homedir()
|
|
13
|
-
const compiledPrefix = path.join(homeDir, '.termcast', 'compiled')
|
|
14
|
-
|
|
15
|
-
// Check if binary is inside ~/.termcast/compiled/{name}/bin/
|
|
16
|
-
if (execPath.startsWith(compiledPrefix)) {
|
|
17
|
-
const relativePath = execPath.slice(compiledPrefix.length + 1) // +1 for trailing slash
|
|
18
|
-
const parts = relativePath.split(path.sep)
|
|
19
|
-
if (parts.length >= 2 && parts[1] === 'bin') {
|
|
20
|
-
// parts[0] is the extension name
|
|
21
|
-
return path.join(compiledPrefix, parts[0])
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return null
|
|
25
|
-
}
|
|
26
|
-
|
|
27
8
|
function getCurrentDatabasePath(): string {
|
|
28
9
|
const { extensionPath } = useStore.getState()
|
|
29
10
|
|
|
30
|
-
// For filesystem-based extensions (dev mode, store mode), use the extension directory
|
|
31
11
|
if (extensionPath) {
|
|
32
12
|
return path.join(extensionPath, '.termcast-bundle', 'data.db')
|
|
33
13
|
}
|
|
34
14
|
|
|
35
|
-
//
|
|
36
|
-
const compiledDir = getCompiledExtensionDir()
|
|
37
|
-
if (compiledDir) {
|
|
38
|
-
return path.join(compiledDir, 'data.db')
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Fallback for unknown context
|
|
15
|
+
// Fallback for examples/tests that don't set extensionPath
|
|
42
16
|
return path.join(os.homedir(), '.termcast', '.termcast-bundle', 'data.db')
|
|
43
17
|
}
|
|
44
18
|
|
|
45
19
|
function getCurrentCacheDir(namespace?: string): string {
|
|
46
20
|
const { extensionPath } = useStore.getState()
|
|
47
21
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return namespace
|
|
51
|
-
? path.join(extensionPath, '.termcast-bundle', 'cache', namespace)
|
|
52
|
-
: path.join(extensionPath, '.termcast-bundle', 'cache')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// For compiled extensions, detect install dir from binary path
|
|
56
|
-
const compiledDir = getCompiledExtensionDir()
|
|
57
|
-
if (compiledDir) {
|
|
58
|
-
const baseDir = path.join(compiledDir, 'cache')
|
|
59
|
-
return namespace ? path.join(baseDir, namespace) : baseDir
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Fallback for unknown context
|
|
63
|
-
return namespace
|
|
64
|
-
? path.join(os.homedir(), '.termcast', '.termcast-bundle', 'cache', namespace)
|
|
22
|
+
const baseDir = extensionPath
|
|
23
|
+
? path.join(extensionPath, '.termcast-bundle', 'cache')
|
|
65
24
|
: path.join(os.homedir(), '.termcast', '.termcast-bundle', 'cache')
|
|
25
|
+
|
|
26
|
+
return namespace ? path.join(baseDir, namespace) : baseDir
|
|
66
27
|
}
|
|
67
28
|
|
|
68
29
|
export class Cache {
|
package/src/apis/hud.tsx
CHANGED
|
@@ -1,63 +1,10 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
2
|
-
import { Theme } from 'termcast/src/theme'
|
|
3
|
-
import { TextAttributes } from '@opentui/core'
|
|
4
1
|
import { logger } from 'termcast/src/logger'
|
|
5
|
-
import { useStore } from 'termcast/src/state'
|
|
6
|
-
import { useTerminalDimensions } from '@opentui/react'
|
|
7
|
-
import { Toast } from 'termcast/src/apis/toast'
|
|
2
|
+
import { useStore, ToastData } from 'termcast/src/state'
|
|
8
3
|
import { PopToRootType } from 'termcast/src/apis/window'
|
|
9
4
|
|
|
10
5
|
// Re-export PopToRootType from window module
|
|
11
6
|
export { PopToRootType } from 'termcast/src/apis/window'
|
|
12
7
|
|
|
13
|
-
interface HUDComponentProps {
|
|
14
|
-
title: string
|
|
15
|
-
onHide: () => void
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function HUDComponent({ title, onHide }: HUDComponentProps): any {
|
|
19
|
-
const dimensions = useTerminalDimensions()
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
// HUD displays for 2 seconds then automatically hides
|
|
23
|
-
const timer = setTimeout(() => {
|
|
24
|
-
onHide()
|
|
25
|
-
}, 2000)
|
|
26
|
-
return () => clearTimeout(timer)
|
|
27
|
-
}, [onHide])
|
|
28
|
-
|
|
29
|
-
// Center the HUD message
|
|
30
|
-
const padding = Math.max(
|
|
31
|
-
0,
|
|
32
|
-
Math.floor((dimensions.width - title.length - 4) / 2),
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<box
|
|
37
|
-
borderColor={Theme.border}
|
|
38
|
-
paddingLeft={1}
|
|
39
|
-
paddingRight={1}
|
|
40
|
-
flexDirection='row'
|
|
41
|
-
alignItems='center'
|
|
42
|
-
>
|
|
43
|
-
<text paddingLeft={padding}>✓ </text>
|
|
44
|
-
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
45
|
-
{title}
|
|
46
|
-
</text>
|
|
47
|
-
</box>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Create a custom Toast class for HUD that displays with HUD styling
|
|
52
|
-
class HUDToast extends Toast {
|
|
53
|
-
constructor(title: string) {
|
|
54
|
-
super({
|
|
55
|
-
title,
|
|
56
|
-
style: Toast.Style.Success,
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
8
|
export async function showHUD(
|
|
62
9
|
title: string,
|
|
63
10
|
options?: {
|
|
@@ -65,18 +12,26 @@ export async function showHUD(
|
|
|
65
12
|
popToRootType?: PopToRootType
|
|
66
13
|
},
|
|
67
14
|
): Promise<void> {
|
|
15
|
+
const onHide = () => {
|
|
16
|
+
useStore.setState({ toast: null, toastWithPrimaryAction: false })
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const toastData: ToastData = {
|
|
20
|
+
id: Math.random().toString(36).substring(7),
|
|
21
|
+
title,
|
|
22
|
+
style: 'SUCCESS',
|
|
23
|
+
onHide,
|
|
24
|
+
}
|
|
25
|
+
|
|
68
26
|
// Show the HUD component in the toast area (bottom of screen)
|
|
69
27
|
useStore.setState({
|
|
70
|
-
toast:
|
|
71
|
-
|
|
72
|
-
title={title}
|
|
73
|
-
onHide={() => {
|
|
74
|
-
useStore.setState({ toast: null })
|
|
75
|
-
}}
|
|
76
|
-
/>
|
|
77
|
-
),
|
|
28
|
+
toast: toastData,
|
|
29
|
+
toastWithPrimaryAction: false,
|
|
78
30
|
})
|
|
79
31
|
|
|
32
|
+
// HUD auto-hides after 2 seconds
|
|
33
|
+
setTimeout(onHide, 2000)
|
|
34
|
+
|
|
80
35
|
// TODO: Handle closeMainWindow behavior with clearRootSearch and popToRootType options
|
|
81
36
|
// This would need to be implemented based on the actual window management system
|
|
82
37
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Database } from 'bun:sqlite'
|
|
2
2
|
import * as path from 'path'
|
|
3
|
-
import * as os from 'os'
|
|
4
3
|
import * as fs from 'fs'
|
|
5
4
|
import { logger } from '../logger'
|
|
6
5
|
import { useStore } from '../state'
|
|
@@ -8,42 +7,14 @@ import { useStore } from '../state'
|
|
|
8
7
|
let db: Database | null = null
|
|
9
8
|
let currentDbPath: string | null = null
|
|
10
9
|
|
|
11
|
-
// Detect install directory for compiled extensions from binary path
|
|
12
|
-
// Binary is at ~/.termcast/compiled/{name}/bin/{name}, data goes in ~/.termcast/compiled/{name}/
|
|
13
|
-
function getCompiledExtensionDir(): string | null {
|
|
14
|
-
const execPath = process.execPath
|
|
15
|
-
const homeDir = os.homedir()
|
|
16
|
-
const compiledPrefix = path.join(homeDir, '.termcast', 'compiled')
|
|
17
|
-
|
|
18
|
-
// Check if binary is inside ~/.termcast/compiled/{name}/bin/
|
|
19
|
-
if (execPath.startsWith(compiledPrefix)) {
|
|
20
|
-
const relativePath = execPath.slice(compiledPrefix.length + 1) // +1 for trailing slash
|
|
21
|
-
const parts = relativePath.split(path.sep)
|
|
22
|
-
if (parts.length >= 2 && parts[1] === 'bin') {
|
|
23
|
-
// parts[0] is the extension name
|
|
24
|
-
return path.join(compiledPrefix, parts[0])
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return null
|
|
28
|
-
}
|
|
29
|
-
|
|
30
10
|
function getCurrentDatabasePath(): string {
|
|
31
11
|
const { extensionPath } = useStore.getState()
|
|
32
12
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return path.join(extensionPath, '.termcast-bundle', 'data.db')
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// For compiled extensions, detect install dir from binary path
|
|
39
|
-
const compiledDir = getCompiledExtensionDir()
|
|
40
|
-
if (compiledDir) {
|
|
41
|
-
return path.join(compiledDir, 'data.db')
|
|
13
|
+
if (!extensionPath) {
|
|
14
|
+
throw new Error('Cannot access LocalStorage - extensionPath not set')
|
|
42
15
|
}
|
|
43
16
|
|
|
44
|
-
|
|
45
|
-
'Cannot access LocalStorage - extension not initialized (no extensionPath and not a compiled extension)',
|
|
46
|
-
)
|
|
17
|
+
return path.join(extensionPath, '.termcast-bundle', 'data.db')
|
|
47
18
|
}
|
|
48
19
|
|
|
49
20
|
function getDatabase(): Database {
|