@ricsam/r5dctl 0.0.150 → 0.0.152

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.
package/dist/cjs/cli.cjs CHANGED
@@ -50,6 +50,7 @@ __export(cli_exports, {
50
50
  handleAuthLogin: () => handleAuthLogin,
51
51
  isUnsupportedServerRoute: () => isUnsupportedServerRoute,
52
52
  main: () => main,
53
+ openInBrowser: () => openInBrowser,
53
54
  parseAnswerEnvRequestCommandArgs: () => parseAnswerEnvRequestCommandArgs,
54
55
  parseAnswerFlags: () => parseAnswerFlags,
55
56
  parseAnswerQuestionsCommandArgs: () => parseAnswerQuestionsCommandArgs,
@@ -1766,16 +1767,26 @@ function parseRecentSessionArgs(args) {
1766
1767
  if (!Number.isInteger(limit) || limit < 1 || limit > 200) throw new Error("--limit must be an integer between 1 and 200");
1767
1768
  return { limit };
1768
1769
  }
1769
- async function openInBrowser(url) {
1770
+ async function openInBrowser(url, launcher = import_node_child_process.spawn) {
1771
+ let command, args;
1770
1772
  if (process.platform === "darwin") {
1771
- (0, import_node_child_process.spawn)("open", [url], { stdio: "ignore", detached: true }).unref();
1772
- return;
1773
- }
1774
- if (process.platform === "win32") {
1775
- (0, import_node_child_process.spawn)("cmd", ["/c", "start", "", url], { stdio: "ignore", detached: true }).unref();
1776
- return;
1777
- }
1778
- (0, import_node_child_process.spawn)("xdg-open", [url], { stdio: "ignore", detached: true }).unref();
1773
+ command = "open";
1774
+ args = [url];
1775
+ } else if (process.platform === "win32") {
1776
+ command = "cmd";
1777
+ args = ["/c", "start", "", url];
1778
+ } else {
1779
+ command = "xdg-open";
1780
+ args = [url];
1781
+ }
1782
+ await new Promise((resolve, reject) => {
1783
+ const child = launcher(command, args, { stdio: "ignore", detached: true });
1784
+ child.once("error", reject);
1785
+ child.once("spawn", () => {
1786
+ child.unref();
1787
+ resolve();
1788
+ });
1789
+ });
1779
1790
  }
1780
1791
  function writeDataOutput(json, data, humanText) {
1781
1792
  if (json) {
@@ -4106,6 +4117,7 @@ async function main(argv = process.argv.slice(2)) {
4106
4117
  handleAuthLogin,
4107
4118
  isUnsupportedServerRoute,
4108
4119
  main,
4120
+ openInBrowser,
4109
4121
  parseAnswerEnvRequestCommandArgs,
4110
4122
  parseAnswerFlags,
4111
4123
  parseAnswerQuestionsCommandArgs,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.150",
3
+ "version": "0.0.152",
4
4
  "type": "commonjs"
5
5
  }
package/dist/mjs/cli.mjs CHANGED
@@ -1655,16 +1655,26 @@ function parseRecentSessionArgs(args) {
1655
1655
  if (!Number.isInteger(limit) || limit < 1 || limit > 200) throw new Error("--limit must be an integer between 1 and 200");
1656
1656
  return { limit };
1657
1657
  }
1658
- async function openInBrowser(url) {
1658
+ async function openInBrowser(url, launcher = spawn) {
1659
+ let command, args;
1659
1660
  if (process.platform === "darwin") {
1660
- spawn("open", [url], { stdio: "ignore", detached: true }).unref();
1661
- return;
1662
- }
1663
- if (process.platform === "win32") {
1664
- spawn("cmd", ["/c", "start", "", url], { stdio: "ignore", detached: true }).unref();
1665
- return;
1666
- }
1667
- spawn("xdg-open", [url], { stdio: "ignore", detached: true }).unref();
1661
+ command = "open";
1662
+ args = [url];
1663
+ } else if (process.platform === "win32") {
1664
+ command = "cmd";
1665
+ args = ["/c", "start", "", url];
1666
+ } else {
1667
+ command = "xdg-open";
1668
+ args = [url];
1669
+ }
1670
+ await new Promise((resolve, reject) => {
1671
+ const child = launcher(command, args, { stdio: "ignore", detached: true });
1672
+ child.once("error", reject);
1673
+ child.once("spawn", () => {
1674
+ child.unref();
1675
+ resolve();
1676
+ });
1677
+ });
1668
1678
  }
1669
1679
  function writeDataOutput(json, data, humanText) {
1670
1680
  if (json) {
@@ -3994,6 +4004,7 @@ export {
3994
4004
  handleAuthLogin,
3995
4005
  isUnsupportedServerRoute,
3996
4006
  main,
4007
+ openInBrowser,
3997
4008
  parseAnswerEnvRequestCommandArgs,
3998
4009
  parseAnswerFlags,
3999
4010
  parseAnswerQuestionsCommandArgs,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.150",
3
+ "version": "0.0.152",
4
4
  "type": "module"
5
5
  }
@@ -1,3 +1,4 @@
1
+ import { type ChildProcess, type SpawnOptions } from "node:child_process";
1
2
  import { R5dctlApiError, R5dctlClient, type R5dctlConversationForkResponse, type R5dctlConversationHeadResponse, type R5dctlConversationRenderOptions, type R5dctlConversationResponse, type R5dctlConversationNodeResponse, type R5dctlConversationOverviewResponse, type R5dctlConversationWorkDetail, type R5dctlConversationWorkResponse, type R5dctlEnvData, type R5dctlProcessInspection, type R5dctlProcessInventory, type R5dctlProcessListInput, type R5dctlProcessLog, type R5dctlProcessRun, type R5dctlWorkerCapacityReport, type R5dctlBranch, type R5dctlBranchDeletionStatus, type R5dctlBranchDescription, type R5dctlBranchOperation, type R5dctlSessionSummary, type R5dctlCheckoutPathResponse, type R5dctlSessionClaim, type R5dctlSessionClaimListResponse, type R5dctlSessionClaimScope, type R5dctlSessionEvent, type R5dctlSessionStartInput, type R5dctlWorkspaceStatus, type R5dctlWorkspaceSyncResult, type R5dctlWorkingTreeMode, type R5dctlWorktreeSource, type R5dctlPromptDelivery, type R5dctlMessageDelivery, type R5dctlSessionMode, type ChatMode, type ModelTier } from "@ricsam/r5d-api";
2
3
  import { type AccountCommand } from "./account";
3
4
  export type GlobalOptions = {
@@ -299,6 +300,8 @@ export declare function parseShellArgs(args: string[]): {
299
300
  };
300
301
  export declare function parsePsListArgs(args: string[]): R5dctlProcessListInput;
301
302
  export declare function parsePsHistoryArgs(args: string[]): R5dctlProcessListInput;
303
+ type BrowserLauncher = (command: string, args: string[], options: SpawnOptions) => Pick<ChildProcess, "once" | "unref">;
304
+ export declare function openInBrowser(url: string, launcher?: BrowserLauncher): Promise<void>;
302
305
  export declare function renderDeviceAuthorizationPrompt(input: {
303
306
  verificationUri: string;
304
307
  userCode: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.150",
3
+ "version": "0.0.152",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/cli.cjs",
6
6
  "module": "./dist/mjs/cli.mjs",
@@ -26,7 +26,7 @@
26
26
  "r5dctl": "dist/cjs/main.cjs"
27
27
  },
28
28
  "dependencies": {
29
- "@ricsam/r5d-api": "^0.0.150",
29
+ "@ricsam/r5d-api": "^0.0.152",
30
30
  "dotenv": "^17",
31
31
  "qrcode": "^1.5.4",
32
32
  "ws": "^8.18.3"