binary-collections 2.0.11 → 2.0.12

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 (225) hide show
  1. package/.opencode/package.json +5 -0
  2. package/binaries/rmx +15 -1
  3. package/binaries/rmx.cmd +12 -0
  4. package/binaries/test-cjs +9 -1
  5. package/binaries/test-cjs.cmd +16 -1
  6. package/binaries/test-esm +16 -0
  7. package/binaries/test-esm.cjs +178 -0
  8. package/binaries/test-esm.cmd +23 -0
  9. package/binaries/yarn-clean +1 -1
  10. package/binaries/yarn-clean.cmd +1 -1
  11. package/binaries/yarn-clean.py +33 -15
  12. package/binaries/yc +110 -0
  13. package/binaries/yc.cjs +178 -0
  14. package/lib/binary-collections/config.cjs +126 -0
  15. package/lib/binary-collections/config.mjs +7 -0
  16. package/lib/binary-collections/executeScript.cjs +19 -0
  17. package/lib/binary-collections/executeScript.d.cts +12 -0
  18. package/lib/binary-collections/executeScript.mjs +6 -0
  19. package/lib/binary-collections/findScript.cjs +284 -0
  20. package/lib/binary-collections/findScript.d.cts +12 -0
  21. package/lib/binary-collections/findScript.mjs +7 -0
  22. package/lib/binary-collections/listScript.cjs +266 -0
  23. package/lib/binary-collections/listScript.d.cts +19 -0
  24. package/lib/binary-collections/listScript.mjs +7 -0
  25. package/lib/binary-collections.cjs +224 -137
  26. package/lib/binary-collections.mjs +22 -282
  27. package/lib/changelog.cjs +2 -2
  28. package/lib/changelog.mjs +1 -1
  29. package/lib/{chunk-AJDD5DZM.mjs → chunk-2LSRSEXF.mjs} +1 -1
  30. package/lib/{chunk-Z6JLYU2J.mjs → chunk-5RTXZVCW.mjs} +2 -2
  31. package/lib/{chunk-XA3SNBPA.mjs → chunk-66KDU4TX.mjs} +93 -9
  32. package/lib/chunk-6PU7BAHB.mjs +61 -0
  33. package/lib/chunk-C6D2TTYU.mjs +32 -0
  34. package/lib/chunk-FB2WKVJD.mjs +158 -0
  35. package/lib/{chunk-NCXAP7AA.mjs → chunk-G5UUEWUO.mjs} +9 -5
  36. package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
  37. package/lib/chunk-H44UWUFY.mjs +105 -0
  38. package/lib/chunk-NCZPTKDV.mjs +79 -0
  39. package/lib/chunk-NGFK3EYW.mjs +28 -0
  40. package/lib/chunk-NVEG3LEZ.mjs +143 -0
  41. package/lib/chunk-OGXVGBRI.mjs +29 -0
  42. package/lib/chunk-OXV52GD5.mjs +62 -0
  43. package/lib/chunk-PXBMHE7O.mjs +35 -0
  44. package/lib/chunk-R5FJOR63.mjs +47 -0
  45. package/lib/chunk-SPTECFE5.mjs +180 -0
  46. package/lib/chunk-UXCFNAR6.mjs +55 -0
  47. package/lib/chunk-V2IBPCEV.mjs +39 -0
  48. package/lib/chunk-XPJGCDOD.mjs +14 -0
  49. package/lib/chunk-ZOWVMII3.mjs +228 -0
  50. package/lib/clean-github-actions-caches-cli.cjs +465 -0
  51. package/lib/clean-github-actions-caches-cli.d.cts +1 -0
  52. package/lib/clean-github-actions-caches-cli.mjs +56 -0
  53. package/lib/clean-github-actions-caches.cjs +149 -205
  54. package/lib/clean-github-actions-caches.d.cts +15 -1
  55. package/lib/clean-github-actions-caches.mjs +4 -130
  56. package/lib/cross-env/command.cjs +63 -0
  57. package/lib/cross-env/command.d.ts +8 -0
  58. package/lib/cross-env/command.js +45 -0
  59. package/lib/cross-env/command.mjs +9 -0
  60. package/lib/cross-env/index.cjs +178 -0
  61. package/lib/cross-env/index.d.ts +8 -0
  62. package/lib/cross-env/index.js +102 -0
  63. package/lib/cross-env/index.mjs +101 -0
  64. package/lib/cross-env/variable.cjs +60 -0
  65. package/lib/cross-env/variable.d.ts +7 -0
  66. package/lib/cross-env/variable.js +59 -0
  67. package/lib/cross-env/variable.mjs +9 -0
  68. package/lib/del-gradle.cjs +2 -2
  69. package/lib/del-gradle.js +8 -8
  70. package/lib/del-gradle.mjs +1 -1
  71. package/lib/del-node-modules.js +24 -24
  72. package/lib/del-ps.cjs +2 -2
  73. package/lib/del-ps.js +8 -8
  74. package/lib/del-ps.mjs +1 -1
  75. package/lib/del-yarn-caches.cjs +2 -2
  76. package/lib/del-yarn-caches.js +2 -2
  77. package/lib/del-yarn-caches.mjs +1 -1
  78. package/lib/file/copy-cli.cjs +92 -0
  79. package/lib/file/copy-cli.d.mts +1 -0
  80. package/lib/file/copy-cli.mjs +55 -0
  81. package/lib/file/copy.cjs +56 -0
  82. package/lib/file/copy.d.mts +1 -0
  83. package/lib/file/copy.mjs +8 -0
  84. package/lib/file/move-cli.cjs +91 -0
  85. package/lib/file/move-cli.d.mts +1 -0
  86. package/lib/file/move-cli.mjs +55 -0
  87. package/lib/file/move.cjs +55 -0
  88. package/lib/file/move.d.mts +1 -0
  89. package/lib/file/move.mjs +8 -0
  90. package/lib/find-node-modules-cli.js +1 -1
  91. package/lib/free-chatgpt.cjs +21 -15
  92. package/lib/free-chatgpt.js +10 -10
  93. package/lib/free-chatgpt.mjs +2 -2
  94. package/lib/git/user-config.cjs +2 -2
  95. package/lib/git/user-config.mjs +2 -2
  96. package/lib/git-diff-cli.cjs +188 -42
  97. package/lib/git-diff-cli.mjs +5 -4
  98. package/lib/git-diff.cjs +188 -42
  99. package/lib/git-diff.d.ts +2 -1
  100. package/lib/git-diff.js +91 -34
  101. package/lib/git-diff.mjs +5 -4
  102. package/lib/git-fix.cjs +2 -2
  103. package/lib/git-fix.mjs +2 -2
  104. package/lib/git-purge.cjs +2 -2
  105. package/lib/git-purge.mjs +1 -1
  106. package/lib/index.d.ts +1 -1
  107. package/lib/kill-night-crows.cjs +7 -7
  108. package/lib/kill-night-crows.mjs +7 -7
  109. package/lib/node-cache-cleaner/npm.cjs +65 -0
  110. package/lib/node-cache-cleaner/npm.d.ts +2 -0
  111. package/lib/node-cache-cleaner/npm.js +41 -0
  112. package/lib/node-cache-cleaner/npm.mjs +10 -0
  113. package/lib/node-cache-cleaner/npx.cjs +89 -0
  114. package/lib/node-cache-cleaner/npx.d.ts +4 -0
  115. package/lib/node-cache-cleaner/npx.js +82 -0
  116. package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
  117. package/lib/node-cache-cleaner/yarn.cjs +73 -0
  118. package/lib/node-cache-cleaner/yarn.d.ts +2 -0
  119. package/lib/node-cache-cleaner/yarn.js +62 -0
  120. package/lib/node-cache-cleaner/yarn.mjs +10 -0
  121. package/lib/node-cache-cleaner-cli.cjs +182 -0
  122. package/lib/node-cache-cleaner-cli.d.ts +2 -0
  123. package/lib/node-cache-cleaner-cli.js +60 -0
  124. package/lib/node-cache-cleaner-cli.mjs +56 -0
  125. package/lib/node-executor.cjs +91 -0
  126. package/lib/node-executor.d.cts +2 -0
  127. package/lib/node-executor.mjs +103 -0
  128. package/lib/npm-run-series.cjs +21 -28
  129. package/lib/npm-run-series.mjs +20 -6
  130. package/lib/package-resolutions-updater-cli.cjs +213 -128
  131. package/lib/package-resolutions-updater-cli.mjs +17 -39
  132. package/lib/package-resolutions-updater.cjs +204 -98
  133. package/lib/package-resolutions-updater.d.mts +20 -1
  134. package/lib/package-resolutions-updater.mjs +7 -5
  135. package/lib/print-directory-tree.cjs +2 -2
  136. package/lib/print-directory-tree.mjs +1 -1
  137. package/lib/ps/connected-domain.js +10 -10
  138. package/lib/ps/index.cjs +1 -1
  139. package/lib/ps/index.mjs +177 -171
  140. package/lib/ps/isWin.js +1 -1
  141. package/lib/ps/table-parser.js +6 -6
  142. package/lib/remove-module.cjs +2 -2
  143. package/lib/remove-module.mjs +1 -1
  144. package/lib/rm-node-module-cli.cjs +222 -0
  145. package/lib/rm-node-module-cli.d.cts +1 -0
  146. package/lib/rm-node-module-cli.mjs +89 -0
  147. package/lib/rm-node-modules.cjs +127 -0
  148. package/lib/rm-node-modules.d.cts +35 -0
  149. package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
  150. package/lib/rmpath.cjs +2 -2
  151. package/lib/rmpath.mjs +1 -1
  152. package/lib/submodule-install.cjs +47 -34
  153. package/lib/submodule-install.mjs +46 -33
  154. package/lib/submodule-remove-cli.cjs +1 -2
  155. package/lib/submodule-remove-cli.js +3 -3
  156. package/lib/submodule-remove-cli.mjs +1 -2
  157. package/lib/utils/chatgpt.cjs +19 -13
  158. package/lib/utils/chatgpt.js +94 -94
  159. package/lib/utils/chatgpt.mjs +1 -1
  160. package/lib/utils/findEnvFiles.cjs +28 -46
  161. package/lib/utils/findEnvFiles.d.cts +19 -0
  162. package/lib/utils/findEnvFiles.mjs +3 -5
  163. package/lib/utils/findWorkspaceRoot.js +4 -4
  164. package/lib/utils/index.cjs +2 -2
  165. package/lib/utils/index.mjs +1 -1
  166. package/lib/utils/isGithubTokenValid.js +7 -7
  167. package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
  168. package/lib/utils/isWindows.d.ts +5 -0
  169. package/lib/utils/isWindows.js +10 -0
  170. package/lib/utils/isWindows.mjs +8 -0
  171. package/lib/utils/runBash.cjs +53 -0
  172. package/lib/utils/runBash.d.cts +12 -0
  173. package/lib/utils/runBash.mjs +66 -0
  174. package/lib/yarn-per-branch-lock-installer.cjs +97 -0
  175. package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
  176. package/lib/yarn-per-branch-lock-installer.mjs +109 -0
  177. package/lib/yarn-reinstall.cjs +2 -2
  178. package/lib/yarn-reinstall.mjs +1 -1
  179. package/package.json +61 -52
  180. package/readme.html +784 -0
  181. package/readme.md +106 -218
  182. package/releases/readme.md +1 -1
  183. package/test/README.md +2 -2
  184. package/test-project/package.json +8 -2
  185. package/test-project/workspaces/workspace-a/package.json +135 -0
  186. package/test-project/workspaces/workspace-a/readme.md +20 -0
  187. package/test-project/workspaces/workspace-a/release/readme.md +42 -0
  188. package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
  189. package/test-project/workspaces/workspace-a/test/readme.md +12 -0
  190. package/test-project/workspaces/workspace-b/package.json +139 -0
  191. package/test-project/workspaces/workspace-b/readme.md +94 -0
  192. package/test-project/workspaces/workspace-b/requirements.txt +1 -0
  193. package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
  194. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
  195. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
  196. package/tmp/rm-node-modules-test-project/package.json +17 -0
  197. package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
  198. package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
  199. package/tmp/test-repo/README.md +2 -35
  200. package/tmp/test-repo/package.json +13 -3
  201. package/docs-src/clean-github-actions-caches.md +0 -26
  202. package/docs-src/free-chatgpt.md +0 -26
  203. package/lib/binary-collections-config.cjs +0 -15
  204. package/lib/chunk-2CBJCW7E.mjs +0 -81
  205. package/lib/chunk-4UHL4WVN.mjs +0 -136
  206. package/lib/chunk-66PAU5PS.mjs +0 -31
  207. package/lib/chunk-6HHJRKFB.mjs +0 -59
  208. package/lib/chunk-7XTEJHOE.mjs +0 -193
  209. package/lib/chunk-FCDQGYBF.mjs +0 -136
  210. package/lib/chunk-GEYA2USY.mjs +0 -207
  211. package/lib/chunk-GJTGHXRA.mjs +0 -356
  212. package/lib/chunk-ID2WBTE2.mjs +0 -80
  213. package/lib/chunk-JXFOHKDM.mjs +0 -239
  214. package/lib/chunk-PDSXF5HY.mjs +0 -187
  215. package/lib/chunk-RWLXRTYP.mjs +0 -109
  216. package/lib/chunk-TOIVAQF7.mjs +0 -136
  217. package/lib/chunk-V5SKYJUB.mjs +0 -136
  218. package/lib/chunk-WSRETQCA.mjs +0 -59
  219. package/lib/chunk-YYLIQQKF.mjs +0 -31
  220. package/lib/ps/index.d.ts +0 -2
  221. package/lib/ps/index.js +0 -254
  222. package/lib/utils/findEnvFiles.d.ts +0 -8
  223. package/lib/utils/findEnvFiles.js +0 -121
  224. package/tmp/typedoc/readme.md +0 -320
  225. /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
