@ricsam/r5dctl 0.0.14 → 0.0.15

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
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var cli_exports = {};
30
30
  __export(cli_exports, {
31
31
  getCliHelpText: () => getCliHelpText,
32
+ getR5dctlVersion: () => getR5dctlVersion,
32
33
  main: () => main,
33
34
  parseAnswerFlags: () => parseAnswerFlags,
34
35
  parseConversationRenderArgs: () => parseConversationRenderArgs,
@@ -60,6 +61,7 @@ const CHAT_MODES = /* @__PURE__ */ new Set([
60
61
  ]);
61
62
  const MODEL_TIERS = /* @__PURE__ */ new Set(["low", "medium", "high", "max"]);
62
63
  const AGENT_TYPES = /* @__PURE__ */ new Set(["research", "debug", "test"]);
64
+ const R5DCTL_PACKAGE_NAME = "@ricsam/r5dctl";
63
65
  const CLI_GLOBAL_OPTION_HELP = [
64
66
  "--base-url <url>",
65
67
  "--json",
@@ -69,6 +71,7 @@ const CLI_GLOBAL_OPTION_HELP = [
69
71
  "-p, --project <namespace/name|id>",
70
72
  "-b, --branch <branch>",
71
73
  "-s, --session <sessionId>",
74
+ "-v, --version",
72
75
  "-h, --help"
73
76
  ];
74
77
  const CLI_ONLY_HELP_ENTRIES = [
@@ -87,7 +90,11 @@ const CLI_ONLY_COMMAND_HELP = [
87
90
  const SHARED_HELP_ENTRIES = [
88
91
  { section: "auth", usage: "auth status", description: "Show the current authenticated user and credential source." },
89
92
  { section: "auth", usage: "auth logout", description: "Revoke the current credential and clear saved auth." },
90
- { section: "auth", usage: "auth api-key create --name <name> [--save]", description: "Create an API key for automation or local scripts." },
93
+ {
94
+ section: "auth",
95
+ usage: "auth api-key create --name <name> [--save]",
96
+ description: "Create an API key for automation or local scripts."
97
+ },
91
98
  { section: "auth", usage: "auth api-key list", description: "List API keys for the current account." },
92
99
  { section: "auth", usage: "auth api-key revoke <key-id>", description: "Revoke an API key." },
93
100
  { section: "projects", usage: "get projects", description: "List projects you can access." },
@@ -96,19 +103,47 @@ const SHARED_HELP_ENTRIES = [
96
103
  { section: "projects", usage: "delete project <namespace/name|id>", description: "Delete a project." },
97
104
  { section: "branches", usage: "-p <project> get branches", description: "List branches for a project." },
98
105
  { section: "branches", usage: "-p <project> describe branch <branch>", description: "Show branch URLs and sessions." },
99
- { section: "sessions", usage: "-p <project> get sessions [--branch <branch>]", description: "List sessions for a project, optionally filtered by branch." },
100
- { section: "sessions", usage: "-p <project> create session -b <branch> [--name <name>]", description: "Create a session for a project branch." },
106
+ {
107
+ section: "sessions",
108
+ usage: "-p <project> get sessions [--branch <branch>]",
109
+ description: "List sessions for a project, optionally filtered by branch."
110
+ },
111
+ {
112
+ section: "sessions",
113
+ usage: "-p <project> create session -b <branch> [--name <name>]",
114
+ description: "Create a session for a project branch."
115
+ },
101
116
  { section: "sessions", usage: "describe session <session-id>", description: "Show session details." },
102
117
  { section: "sessions", usage: "-s <session-id> update session --name <name>", description: "Rename a session or clear its name." },
103
118
  { section: "sessions", usage: "-s <session-id> delete session", description: "Delete a session." },
104
119
  { section: "sessions", usage: "-s <session-id> conversation", description: "Read the exact agent request transcript." },
105
- { section: "sessions", usage: '-s <session-id> prompt --mode <mode> --model <tier> "<message>"', description: "Send a prompt to a session." },
106
- { section: "sessions", usage: '-s <session-id> answer-questions -a1 "<answer>" -a2 "<answer>" ...', description: "Answer pending questions in order." },
107
- { section: "sessions", usage: "-s <session-id> apply-required-envs -e backend/KEY=value -e frontend/KEY=value", description: "Apply required backend or frontend env values." },
108
- { section: "agents", usage: '-p <project> start-agent <src-branch> <agent-type> "<prompt>"', description: "Start a detached branch agent." },
120
+ {
121
+ section: "sessions",
122
+ usage: '-s <session-id> prompt --mode <mode> --model <tier> "<message>"',
123
+ description: "Send a prompt to a session."
124
+ },
125
+ {
126
+ section: "sessions",
127
+ usage: '-s <session-id> answer-questions -a1 "<answer>" -a2 "<answer>" ...',
128
+ description: "Answer pending questions in order."
129
+ },
130
+ {
131
+ section: "sessions",
132
+ usage: "-s <session-id> apply-required-envs -e backend/KEY=value -e frontend/KEY=value",
133
+ description: "Apply required backend or frontend env values."
134
+ },
135
+ {
136
+ section: "agents",
137
+ usage: '-p <project> start-agent <src-branch> <agent-type> "<prompt>"',
138
+ description: "Start a detached branch agent."
139
+ },
109
140
  { section: "agents", usage: "agent-status <session-id>", description: "Show detached branch agent status." },
110
141
  { section: "agents", usage: 'send-prompt <session-id> "<prompt>"', description: "Queue or resume a detached branch agent." },
111
- { section: "merges", usage: "-p <project> merge-changes <target-branch> <sub-agent-branch>", description: "Squash merge an agent branch into a target branch." },
142
+ {
143
+ section: "merges",
144
+ usage: "-p <project> merge-changes <target-branch> <sub-agent-branch>",
145
+ description: "Squash merge an agent branch into a target branch."
146
+ },
112
147
  { section: "merges", usage: "-p <project> continue-merge <target-branch>", description: "Commit a resolved merge." },
113
148
  { section: "merges", usage: "-p <project> abort-merge <target-branch>", description: "Abort an in-progress merge." }
114
149
  ];
@@ -151,6 +186,49 @@ function getCliHelpText() {
151
186
  function printHelp() {
152
187
  process.stdout.write(getCliHelpText());
153
188
  }
189
+ function readVersionFile(filePath) {
190
+ try {
191
+ const version = import_node_fs.default.readFileSync(filePath, "utf8").trim();
192
+ return version || null;
193
+ } catch {
194
+ return null;
195
+ }
196
+ }
197
+ function readInstalledPackageVersion(packageJsonPath) {
198
+ try {
199
+ const parsed = JSON.parse(import_node_fs.default.readFileSync(packageJsonPath, "utf8"));
200
+ if (parsed.name === R5DCTL_PACKAGE_NAME && typeof parsed.version === "string" && parsed.version.trim()) {
201
+ return parsed.version.trim();
202
+ }
203
+ } catch {
204
+ return null;
205
+ }
206
+ return null;
207
+ }
208
+ function getR5dctlVersion() {
209
+ const entrypoint = process.argv[1] ? import_node_path.default.resolve(process.argv[1]) : null;
210
+ let current = entrypoint ? import_node_path.default.dirname(entrypoint) : process.cwd();
211
+ for (let index = 0; index < 12; index += 1) {
212
+ const packageVersion = readInstalledPackageVersion(import_node_path.default.join(current, "package.json"));
213
+ if (packageVersion) {
214
+ return packageVersion;
215
+ }
216
+ const sourceVersion = readVersionFile(import_node_path.default.join(current, "VERSION.txt"));
217
+ if (sourceVersion && import_node_path.default.basename(current) === "packages") {
218
+ return sourceVersion;
219
+ }
220
+ const parent = import_node_path.default.dirname(current);
221
+ if (parent === current) {
222
+ break;
223
+ }
224
+ current = parent;
225
+ }
226
+ return readVersionFile(import_node_path.default.join(process.cwd(), "packages", "VERSION.txt")) ?? "unknown";
227
+ }
228
+ function printVersion() {
229
+ process.stdout.write(`r5dctl ${getR5dctlVersion()}
230
+ `);
231
+ }
154
232
  function isHelpFlag(arg) {
155
233
  return arg === "--help" || arg === "-h";
156
234
  }
@@ -217,7 +295,8 @@ function parseGlobalArgs(argv) {
217
295
  const options = {
218
296
  json: false,
219
297
  configPath: defaultConfigPath(),
220
- help: false
298
+ help: false,
299
+ version: false
221
300
  };
222
301
  const rest = [];
223
302
  for (let i = 0; i < argv.length; i += 1) {
@@ -241,6 +320,14 @@ function parseGlobalArgs(argv) {
241
320
  }
242
321
  continue;
243
322
  }
323
+ if (arg === "--version" || arg === "-v") {
324
+ if (rest.length === 0) {
325
+ options.version = true;
326
+ } else {
327
+ rest.push(arg);
328
+ }
329
+ continue;
330
+ }
244
331
  if (arg === "--base-url") {
245
332
  options.baseUrl = requireValue(argv[i + 1], "Missing value for --base-url");
246
333
  i += 1;
@@ -531,13 +618,17 @@ async function handleAuthLogin(client, options, commandArgs, config) {
531
618
  baseUrl: options.baseUrl ?? config.baseUrl
532
619
  });
533
620
  if (options.json) {
534
- writeDataOutput(true, {
535
- status: "pending",
536
- requestId: start.requestId,
537
- loginUrl: start.loginUrl,
538
- expiresAt: start.expiresAt,
539
- intervalMs: start.intervalMs
540
- }, "");
621
+ writeDataOutput(
622
+ true,
623
+ {
624
+ status: "pending",
625
+ requestId: start.requestId,
626
+ loginUrl: start.loginUrl,
627
+ expiresAt: start.expiresAt,
628
+ intervalMs: start.intervalMs
629
+ },
630
+ ""
631
+ );
541
632
  } else {
542
633
  process.stdout.write(`Open this URL to approve login:
543
634
  ${start.loginUrl}
@@ -645,12 +736,7 @@ function renderAgentStart(agent) {
645
736
  ].join("\n") + "\n";
646
737
  }
647
738
  function renderAgentStatus(agent) {
648
- const lines = [
649
- `Agent: ${agent.sessionId}`,
650
- `Status: ${agent.status}`,
651
- `Branch: ${agent.branchName}`,
652
- `Head: ${agent.headCommit}`
653
- ];
739
+ const lines = [`Agent: ${agent.sessionId}`, `Status: ${agent.status}`, `Branch: ${agent.branchName}`, `Head: ${agent.headCommit}`];
654
740
  if (agent.baseBranch && agent.baseCommit) {
655
741
  lines.push(`Base: ${agent.baseBranch} @ ${agent.baseCommit}`);
656
742
  }
@@ -813,13 +899,19 @@ async function executeR5dctlCommand(client, json, args) {
813
899
  if (first === "projects" && second === "branches" && third === "list" || first === "get" && second === "branches") {
814
900
  const projectRef = requireValue(first === "get" ? args[2] : args[3], "Missing project reference");
815
901
  const branches = await client.projects.branches.list(projectRef);
816
- write(branches, branches.length === 0 ? "No branches found.\n" : `${branches.map((branch) => `${branch.branchName} sessions=${branch.sessionCount}`).join("\n")}
817
- `);
902
+ write(
903
+ branches,
904
+ branches.length === 0 ? "No branches found.\n" : `${branches.map((branch) => `${branch.branchName} sessions=${branch.sessionCount}`).join("\n")}
905
+ `
906
+ );
818
907
  return;
819
908
  }
820
909
  if (first === "projects" && second === "branches" && third === "describe" || first === "describe" && second === "branch") {
821
910
  const offset = first === "describe" ? 2 : 3;
822
- const result = await client.projects.branches.describe(requireValue(args[offset], "Missing project reference"), requireValue(args[offset + 1], "Missing branch name"));
911
+ const result = await client.projects.branches.describe(
912
+ requireValue(args[offset], "Missing project reference"),
913
+ requireValue(args[offset + 1], "Missing branch name")
914
+ );
823
915
  write(result, `Project: ${result.project.path}
824
916
  Branch: ${result.branchName}
825
917
  Sessions: ${result.sessions.length}
@@ -836,7 +928,10 @@ Sessions: ${result.sessions.length}
836
928
  }
837
929
  if (first === "projects" && second === "sessions" && third === "create" || first === "create" && second === "session") {
838
930
  const offset = first === "create" ? 2 : 3;
839
- const session = await client.projects.sessions.create(requireValue(args[offset], "Missing project reference"), parseSessionCreateArgs(args.slice(offset + 1)));
931
+ const session = await client.projects.sessions.create(
932
+ requireValue(args[offset], "Missing project reference"),
933
+ parseSessionCreateArgs(args.slice(offset + 1))
934
+ );
840
935
  write(session, renderSessionDescription(session));
841
936
  return;
842
937
  }
@@ -1301,6 +1396,10 @@ function resolveCommandExecution(options, rest) {
1301
1396
  }
1302
1397
  async function runCommand(argv) {
1303
1398
  const { options, rest } = parseGlobalArgs(argv);
1399
+ if (options.version) {
1400
+ printVersion();
1401
+ return;
1402
+ }
1304
1403
  if (options.help || rest.length === 0) {
1305
1404
  printHelp();
1306
1405
  return;
@@ -1358,6 +1457,7 @@ async function main(argv = process.argv.slice(2)) {
1358
1457
  // Annotate the CommonJS export names for ESM import in node:
1359
1458
  0 && (module.exports = {
1360
1459
  getCliHelpText,
1460
+ getR5dctlVersion,
1361
1461
  main,
1362
1462
  parseAnswerFlags,
1363
1463
  parseConversationRenderArgs,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "commonjs"
5
5
  }
package/dist/mjs/cli.mjs CHANGED
@@ -21,6 +21,7 @@ const CHAT_MODES = /* @__PURE__ */ new Set([
21
21
  ]);
22
22
  const MODEL_TIERS = /* @__PURE__ */ new Set(["low", "medium", "high", "max"]);
23
23
  const AGENT_TYPES = /* @__PURE__ */ new Set(["research", "debug", "test"]);
24
+ const R5DCTL_PACKAGE_NAME = "@ricsam/r5dctl";
24
25
  const CLI_GLOBAL_OPTION_HELP = [
25
26
  "--base-url <url>",
26
27
  "--json",
@@ -30,6 +31,7 @@ const CLI_GLOBAL_OPTION_HELP = [
30
31
  "-p, --project <namespace/name|id>",
31
32
  "-b, --branch <branch>",
32
33
  "-s, --session <sessionId>",
34
+ "-v, --version",
33
35
  "-h, --help"
34
36
  ];
35
37
  const CLI_ONLY_HELP_ENTRIES = [
@@ -48,7 +50,11 @@ const CLI_ONLY_COMMAND_HELP = [
48
50
  const SHARED_HELP_ENTRIES = [
49
51
  { section: "auth", usage: "auth status", description: "Show the current authenticated user and credential source." },
50
52
  { section: "auth", usage: "auth logout", description: "Revoke the current credential and clear saved auth." },
51
- { section: "auth", usage: "auth api-key create --name <name> [--save]", description: "Create an API key for automation or local scripts." },
53
+ {
54
+ section: "auth",
55
+ usage: "auth api-key create --name <name> [--save]",
56
+ description: "Create an API key for automation or local scripts."
57
+ },
52
58
  { section: "auth", usage: "auth api-key list", description: "List API keys for the current account." },
53
59
  { section: "auth", usage: "auth api-key revoke <key-id>", description: "Revoke an API key." },
54
60
  { section: "projects", usage: "get projects", description: "List projects you can access." },
@@ -57,19 +63,47 @@ const SHARED_HELP_ENTRIES = [
57
63
  { section: "projects", usage: "delete project <namespace/name|id>", description: "Delete a project." },
58
64
  { section: "branches", usage: "-p <project> get branches", description: "List branches for a project." },
59
65
  { section: "branches", usage: "-p <project> describe branch <branch>", description: "Show branch URLs and sessions." },
60
- { section: "sessions", usage: "-p <project> get sessions [--branch <branch>]", description: "List sessions for a project, optionally filtered by branch." },
61
- { section: "sessions", usage: "-p <project> create session -b <branch> [--name <name>]", description: "Create a session for a project branch." },
66
+ {
67
+ section: "sessions",
68
+ usage: "-p <project> get sessions [--branch <branch>]",
69
+ description: "List sessions for a project, optionally filtered by branch."
70
+ },
71
+ {
72
+ section: "sessions",
73
+ usage: "-p <project> create session -b <branch> [--name <name>]",
74
+ description: "Create a session for a project branch."
75
+ },
62
76
  { section: "sessions", usage: "describe session <session-id>", description: "Show session details." },
63
77
  { section: "sessions", usage: "-s <session-id> update session --name <name>", description: "Rename a session or clear its name." },
64
78
  { section: "sessions", usage: "-s <session-id> delete session", description: "Delete a session." },
65
79
  { section: "sessions", usage: "-s <session-id> conversation", description: "Read the exact agent request transcript." },
66
- { section: "sessions", usage: '-s <session-id> prompt --mode <mode> --model <tier> "<message>"', description: "Send a prompt to a session." },
67
- { section: "sessions", usage: '-s <session-id> answer-questions -a1 "<answer>" -a2 "<answer>" ...', description: "Answer pending questions in order." },
68
- { section: "sessions", usage: "-s <session-id> apply-required-envs -e backend/KEY=value -e frontend/KEY=value", description: "Apply required backend or frontend env values." },
69
- { section: "agents", usage: '-p <project> start-agent <src-branch> <agent-type> "<prompt>"', description: "Start a detached branch agent." },
80
+ {
81
+ section: "sessions",
82
+ usage: '-s <session-id> prompt --mode <mode> --model <tier> "<message>"',
83
+ description: "Send a prompt to a session."
84
+ },
85
+ {
86
+ section: "sessions",
87
+ usage: '-s <session-id> answer-questions -a1 "<answer>" -a2 "<answer>" ...',
88
+ description: "Answer pending questions in order."
89
+ },
90
+ {
91
+ section: "sessions",
92
+ usage: "-s <session-id> apply-required-envs -e backend/KEY=value -e frontend/KEY=value",
93
+ description: "Apply required backend or frontend env values."
94
+ },
95
+ {
96
+ section: "agents",
97
+ usage: '-p <project> start-agent <src-branch> <agent-type> "<prompt>"',
98
+ description: "Start a detached branch agent."
99
+ },
70
100
  { section: "agents", usage: "agent-status <session-id>", description: "Show detached branch agent status." },
71
101
  { section: "agents", usage: 'send-prompt <session-id> "<prompt>"', description: "Queue or resume a detached branch agent." },
72
- { section: "merges", usage: "-p <project> merge-changes <target-branch> <sub-agent-branch>", description: "Squash merge an agent branch into a target branch." },
102
+ {
103
+ section: "merges",
104
+ usage: "-p <project> merge-changes <target-branch> <sub-agent-branch>",
105
+ description: "Squash merge an agent branch into a target branch."
106
+ },
73
107
  { section: "merges", usage: "-p <project> continue-merge <target-branch>", description: "Commit a resolved merge." },
74
108
  { section: "merges", usage: "-p <project> abort-merge <target-branch>", description: "Abort an in-progress merge." }
75
109
  ];
@@ -112,6 +146,49 @@ function getCliHelpText() {
112
146
  function printHelp() {
113
147
  process.stdout.write(getCliHelpText());
114
148
  }
149
+ function readVersionFile(filePath) {
150
+ try {
151
+ const version = fs.readFileSync(filePath, "utf8").trim();
152
+ return version || null;
153
+ } catch {
154
+ return null;
155
+ }
156
+ }
157
+ function readInstalledPackageVersion(packageJsonPath) {
158
+ try {
159
+ const parsed = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
160
+ if (parsed.name === R5DCTL_PACKAGE_NAME && typeof parsed.version === "string" && parsed.version.trim()) {
161
+ return parsed.version.trim();
162
+ }
163
+ } catch {
164
+ return null;
165
+ }
166
+ return null;
167
+ }
168
+ function getR5dctlVersion() {
169
+ const entrypoint = process.argv[1] ? path.resolve(process.argv[1]) : null;
170
+ let current = entrypoint ? path.dirname(entrypoint) : process.cwd();
171
+ for (let index = 0; index < 12; index += 1) {
172
+ const packageVersion = readInstalledPackageVersion(path.join(current, "package.json"));
173
+ if (packageVersion) {
174
+ return packageVersion;
175
+ }
176
+ const sourceVersion = readVersionFile(path.join(current, "VERSION.txt"));
177
+ if (sourceVersion && path.basename(current) === "packages") {
178
+ return sourceVersion;
179
+ }
180
+ const parent = path.dirname(current);
181
+ if (parent === current) {
182
+ break;
183
+ }
184
+ current = parent;
185
+ }
186
+ return readVersionFile(path.join(process.cwd(), "packages", "VERSION.txt")) ?? "unknown";
187
+ }
188
+ function printVersion() {
189
+ process.stdout.write(`r5dctl ${getR5dctlVersion()}
190
+ `);
191
+ }
115
192
  function isHelpFlag(arg) {
116
193
  return arg === "--help" || arg === "-h";
117
194
  }
@@ -178,7 +255,8 @@ function parseGlobalArgs(argv) {
178
255
  const options = {
179
256
  json: false,
180
257
  configPath: defaultConfigPath(),
181
- help: false
258
+ help: false,
259
+ version: false
182
260
  };
183
261
  const rest = [];
184
262
  for (let i = 0; i < argv.length; i += 1) {
@@ -202,6 +280,14 @@ function parseGlobalArgs(argv) {
202
280
  }
203
281
  continue;
204
282
  }
283
+ if (arg === "--version" || arg === "-v") {
284
+ if (rest.length === 0) {
285
+ options.version = true;
286
+ } else {
287
+ rest.push(arg);
288
+ }
289
+ continue;
290
+ }
205
291
  if (arg === "--base-url") {
206
292
  options.baseUrl = requireValue(argv[i + 1], "Missing value for --base-url");
207
293
  i += 1;
@@ -492,13 +578,17 @@ async function handleAuthLogin(client, options, commandArgs, config) {
492
578
  baseUrl: options.baseUrl ?? config.baseUrl
493
579
  });
494
580
  if (options.json) {
495
- writeDataOutput(true, {
496
- status: "pending",
497
- requestId: start.requestId,
498
- loginUrl: start.loginUrl,
499
- expiresAt: start.expiresAt,
500
- intervalMs: start.intervalMs
501
- }, "");
581
+ writeDataOutput(
582
+ true,
583
+ {
584
+ status: "pending",
585
+ requestId: start.requestId,
586
+ loginUrl: start.loginUrl,
587
+ expiresAt: start.expiresAt,
588
+ intervalMs: start.intervalMs
589
+ },
590
+ ""
591
+ );
502
592
  } else {
503
593
  process.stdout.write(`Open this URL to approve login:
504
594
  ${start.loginUrl}
@@ -606,12 +696,7 @@ function renderAgentStart(agent) {
606
696
  ].join("\n") + "\n";
607
697
  }
608
698
  function renderAgentStatus(agent) {
609
- const lines = [
610
- `Agent: ${agent.sessionId}`,
611
- `Status: ${agent.status}`,
612
- `Branch: ${agent.branchName}`,
613
- `Head: ${agent.headCommit}`
614
- ];
699
+ const lines = [`Agent: ${agent.sessionId}`, `Status: ${agent.status}`, `Branch: ${agent.branchName}`, `Head: ${agent.headCommit}`];
615
700
  if (agent.baseBranch && agent.baseCommit) {
616
701
  lines.push(`Base: ${agent.baseBranch} @ ${agent.baseCommit}`);
617
702
  }
@@ -774,13 +859,19 @@ async function executeR5dctlCommand(client, json, args) {
774
859
  if (first === "projects" && second === "branches" && third === "list" || first === "get" && second === "branches") {
775
860
  const projectRef = requireValue(first === "get" ? args[2] : args[3], "Missing project reference");
776
861
  const branches = await client.projects.branches.list(projectRef);
777
- write(branches, branches.length === 0 ? "No branches found.\n" : `${branches.map((branch) => `${branch.branchName} sessions=${branch.sessionCount}`).join("\n")}
778
- `);
862
+ write(
863
+ branches,
864
+ branches.length === 0 ? "No branches found.\n" : `${branches.map((branch) => `${branch.branchName} sessions=${branch.sessionCount}`).join("\n")}
865
+ `
866
+ );
779
867
  return;
780
868
  }
781
869
  if (first === "projects" && second === "branches" && third === "describe" || first === "describe" && second === "branch") {
782
870
  const offset = first === "describe" ? 2 : 3;
783
- const result = await client.projects.branches.describe(requireValue(args[offset], "Missing project reference"), requireValue(args[offset + 1], "Missing branch name"));
871
+ const result = await client.projects.branches.describe(
872
+ requireValue(args[offset], "Missing project reference"),
873
+ requireValue(args[offset + 1], "Missing branch name")
874
+ );
784
875
  write(result, `Project: ${result.project.path}
785
876
  Branch: ${result.branchName}
786
877
  Sessions: ${result.sessions.length}
@@ -797,7 +888,10 @@ Sessions: ${result.sessions.length}
797
888
  }
798
889
  if (first === "projects" && second === "sessions" && third === "create" || first === "create" && second === "session") {
799
890
  const offset = first === "create" ? 2 : 3;
800
- const session = await client.projects.sessions.create(requireValue(args[offset], "Missing project reference"), parseSessionCreateArgs(args.slice(offset + 1)));
891
+ const session = await client.projects.sessions.create(
892
+ requireValue(args[offset], "Missing project reference"),
893
+ parseSessionCreateArgs(args.slice(offset + 1))
894
+ );
801
895
  write(session, renderSessionDescription(session));
802
896
  return;
803
897
  }
@@ -1262,6 +1356,10 @@ function resolveCommandExecution(options, rest) {
1262
1356
  }
1263
1357
  async function runCommand(argv) {
1264
1358
  const { options, rest } = parseGlobalArgs(argv);
1359
+ if (options.version) {
1360
+ printVersion();
1361
+ return;
1362
+ }
1265
1363
  if (options.help || rest.length === 0) {
1266
1364
  printHelp();
1267
1365
  return;
@@ -1318,6 +1416,7 @@ async function main(argv = process.argv.slice(2)) {
1318
1416
  }
1319
1417
  export {
1320
1418
  getCliHelpText,
1419
+ getR5dctlVersion,
1321
1420
  main,
1322
1421
  parseAnswerFlags,
1323
1422
  parseConversationRenderArgs,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "module"
5
5
  }
@@ -9,6 +9,7 @@ export type GlobalOptions = {
9
9
  branch?: string;
10
10
  session?: string;
11
11
  help: boolean;
12
+ version: boolean;
12
13
  };
13
14
  export type R5dctlConfig = {
14
15
  baseUrl?: string;
@@ -31,6 +32,7 @@ type CommandExecutionPlan = {
31
32
  };
32
33
  type ConversationRenderOptions = {};
33
34
  export declare function getCliHelpText(): string;
35
+ export declare function getR5dctlVersion(): string;
34
36
  export declare function parseGlobalArgs(argv: string[]): {
35
37
  options: GlobalOptions;
36
38
  rest: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
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.14"
29
+ "@ricsam/r5d-api": "^0.0.15"
30
30
  },
31
31
  "files": [
32
32
  "dist",