termcast 1.3.53 → 1.4.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.
Files changed (196) hide show
  1. package/dist/action-utils.d.ts.map +1 -1
  2. package/dist/action-utils.js +17 -132
  3. package/dist/action-utils.js.map +1 -1
  4. package/dist/apis/cache.d.ts +8 -30
  5. package/dist/apis/cache.d.ts.map +1 -1
  6. package/dist/apis/cache.js +9 -271
  7. package/dist/apis/cache.js.map +1 -1
  8. package/dist/apis/clipboard.d.ts +4 -2
  9. package/dist/apis/clipboard.d.ts.map +1 -1
  10. package/dist/apis/clipboard.js +18 -31
  11. package/dist/apis/clipboard.js.map +1 -1
  12. package/dist/apis/environment.d.ts.map +1 -1
  13. package/dist/apis/environment.js +14 -49
  14. package/dist/apis/environment.js.map +1 -1
  15. package/dist/apis/localstorage.d.ts +7 -12
  16. package/dist/apis/localstorage.d.ts.map +1 -1
  17. package/dist/apis/localstorage.js +7 -184
  18. package/dist/apis/localstorage.js.map +1 -1
  19. package/dist/app.d.ts.map +1 -1
  20. package/dist/app.js +46 -20
  21. package/dist/app.js.map +1 -1
  22. package/dist/cli.js +7 -6
  23. package/dist/cli.js.map +1 -1
  24. package/dist/components/actions.d.ts.map +1 -1
  25. package/dist/components/actions.js +13 -2
  26. package/dist/components/actions.js.map +1 -1
  27. package/dist/components/candle-chart.d.ts +110 -0
  28. package/dist/components/candle-chart.d.ts.map +1 -0
  29. package/dist/components/candle-chart.js +295 -0
  30. package/dist/components/candle-chart.js.map +1 -0
  31. package/dist/components/extension-preferences.d.ts.map +1 -1
  32. package/dist/components/extension-preferences.js +7 -8
  33. package/dist/components/extension-preferences.js.map +1 -1
  34. package/dist/components/form/file-autocomplete.js +2 -2
  35. package/dist/components/form/file-autocomplete.js.map +1 -1
  36. package/dist/components/list.d.ts.map +1 -1
  37. package/dist/components/list.js +242 -14
  38. package/dist/components/list.js.map +1 -1
  39. package/dist/components/table.d.ts +2 -0
  40. package/dist/components/table.d.ts.map +1 -1
  41. package/dist/components/table.js +41 -4
  42. package/dist/components/table.js.map +1 -1
  43. package/dist/e2e-node.d.ts.map +1 -1
  44. package/dist/e2e-node.js +5 -4
  45. package/dist/e2e-node.js.map +1 -1
  46. package/dist/examples/simple-candle-chart-data.d.ts +9064 -0
  47. package/dist/examples/simple-candle-chart-data.d.ts.map +1 -0
  48. package/dist/examples/simple-candle-chart-data.js +12683 -0
  49. package/dist/examples/simple-candle-chart-data.js.map +1 -0
  50. package/dist/examples/simple-candle-chart.d.ts +2 -0
  51. package/dist/examples/simple-candle-chart.d.ts.map +1 -0
  52. package/dist/examples/simple-candle-chart.js +125 -0
  53. package/dist/examples/simple-candle-chart.js.map +1 -0
  54. package/dist/extensions/dev.d.ts.map +1 -1
  55. package/dist/extensions/dev.js +5 -2
  56. package/dist/extensions/dev.js.map +1 -1
  57. package/dist/globals.d.ts.map +1 -1
  58. package/dist/globals.js +2 -1
  59. package/dist/globals.js.map +1 -1
  60. package/dist/index.d.ts +2 -0
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +2 -0
  63. package/dist/index.js.map +1 -1
  64. package/dist/internal/error-handler.d.ts.map +1 -1
  65. package/dist/internal/error-handler.js +21 -19
  66. package/dist/internal/error-handler.js.map +1 -1
  67. package/dist/internal/providers.d.ts.map +1 -1
  68. package/dist/internal/providers.js +41 -1
  69. package/dist/internal/providers.js.map +1 -1
  70. package/dist/logger.d.ts.map +1 -1
  71. package/dist/logger.js +31 -29
  72. package/dist/logger.js.map +1 -1
  73. package/dist/platform/browser/cache.d.ts +41 -0
  74. package/dist/platform/browser/cache.d.ts.map +1 -0
  75. package/dist/platform/browser/cache.js +262 -0
  76. package/dist/platform/browser/cache.js.map +1 -0
  77. package/dist/platform/browser/localstorage.d.ts +20 -0
  78. package/dist/platform/browser/localstorage.d.ts.map +1 -0
  79. package/dist/platform/browser/localstorage.js +102 -0
  80. package/dist/platform/browser/localstorage.js.map +1 -0
  81. package/dist/platform/browser/runtime.d.ts +51 -0
  82. package/dist/platform/browser/runtime.d.ts.map +1 -0
  83. package/dist/platform/browser/runtime.js +164 -0
  84. package/dist/platform/browser/runtime.js.map +1 -0
  85. package/dist/platform/bun/sqlite.d.ts +17 -0
  86. package/dist/platform/bun/sqlite.d.ts.map +1 -0
  87. package/dist/platform/bun/sqlite.js +6 -0
  88. package/dist/platform/bun/sqlite.js.map +1 -0
  89. package/dist/platform/node/cache.d.ts +35 -0
  90. package/dist/platform/node/cache.d.ts.map +1 -0
  91. package/dist/platform/node/cache.js +269 -0
  92. package/dist/platform/node/cache.js.map +1 -0
  93. package/dist/platform/node/localstorage.d.ts +17 -0
  94. package/dist/platform/node/localstorage.d.ts.map +1 -0
  95. package/dist/platform/node/localstorage.js +186 -0
  96. package/dist/platform/node/localstorage.js.map +1 -0
  97. package/dist/platform/node/runtime.d.ts +52 -0
  98. package/dist/platform/node/runtime.d.ts.map +1 -0
  99. package/dist/platform/node/runtime.js +230 -0
  100. package/dist/platform/node/runtime.js.map +1 -0
  101. package/dist/platform/node/sqlite.d.ts +27 -0
  102. package/dist/platform/node/sqlite.d.ts.map +1 -0
  103. package/dist/platform/node/sqlite.js +21 -0
  104. package/dist/platform/node/sqlite.js.map +1 -0
  105. package/dist/state.d.ts +5 -0
  106. package/dist/state.d.ts.map +1 -1
  107. package/dist/state.js +6 -28
  108. package/dist/state.js.map +1 -1
  109. package/dist/utils/file-system.d.ts.map +1 -1
  110. package/dist/utils/file-system.js +17 -22
  111. package/dist/utils/file-system.js.map +1 -1
  112. package/dist/utils.d.ts +1 -1
  113. package/dist/utils.d.ts.map +1 -1
  114. package/dist/utils.js +42 -47
  115. package/dist/utils.js.map +1 -1
  116. package/dist/vim-mode.d.ts +40 -0
  117. package/dist/vim-mode.d.ts.map +1 -0
  118. package/dist/vim-mode.js +135 -0
  119. package/dist/vim-mode.js.map +1 -0
  120. package/fonts/Inconsolata.otf +0 -0
  121. package/fonts/SIL Open Font License.txt +41 -0
  122. package/package.json +60 -8
  123. package/src/action-utils.tsx +27 -124
  124. package/src/apis/cache.test.ts +1 -1
  125. package/src/apis/cache.tsx +9 -373
  126. package/src/apis/clipboard.tsx +29 -38
  127. package/src/apis/environment.tsx +25 -52
  128. package/src/apis/localstorage.tsx +8 -214
  129. package/src/app.tsx +51 -20
  130. package/src/cli.tsx +14 -15
  131. package/src/compile.vitest.tsx +2 -2
  132. package/src/components/actions.tsx +19 -1
  133. package/src/components/candle-chart.tsx +410 -0
  134. package/src/components/extension-preferences.tsx +7 -8
  135. package/src/components/form/file-autocomplete.tsx +2 -2
  136. package/src/components/list.tsx +279 -14
  137. package/src/components/table.tsx +46 -4
  138. package/src/e2e-node.tsx +7 -7
  139. package/src/examples/action-shortcut.vitest.tsx +2 -2
  140. package/src/examples/actions-context.vitest.tsx +1 -1
  141. package/src/examples/bar-graph-weekly.vitest.tsx +10 -36
  142. package/src/examples/detail-metadata-showcase.vitest.tsx +36 -36
  143. package/src/examples/form-basic.vitest.tsx +21 -17
  144. package/src/examples/github.vitest.tsx +4 -4
  145. package/src/examples/graph-bar-chart.vitest.tsx +13 -11
  146. package/src/examples/graph-polymarket.vitest.tsx +2 -2
  147. package/src/examples/graph-row.vitest.tsx +66 -66
  148. package/src/examples/graph-styles.vitest.tsx +12 -12
  149. package/src/examples/internal/simple-scrollbox.vitest.tsx +14 -48
  150. package/src/examples/list-detail-metadata.vitest.tsx +5 -5
  151. package/src/examples/list-fetch-data.vitest.tsx +3 -3
  152. package/src/examples/list-item-accessories.vitest.tsx +2 -2
  153. package/src/examples/list-loading-empty-view.vitest.tsx +1 -1
  154. package/src/examples/list-no-actions.vitest.tsx +2 -2
  155. package/src/examples/list-scrollbox.vitest.tsx +5 -5
  156. package/src/examples/list-spacing-mode.vitest.tsx +3 -3
  157. package/src/examples/list-with-detail.vitest.tsx +68 -68
  158. package/src/examples/list-with-dropdown.vitest.tsx +5 -5
  159. package/src/examples/list-with-sections.vitest.tsx +27 -27
  160. package/src/examples/simple-candle-chart-data.ts +12683 -0
  161. package/src/examples/simple-candle-chart.tsx +363 -0
  162. package/src/examples/simple-candle-chart.vitest.tsx +269 -0
  163. package/src/examples/simple-detail-markdown.vitest.tsx +8 -8
  164. package/src/examples/simple-detail-table.vitest.tsx +10 -10
  165. package/src/examples/simple-graph.vitest.tsx +3 -3
  166. package/src/examples/simple-grid.vitest.tsx +14 -14
  167. package/src/examples/simple-heatmap.vitest.tsx +1 -1
  168. package/src/examples/simple-navigation.vitest.tsx +17 -17
  169. package/src/examples/simple-progress-bar.vitest.tsx +1 -1
  170. package/src/examples/simple-table-wrap.vitest.tsx +19 -19
  171. package/src/examples/store.vitest.tsx +1 -1
  172. package/src/examples/swift-extension.vitest.tsx +2 -2
  173. package/src/examples/table-edge-cases.vitest.tsx +18 -18
  174. package/src/examples/table-flex-grow.vitest.tsx +8 -8
  175. package/src/examples/toast-action.vitest.tsx +2 -2
  176. package/src/extensions/dev.tsx +5 -2
  177. package/src/extensions/dev.vitest.tsx +3 -3
  178. package/src/globals.ts +2 -1
  179. package/src/index.tsx +7 -0
  180. package/src/internal/error-handler.tsx +19 -21
  181. package/src/internal/providers.tsx +39 -0
  182. package/src/logger.tsx +38 -41
  183. package/src/platform/browser/cache.ts +327 -0
  184. package/src/platform/browser/localstorage.ts +119 -0
  185. package/src/platform/browser/runtime.ts +209 -0
  186. package/src/platform/bun/sqlite.ts +19 -0
  187. package/src/platform/node/cache.ts +372 -0
  188. package/src/platform/node/localstorage.ts +214 -0
  189. package/src/platform/node/runtime.ts +264 -0
  190. package/src/platform/node/sqlite.ts +43 -0
  191. package/src/state.tsx +17 -28
  192. package/src/utils/file-system.ts +17 -22
  193. package/src/utils.test.tsx +1 -1
  194. package/src/utils.tsx +56 -47
  195. package/src/vim-mode.tsx +153 -0
  196. package/src/apis/sqlite.ts +0 -14
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "termcast",
3
- "version": "1.3.53",
3
+ "version": "1.4.0",
4
4
  "description": "Raycast for the terminal",
