@ricsam/r5dctl 0.0.5 → 0.0.6

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/README.md CHANGED
@@ -29,7 +29,7 @@ Credentials are stored in:
29
29
  - `--config <path>`
30
30
  - `--token <token>`
31
31
  - `--api-key <key>`
32
- - `-p, --project <slug|id>`
32
+ - `-p, --project <namespace/name|id>`
33
33
  - `-b, --branch <branch>`
34
34
  - `-s, --session <sessionId>`
35
35
 
@@ -43,10 +43,9 @@ r5dctl auth api-key list
43
43
  r5dctl auth api-key revoke <key-id>
44
44
 
45
45
  r5dctl get projects
46
- r5dctl create project --name "Demo Project"
47
- r5dctl describe project <project-ref>
48
- r5dctl update project <project-ref> --name "Renamed Project" --mode prod
49
- r5dctl delete project <project-ref>
46
+ r5dctl describe project <namespace/name|id>
47
+ r5dctl update project <namespace/name|id> --mode prod
48
+ r5dctl delete project <namespace/name|id>
50
49
 
51
50
  r5dctl -p <project> get branches
52
51
  r5dctl -p <project> describe branch <branch>
package/dist/cjs/cli.cjs CHANGED
@@ -52,7 +52,7 @@ const CLI_GLOBAL_OPTION_HELP = [
52
52
  "--config <path>",
53
53
  "--token <token>",
54
54
  "--api-key <key>",
55
- "-p, --project <slug|id>",
55
+ "-p, --project <namespace/name|id>",
56
56
  "-b, --branch <branch>",
57
57
  "-s, --session <sessionId>",
58
58
  "-h, --help"
@@ -77,10 +77,9 @@ const SHARED_HELP_ENTRIES = [
77
77
  { section: "auth", usage: "auth api-key list", description: "List API keys for the current account." },
78
78
  { section: "auth", usage: "auth api-key revoke <key-id>", description: "Revoke an API key." },
79
79
  { section: "projects", usage: "get projects", description: "List projects you can access." },
80
- { section: "projects", usage: "create project [--name <name>] [--org <org-id>]", description: "Create a new project." },
81
- { section: "projects", usage: "describe project <project-ref>", description: "Show details for a project." },
82
- { section: "projects", usage: "update project <project-ref> [--name <name>] [--mode <greenfield|prod>]", description: "Update project settings." },
83
- { section: "projects", usage: "delete project <project-ref>", description: "Delete a project." },
80
+ { section: "projects", usage: "describe project <namespace/name|id>", description: "Show details for a project." },
81
+ { section: "projects", usage: "update project <namespace/name|id> --mode <greenfield|prod>", description: "Update project settings." },
82
+ { section: "projects", usage: "delete project <namespace/name|id>", description: "Delete a project." },
84
83
  { section: "branches", usage: "-p <project> get branches", description: "List branches for a project." },
85
84
  { section: "branches", usage: "-p <project> describe branch <branch>", description: "Show branch URLs and sessions." },
86
85
  { section: "sessions", usage: "-p <project> get sessions [--branch <branch>]", description: "List sessions for a project, optionally filtered by branch." },
@@ -593,14 +592,15 @@ function clearAuthFromConfig(config, options) {
593
592
  };
594
593
  }
595
594
  function renderProjectDescription(project) {
596
- return [`Project: ${project.name ?? project.id}`, `Ref: ${project.slug ?? project.id}`, `Mode: ${project.mode}`].join("\n") + "\n";
595
+ return [`Project: ${project.path}`, `Ref: ${project.path}`, `ID: ${project.id}`, `Mode: ${project.mode}`].join("\n") + "\n";
597
596
  }
598
597
  function renderProjectList(projects) {
599
598
  if (projects.length === 0) {
600
599
  return "No projects found.\n";
601
600
  }
602
- return `${projects.map((project) => `${project.name ?? "(unnamed project)"}
603
- Ref: ${project.slug ?? project.id}
601
+ return `${projects.map((project) => `${project.path}
602
+ Ref: ${project.path}
603
+ ID: ${project.id}
604
604
  Mode: ${project.mode}`).join("\n\n")}
605
605
  `;
606
606
  }
@@ -612,50 +612,12 @@ function renderSessionList(sessions) {
612
612
  `;
613
613
  }
614
614
  function renderSessionDescription(session) {
615
- return [`Session: ${session.id}`, `Project: ${session.projectName ?? session.projectId}`, `Branch: ${session.branchName}`].join("\n") + "\n";
616
- }
617
- function parseProjectCreateArgs(args) {
618
- const input = {};
619
- for (let index = 0; index < args.length; index += 1) {
620
- const arg = args[index];
621
- if (arg === "--name") {
622
- input.name = requireValue(args[index + 1], "Missing value for --name");
623
- index += 1;
624
- continue;
625
- }
626
- const inlineName = arg ? parseLongOptionWithEquals(arg, "--name") : void 0;
627
- if (inlineName !== void 0) {
628
- input.name = inlineName;
629
- continue;
630
- }
631
- if (arg === "--org" || arg === "--org-id") {
632
- input.orgId = requireValue(args[index + 1], `Missing value for ${arg}`);
633
- index += 1;
634
- continue;
635
- }
636
- const inlineOrg = arg ? parseLongOptionWithEquals(arg, "--org") ?? parseLongOptionWithEquals(arg, "--org-id") : void 0;
637
- if (inlineOrg !== void 0) {
638
- input.orgId = inlineOrg;
639
- continue;
640
- }
641
- throw new Error(`Unknown project create argument: ${arg}`);
642
- }
643
- return input;
615
+ return [`Session: ${session.id}`, `Project: ${session.projectPath}`, `Branch: ${session.branchName}`].join("\n") + "\n";
644
616
  }
645
617
  function parseProjectUpdateArgs(args) {
646
618
  const input = {};
647
619
  for (let index = 0; index < args.length; index += 1) {
648
620
  const arg = args[index];
649
- if (arg === "--name") {
650
- input.name = requireValue(args[index + 1], "Missing value for --name");
651
- index += 1;
652
- continue;
653
- }
654
- const inlineName = arg ? parseLongOptionWithEquals(arg, "--name") : void 0;
655
- if (inlineName !== void 0) {
656
- input.name = inlineName;
657
- continue;
658
- }
659
621
  if (arg === "--mode") {
660
622
  const mode = requireValue(args[index + 1], "Missing value for --mode");
661
623
  if (mode !== "greenfield" && mode !== "prod") throw new Error("Invalid value for --mode: expected greenfield or prod");
@@ -760,7 +722,7 @@ function parseConversationRenderArgs(args) {
760
722
  function renderConversationResponse(read, options = { full: false, compact: false }) {
761
723
  const thread = Array.isArray(read.thread) ? read.thread : [];
762
724
  const visibleThread = options.tail ? thread.slice(-options.tail) : thread;
763
- const lines = [`Session: ${read.session.id}`, `Project: ${read.session.projectName ?? read.session.projectId}`, `Branch: ${read.session.branchName}`, ""];
725
+ const lines = [`Session: ${read.session.id}`, `Project: ${read.session.projectPath}`, `Branch: ${read.session.branchName}`, ""];
764
726
  lines.push(`Conversation nodes: ${visibleThread.length}${options.tail ? ` of ${thread.length}` : ""}`);
765
727
  if (!options.compact) {
766
728
  lines.push(JSON.stringify(visibleThread, null, options.full ? 2 : 0));
@@ -806,11 +768,6 @@ async function executeBinctlCommand(client, json, args) {
806
768
  write(projects, renderProjectList(projects));
807
769
  return;
808
770
  }
809
- if (first === "projects" && second === "create" || first === "create" && second === "project") {
810
- const project = await client.projects.create(parseProjectCreateArgs(args.slice(2)));
811
- write(project, renderProjectDescription(project));
812
- return;
813
- }
814
771
  if (first === "projects" && second === "describe" || first === "describe" && second === "project") {
815
772
  const project = await client.projects.describe(requireValue(args[2], "Missing project reference"));
816
773
  write(project, renderProjectDescription(project));
@@ -837,7 +794,7 @@ async function executeBinctlCommand(client, json, args) {
837
794
  if (first === "projects" && second === "branches" && third === "describe" || first === "describe" && second === "branch") {
838
795
  const offset = first === "describe" ? 2 : 3;
839
796
  const result = await client.projects.branches.describe(requireValue(args[offset], "Missing project reference"), requireValue(args[offset + 1], "Missing branch name"));
840
- write(result, `Project: ${result.project.name ?? result.project.id}
797
+ write(result, `Project: ${result.project.path}
841
798
  Branch: ${result.branchName}
842
799
  Sessions: ${result.sessions.length}
843
800
  `);
@@ -1058,12 +1015,6 @@ function resolveCommandExecution(options, rest) {
1058
1015
  }
1059
1016
  if (command === "create") {
1060
1017
  const target = commandArgs[0];
1061
- if (target === "project") {
1062
- return {
1063
- kind: "plugin",
1064
- pluginArgs: ["create", "project", ...commandArgs.slice(1)]
1065
- };
1066
- }
1067
1018
  if (target === "session") {
1068
1019
  const rawArgs = commandArgs.slice(1);
1069
1020
  const firstFlagIndex = rawArgs.findIndex((arg) => arg.startsWith("-"));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "commonjs"
5
5
  }
package/dist/mjs/cli.mjs CHANGED
@@ -15,7 +15,7 @@ const CLI_GLOBAL_OPTION_HELP = [
15
15
  "--config <path>",
16
16
  "--token <token>",
17
17
  "--api-key <key>",
18
- "-p, --project <slug|id>",
18
+ "-p, --project <namespace/name|id>",
19
19
  "-b, --branch <branch>",
20
20
  "-s, --session <sessionId>",
21
21
  "-h, --help"
@@ -40,10 +40,9 @@ const SHARED_HELP_ENTRIES = [
40
40
  { section: "auth", usage: "auth api-key list", description: "List API keys for the current account." },
41
41
  { section: "auth", usage: "auth api-key revoke <key-id>", description: "Revoke an API key." },
42
42
  { section: "projects", usage: "get projects", description: "List projects you can access." },
43
- { section: "projects", usage: "create project [--name <name>] [--org <org-id>]", description: "Create a new project." },
44
- { section: "projects", usage: "describe project <project-ref>", description: "Show details for a project." },
45
- { section: "projects", usage: "update project <project-ref> [--name <name>] [--mode <greenfield|prod>]", description: "Update project settings." },
46
- { section: "projects", usage: "delete project <project-ref>", description: "Delete a project." },
43
+ { section: "projects", usage: "describe project <namespace/name|id>", description: "Show details for a project." },
44
+ { section: "projects", usage: "update project <namespace/name|id> --mode <greenfield|prod>", description: "Update project settings." },
45
+ { section: "projects", usage: "delete project <namespace/name|id>", description: "Delete a project." },
47
46
  { section: "branches", usage: "-p <project> get branches", description: "List branches for a project." },
48
47
  { section: "branches", usage: "-p <project> describe branch <branch>", description: "Show branch URLs and sessions." },
49
48
  { section: "sessions", usage: "-p <project> get sessions [--branch <branch>]", description: "List sessions for a project, optionally filtered by branch." },
@@ -556,14 +555,15 @@ function clearAuthFromConfig(config, options) {
556
555
  };
557
556
  }
558
557
  function renderProjectDescription(project) {
559
- return [`Project: ${project.name ?? project.id}`, `Ref: ${project.slug ?? project.id}`, `Mode: ${project.mode}`].join("\n") + "\n";
558
+ return [`Project: ${project.path}`, `Ref: ${project.path}`, `ID: ${project.id}`, `Mode: ${project.mode}`].join("\n") + "\n";
560
559
  }
561
560
  function renderProjectList(projects) {
562
561
  if (projects.length === 0) {
563
562
  return "No projects found.\n";
564
563
  }
565
- return `${projects.map((project) => `${project.name ?? "(unnamed project)"}
566
- Ref: ${project.slug ?? project.id}
564
+ return `${projects.map((project) => `${project.path}
565
+ Ref: ${project.path}
566
+ ID: ${project.id}
567
567
  Mode: ${project.mode}`).join("\n\n")}
568
568
  `;
569
569
  }
@@ -575,50 +575,12 @@ function renderSessionList(sessions) {
575
575
  `;
576
576
  }
577
577
  function renderSessionDescription(session) {
578
- return [`Session: ${session.id}`, `Project: ${session.projectName ?? session.projectId}`, `Branch: ${session.branchName}`].join("\n") + "\n";
579
- }
580
- function parseProjectCreateArgs(args) {
581
- const input = {};
582
- for (let index = 0; index < args.length; index += 1) {
583
- const arg = args[index];
584
- if (arg === "--name") {
585
- input.name = requireValue(args[index + 1], "Missing value for --name");
586
- index += 1;
587
- continue;
588
- }
589
- const inlineName = arg ? parseLongOptionWithEquals(arg, "--name") : void 0;
590
- if (inlineName !== void 0) {
591
- input.name = inlineName;
592
- continue;
593
- }
594
- if (arg === "--org" || arg === "--org-id") {
595
- input.orgId = requireValue(args[index + 1], `Missing value for ${arg}`);
596
- index += 1;
597
- continue;
598
- }
599
- const inlineOrg = arg ? parseLongOptionWithEquals(arg, "--org") ?? parseLongOptionWithEquals(arg, "--org-id") : void 0;
600
- if (inlineOrg !== void 0) {
601
- input.orgId = inlineOrg;
602
- continue;
603
- }
604
- throw new Error(`Unknown project create argument: ${arg}`);
605
- }
606
- return input;
578
+ return [`Session: ${session.id}`, `Project: ${session.projectPath}`, `Branch: ${session.branchName}`].join("\n") + "\n";
607
579
  }
608
580
  function parseProjectUpdateArgs(args) {
609
581
  const input = {};
610
582
  for (let index = 0; index < args.length; index += 1) {
611
583
  const arg = args[index];
612
- if (arg === "--name") {
613
- input.name = requireValue(args[index + 1], "Missing value for --name");
614
- index += 1;
615
- continue;
616
- }
617
- const inlineName = arg ? parseLongOptionWithEquals(arg, "--name") : void 0;
618
- if (inlineName !== void 0) {
619
- input.name = inlineName;
620
- continue;
621
- }
622
584
  if (arg === "--mode") {
623
585
  const mode = requireValue(args[index + 1], "Missing value for --mode");
624
586
  if (mode !== "greenfield" && mode !== "prod") throw new Error("Invalid value for --mode: expected greenfield or prod");
@@ -723,7 +685,7 @@ function parseConversationRenderArgs(args) {
723
685
  function renderConversationResponse(read, options = { full: false, compact: false }) {
724
686
  const thread = Array.isArray(read.thread) ? read.thread : [];
725
687
  const visibleThread = options.tail ? thread.slice(-options.tail) : thread;
726
- const lines = [`Session: ${read.session.id}`, `Project: ${read.session.projectName ?? read.session.projectId}`, `Branch: ${read.session.branchName}`, ""];
688
+ const lines = [`Session: ${read.session.id}`, `Project: ${read.session.projectPath}`, `Branch: ${read.session.branchName}`, ""];
727
689
  lines.push(`Conversation nodes: ${visibleThread.length}${options.tail ? ` of ${thread.length}` : ""}`);
728
690
  if (!options.compact) {
729
691
  lines.push(JSON.stringify(visibleThread, null, options.full ? 2 : 0));
@@ -769,11 +731,6 @@ async function executeBinctlCommand(client, json, args) {
769
731
  write(projects, renderProjectList(projects));
770
732
  return;
771
733
  }
772
- if (first === "projects" && second === "create" || first === "create" && second === "project") {
773
- const project = await client.projects.create(parseProjectCreateArgs(args.slice(2)));
774
- write(project, renderProjectDescription(project));
775
- return;
776
- }
777
734
  if (first === "projects" && second === "describe" || first === "describe" && second === "project") {
778
735
  const project = await client.projects.describe(requireValue(args[2], "Missing project reference"));
779
736
  write(project, renderProjectDescription(project));
@@ -800,7 +757,7 @@ async function executeBinctlCommand(client, json, args) {
800
757
  if (first === "projects" && second === "branches" && third === "describe" || first === "describe" && second === "branch") {
801
758
  const offset = first === "describe" ? 2 : 3;
802
759
  const result = await client.projects.branches.describe(requireValue(args[offset], "Missing project reference"), requireValue(args[offset + 1], "Missing branch name"));
803
- write(result, `Project: ${result.project.name ?? result.project.id}
760
+ write(result, `Project: ${result.project.path}
804
761
  Branch: ${result.branchName}
805
762
  Sessions: ${result.sessions.length}
806
763
  `);
@@ -1021,12 +978,6 @@ function resolveCommandExecution(options, rest) {
1021
978
  }
1022
979
  if (command === "create") {
1023
980
  const target = commandArgs[0];
1024
- if (target === "project") {
1025
- return {
1026
- kind: "plugin",
1027
- pluginArgs: ["create", "project", ...commandArgs.slice(1)]
1028
- };
1029
- }
1030
981
  if (target === "session") {
1031
982
  const rawArgs = commandArgs.slice(1);
1032
983
  const firstFlagIndex = rawArgs.findIndex((arg) => arg.startsWith("-"));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "module"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5dctl",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
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.5"
29
+ "@ricsam/r5d-api": "^0.0.6"
30
30
  },
31
31
  "files": [
32
32
  "dist",