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
@@ -1,29 +1,38 @@
1
1
  /**
2
2
  * Node.js runtime bindings for goke core.
3
3
  */
4
- import { execSync } from 'child_process';
4
+ import { exec } from 'child_process';
5
5
  import { EventEmitter } from 'events';
6
6
  import * as nodeFs from 'node:fs/promises';
7
7
  const process = globalThis.process;
8
8
  const fs = nodeFs;
9
- function openInBrowser(url) {
9
+ async function openInBrowser(url) {
10
10
  if (!process.stdout.isTTY) {
11
- process.stdout.write(url + '\n');
11
+ process.stderr.write(url + '\n');
12
12
  return;
13
13
  }
14
+ let cmd;
15
+ if (process.platform === 'darwin') {
16
+ cmd = `open ${JSON.stringify(url)}`;
17
+ }
18
+ else if (process.platform === 'win32') {
19
+ cmd = `start "" ${JSON.stringify(url)}`;
20
+ }
21
+ else {
22
+ cmd = `xdg-open ${JSON.stringify(url)}`;
23
+ }
14
24
  try {
15
- if (process.platform === 'darwin') {
16
- execSync(`open ${JSON.stringify(url)}`, { stdio: 'ignore' });
17
- }
18
- else if (process.platform === 'win32') {
19
- execSync(`start "" ${JSON.stringify(url)}`, { stdio: 'ignore' });
20
- }
21
- else {
22
- execSync(`xdg-open ${JSON.stringify(url)}`, { stdio: 'ignore' });
23
- }
25
+ await new Promise((resolve, reject) => {
26
+ exec(cmd, { stdio: 'ignore' }, (err) => {
27
+ if (err)
28
+ reject(err);
29
+ else
30
+ resolve();
31
+ });
32
+ });
24
33
  }
25
34
  catch {
26
- process.stdout.write(url + '\n');
35
+ process.stderr.write(url + '\n');
27
36
  }
28
37
  }
29
38
  export { EventEmitter, fs, openInBrowser, process };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goke",
3
- "version": "6.9.0",
3
+ "version": "6.11.0",
4
4
  "type": "module",
5
5
  "description": "Simple yet powerful framework for building command-line apps. Inspired by cac.",
6
6
  "repository": {