5
5
  "repository": "https://github.com/remorses/termcast",
6
6
  "types": "./dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
- "prepublishOnly": "tsc && chmod +x dist/cli.js",
9
+ "prepublishOnly": "bun x tsc && chmod +x dist/cli.js",
10
10
  "release": "cd .. && bun changeset version && /Users/morse/Documents/GitHub/changesets/packages/cli/bin.js publish # my own fork to support github releases",
11
11
  "see-raycast-types": "zed node_modules/@raycast/api/types/index.d.ts",
12
12
  "play": "bun src/cli.tsx",
@@ -16,6 +16,55 @@
16
16
  "bin": {
17
17
  "termcast": "./dist/cli.js"
18
18
  },
19
+ "imports": {
20
+ "#platform/cache": {
21
+ "bun": "./src/platform/node/cache.ts",
22
+ "node": {
23
+ "types": "./src/platform/node/cache.ts",
24
+ "default": "./dist/platform/node/cache.js"
25
+ },
26
+ "browser": "./src/platform/browser/cache.ts",
27
+ "default": {
28
+ "types": "./src/platform/node/cache.ts",
29
+ "default": "./dist/platform/node/cache.js"
30
+ }
31
+ },
32
+ "#platform/localstorage": {
33
+ "bun": "./src/platform/node/localstorage.ts",
34
+ "node": {
35
+ "types": "./src/platform/node/localstorage.ts",
36
+ "default": "./dist/platform/node/localstorage.js"
37
+ },
38
+ "browser": "./src/platform/browser/localstorage.ts",
39
+ "default": {
40
+ "types": "./src/platform/node/localstorage.ts",
41
+ "default": "./dist/platform/node/localstorage.js"
42
+ }
43
+ },
44
+ "#platform/runtime": {
45
+ "bun": "./src/platform/node/runtime.ts",
46
+ "node": {
47
+ "types": "./src/platform/node/runtime.ts",
48
+ "default": "./dist/platform/node/runtime.js"
49
+ },
50
+ "browser": "./src/platform/browser/runtime.ts",
51
+ "default": {
52
+ "types": "./src/platform/node/runtime.ts",
53
+ "default": "./dist/platform/node/runtime.js"
54
+ }
55
+ },
56
+ "#sqlite": {
57
+ "bun": "./src/platform/bun/sqlite.ts",
58
+ "node": {
59
+ "types": "./src/platform/node/sqlite.ts",
60
+ "default": "./dist/platform/node/sqlite.js"
61
+ },
62
+ "default": {
63
+ "types": "./src/platform/node/sqlite.ts",
64
+ "default": "./dist/platform/node/sqlite.js"
65
+ }
66
+ }
67
+ },
19
68
  "exports": {
20
69
  ".": {
21
70
  "types": "./dist/index.d.ts",
@@ -35,7 +84,8 @@
35
84
  "files": [
36
85
  "dist",
37
86
  "src",
38
- "esm"
87
+ "esm",
88
+ "fonts"
39
89
  ],
40
90
  "keywords": [],
41
91
  "author": "Tommaso De Rossi, morse <beats.by.morse@gmail.com>",
@@ -47,7 +97,7 @@
47
97
  "@termcast/utils": "^2.2.8",
48
98
  "change-case": "^5.4.4",
49
99
  "colord": "^2.9.3",
50
- "goke": "^6.1.3",
100
+ "goke": "^6.6.0",
51
101
  "google-auth-library": "^10.3.0",
52
102
  "jszip": "^3.10.1",
53
103
  "marked": "^17.0.2",
@@ -57,6 +107,7 @@
57
107
  "react-refresh": "^0.18.0",
58
108
  "simple-plist": "^1.3.1",
59
109
  "string-dedent": "^3.0.2",
110
+ "better-sqlite3": "^12.8.0",
60
111
  "zustand": "^5.0.8"
61
112
  },
62
113
  "peerDependencies": {
@@ -65,18 +116,19 @@
65
116
  "react": "*"
66
117
  },
67
118
  "devDependencies": {
68
- "@opentui/core": "^0.1.79",
69
- "@opentui/react": "^0.1.79",
119
+ "@opentui/core": "^0.1.88",
120
+ "@opentui/react": "^0.1.88",
70
121
  "@raycast/api": "^1.102.5",
71
122
  "@raycast/utils": "^2.2.1",
123
+ "@types/better-sqlite3": "^7.6.13",
72
124
  "@types/bun": "^1.3.9",
73
125
  "@types/node": "^25.2.3",
74
126
  "@xterm/addon-serialize": "^0.13.0",
75
127
  "@xterm/headless": "^5.5.0",
76
128
  "bun-pty": "0.4.8",
77
- "node-pty": "0.10.1",
129
+ "zigpty": "^0.0.4",
78
130
  "react": "^19.2.4",
79
- "tuistory": "0.0.16",
131
+ "tuistory": "^0.0.16",
80
132
  "vitest": "^4.0.16"
81
133
  },
82
134
  "optionalDependencies": {
@@ -1,27 +1,16 @@
1
- import { exec } from 'child_process'
2
- import { promisify } from 'util'
1
+ import {
2
+ platform,
3
+ getEnv,
4
+ copyToClipboard as platformCopy,
5
+ execWithInput,
6
+ execCommand,
7
+ openUrl,
8
+ openFile as platformOpenFile,
9
+ showInFileManager,
10
+ moveToTrash as platformMoveToTrash,
11
+ } from '#platform/runtime'
3
12
  import { logger } from 'termcast/src/logger'
4
13
 
5
- const execAsync = promisify(exec)
6
- const platform = process.platform
7
-
8
- /**
9
- * Execute command with input (for commands like pbcopy that need stdin)
10
- */
11
- function execWithInput(command: string, input: string): Promise<void> {
12
- return new Promise((resolve, reject) => {
13
- const child = exec(command, (error) => {
14
- if (error) {
15
- reject(error)
16
- } else {
17
- resolve()
18
- }
19
- })
20
- child.stdin?.write(input)
21
- child.stdin?.end()
22
- })
23
- }
24
-
25
14
  /**
26
15
  * Copy text to clipboard
27
16
  */
@@ -31,29 +20,14 @@ export async function copyToClipboard(
31
20
  ): Promise<void> {
32
21
  const text = String(content)
33
22
 
34
- if (process.env.VITEST) {
23
+ if (getEnv('VITEST')) {
35
24
  logger.log(`📋 [VITEST] Skipping copy to clipboard: ${concealed ? '[CONCEALED]' : text}`)
36
25
  return
37
26
  }
38
27
 
39
28
  try {
40
- if (platform === 'darwin') {
41
- // macOS: use pbcopy
42
- await execWithInput('pbcopy', text)
43
- logger.log(`📋 Copied to clipboard: ${concealed ? '[CONCEALED]' : text}`)
44
- } else if (platform === 'linux') {
45
- // Linux: use xclip if available
46
- await execWithInput('xclip -selection clipboard', text)
47
- logger.log(`📋 Copied to clipboard: ${concealed ? '[CONCEALED]' : text}`)
48
- } else if (platform === 'win32') {
49
- // Windows: use clip
50
- await execWithInput('clip', text)
51
- logger.log(`📋 Copied to clipboard: ${concealed ? '[CONCEALED]' : text}`)
52
- } else {
53
- logger.log(
54
- `📋 Copy to clipboard not supported on ${platform}: ${concealed ? '[CONCEALED]' : text}`,
55
- )
56
- }
29
+ await platformCopy(text)
30
+ logger.log(`📋 Copied to clipboard: ${concealed ? '[CONCEALED]' : text}`)
57
31
  } catch (error) {
58
32
  logger.log(`📋 Failed to copy to clipboard: ${error}`)
59
33
  }
@@ -64,21 +38,8 @@ export async function copyToClipboard(
64
38
  */
65
39
  export async function openInBrowser(url: string): Promise<void> {
66
40
  try {
67
- if (platform === 'darwin') {
68
- // macOS: use open
69
- await execAsync(`open "${url}"`)
70
- logger.log(`🌐 Opened in browser: ${url}`)
71
- } else if (platform === 'linux') {
72
- // Linux: use xdg-open
73
- await execAsync(`xdg-open "${url}"`)
74
- logger.log(`🌐 Opened in browser: ${url}`)
75
- } else if (platform === 'win32') {
76
- // Windows: use start
77
- await execAsync(`start "${url}"`)
78
- logger.log(`🌐 Opened in browser: ${url}`)
79
- } else {
80
- logger.log(`🌐 Opening browser not supported on ${platform}: ${url}`)
81
- }
41
+ await openUrl(url)
42
+ logger.log(`🌐 Opened in browser: ${url}`)
82
43
  } catch (error) {
83
44
  logger.log(`🌐 Failed to open browser: ${error}`)
84
45
  }
@@ -92,26 +53,8 @@ export async function openFile(
92
53
  application?: string,
93
54
  ): Promise<void> {
94
55
  try {
95
- if (platform === 'darwin') {
96
- // macOS: use open with optional application
97
- if (application) {
98
- await execAsync(`open -a "${application}" "${target}"`)
99
- logger.log(`📂 Opened ${target} with ${application}`)
100
- } else {
101
- await execAsync(`open "${target}"`)
102
- logger.log(`📂 Opened ${target}`)
103
- }
104
- } else if (platform === 'linux') {
105
- // Linux: use xdg-open (doesn't support specific application)
106
- await execAsync(`xdg-open "${target}"`)
107
- logger.log(`📂 Opened ${target}`)
108
- } else if (platform === 'win32') {
109
- // Windows: use start
110
- await execAsync(`start "" "${target}"`)
111
- logger.log(`📂 Opened ${target}`)
112
- } else {
113
- logger.log(`📂 Opening files not supported on ${platform}: ${target}`)
114
- }
56
+ await platformOpenFile(target, application)
57
+ logger.log(`📂 Opened ${target}${application ? ` with ${application}` : ''}`)
115
58
  } catch (error) {
116
59
  logger.log(`📂 Failed to open file: ${error}`)
117
60
  }
@@ -123,7 +66,7 @@ export async function openFile(
123
66
  export async function pasteContent(content: string | number): Promise<void> {
124
67
  const text = String(content)
125
68
 
126
- if (process.env.VITEST) {
69
+ if (getEnv('VITEST')) {
127
70
  logger.log(`📝 [VITEST] Skipping paste: ${text}`)
128
71
  return
129
72
  }
@@ -132,22 +75,20 @@ export async function pasteContent(content: string | number): Promise<void> {
132
75
  if (platform === 'darwin') {
133
76
  // macOS: First copy to clipboard, then simulate Cmd+V
134
77
  await execWithInput('pbcopy', text)
135
- // Note: Simulating keypress requires additional tools like osascript
136
- await execAsync(
78
+ await execCommand(
137
79
  `osascript -e 'tell application "System Events" to keystroke "v" using command down'`,
138
80
  )
139
81
  logger.log(`📝 Pasted: ${text}`)
140
82
  } else if (platform === 'linux') {
141
- // Linux: Copy to clipboard with xclip
142
83
  await execWithInput('xclip -selection clipboard', text)
143
- // Simulating paste would require xdotool or similar
144
84
  logger.log(`📝 Copied for paste: ${text}`)
145
85
  } else if (platform === 'win32') {
146
- // Windows: Copy to clipboard
147
86
  await execWithInput('clip', text)
148
87
  logger.log(`📝 Copied for paste: ${text}`)
149
88
  } else {
150
- logger.log(`📝 Paste not supported on ${platform}: ${text}`)
89
+ // browser or unknown copy to clipboard
90
+ await platformCopy(text)
91
+ logger.log(`📝 Copied for paste: ${text}`)
151
92
  }
152
93
  } catch (error) {
153
94
  logger.log(`📝 Failed to paste: ${error}`)
@@ -159,23 +100,8 @@ export async function pasteContent(content: string | number): Promise<void> {
159
100
  */
160
101
  export async function showInFinder(path: string): Promise<void> {
161
102
  try {
162
- if (platform === 'darwin') {
163
- // macOS: use open -R to reveal in Finder
164
- await execAsync(`open -R "${path}"`)
165
- logger.log(`📁 Revealed in Finder: ${path}`)
166
- } else if (platform === 'linux') {
167
- // Linux: open containing directory
168
- await execAsync(`xdg-open "$(dirname "${path}")"`)
169
- logger.log(`📁 Opened containing folder: ${path}`)
170
- } else if (platform === 'win32') {
171
- // Windows: use explorer with /select
172
- await execAsync(`explorer /select,"${path}"`)
173
- logger.log(`📁 Revealed in Explorer: ${path}`)
174
- } else {
175
- logger.log(
176
- `📁 Show in file manager not supported on ${platform}: ${path}`,
177
- )
178
- }
103
+ await showInFileManager(path)
104
+ logger.log(`📁 Revealed in file manager: ${path}`)
179
105
  } catch (error) {
180
106
  logger.log(`📁 Failed to show in file manager: ${error}`)
181
107
  }
@@ -186,31 +112,8 @@ export async function showInFinder(path: string): Promise<void> {
186
112
  */
187
113
  export async function moveToTrash(path: string): Promise<void> {
188
114
  try {
189
- if (platform === 'darwin') {
190
- // macOS: use osascript to move to trash
191
- await execAsync(
192
- `osascript -e 'tell application "Finder" to delete POSIX file "${path}"'`,
193
- )
194
- logger.log(`🗑️ Moved to trash: ${path}`)
195
- } else if (platform === 'linux') {
196
- // Linux: use gio trash if available, otherwise move to trash directory
197
- try {
198
- await execAsync(`gio trash "${path}"`)
199
- } catch {
200
- // Fallback to moving to trash directory
201
- const trashDir = `${process.env.HOME}/.local/share/Trash/files`
202
- await execAsync(`mkdir -p "${trashDir}" && mv "${path}" "${trashDir}/"`)
203
- }
204
- logger.log(`🗑️ Moved to trash: ${path}`)
205
- } else if (platform === 'win32') {
206
- // Windows: use PowerShell to move to recycle bin
207
- await execAsync(
208
- `powershell -command "Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile('${path}','OnlyErrorDialogs','SendToRecycleBin')"`,
209
- )
210
- logger.log(`🗑️ Moved to recycle bin: ${path}`)
211
- } else {
212
- logger.log(`🗑️ Move to trash not supported on ${platform}: ${path}`)
213
- }
115
+ await platformMoveToTrash(path)
116
+ logger.log(`🗑️ Moved to trash: ${path}`)
214
117
  } catch (error) {
215
118
  logger.log(`🗑️ Failed to move to trash: ${error}`)
216
119
  }
@@ -1,6 +1,6 @@
1
1
  import { describe, test, expect, beforeEach, afterAll, jest } from 'bun:test'
2
2
  import { Cache } from './cache'
3
- import { Database } from './sqlite'
3
+ import { Database } from '#sqlite'
4
4
  import * as os from 'os'
5
5
  import * as path from 'path'
6
6
  import * as fs from 'fs'