gennady 0.8.4-draft.2 → 0.8.4-draft.3

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 (146) hide show
  1. package/ai/directives/sdd-v2/root.directive.xml +36 -3
  2. package/ai/directives/sdd-v2/router.directive.xml +22 -1
  3. package/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
  4. package/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
  5. package/ai/skills/agent-inbox/SKILL.md +1 -1
  6. package/ai/skills/sdd/SKILL.md +5 -3
  7. package/ai/skills/sdd-audit/SKILL.md +5 -2
  8. package/ai/skills/sdd-check/SKILL.md +2 -2
  9. package/ai/skills/sdd-code-review/SKILL.md +4 -1
  10. package/ai/skills/sdd-critic/SKILL.md +5 -2
  11. package/ai/skills/sdd-execute/SKILL.md +5 -2
  12. package/ai/skills/sdd-reconcile/SKILL.md +5 -2
  13. package/ai/skills/sdd-scaffold/SKILL.md +5 -2
  14. package/dist/ai/directives/sdd-v2/root.directive.xml +36 -3
  15. package/dist/ai/directives/sdd-v2/router.directive.xml +22 -1
  16. package/dist/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
  17. package/dist/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
  18. package/dist/ai/skills/agent-inbox/SKILL.md +1 -1
  19. package/dist/ai/skills/sdd/SKILL.md +5 -3
  20. package/dist/ai/skills/sdd-audit/SKILL.md +5 -2
  21. package/dist/ai/skills/sdd-check/SKILL.md +2 -2
  22. package/dist/ai/skills/sdd-code-review/SKILL.md +4 -1
  23. package/dist/ai/skills/sdd-critic/SKILL.md +5 -2
  24. package/dist/ai/skills/sdd-execute/SKILL.md +5 -2
  25. package/dist/ai/skills/sdd-reconcile/SKILL.md +5 -2
  26. package/dist/ai/skills/sdd-scaffold/SKILL.md +5 -2
  27. package/dist/chunks/{classify-mr-stage.logic-BiCHTmPp.js → classify-mr-stage.logic-CazmQDwZ.js} +2 -2
  28. package/dist/chunks/{config-index-9VHWSDQD.js → config-index-DU8-FEjq.js} +1 -1
  29. package/dist/chunks/{devtools-b0DwO1x_.js → devtools-1JmXJjUG.js} +1 -1
  30. package/dist/chunks/{eval.cmd-CwNPaNJd.js → eval.cmd-CBANnOFG.js} +1 -1
  31. package/dist/chunks/{help-D5cXtdMI.js → help-DVloaFF5.js} +1 -1
  32. package/dist/chunks/{index-BVnJEutp.js → index-2xhpqJtd.js} +2 -2
  33. package/dist/chunks/{index-RR5OUxje.js → index-AxsLBUAx.js} +14 -14
  34. package/dist/chunks/{index-CUkeTGqM.js → index-B7sydB0W.js} +2 -2
  35. package/dist/chunks/{index-CMCn9ErF.js → index-BKxk4zOz.js} +2 -2
  36. package/dist/chunks/{index-Db13NlHh.js → index-BNMmX_Mv.js} +21 -21
  37. package/dist/chunks/{index-CmQO-RmM.js → index-BPzldG3a.js} +2 -2
  38. package/dist/chunks/{index-BOQl7F_Z.js → index-BQlFDvKW.js} +2 -2
  39. package/dist/chunks/{index-RzkvIfJQ.js → index-Baq7RL1L.js} +3 -3
  40. package/dist/chunks/index-BbPiwvY9.js +2 -0
  41. package/dist/chunks/{index-ClJLPEUB.js → index-BreGNLJ_.js} +1 -1
  42. package/dist/chunks/{index-DjSafAkN.js → index-BslPwGtM.js} +2 -2
  43. package/dist/chunks/{index-DiMFxS0z.js → index-BtCUN2fZ.js} +16 -16
  44. package/dist/chunks/{index-CS0VbiLD.js → index-C10-EOdB.js} +1 -1
  45. package/dist/chunks/{index-2BOEcJIa.js → index-C4JmZLaj.js} +2 -2
  46. package/dist/chunks/index-CA-JKLr4.js +2 -0
  47. package/dist/chunks/{index-43GiH--T.js → index-CG_jJZVu.js} +2 -2
  48. package/dist/chunks/{index-BdkFKsMm.js → index-CGyP2uDE.js} +3 -3
  49. package/dist/chunks/{index-BOKv0b01.js → index-CPl1s9XJ.js} +2 -2
  50. package/dist/chunks/{index-DIPrBH-4.js → index-CSxE4cEm.js} +9 -9
  51. package/dist/chunks/{index-Cm7U1-fU.js → index-CWR5EzXx.js} +2 -2
  52. package/dist/chunks/{index-BwN5llCR.js → index-Camql5kL.js} +2 -2
  53. package/dist/chunks/{index-Drh-J9O7.js → index-CdUiTipO.js} +7 -7
  54. package/dist/chunks/{index-Cn029KTN.js → index-Crg61pK5.js} +2 -2
  55. package/dist/chunks/{index-Dja2O-hV.js → index-Cv9ZYXso.js} +1 -1
  56. package/dist/chunks/{index-Ck8v_Gv7.js → index-D7ADMlG3.js} +1 -1
  57. package/dist/chunks/index-DNl2gC8l.js +158 -0
  58. package/dist/chunks/{index-BYIzl-Ut.js → index-DVJA0qVm.js} +36 -36
  59. package/dist/chunks/{index-BAEIZVx0.js → index-DcFJhkY1.js} +2 -2
  60. package/dist/chunks/{index-Dx5_CB2E.js → index-DdEd-L3x.js} +2 -2
  61. package/dist/chunks/{index-DVmqMmgb.js → index-DkGA1eW_.js} +32 -32
  62. package/dist/chunks/{index-3k7mPX1e.js → index-Dnwxlti3.js} +1 -1
  63. package/dist/chunks/{index-CrizvxOJ.js → index-DqdEJDi2.js} +2 -2
  64. package/dist/chunks/{index-BIPebtDl.js → index-DqiwmBt4.js} +1 -1
  65. package/dist/chunks/{index-DS4MhAw-.js → index-PfuqBWjY.js} +2 -2
  66. package/dist/chunks/{index-BmFT1Kx2.js → index-SVP6RfVl.js} +2 -2
  67. package/dist/chunks/{index-CDxV4b81.js → index-Y8wu48Q0.js} +1 -1
  68. package/dist/chunks/index-_ewSKppm.js +2 -0
  69. package/dist/chunks/{index-Ctcr_Qeu.js → index-aBVtCLIJ.js} +2 -2
  70. package/dist/chunks/index-dNdz9j6d.js +2 -0
  71. package/dist/chunks/{index-BFUkVkSo.js → index-gskOpu3H.js} +16 -16
  72. package/dist/chunks/{index-CXpkT25O.js → index-pBSLMn5Q.js} +3 -3
  73. package/dist/chunks/index-sqPhX5Io.js +2 -0
  74. package/dist/chunks/{index-BzmR4Es2.js → index-vfrjhUD1.js} +39 -39
  75. package/dist/chunks/{index-J2NvjjDV.js → index-xGF5XC_i.js} +2 -2
  76. package/dist/chunks/{run-review-command.logic-CA2Rjymb.js → run-review-command.logic-B9GoCxh-.js} +24 -24
  77. package/dist/chunks/{serve.cmd-RxYS6WoN.js → serve.cmd-UXkaeaPI.js} +2 -2
  78. package/dist/chunks/{services-Csd556Tv.js → services-BYCeGBlO.js} +4 -4
  79. package/dist/chunks/{shared-B5CTGvpG.js → shared-B3cXL2Np.js} +1178 -1117
  80. package/dist/chunks/{stats-index-BLztvK69.js → stats-index-AIAnnp9S.js} +2 -2
  81. package/dist/gennady.js +46 -46
  82. package/dist/index.js +4 -4
  83. package/dist/shared/sdd/ladder.d.ts +42 -0
  84. package/dist/shared/sdd/module-specs.d.ts +7 -0
  85. package/dist/shared/sdd/tracker.d.ts +9 -0
  86. package/package.json +1 -1
  87. package/dist/chunks/classify-mr-stage.logic-ClmhzQPQ.js +0 -53
  88. package/dist/chunks/config-index-RFeqlDWs.js +0 -104
  89. package/dist/chunks/devtools-p8tmPuLn.js +0 -79
  90. package/dist/chunks/eval.cmd-ewU5lcUY.js +0 -34
  91. package/dist/chunks/help-DzGnMNi2.js +0 -7
  92. package/dist/chunks/index--AXFi0ty.js +0 -89
  93. package/dist/chunks/index-64TSesTc.js +0 -186
  94. package/dist/chunks/index-9Gv5trS_.js +0 -125
  95. package/dist/chunks/index-B1DQIryA.js +0 -2
  96. package/dist/chunks/index-B1PiBeQ3.js +0 -2
  97. package/dist/chunks/index-B4rzuhkt.js +0 -183
  98. package/dist/chunks/index-B97HJjkg.js +0 -159
  99. package/dist/chunks/index-BF6qypm0.js +0 -131
  100. package/dist/chunks/index-BK84ZQsh.js +0 -128
  101. package/dist/chunks/index-BRVIirjj.js +0 -141
  102. package/dist/chunks/index-BXnryCGW.js +0 -96
  103. package/dist/chunks/index-BaZm7Otb.js +0 -2
  104. package/dist/chunks/index-Bhk746A2.js +0 -129
  105. package/dist/chunks/index-Bi-eY_dY.js +0 -164
  106. package/dist/chunks/index-BjumU69g.js +0 -2
  107. package/dist/chunks/index-BkWXcpXU.js +0 -16979
  108. package/dist/chunks/index-BlY4jQIA.js +0 -168
  109. package/dist/chunks/index-C0iy7GxD.js +0 -140
  110. package/dist/chunks/index-CCBTXczb.js +0 -56
  111. package/dist/chunks/index-CDAfkSrr.js +0 -2
  112. package/dist/chunks/index-CDHymWzC.js +0 -102
  113. package/dist/chunks/index-CNfXJAao.js +0 -2
  114. package/dist/chunks/index-CQsae1nq.js +0 -207
  115. package/dist/chunks/index-CVmd0prf.js +0 -2
  116. package/dist/chunks/index-CZuTNeNm.js +0 -2
  117. package/dist/chunks/index-CasNhhrL.js +0 -96
  118. package/dist/chunks/index-Ce7GWENF.js +0 -377
  119. package/dist/chunks/index-Cf-02TAg.js +0 -265
  120. package/dist/chunks/index-CfjQWSrh.js +0 -52
  121. package/dist/chunks/index-Chr7gBBz.js +0 -443
  122. package/dist/chunks/index-Ci875Zlg.js +0 -346
  123. package/dist/chunks/index-CwA6RzIB.js +0 -3793
  124. package/dist/chunks/index-D1dI63ej.js +0 -46
  125. package/dist/chunks/index-DCS32A2i.js +0 -663
  126. package/dist/chunks/index-DOFoNxvb.js +0 -131
  127. package/dist/chunks/index-DVkCEuws.js +0 -136
  128. package/dist/chunks/index-DkadaaXq.js +0 -658
  129. package/dist/chunks/index-Dn11CLtk.js +0 -7
  130. package/dist/chunks/index-Do3spFJT.js +0 -340
  131. package/dist/chunks/index-DrFRZ0Yg.js +0 -2
  132. package/dist/chunks/index-DvEQhXi2.js +0 -1054
  133. package/dist/chunks/index-GiS0x6jg.js +0 -90
  134. package/dist/chunks/index-NacvqeQ5.js +0 -69
  135. package/dist/chunks/index-RNJhFzdr.js +0 -227
  136. package/dist/chunks/index-R_vUB6CL.js +0 -2
  137. package/dist/chunks/index-TQft1s5H.js +0 -20
  138. package/dist/chunks/index-ZmQRP38W.js +0 -26969
  139. package/dist/chunks/index-jdOZ4AkD.js +0 -143
  140. package/dist/chunks/index-kNa21kUI.js +0 -279
  141. package/dist/chunks/index-v4AV9kAc.js +0 -108
  142. package/dist/chunks/run-review-command.logic-CU1Slmc_.js +0 -331
  143. package/dist/chunks/serve.cmd-dWu_k_G_.js +0 -162
  144. package/dist/chunks/services-CwvXl2MB.js +0 -46832
  145. package/dist/chunks/shared-DSZTUx5b.js +0 -4509
  146. package/dist/chunks/stats-index-H6ALcjxy.js +0 -66
