@higherdev/cli 0.14.2 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,6 +35,7 @@ workspace-map config shapes are migrated automatically when they are read.
35
35
  | `hd epic rm ID` | Remove a draft epic |
36
36
  | `hd plan` | Point to the TUI `/architect` conversation |
37
37
  | `hd workspace ls` | List every workspace available to the configured key |
38
+ | `hd workspace use SLUG` | Switch the current workspace |
38
39
  | `hd workspace new --name NAME --repo OWNER/NAME [options]` | Preflight GitHub, wire the runner, and create a paused workspace |
39
40
  | `hd workspace set [options]` | Update settings; max turns uses `--max-turns KIND=N[,KIND=N...]` |
40
41
  | `hd workspace rotate-key` | Rotate the shared API key and save it locally |
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { login, parseLoginFlags } from "./login.js";
7
7
  import { loadConfig } from "./config.js";
8
8
  import { epicProgressRows, readEpicSpec } from "./epics.js";
9
9
  import { banner, c, statusChip, table, truncate, usage } from "./out.js";
10
- import { WORKSPACE_USAGE, workspaceNew, workspaceRotateKey, workspaceSet } from "./workspace-commands.js";
10
+ import { WORKSPACE_USAGE, workspaceNew, workspaceRotateKey, workspaceSet, workspaceUse } from "./workspace-commands.js";
11
11
  function fail(message) {
12
12
  console.error(message);
13
13
  process.exit(1);
@@ -252,6 +252,11 @@ async function cmdWorkspace(argv, deps = {}) {
252
252
  ])));
253
253
  return;
254
254
  }
255
+ if (action === "use") {
256
+ const workspace = await workspaceUse(rest);
257
+ console.log(`${workspace.slug} ${workspace.name} ${workspace.repo}`);
258
+ return;
259
+ }
255
260
  if (action === "rotate-key") {
256
261
  if (rest.length)
257
262
  fail(WORKSPACE_USAGE);
package/dist/out.js CHANGED
@@ -67,7 +67,7 @@ export function usage() {
67
67
  ` ${c.blue("hd ticket list | show | new | queue | cancel")} ticket operations`,
68
68
  ` ${c.blue("hd epic new PATH | list | approve | rm")} epic operations`,
69
69
  ` ${c.blue("hd plan")} use /architect in the TUI`,
70
- ` ${c.blue("hd workspace ls | new | set | rotate-key")} workspace operations`,
70
+ ` ${c.blue("hd workspace ls | use | new | set | rotate-key")} workspace operations`,
71
71
  ` ${c.blue("hd agents [add | rm | set]")} manage agents`,
72
72
  ` ${c.blue("hd caps [set PROVIDER N]")} provider concurrency`,
73
73
  ` ${c.blue("hd env ls | set | rm")} workspace environment`,
@@ -1,8 +1,8 @@
1
- import { createWorkspace, rotateWorkspaceApiKey, updateWorkspace } from "./api.js";
2
- import { loadConfig, writeHdConfig } from "./config.js";
1
+ import { createWorkspace, listWorkspaces, rotateWorkspaceApiKey, updateWorkspace } from "./api.js";
2
+ import { loadConfig, switchWorkspace, writeHdConfig } from "./config.js";
3
3
  import { promptOnStdin } from "./prompt.js";
4
4
  import { defaultGh, HDX_RUNNER_GH_USER, preflightWorkspace } from "./workspace-preflight.js";
5
- export const WORKSPACE_USAGE = "usage: hd workspace ls | new --name NAME --repo OWNER/NAME [--create|--no-create] [flags] | set [flags] | rotate-key";
5
+ export const WORKSPACE_USAGE = "usage: hd workspace ls | use SLUG | new --name NAME --repo OWNER/NAME [--create|--no-create] [flags] | set [flags] | rotate-key";
6
6
  function flags(argv) {
7
7
  const opts = {};
8
8
  const bools = new Set();
@@ -154,6 +154,17 @@ export async function workspaceSet(argv) {
154
154
  throw new Error(WORKSPACE_USAGE);
155
155
  return (await updateWorkspace(fields)).workspace;
156
156
  }
157
+ export async function workspaceUse(argv) {
158
+ if (argv.length !== 1 || !argv[0])
159
+ throw new Error(WORKSPACE_USAGE);
160
+ const workspaces = await listWorkspaces();
161
+ const selected = workspaces.find((workspace) => workspace.slug === argv[0]);
162
+ if (!selected) {
163
+ throw new Error(`No workspace ${argv[0]}. You can reach: ${workspaces.map((workspace) => workspace.slug).sort().join(", ")}.`);
164
+ }
165
+ switchWorkspace(selected.slug);
166
+ return selected;
167
+ }
157
168
  export async function workspaceRotateKey() {
158
169
  const config = loadConfig();
159
170
  const { api_key } = await rotateWorkspaceApiKey(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@higherdev/cli",
3
- "version": "0.14.2",
3
+ "version": "0.14.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "hd": "dist/index.js"