goke 6.9.0 → 6.11.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 (40) hide show
  1. package/dist/__test__/completions.test.d.ts +9 -0
  2. package/dist/__test__/completions.test.d.ts.map +1 -0
  3. package/dist/__test__/completions.test.js +774 -0
  4. package/dist/__test__/index.test.js +436 -308
  5. package/dist/__test__/just-bash.test.js +7 -7
  6. package/dist/__test__/readme-examples.test.js +149 -13
  7. package/dist/__test__/types.test-d.js +27 -0
  8. package/dist/agents.d.ts +38 -0
  9. package/dist/agents.d.ts.map +1 -0
  10. package/dist/agents.js +63 -0
  11. package/dist/completions.d.ts +88 -0
  12. package/dist/completions.d.ts.map +1 -0
  13. package/dist/completions.js +315 -0
  14. package/dist/goke.d.ts +95 -5
  15. package/dist/goke.d.ts.map +1 -1
  16. package/dist/goke.js +487 -4
  17. package/dist/index.d.ts +9 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +8 -1
  20. package/dist/just-bash.d.ts.map +1 -1
  21. package/dist/just-bash.js +1 -2
  22. package/dist/runtime-browser.d.ts +1 -1
  23. package/dist/runtime-browser.d.ts.map +1 -1
  24. package/dist/runtime-browser.js +1 -1
  25. package/dist/runtime-node.d.ts +1 -1
  26. package/dist/runtime-node.d.ts.map +1 -1
  27. package/dist/runtime-node.js +22 -13
  28. package/package.json +1 -1
  29. package/src/__test__/completions.test.ts +902 -0
  30. package/src/__test__/index.test.ts +471 -308
  31. package/src/__test__/just-bash.test.ts +7 -7
  32. package/src/__test__/readme-examples.test.ts +161 -13
  33. package/src/__test__/types.test-d.ts +27 -0
  34. package/src/agents.ts +101 -0
  35. package/src/completions.ts +363 -0
  36. package/src/goke.ts +540 -8
  37. package/src/index.ts +11 -2
  38. package/src/just-bash.ts +1 -2
  39. package/src/runtime-browser.ts +1 -1
  40. package/src/runtime-node.ts +19 -11
@@ -2,7 +2,7 @@
2
2
  * Node.js runtime bindings for goke core.
3
3
  */
4
4
 
5
- import { execSync } from 'child_process'
5
+ import { exec } from 'child_process'
6
6
  import { EventEmitter } from 'events'
7
7
  import * as nodeFs from 'node:fs/promises'
8
8
  import type { GokeFs } from './goke-fs.js'
@@ -10,22 +10,30 @@ import type { GokeFs } from './goke-fs.js'
10
10
  const process = globalThis.process
11
11
  const fs: GokeFs = nodeFs
12
12
 
13
- function openInBrowser(url: string): void {
13
+ async function openInBrowser(url: string): Promise<void> {
14
14
  if (!process.stdout.isTTY) {
15
- process.stdout.write(url + '\n')
15
+ process.stderr.write(url + '\n')
16
16
  return
17
17
  }
18
18
 
19
+ let cmd: string
20
+ if (process.platform === 'darwin') {
21
+ cmd = `open ${JSON.stringify(url)}`
22
+ } else if (process.platform === 'win32') {
23
+ cmd = `start "" ${JSON.stringify(url)}`
24
+ } else {
25
+ cmd = `xdg-open ${JSON.stringify(url)}`
26
+ }
27
+
19
28
  try {
20
- if (process.platform === 'darwin') {
21
- execSync(`open ${JSON.stringify(url)}`, { stdio: 'ignore' })
22
- } else if (process.platform === 'win32') {
23
- execSync(`start "" ${JSON.stringify(url)}`, { stdio: 'ignore' })
24
- } else {
25
- execSync(`xdg-open ${JSON.stringify(url)}`, { stdio: 'ignore' })
26
- }
29
+ await new Promise<void>((resolve, reject) => {
30
+ exec(cmd, { stdio: 'ignore' } as any, (err) => {
31
+ if (err) reject(err)
32
+ else resolve()
33
+ })
34
+ })
27
35
  } catch {
28
- process.stdout.write(url + '\n')
36
+ process.stderr.write(url + '\n')
29
37
  }
30
38
  }
31
39