@@ -1,443 +0,0 @@
1
- import l from "node:process";
2
- import k from "node:path";
3
- import { fileURLToPath as D } from "node:url";
4
- import L, { execFile as B } from "node:child_process";
5
- import E, { constants as O } from "node:fs/promises";
6
- import { promisify as h } from "node:util";
7
- import z from "node:os";
8
- import g from "node:fs";
9
- import { Buffer as X } from "node:buffer";
10
- import { p as G } from "./shared-DSZTUx5b.js";
11
- import { ao as K } from "./services-CwvXl2MB.js";
12
- let F;
13
- function q() {
14
- try {
15
- return g.statSync("/.dockerenv"), !0;
16
- } catch {
17
- return !1;
18
- }
19
- }
20
- function V() {
21
- try {
22
- return g.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
23
- } catch {
24
- return !1;
25
- }
26
- }
27
- function Y() {
28
- return F === void 0 && (F = q() || V()), F;
29
- }
30
- let _;
31
- const J = () => {
32
- try {
33
- return g.statSync("/run/.containerenv"), !0;
34
- } catch {
35
- return !1;
36
- }
37
- };
38
- function b() {
39
- return _ === void 0 && (_ = J() || Y()), _;
40
- }
41
- const T = () => {
42
- if (l.platform !== "linux")
43
- return !1;
44
- if (z.release().toLowerCase().includes("microsoft"))
45
- return !b();
46
- try {
47
- if (g.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft"))
48
- return !b();
49
- } catch {
50
- }
51
- return g.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || g.existsSync("/run/WSL") ? !b() : !1;
52
- }, p = l.env.__IS_WSL_TEST__ ? T : T(), Q = h(L.execFile), N = () => `${l.env.SYSTEMROOT || l.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, f = async (e, r = {}) => {
53
- const {
54
- powerShellPath: o,
55
- ...t
56
- } = r, n = f.encodeCommand(e);
57
- return Q(
58
- o ?? N(),
59
- [
60
- ...f.argumentsPrefix,
61
- n
62
- ],
63
- {
64
- encoding: "utf8",
65
- ...t
66
- }
67
- );
68
- };
69
- f.argumentsPrefix = [
70
- "-NoProfile",
71
- "-NonInteractive",
72
- "-ExecutionPolicy",
73
- "Bypass",
74
- "-EncodedCommand"
75
- ];
76
- f.encodeCommand = (e) => X.from(e, "utf16le").toString("base64");
77
- f.escapeArgument = (e) => `'${String(e).replaceAll("'", "''")}'`;
78
- function Z(e) {
79
- for (const r of e.split(`
80
- `)) {
81
- if (/^\s*#/.test(r))
82
- continue;
83
- const o = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(r);
84
- if (o)
85
- return o.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
86
- }
87
- }
88
- const j = h(L.execFile), ee = /* @__PURE__ */ (() => {
89
- const e = "/mnt/";
90
- let r;
91
- return async function() {
92
- if (r)
93
- return r;
94
- const o = "/etc/wsl.conf";
95
- let t = !1;
96
- try {
97
- await E.access(o, O.F_OK), t = !0;
98
- } catch {
99
- }
100
- if (!t)
101
- return e;
102
- const n = await E.readFile(o, { encoding: "utf8" }), s = Z(n);
103
- return s === void 0 ? e : (r = s, r = r.endsWith("/") ? r : `${r}/`, r);
104
- };
105
- })(), re = async () => `${await ee()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`, M = p ? re : N;
106
- let $;
107
- const oe = async () => ($ ??= (async () => {
108
- try {
109
- const e = await M();
110
- return await E.access(e, O.X_OK), !0;
111
- } catch {
112
- return !1;
113
- }
114
- })(), $), te = async () => {
115
- const e = await M(), r = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { stdout: o } = await f(r, { powerShellPath: e });
116
- return o.trim();
117
- }, ne = async (e) => {
118
- if (/^[a-z]+:\/\//i.test(e))
119
- return e;
120
- try {
121
- const { stdout: r } = await j("wslpath", ["-aw", e], { encoding: "utf8" });
122
- return r.trim();
123
- } catch {
124
- return e;
125
- }
126
- };
127
- function y(e, r, o) {
128
- const t = (n) => Object.defineProperty(e, r, { value: n, enumerable: !0, writable: !0 });
129
- return Object.defineProperty(e, r, {
130
- configurable: !0,
131
- enumerable: !0,
132
- get() {
133
- const n = o();
134
- return t(n), n;
135
- },
136
- set(n) {
137
- t(n);
138
- }
139
- }), e;
140
- }
141
- const se = h(B);
142
- async function ae() {
143
- if (l.platform !== "darwin")
144
- throw new Error("macOS only");
145
- const { stdout: e } = await se("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]), o = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id ?? "com.apple.Safari";
146
- return o === "com.apple.safari" ? "com.apple.Safari" : o;
147
- }
148
- const ie = h(B);
149
- async function ce(e, { humanReadableOutput: r = !0, signal: o } = {}) {
150
- if (l.platform !== "darwin")
151
- throw new Error("macOS only");
152
- const t = r ? [] : ["-ss"], n = {};
153
- o && (n.signal = o);
154
- const { stdout: s } = await ie("osascript", ["-e", e, t], n);
155
- return s.trim();
156
- }
157
- async function le(e) {
158
- return ce(`tell application "Finder" to set app_path to application file id "${e}" as string
159
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
160
- }
161
- const me = h(B), C = {
162
- MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
163
- // The missing `L` is correct.
164
- MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
165
- MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
166
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
167
- ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
168
- ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
169
- ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
170
- ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
171
- BraveHTML: { name: "Brave", id: "com.brave.Browser" },
172
- BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
173
- BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
174
- BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
175
- FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
176
- OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
177
- VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
178
- "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
179
- }, fe = new Map(Object.entries(C));
180
- class ue extends Error {
181
- }
182
- async function de(e = me) {
183
- const { stdout: r } = await e("reg", [
184
- "QUERY",
185
- " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
186
- "/v",
187
- "ProgId"
188
- ]), o = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);
189
- if (!o)
190
- throw new ue(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);
191
- const { id: t } = o.groups, n = t.lastIndexOf("."), s = t.lastIndexOf("-"), u = n === -1 ? void 0 : t.slice(0, n), d = s === -1 ? void 0 : t.slice(0, s);
192
- return C[t] ?? C[u] ?? C[d] ?? { name: t, id: t };
193
- }
194
- const pe = h(B), we = (e) => e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (r) => r.toUpperCase());
195
- async function ge() {
196
- if (l.platform === "darwin") {
197
- const e = await ae();
198
- return { name: await le(e), id: e };
199
- }
200
- if (l.platform === "linux") {
201
- const { stdout: e } = await pe("xdg-mime", ["query", "default", "x-scheme-handler/http"]), r = e.trim();
202
- return { name: we(r.replace(/.desktop$/, "").replace("-", " ")), id: r };
203
- }
204
- if (l.platform === "win32")
205
- return de();
206
- throw new Error("Only macOS, Linux, and Windows are supported");
207
- }
208
- const he = !!(l.env.SSH_CONNECTION || l.env.SSH_CLIENT || l.env.SSH_TTY), P = Symbol("fallbackAttempt"), I = import.meta.url ? k.dirname(D(import.meta.url)) : "", U = k.join(I, "xdg-open"), { platform: w, arch: H } = l, W = async (e, r) => {
209
- if (e.length === 0)
210
- return;
211
- const o = [];
212
- for (const t of e)
213
- try {
214
- return await r(t);
215
- } catch (n) {
216
- o.push(n);
217
- }
218
- throw new AggregateError(o, "Failed to open in all supported apps");
219
- }, A = async (e) => {
220
- e = {
221
- wait: !1,
222
- background: !1,
223
- newInstance: !1,
224
- allowNonzeroExitCode: !1,
225
- ...e
226
- };
227
- const r = e[P] === !0;
228
- if (delete e[P], Array.isArray(e.app))
229
- return W(e.app, (a) => A({
230
- ...e,
231
- app: a,
232
- [P]: !0
233
- }));
234
- let { name: o, arguments: t = [] } = e.app ?? {};
235
- if (t = [...t], Array.isArray(o))
236
- return W(o, (a) => A({
237
- ...e,
238
- app: {
239
- name: a,
240
- arguments: t
241
- },
242
- [P]: !0
243
- }));
244
- if (o === "browser" || o === "browserPrivate") {
245
- const a = {
246
- "com.google.chrome": "chrome",
247
- "google-chrome.desktop": "chrome",
248
- "com.brave.browser": "brave",
249
- "org.mozilla.firefox": "firefox",
250
- "firefox.desktop": "firefox",
251
- "com.microsoft.msedge": "edge",
252
- "com.microsoft.edge": "edge",
253
- "com.microsoft.edgemac": "edge",
254
- "microsoft-edge.desktop": "edge",
255
- "com.apple.safari": "safari"
256
- }, i = {
257
- chrome: "--incognito",
258
- brave: "--incognito",
259
- firefox: "--private-window",
260
- edge: "--inPrivate"
261
- // Safari doesn't support private mode via command line
262
- };
263
- let m;
264
- if (p) {
265
- const x = await te();
266
- m = fe.get(x) ?? {};
267
- } else
268
- m = await ge();
269
- if (m.id in a) {
270
- const x = a[m.id.toLowerCase()];
271
- if (o === "browserPrivate") {
272
- if (x === "safari")
273
- throw new Error("Safari doesn't support opening in private mode via command line");
274
- t.push(i[x]);
275
- }
276
- return A({
277
- ...e,
278
- app: {
279
- name: v[x],
280
- arguments: t
281
- }
282
- });
283
- }
284
- throw new Error(`${m.name} is not supported as a default browser`);
285
- }
286
- let n;
287
- const s = [], u = {};
288
- let d = !1;
289
- if (p && !b() && !he && !o && (d = await oe()), w === "darwin")
290
- n = "open", e.wait && s.push("--wait-apps"), e.background && s.push("--background"), e.newInstance && s.push("--new"), o && s.push("-a", o);
291
- else if (w === "win32" || d) {
292
- n = await M(), s.push(...f.argumentsPrefix), p || (u.windowsVerbatimArguments = !0), p && e.target && (e.target = await ne(e.target));
293
- const a = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
294
- e.wait && a.push("-Wait"), o ? (a.push(f.escapeArgument(o)), e.target && t.push(e.target)) : e.target && a.push(f.escapeArgument(e.target)), t.length > 0 && (t = t.map((i) => f.escapeArgument(i)), a.push("-ArgumentList", t.join(","))), e.target = f.encodeCommand(a.join(" ")), e.wait || (u.stdio = "ignore");
295
- } else {
296
- if (o)
297
- n = o;
298
- else {
299
- const a = !I || I === "/";
300
- let i = !1;
301
- try {
302
- await E.access(U, O.X_OK), i = !0;
303
- } catch {
304
- }
305
- n = l.versions.electron ?? (w === "android" || a || !i) ? "xdg-open" : U;
306
- }
307
- t.length > 0 && s.push(...t), e.wait || (u.stdio = "ignore", u.detached = !0);
308
- }
309
- w === "darwin" && t.length > 0 && s.push("--args", ...t), e.target && s.push(e.target);
310
- const c = L.spawn(n, s, u);
311
- return e.wait ? new Promise((a, i) => {
312
- c.once("error", i), c.once("close", (m) => {
313
- if (!e.allowNonzeroExitCode && m !== 0) {
314
- i(new Error(`Exited with code ${m}`));
315
- return;
316
- }
317
- a(c);
318
- });
319
- }) : r ? new Promise((a, i) => {
320
- c.once("error", i), c.once("spawn", () => {
321
- c.once("close", (m) => {
322
- if (c.off("error", i), m !== 0) {
323
- i(new Error(`Exited with code ${m}`));
324
- return;
325
- }
326
- c.unref(), a(c);
327
- });
328
- });
329
- }) : (c.unref(), new Promise((a, i) => {
330
- c.once("error", i), c.once("spawn", () => {
331
- c.off("error", i), a(c);
332
- });
333
- }));
334
- }, ve = (e, r) => {
335
- if (typeof e != "string")
336
- throw new TypeError("Expected a `target`");
337
- return A({
338
- ...r,
339
- target: e
340
- });
341
- };
342
- function R(e) {
343
- if (typeof e == "string" || Array.isArray(e))
344
- return e;
345
- const { [H]: r } = e;
346
- if (!r)
347
- throw new Error(`${H} is not supported`);
348
- return r;
349
- }
350
- function S({ [w]: e }, { wsl: r } = {}) {
351
- if (r && p)
352
- return R(r);
353
- if (!e)
354
- throw new Error(`${w} is not supported`);
355
- return R(e);
356
- }
357
- const v = {
358
- browser: "browser",
359
- browserPrivate: "browserPrivate"
360
- };
361
- y(v, "chrome", () => S({
362
- darwin: "google chrome",
363
- win32: "chrome",
364
- // `chromium-browser` is the older deb package name used by Ubuntu/Debian before snap.
365
- linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
366
- }, {
367
- wsl: {
368
- ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
369
- x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
370
- }
371
- }));
372
- y(v, "brave", () => S({
373
- darwin: "brave browser",
374
- win32: "brave",
375
- linux: ["brave-browser", "brave"]
376
- }, {
377
- wsl: {
378
- ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
379
- x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
380
- }
381
- }));
382
- y(v, "firefox", () => S({
383
- darwin: "firefox",
384
- win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
385
- linux: "firefox"
386
- }, {
387
- wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
388
- }));
389
- y(v, "edge", () => S({
390
- darwin: "microsoft edge",
391
- win32: "msedge",
392
- linux: ["microsoft-edge", "microsoft-edge-dev"]
393
- }, {
394
- wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
395
- }));
396
- y(v, "safari", () => S({
397
- darwin: "Safari"
398
- }));
399
- async function xe(e, r = {
400
- startServer: K,
401
- openBrowser: ve,
402
- info: (...o) => console.info(...o),
403
- warn: (...o) => console.warn(...o)
404
- }) {
405
- const o = ye(e), t = await r.startServer({
406
- port: o.port ?? 43001,
407
- host: o.host,
408
- exitCode: 0
409
- });
410
- if (r.info(`[remote-console] listening on ${t.url}`), r.info("[remote-console] browser client: remoteConsoleClient.connect(console, { url })"), !!o.url)
411
- try {
412
- const n = Se(o.url);
413
- await r.openBrowser(n), r.info(`[remote-console] opened ${n}`);
414
- } catch (n) {
415
- r.warn("[remote-console] failed to open browser URL, server is still running", { cause: n });
416
- }
417
- }
418
- function ye(e) {
419
- const r = G(e, {
420
- port: ["port", "p"],
421
- host: ["host"],
422
- url: ["url"]
423
- }), o = r.port, t = r.host, n = r.url, s = e.slice(2).find((d) => d.startsWith("--url=") || d.startsWith("-url=")), u = s ? s.slice(s.indexOf("=") + 1) : void 0;
424
- return {
425
- port: typeof o == "string" ? Number(o) : void 0,
426
- host: typeof t == "string" ? t : void 0,
427
- url: u ?? (typeof n == "string" ? n : void 0)
428
- };
429
- }
430
- function Se(e) {
431
- try {
432
- const r = new URL(e);
433
- return r.searchParams.set("__remote_console__", "1"), r.toString();
434
- } catch (r) {
435
- throw new Error(
436
- "[composeRemoteConsoleActivationUrl] Invalid --url value: expected absolute URL",
437
- {
438
- cause: r
439
- }
440
- );
441
- }
442
- }
443
- await xe(process.argv);