@@ -17,8 +17,8 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
17
17
  const puppeteer_extra_1 = __importDefault(require("puppeteer-extra"));
18
18
  const puppeteer_extra_plugin_stealth_1 = __importDefault(require("puppeteer-extra-plugin-stealth"));
19
19
  const upath_1 = __importDefault(require("upath"));
20
- const COOKIE_DIR = upath_1.default.join(process.cwd(), "tmp", "cookies");
21
- const DEFAULT_COOKIE_PATH = upath_1.default.join(COOKIE_DIR, "cookies.json");
20
+ const COOKIE_DIR = upath_1.default.join(process.cwd(), 'tmp', 'cookies');
21
+ const DEFAULT_COOKIE_PATH = upath_1.default.join(COOKIE_DIR, 'cookies.json');
22
22
  const NAVIGATION_TIMEOUT_MS = 90000;
23
23
  const NETWORK_IDLE_TIMEOUT_MS = 15000;
24
24
  const MAX_INLINE_QUESTION_FILE_BYTES = 2 * 1024;
@@ -32,7 +32,7 @@ fs_extra_1.default.ensureDirSync(COOKIE_DIR);
32
32
  */
33
33
  function gotoWithFallback(page, url) {
34
34
  return __awaiter(this, void 0, void 0, function* () {
35
- yield page.goto(url, { waitUntil: "domcontentloaded", timeout: NAVIGATION_TIMEOUT_MS });
35
+ yield page.goto(url, { waitUntil: 'domcontentloaded', timeout: NAVIGATION_TIMEOUT_MS });
36
36
  // Best effort: settle initial bursty requests without hard-failing on persistent streams.
37
37
  try {
38
38
  yield page.waitForNetworkIdle({ idleTime: 1000, timeout: NETWORK_IDLE_TIMEOUT_MS });
@@ -126,7 +126,7 @@ function navigatePage(page, url) {
126
126
  }
127
127
  yield new Promise((r) => setTimeout(r, 200)); // poll every 200ms
128
128
  }
129
- throw new Error("DOM did not stabilize within timeout");
129
+ throw new Error('DOM did not stabilize within timeout');
130
130
  });
131
131
  return { waitForDomIdle };
132
132
  });
