termcast 1.3.54 → 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 (169) 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 +16 -15
  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/extension-preferences.d.ts.map +1 -1
  28. package/dist/components/extension-preferences.js +7 -8
  29. package/dist/components/extension-preferences.js.map +1 -1
  30. package/dist/components/form/file-autocomplete.js +2 -2
  31. package/dist/components/form/file-autocomplete.js.map +1 -1
  32. package/dist/components/list.d.ts.map +1 -1
  33. package/dist/components/list.js +242 -14
  34. package/dist/components/list.js.map +1 -1
  35. package/dist/e2e-node.d.ts.map +1 -1
  36. package/dist/e2e-node.js +5 -4
  37. package/dist/e2e-node.js.map +1 -1
  38. package/dist/extensions/dev.d.ts.map +1 -1
  39. package/dist/extensions/dev.js +5 -2
  40. package/dist/extensions/dev.js.map +1 -1
  41. package/dist/globals.d.ts.map +1 -1
  42. package/dist/globals.js +2 -1
  43. package/dist/globals.js.map +1 -1
  44. package/dist/internal/error-handler.d.ts.map +1 -1
  45. package/dist/internal/error-handler.js +21 -19
  46. package/dist/internal/error-handler.js.map +1 -1
  47. package/dist/internal/providers.d.ts.map +1 -1
  48. package/dist/internal/providers.js +41 -1
  49. package/dist/internal/providers.js.map +1 -1
  50. package/dist/logger.d.ts.map +1 -1
  51. package/dist/logger.js +31 -29
  52. package/dist/logger.js.map +1 -1
  53. package/dist/platform/browser/cache.d.ts +41 -0
  54. package/dist/platform/browser/cache.d.ts.map +1 -0
  55. package/dist/platform/browser/cache.js +262 -0
  56. package/dist/platform/browser/cache.js.map +1 -0
  57. package/dist/platform/browser/localstorage.d.ts +20 -0
  58. package/dist/platform/browser/localstorage.d.ts.map +1 -0
  59. package/dist/platform/browser/localstorage.js +102 -0
  60. package/dist/platform/browser/localstorage.js.map +1 -0
  61. package/dist/platform/browser/runtime.d.ts +51 -0
  62. package/dist/platform/browser/runtime.d.ts.map +1 -0
  63. package/dist/platform/browser/runtime.js +164 -0
  64. package/dist/platform/browser/runtime.js.map +1 -0
  65. package/dist/platform/bun/sqlite.d.ts +17 -0
  66. package/dist/platform/bun/sqlite.d.ts.map +1 -0
  67. package/dist/platform/bun/sqlite.js +6 -0
  68. package/dist/platform/bun/sqlite.js.map +1 -0
  69. package/dist/platform/node/cache.d.ts +35 -0
  70. package/dist/platform/node/cache.d.ts.map +1 -0
  71. package/dist/platform/node/cache.js +269 -0
  72. package/dist/platform/node/cache.js.map +1 -0
  73. package/dist/platform/node/localstorage.d.ts +17 -0
  74. package/dist/platform/node/localstorage.d.ts.map +1 -0
  75. package/dist/platform/node/localstorage.js +186 -0
  76. package/dist/platform/node/localstorage.js.map +1 -0
  77. package/dist/platform/node/runtime.d.ts +52 -0
  78. package/dist/platform/node/runtime.d.ts.map +1 -0
  79. package/dist/platform/node/runtime.js +230 -0
  80. package/dist/platform/node/runtime.js.map +1 -0
  81. package/dist/platform/node/sqlite.d.ts +27 -0
  82. package/dist/platform/node/sqlite.d.ts.map +1 -0
  83. package/dist/platform/node/sqlite.js +21 -0
  84. package/dist/platform/node/sqlite.js.map +1 -0
  85. package/dist/state.d.ts +5 -0
  86. package/dist/state.d.ts.map +1 -1
  87. package/dist/state.js +6 -28
  88. package/dist/state.js.map +1 -1
  89. package/dist/utils/file-system.d.ts.map +1 -1
  90. package/dist/utils/file-system.js +17 -22
  91. package/dist/utils/file-system.js.map +1 -1
  92. package/dist/utils.d.ts +1 -1
  93. package/dist/utils.d.ts.map +1 -1
  94. package/dist/utils.js +42 -47
  95. package/dist/utils.js.map +1 -1
  96. package/dist/vim-mode.d.ts +40 -0
  97. package/dist/vim-mode.d.ts.map +1 -0
  98. package/dist/vim-mode.js +135 -0
  99. package/dist/vim-mode.js.map +1 -0
  100. package/fonts/Inconsolata.otf +0 -0
  101. package/fonts/SIL Open Font License.txt +41 -0
  102. package/package.json +60 -8
  103. package/src/action-utils.tsx +27 -124
  104. package/src/apis/cache.test.ts +1 -1
  105. package/src/apis/cache.tsx +9 -373
  106. package/src/apis/clipboard.tsx +29 -38
  107. package/src/apis/environment.tsx +25 -52
  108. package/src/apis/localstorage.tsx +8 -214
  109. package/src/app.tsx +16 -15
  110. package/src/cli.tsx +14 -15
  111. package/src/compile.vitest.tsx +2 -2
  112. package/src/components/actions.tsx +19 -1
  113. package/src/components/extension-preferences.tsx +7 -8
  114. package/src/components/form/file-autocomplete.tsx +2 -2
  115. package/src/components/list.tsx +279 -14
  116. package/src/e2e-node.tsx +7 -7
  117. package/src/examples/action-shortcut.vitest.tsx +2 -2
  118. package/src/examples/actions-context.vitest.tsx +1 -1
  119. package/src/examples/bar-graph-weekly.vitest.tsx +10 -36
  120. package/src/examples/detail-metadata-showcase.vitest.tsx +36 -36
  121. package/src/examples/form-basic.vitest.tsx +21 -17
  122. package/src/examples/github.vitest.tsx +4 -4
  123. package/src/examples/graph-bar-chart.vitest.tsx +13 -11
  124. package/src/examples/graph-polymarket.vitest.tsx +2 -2
  125. package/src/examples/graph-row.vitest.tsx +66 -66
  126. package/src/examples/graph-styles.vitest.tsx +12 -12
  127. package/src/examples/internal/simple-scrollbox.vitest.tsx +14 -48
  128. package/src/examples/list-detail-metadata.vitest.tsx +5 -5
  129. package/src/examples/list-fetch-data.vitest.tsx +3 -3
  130. package/src/examples/list-item-accessories.vitest.tsx +2 -2
  131. package/src/examples/list-loading-empty-view.vitest.tsx +1 -1
  132. package/src/examples/list-no-actions.vitest.tsx +2 -2
  133. package/src/examples/list-scrollbox.vitest.tsx +5 -5
  134. package/src/examples/list-spacing-mode.vitest.tsx +3 -3
  135. package/src/examples/list-with-detail.vitest.tsx +68 -68
  136. package/src/examples/list-with-dropdown.vitest.tsx +5 -5
  137. package/src/examples/list-with-sections.vitest.tsx +27 -27
  138. package/src/examples/simple-candle-chart.vitest.tsx +7 -7
  139. package/src/examples/simple-detail-markdown.vitest.tsx +8 -8
  140. package/src/examples/simple-detail-table.vitest.tsx +8 -8
  141. package/src/examples/simple-graph.vitest.tsx +3 -3
  142. package/src/examples/simple-grid.vitest.tsx +14 -14
  143. package/src/examples/simple-heatmap.vitest.tsx +1 -1
  144. package/src/examples/simple-navigation.vitest.tsx +17 -17
  145. package/src/examples/simple-progress-bar.vitest.tsx +1 -1
  146. package/src/examples/store.vitest.tsx +1 -1
  147. package/src/examples/swift-extension.vitest.tsx +2 -2
  148. package/src/examples/table-edge-cases.vitest.tsx +18 -18
  149. package/src/examples/toast-action.vitest.tsx +2 -2
  150. package/src/extensions/dev.tsx +5 -2
  151. package/src/extensions/dev.vitest.tsx +3 -3
  152. package/src/globals.ts +2 -1
  153. package/src/internal/error-handler.tsx +19 -21
  154. package/src/internal/providers.tsx +39 -0
  155. package/src/logger.tsx +38 -41
  156. package/src/platform/browser/cache.ts +327 -0
  157. package/src/platform/browser/localstorage.ts +119 -0
  158. package/src/platform/browser/runtime.ts +209 -0
  159. package/src/platform/bun/sqlite.ts +19 -0
  160. package/src/platform/node/cache.ts +372 -0
  161. package/src/platform/node/localstorage.ts +214 -0
  162. package/src/platform/node/runtime.ts +264 -0
  163. package/src/platform/node/sqlite.ts +43 -0
  164. package/src/state.tsx +17 -28
  165. package/src/utils/file-system.ts +17 -22
  166. package/src/utils.test.tsx +1 -1
  167. package/src/utils.tsx +56 -47
  168. package/src/vim-mode.tsx +153 -0
  169. package/src/apis/sqlite.ts +0 -14
@@ -0,0 +1,41 @@
1
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
2
+ This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
3
+
4
+ -----------------------------------------------------------
5
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
6
+ -----------------------------------------------------------
7
+
8
+ PREAMBLE
9
+ The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
10
+
11
+ The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
12
+
13
+ DEFINITIONS
14
+ "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
15
+
16
+ "Reserved Font Name" refers to any names specified as such after the copyright statement(s).
17
+
18
+ "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
19
+
20
+ "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
21
+
22
+ "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
23
+
24
+ PERMISSION & CONDITIONS
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
26
+
27
+ 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
28
+
29
+ 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
30
+
31
+ 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
32
+
33
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
34
+
35
+ 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
36
+
37
+ TERMINATION
38
+ This license becomes null and void if any of the above conditions are not met.
39
+
40
+ DISCLAIMER
41
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "termcast",
3
- "version": "1.3.54",
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'