@@ -166,40 +166,40 @@ function _restoreCookies(page_1) {
166
166
  */
167
167
  function writeQuestion(page, question) {
168
168
  return __awaiter(this, void 0, void 0, function* () {
169
- const promptTextarea = yield page.waitForSelector("#prompt-textarea", { timeout: 30000 });
169
+ const promptTextarea = yield page.waitForSelector('#prompt-textarea', { timeout: 30000 });
170
170
  if (!promptTextarea) {
171
- console.log("Cannot find the prompt input on the webpage. Please check whether you have access to chat.openai.com without logging in via your browser.");
171
+ console.log('Cannot find the prompt input on the webpage. Please check whether you have access to chat.openai.com without logging in via your browser.');
172
172
  return;
173
173
  }
174
174
  // Inject the full prompt instantly and emit input-like events so the UI reacts.
175
175
  yield page.evaluate((text) => {
176
- const promptEl = document.querySelector("#prompt-textarea");
176
+ const promptEl = document.querySelector('#prompt-textarea');
177
177
  if (!promptEl) {
178
178
  return;
179
179
  }
180
180
  promptEl.focus();
181
- promptEl.innerHTML = "";
182
- const lines = String(text).split("\n");
181
+ promptEl.innerHTML = '';
182
+ const lines = String(text).split('\n');
183
183
  for (const line of lines) {
184
- const p = document.createElement("p");
184
+ const p = document.createElement('p');
185
185
  p.textContent = line;
186
186
  promptEl.appendChild(p);
187
187
  }
188
- promptEl.dispatchEvent(new InputEvent("beforeinput", { bubbles: true, inputType: "insertFromPaste", data: text }));
189
- promptEl.dispatchEvent(new InputEvent("input", { bubbles: true, inputType: "insertFromPaste", data: text }));
190
- promptEl.dispatchEvent(new Event("change", { bubbles: true }));
188
+ promptEl.dispatchEvent(new InputEvent('beforeinput', { bubbles: true, inputType: 'insertFromPaste', data: text }));
189
+ promptEl.dispatchEvent(new InputEvent('input', { bubbles: true, inputType: 'insertFromPaste', data: text }));
190
+ promptEl.dispatchEvent(new Event('change', { bubbles: true }));
191
191
  }, question);
192
192
  // If the app state did not pick up the DOM injection, use keyboard insertion as a reliable fallback.
193
193
  const hasPromptText = yield page.evaluate(() => {
194
- const promptEl = document.querySelector("#prompt-textarea");
194
+ const promptEl = document.querySelector('#prompt-textarea');
195
195
  return Boolean(promptEl && promptEl.textContent && promptEl.textContent.trim().length > 0);
196
196
  });
197
197
  if (!hasPromptText) {
198
- console.log("Prompt state not updated by DOM injection. Falling back to keyboard insertText.");
198
+ console.log('Prompt state not updated by DOM injection. Falling back to keyboard insertText.');
199
199
  yield promptTextarea.click({ clickCount: 1 });
200
- yield page.keyboard.down("Control");
201
- yield page.keyboard.press("KeyA");
202
- yield page.keyboard.up("Control");
200
+ yield page.keyboard.down('Control');
201
+ yield page.keyboard.press('KeyA');
202
+ yield page.keyboard.up('Control');
203
203
  yield page.keyboard.insertText(question);
204
204
  }
205
205
  });
@@ -212,7 +212,7 @@ function writeQuestion(page, question) {
212
212
  */
213
213
  function clickSubmitButton(page) {
214
214
  return __awaiter(this, void 0, void 0, function* () {
215
- console.log("Attempting to click the submit button...");
215
+ console.log('Attempting to click the submit button...');
216
216
  try {
217
217
  const userMessageCountBefore = yield page.$$eval('[data-message-author-role="user"]', (elements) => elements.length);
218
218
  const waitForSubmit = (...args_1) => __awaiter(this, [...args_1], void 0, function* (timeout = 5000) {
@@ -227,32 +227,32 @@ function clickSubmitButton(page) {
227
227
  return false;
228
228
  }
229
229
  });
230
- yield page.waitForFunction(() => {
230
+ yield page
231
+ .waitForFunction(() => {
231
232
  const candidates = [
232
233
  document.querySelector('[data-testid="fruitjuice-send-button"]'),
233
234
  document.querySelector('#composer-submit-button'),
234
235
  document.querySelector('[data-testid="send-button"]')
235
236
  ].filter(Boolean);
236
237
  return candidates.some((button) => {
237
- const isDisabled = button.disabled || button.getAttribute("aria-disabled") === "true";
238
+ const isDisabled = button.disabled || button.getAttribute('aria-disabled') === 'true';
238
239
  const isVisible = button.offsetParent !== null;
239
240
  return !isDisabled && isVisible;
240
241
  });
241
- }, { timeout: 5000 }).catch(() => {
242
+ }, { timeout: 5000 })
243
+ .catch(() => {
242
244
  // Continue to diagnostics below even if no enabled button was found within timeout.
243
245
  });
244
246
  const buttonDetails = yield page.evaluate(() => {
245
247
  const selectors = [
246
248
  '[data-testid="fruitjuice-send-button"]',
247
- "#composer-submit-button",
249
+ '#composer-submit-button',
248
250
  '[data-testid="send-button"]'
249
251
  ];
250
252
  const details = selectors.map((selector) => {
251
253
  const el = document.querySelector(selector);
252
254
  const exists = Boolean(el);
253
- const disabled = exists
254
- ? Boolean(el.disabled || el.getAttribute("aria-disabled") === "true")
255
- : null;
255
+ const disabled = exists ? Boolean(el.disabled || el.getAttribute('aria-disabled') === 'true') : null;
256
256
  const visible = exists ? el.offsetParent !== null : null;
257
257
  return { selector, exists, disabled, visible };
258
258
  });
@@ -265,7 +265,7 @@ function clickSubmitButton(page) {
265
265
  yield page.click(selectedSelector);
266
266
  console.log(`Clicked submit button selector: ${selectedSelector}`);
267
267
  if (yield waitForSubmit(5000)) {
268
- console.log("Submission detected after selector click.");
268
+ console.log('Submission detected after selector click.');
269
269
  return true;
270
270
  }
271
271
  // Fallback: force a DOM click in case pointer-interception blocked page.click.
@@ -280,29 +280,29 @@ function clickSubmitButton(page) {
280
280
  if (forcedClickWorked) {
281
281
  console.log(`Forced DOM click on selector: ${selectedSelector}`);
282
282
  if (yield waitForSubmit(5000)) {
283
- console.log("Submission detected after forced DOM click.");
283
+ console.log('Submission detected after forced DOM click.');
284
284
  return true;
285
285
  }
286
286
  }
287
287
  }
288
- console.log("Submit button path did not submit. Trying Enter key fallback on prompt.");
289
- yield page.focus("#prompt-textarea");
290
- yield page.keyboard.press("Enter");
288
+ console.log('Submit button path did not submit. Trying Enter key fallback on prompt.');
289
+ yield page.focus('#prompt-textarea');
290
+ yield page.keyboard.press('Enter');
291
291
  if (yield waitForSubmit(5000)) {
292
- console.log("Submission detected after Enter key fallback.");
292
+ console.log('Submission detected after Enter key fallback.');
293
293
  return true;
294
294
  }
295
295
  // Final fallback: submit the nearest composer form.
296
296
  const didRequestSubmit = yield page.evaluate(() => {
297
- const prompt = document.querySelector("#prompt-textarea");
297
+ const prompt = document.querySelector('#prompt-textarea');
298
298
  if (!prompt) {
299
299
  return false;
300
300
  }
301
- const form = prompt.closest("form");
301
+ const form = prompt.closest('form');
302
302
  if (!form) {
303
303
  return false;
304
304
  }
305
- if (typeof form.requestSubmit === "function") {
305
+ if (typeof form.requestSubmit === 'function') {
306
306
  form.requestSubmit();
307
307
  }
308
308
  else {
@@ -311,13 +311,13 @@ function clickSubmitButton(page) {
311
311
  return true;
312
312
  });
313
313
  if (didRequestSubmit) {
314
- console.log("Triggered form submit fallback.");
314
+ console.log('Triggered form submit fallback.');
315
315
  if (yield waitForSubmit(5000)) {
316
- console.log("Submission detected after form submit fallback.");
316
+ console.log('Submission detected after form submit fallback.');
317
317
  return true;
318
318
  }
319
319
  }
320
- console.log("Failed to submit prompt after all strategies.");
320
+ console.log('Failed to submit prompt after all strategies.');
321
321
  return false;
322
322
  }
323
323
  catch (e) {
@@ -353,16 +353,16 @@ function waitForInitialResponse(page_1) {
353
353
  const currentMessageCount = assistantMessages.length;
354
354
  if (currentMessageCount > messageCount) {
355
355
  const lastMessage = assistantMessages[assistantMessages.length - 1];
356
- const isThinking = yield lastMessage.$(".result-thinking");
356
+ const isThinking = yield lastMessage.$('.result-thinking');
357
357
  if (!isThinking) {
358
- lastMessageId = yield page.evaluate((element) => element.getAttribute("data-message-id"), lastMessage);
358
+ lastMessageId = yield page.evaluate((element) => element.getAttribute('data-message-id'), lastMessage);
359
359
  messageCount = currentMessageCount;
360
360
  return;
361
361
  }
362
362
  }
363
363
  yield sleep(100);
364
364
  }
365
- console.log("Timed out waiting for the initial response.");
365
+ console.log('Timed out waiting for the initial response.');
366
366
  });
367
367
  }
368
368
  /**
@@ -373,15 +373,15 @@ function waitForInitialResponse(page_1) {
373
373
  * @returns {Promise<void>} Resolves when streaming is complete.
374
374
  */
375
375
  function handleStreamingResponse(page_1) {
376
- return __awaiter(this, arguments, void 0, function* (page, outputFile = upath_1.default.join(process.cwd(), "tmp/response.txt")) {
377
- let previousText = "";
378
- let completeResponse = "";
376
+ return __awaiter(this, arguments, void 0, function* (page, outputFile = upath_1.default.join(process.cwd(), 'tmp/response.txt')) {
377
+ let previousText = '';
378
+ let completeResponse = '';
379
379
  let newContentDetected = false;
380
380
  while (!newContentDetected) {
381
381
  const assistantMessages = yield page.$$('[data-message-author-role="assistant"]');
382
382
  if (assistantMessages.length > 0) {
383
383
  const lastMessage = assistantMessages[assistantMessages.length - 1];
384
- const currentMessageId = yield page.evaluate((element) => element.getAttribute("data-message-id"), lastMessage);
384
+ const currentMessageId = yield page.evaluate((element) => element.getAttribute('data-message-id'), lastMessage);
385
385
  if (currentMessageId === lastMessageId) {
386
386
  const currentText = yield page.evaluate((element) => element.textContent, lastMessage);
387
387
  console.log(`Current text: ${currentText}`);
@@ -394,7 +394,7 @@ function handleStreamingResponse(page_1) {
394
394
  }
395
395
  }
396
396
  previousText = currentText;
397
- const isStreaming = yield lastMessage.$(".result-streaming");
397
+ const isStreaming = yield lastMessage.$('.result-streaming');
398
398
  if (!isStreaming) {
399
399
  newContentDetected = true;
400
400
  }
@@ -407,7 +407,7 @@ function handleStreamingResponse(page_1) {
407
407
  }
408
408
  if (!is_streaming) {
409
409
  console.log(completeResponse.trim());
410
- console.log("\n\n");
410
+ console.log('\n\n');
411
411
  fs_extra_1.default.ensureDirSync(upath_1.default.dirname(outputFile));
412
412
  fs_extra_1.default.writeFileSync(outputFile, completeResponse.trim());
413
413
  console.log(`Response saved to ${outputFile}`);
@@ -439,26 +439,26 @@ function isLoggedIn(page) {
439
439
  */
440
440
  function createBrowser() {
441
441
  return __awaiter(this, arguments, void 0, function* (browserOptions = {}) {
442
- const windowsChromeExecutable = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
443
- const hasWindowsChrome = process.platform === "win32" && fs_extra_1.default.existsSync(windowsChromeExecutable);
442
+ const windowsChromeExecutable = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';
443
+ const hasWindowsChrome = process.platform === 'win32' && fs_extra_1.default.existsSync(windowsChromeExecutable);
444
444
  /**
445
445
  * @type {Parameters<import("puppeteer-extra").VanillaPuppeteer["launch"]>[0]}
446
446
  */
447
- const defaultOptions = Object.assign({ headless: false, defaultViewport: null, userDataDir: upath_1.default.join(process.cwd(), "tmp/puppeteer-profile"),
447
+ const defaultOptions = Object.assign({ headless: false, defaultViewport: null, userDataDir: upath_1.default.join(process.cwd(), 'tmp/puppeteer-profile'),
448
448
  // Windows-specific options to handle browser launch issues
449
449
  args: [
450
- "--start-maximized",
451
- "--no-sandbox",
452
- "--disable-setuid-sandbox",
453
- "--disable-dev-shm-usage",
454
- "--disable-accelerated-2d-canvas",
455
- "--no-first-run",
456
- "--no-zygote",
457
- "--disable-gpu",
458
- "--disable-background-timer-throttling",
459
- "--disable-backgrounding-occluded-windows",
460
- "--disable-renderer-backgrounding"
461
- ], ignoreDefaultArgs: ["--disable-extensions"] }, (hasWindowsChrome && {
450
+ '--start-maximized',
451
+ '--no-sandbox',
452
+ '--disable-setuid-sandbox',
453
+ '--disable-dev-shm-usage',
454
+ '--disable-accelerated-2d-canvas',
455
+ '--no-first-run',
456
+ '--no-zygote',
457
+ '--disable-gpu',
458
+ '--disable-background-timer-throttling',
459
+ '--disable-backgrounding-occluded-windows',
460
+ '--disable-renderer-backgrounding'
461
+ ], ignoreDefaultArgs: ['--disable-extensions'] }, (hasWindowsChrome && {
462
462
  // Prefer local Chrome installation when present on Windows.
463
463
  executablePath: windowsChromeExecutable
464
464
  }));
@@ -466,19 +466,19 @@ function createBrowser() {
466
466
  return yield puppeteer_extra_1.default.use((0, puppeteer_extra_plugin_stealth_1.default)()).launch(Object.assign(Object.assign({}, defaultOptions), browserOptions));
467
467
  }
468
468
  catch (_error) {
469
- console.error("Failed to launch browser with default options. Trying fallback options...");
469
+ console.error('Failed to launch browser with default options. Trying fallback options...');
470
470
  // Fallback: Try with minimal options
471
471
  try {
472
- return yield puppeteer_extra_1.default.use((0, puppeteer_extra_plugin_stealth_1.default)()).launch(Object.assign(Object.assign({ headless: browserOptions.headless || false, defaultViewport: null, args: ["--start-maximized", "--no-sandbox", "--disable-setuid-sandbox"], ignoreDefaultArgs: false }, (hasWindowsChrome && {
472
+ return yield puppeteer_extra_1.default.use((0, puppeteer_extra_plugin_stealth_1.default)()).launch(Object.assign(Object.assign({ headless: browserOptions.headless || false, defaultViewport: null, args: ['--start-maximized', '--no-sandbox', '--disable-setuid-sandbox'], ignoreDefaultArgs: false }, (hasWindowsChrome && {
473
473
  executablePath: windowsChromeExecutable
474
474
  })), browserOptions));
475
475
  }
476
476
  catch (fallbackError) {
477
- console.error("Browser launch failed completely. Common solutions:");
478
- console.error("1. Install Google Chrome if not installed");
479
- console.error("2. Update Node.js to the latest version");
480
- console.error("3. Try running: npm install puppeteer --force");
481
- console.error("4. Check if antivirus is blocking browser launch");
477
+ console.error('Browser launch failed completely. Common solutions:');
478
+ console.error('1. Install Google Chrome if not installed');
479
+ console.error('2. Update Node.js to the latest version');
480
+ console.error('3. Try running: npm install puppeteer --force');
481
+ console.error('4. Check if antivirus is blocking browser launch');
482
482
  throw new Error(`Browser launch failed: ${fallbackError.message}`);
483
483
  }
484
484
  }
@@ -493,7 +493,7 @@ function loginToChatGpt() {
493
493
  return __awaiter(this, void 0, void 0, function* () {
494
494
  const browser = yield createBrowser({ headless: false });
495
495
  const page = (yield browser.pages()).length > 0 ? (yield browser.pages())[0] : yield browser.newPage();
496
- const url = "https://chat.openai.com";
496
+ const url = 'https://chat.openai.com';
497
497
  const navigate = yield navigatePage(page, url);
498
498
  // Wait for page to fully load before checking login status
499
499
  yield navigate.waitForDomIdle(2000, 10000);
@@ -502,20 +502,20 @@ function loginToChatGpt() {
502
502
  return document.querySelector('[data-testid="login-button"]') !== null;
503
503
  });
504
504
  if (loginButtonExists) {
505
- console.log("Login button found, clicking to log in...");
505
+ console.log('Login button found, clicking to log in...');
506
506
  yield page.click('[data-testid="login-button"]');
507
507
  // Wait for the login process to complete without requiring full network idleness.
508
- yield page.waitForNavigation({ waitUntil: "domcontentloaded", timeout: NAVIGATION_TIMEOUT_MS });
508
+ yield page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: NAVIGATION_TIMEOUT_MS });
509
509
  try {
510
510
  yield page.waitForNetworkIdle({ idleTime: 1000, timeout: NETWORK_IDLE_TIMEOUT_MS });
511
511
  }
512
512
  catch (_a) {
513
513
  // Ignore: authentication pages can keep background connections active.
514
514
  }
515
- console.log("Login process completed.");
515
+ console.log('Login process completed.');
516
516
  }
517
517
  else {
518
- console.log("No login required - user appears to be already logged in.");
518
+ console.log('No login required - user appears to be already logged in.');
519
519
  }
520
520
  });
521
521
  }
@@ -550,13 +550,13 @@ function runChatGpt() {
550
550
  const questionFile = chatgptOptions.questionFile;
551
551
  let question = chatgptOptions.question;
552
552
  let shouldUploadQuestionFile = Boolean(questionFile);
553
- const responseFile = chatgptOptions.responseFile || upath_1.default.join(process.cwd(), "tmp", "response.txt");
553
+ const responseFile = chatgptOptions.responseFile || upath_1.default.join(process.cwd(), 'tmp', 'response.txt');
554
554
  // Validate input parameters
555
555
  const noInputProvided = !question && !questionFile;
556
556
  const questionIsEmpty = question && question.trim().length === 0;
557
557
  const questionFileIsEmpty = questionFile && questionFile.trim().length === 0;
558
558
  if (noInputProvided || questionIsEmpty || questionFileIsEmpty) {
559
- throw new Error("You must provide a question or a question file.");
559
+ throw new Error('You must provide a question or a question file.');
560
560
  }
561
561
  // For small files, send content as plain text to avoid file-upload login requirements.
562
562
  if (!question && questionFile) {
@@ -565,9 +565,9 @@ function runChatGpt() {
565
565
  }
566
566
  const questionFileStats = fs_extra_1.default.statSync(questionFile);
567
567
  if (questionFileStats.size <= MAX_INLINE_QUESTION_FILE_BYTES) {
568
- question = fs_extra_1.default.readFileSync(questionFile, "utf8").trim();
568
+ question = fs_extra_1.default.readFileSync(questionFile, 'utf8').trim();
569
569
  if (!question) {
570
- throw new Error("Question file is empty.");
570
+ throw new Error('Question file is empty.');
571
571
  }
572
572
  shouldUploadQuestionFile = false;
573
573
  console.log(`Question file is ${questionFileStats.size} bytes (<= ${MAX_INLINE_QUESTION_FILE_BYTES}). Sending as text prompt.`);
@@ -578,12 +578,12 @@ function runChatGpt() {
578
578
  browser = yield createBrowser({ headless });
579
579
  }
580
580
  catch (error) {
581
- console.error("Error running ChatGPT:", error);
582
- console.error("\nTroubleshooting steps:");
583
- console.error("1. Make sure Google Chrome is installed");
584
- console.error("2. Try running: yarn add puppeteer --force");
585
- console.error("3. Check if your antivirus is blocking the browser");
586
- console.error("4. Close any running Chrome instances and try again");
581
+ console.error('Error running ChatGPT:', error);
582
+ console.error('\nTroubleshooting steps:');
583
+ console.error('1. Make sure Google Chrome is installed');
584
+ console.error('2. Try running: yarn add puppeteer --force');
585
+ console.error('3. Check if your antivirus is blocking the browser');
586
+ console.error('4. Close any running Chrome instances and try again');
587
587
  throw error;
588
588
  }
589
589
  const allPages = yield browser.pages();
@@ -599,7 +599,7 @@ function runChatGpt() {
599
599
  }
600
600
  }
601
601
  try {
602
- const url = "https://chat.openai.com";
602
+ const url = 'https://chat.openai.com';
603
603
  const navigate = yield navigatePage(page, url);
604
604
  // Check temporary chat - wait for page to load and try to click temporary chat button
605
605
  yield navigate.waitForDomIdle(2000, 15000);
@@ -607,11 +607,11 @@ function runChatGpt() {
607
607
  const tempChatButton = yield page.$('button[aria-label="Turn on temporary chat"]');
608
608
  if (tempChatButton) {
609
609
  yield page.evaluate((el) => el.click(), tempChatButton);
610
- console.log("Successfully clicked temporary chat button");
610
+ console.log('Successfully clicked temporary chat button');
611
611
  yield navigate.waitForDomIdle(1000, 10000);
612
612
  }
613
613
  else {
614
- console.log("Temporary chat button not found, proceeding without it.");
614
+ console.log('Temporary chat button not found, proceeding without it.');
615
615
  }
616
616
  }
617
617
  catch (error) {
@@ -622,7 +622,7 @@ function runChatGpt() {
622
622
  // Submit the question
623
623
  const didSubmit = yield clickSubmitButton(page);
624
624
  if (!didSubmit) {
625
- throw new Error("Prompt was not submitted. The composer button may be disabled or blocked.");
625
+ throw new Error('Prompt was not submitted. The composer button may be disabled or blocked.');
626
626
  }
627
627
  yield navigate.waitForDomIdle(1000, 30000); // Wait for DOM to stabilize
628
628
  // Wait for the initial response
@@ -637,9 +637,9 @@ function runChatGpt() {
637
637
  yield navigate.waitForDomIdle(2000, 10000);
638
638
  // Check if logged in
639
639
  const isUserLoggedIn = yield isLoggedIn(page);
640
- console.log(`Login status: ${isUserLoggedIn ? "Logged in" : "Not logged in"}`);
640
+ console.log(`Login status: ${isUserLoggedIn ? 'Logged in' : 'Not logged in'}`);
641
641
  if (!isUserLoggedIn) {
642
- console.log("Not logged in. Please log in to ChatGPT in the browser window, then close it and run the command again.");
642
+ console.log('Not logged in. Please log in to ChatGPT in the browser window, then close it and run the command again.');
643
643
  return loginToChatGpt();
644
644
  }
645
645
  // Upload the question file
@@ -654,7 +654,7 @@ function runChatGpt() {
654
654
  let clicked = false;
655
655
  for (const item of menuItems) {
656
656
  const text = yield page.evaluate((el) => el.innerText, item);
657
- if (text && text.includes("Add photos") && text.includes("files")) {
657
+ if (text && text.includes('Add photos') && text.includes('files')) {
658
658
  yield item.hover();
659
659
  clicked = true;
660
660
  break;
@@ -674,11 +674,11 @@ function runChatGpt() {
674
674
  yield fileInput.uploadFile(questionFile);
675
675
  // Wait for the file to be processed
676
676
  yield navigate.waitForDomIdle(2000, 15000);
677
- console.log("File uploaded successfully");
677
+ console.log('File uploaded successfully');
678
678
  // Optionally submit after file upload
679
679
  const didSubmit = yield clickSubmitButton(page);
680
680
  if (!didSubmit) {
681
- throw new Error("Prompt was not submitted after file upload.");
681
+ throw new Error('Prompt was not submitted after file upload.');
682
682
  }
683
683
  yield navigate.waitForDomIdle(1000, 30000);
684
684
  // Wait for and handle response
@@ -686,7 +686,7 @@ function runChatGpt() {
686
686
  yield handleStreamingResponse(page, responseFile);
687
687
  }
688
688
  else {
689
- console.log("Could not find file input element");
689
+ console.log('Could not find file input element');
690
690
  }
691
691
  }
692
692
  catch (error) {
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  runChatGpt
4
- } from "../chunk-N436BNBK.mjs";
4
+ } from "../chunk-GAGABICI.mjs";
5
5
  import "../chunk-QQ4A6DLD.mjs";
6
6
  export {
7
7
  runChatGpt
@@ -1,40 +1,7 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/utils/findEnvFiles.js
30
- var findEnvFiles_exports = {};
31
- __export(findEnvFiles_exports, {
32
- findEnvFiles: () => findEnvFiles
33
- });
34
- module.exports = __toCommonJS(findEnvFiles_exports);
35
- var import_node_fs = __toESM(require("fs"), 1);
36
- var import_node_path = __toESM(require("path"), 1);
37
- var glob = __toESM(require("glob"), 1);
1
+ // src/utils/findEnvFiles.cjs
2
+ var fs = require("fs");
3
+ var path = require("path");
4
+ var glob = require("glob");
38
5
  var DEFAULT_IGNORES = [
39
6
  "**/node_modules/**",
40
7
  "**/.git/**",
@@ -72,19 +39,19 @@ var DEFAULT_IGNORES = [
72
39
  function findEnvFiles(startDir = process.cwd(), filter) {
73
40
  const found = /* @__PURE__ */ new Set();
74
41
  function addFile(file) {
75
- const normalized = import_node_path.default.normalize(file);
42
+ const normalized = path.normalize(file);
76
43
  if (typeof filter === "function" && !filter(normalized)) {
77
44
  return;
78
45
  }
79
46
  found.add(normalized);
80
47
  }
81
- let current = import_node_path.default.resolve(startDir);
48
+ let current = path.resolve(startDir);
82
49
  while (true) {
83
- const envPath = import_node_path.default.join(current, ".env");
84
- if (import_node_fs.default.existsSync(envPath)) {
50
+ const envPath = path.join(current, ".env");
51
+ if (fs.existsSync(envPath)) {
85
52
  addFile(envPath);
86
53
  }
87
- const parent = import_node_path.default.dirname(current);
54
+ const parent = path.dirname(current);
88
55
  if (parent === current) {
89
56
  break;
90
57
  }
@@ -101,7 +68,22 @@ function findEnvFiles(startDir = process.cwd(), filter) {
101
68
  }
102
69
  return [...found];
103
70
  }
104
- // Annotate the CommonJS export names for ESM import in node:
105
- 0 && (module.exports = {
106
- findEnvFiles
107
- });
71
+ function findEnvWithToken(startDir = process.cwd(), tokenName = "GITHUB_TOKEN") {
72
+ const envFiles = findEnvFiles(startDir);
73
+ return envFiles.find((file) => {
74
+ try {
75
+ const content = fs.readFileSync(file, "utf-8");
76
+ const regex = new RegExp(`^\\s*${tokenName}\\s*=`, "m");
77
+ return regex.test(content);
78
+ } catch (err) {
79
+ console.warn(`Failed to read ${file}: ${err instanceof Error ? err.message : String(err)}`);
80
+ return false;
81
+ }
82
+ });
83
+ }
84
+ module.exports = {
85
+ DEFAULT_IGNORES,
86
+ findEnvFiles,
87
+ findEnvWithToken,
88
+ default: findEnvFiles
89
+ };
@@ -0,0 +1,19 @@
1
+ export const DEFAULT_IGNORES: string[];
2
+ /**
3
+ * Find all `.env*` files from the current directory tree
4
+ * and parent directories.
5
+ *
6
+ * @param {string} [startDir=process.cwd()] Starting directory.
7
+ * @param {(file: string) => boolean} [filter] Optional filter callback.
8
+ * @returns {string[]} Normalized absolute file paths.
9
+ */
10
+ export function findEnvFiles(startDir?: string, filter?: (file: string) => boolean): string[];
11
+ /**
12
+ * Find the first `.env*` file containing a token variable.
13
+ *
14
+ * @param {string} [startDir=process.cwd()] Starting directory.
15
+ * @param {string} [tokenName="GITHUB_TOKEN"] Environment variable name.
16
+ * @returns {string | undefined} Matching file path.
17
+ */
18
+ export function findEnvWithToken(startDir?: string, tokenName?: string): string | undefined;
19
+ export { findEnvFiles as default };
@@ -1,8 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
- findEnvFiles
4
- } from "../chunk-ID2WBTE2.mjs";
3
+ require_findEnvFiles
4
+ } from "../chunk-H44UWUFY.mjs";
5
5
  import "../chunk-QQ4A6DLD.mjs";
6
- export {
7
- findEnvFiles
8
- };
6
+ export default require_findEnvFiles();
@@ -34,13 +34,13 @@ function findWorkspaceRootYC() {
34
34
  function findYarnWorkspaceRootFS(cwd = process.cwd()) {
35
35
  let current = upath_1.default.resolve(cwd);
36
36
  while (true) {
37
- const pkgPath = upath_1.default.join(current, "package.json");
37
+ const pkgPath = upath_1.default.join(current, 'package.json');
38
38
  if (fs_extra_1.default.existsSync(pkgPath)) {
39
39
  try {
40
- const pkg = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, "utf8"));
40
+ const pkg = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8'));
41
41
  if (pkg.workspaces ||
42
- fs_extra_1.default.existsSync(upath_1.default.join(current, "yarn.lock")) ||
43
- fs_extra_1.default.existsSync(upath_1.default.join(current, ".yarn"))) {
42
+ fs_extra_1.default.existsSync(upath_1.default.join(current, 'yarn.lock')) ||
43
+ fs_extra_1.default.existsSync(upath_1.default.join(current, '.yarn'))) {
44
44
  return current;
45
45
  }
46
46
  }