@dxos/cli-util 0.8.4-main.6fa680abb7 → 0.8.4-main.74a063c4e0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/cli-util",
3
- "version": "0.8.4-main.6fa680abb7",
3
+ "version": "0.8.4-main.74a063c4e0",
4
4
  "description": "Shared CLI utilities for DXOS CLI commands and plugins",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -33,23 +33,24 @@
33
33
  "@effect/cli": "0.73.2",
34
34
  "@effect/printer": "0.47.0",
35
35
  "@effect/printer-ansi": "0.47.0",
36
- "@dxos/client": "0.8.4-main.6fa680abb7",
37
- "@dxos/echo": "0.8.4-main.6fa680abb7",
38
- "@dxos/effect": "0.8.4-main.6fa680abb7",
39
- "@dxos/errors": "0.8.4-main.6fa680abb7",
40
- "@dxos/log": "0.8.4-main.6fa680abb7",
41
- "@dxos/functions": "0.8.4-main.6fa680abb7",
42
- "@dxos/protocols": "0.8.4-main.6fa680abb7",
43
- "@dxos/debug": "0.8.4-main.6fa680abb7",
44
- "@dxos/util": "0.8.4-main.6fa680abb7"
36
+ "@dxos/debug": "0.8.4-main.74a063c4e0",
37
+ "@dxos/client": "0.8.4-main.74a063c4e0",
38
+ "@dxos/errors": "0.8.4-main.74a063c4e0",
39
+ "@dxos/effect": "0.8.4-main.74a063c4e0",
40
+ "@dxos/app-toolkit": "0.8.4-main.74a063c4e0",
41
+ "@dxos/functions": "0.8.4-main.74a063c4e0",
42
+ "@dxos/log": "0.8.4-main.74a063c4e0",
43
+ "@dxos/util": "0.8.4-main.74a063c4e0",
44
+ "@dxos/echo": "0.8.4-main.74a063c4e0",
45
+ "@dxos/protocols": "0.8.4-main.74a063c4e0"
45
46
  },
46
47
  "devDependencies": {
47
- "effect": "3.19.16",
48
+ "effect": "3.20.0",
48
49
  "typescript": "^5.9.3",
49
50
  "vitest": "3.2.4"
50
51
  },
51
52
  "peerDependencies": {
52
- "effect": "3.19.16"
53
+ "effect": "3.20.0"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
@@ -2,12 +2,11 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { inspect } from 'node:util';
6
-
7
5
  import * as Console from 'effect/Console';
8
6
  import * as Context from 'effect/Context';
9
7
  import * as Effect from 'effect/Effect';
10
8
  import * as Layer from 'effect/Layer';
9
+ import { inspect } from 'node:util';
11
10
 
12
11
  function logToString(...args: any[]): string {
13
12
  return args
@@ -8,7 +8,6 @@ import * as Layer from 'effect/Layer';
8
8
  import { ClientService, ConfigService } from '@dxos/client';
9
9
 
10
10
  import { CommandConfig } from '../services';
11
-
12
11
  import { TestConsole } from './test-console';
13
12
 
14
13
  export const TestLayer = Function.pipe(
@@ -2,8 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as Doc from '@effect/printer/Doc';
6
5
  import * as Ansi from '@effect/printer-ansi/Ansi';
6
+ import * as Doc from '@effect/printer/Doc';
7
7
  import * as Option from 'effect/Option';
8
8
  import * as Pipeable from 'effect/Pipeable';
9
9
 
@@ -2,9 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { spawn } from 'node:child_process';
6
-
7
5
  import * as Effect from 'effect/Effect';
6
+ import { spawn } from 'node:child_process';
8
7
 
9
8
  /**
10
9
  * Copy text to the system clipboard.
@@ -2,8 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as Doc from '@effect/printer/Doc';
6
5
  import * as AnsiDoc from '@effect/printer-ansi/AnsiDoc';
6
+ import * as Doc from '@effect/printer/Doc';
7
7
 
8
8
  /**
9
9
  * Pretty print document.
package/src/util/space.ts CHANGED
@@ -8,6 +8,7 @@ import * as Layer from 'effect/Layer';
8
8
  import * as Match from 'effect/Match';
9
9
  import * as Option from 'effect/Option';
10
10
 
11
+ import { getPersonalSpace } from '@dxos/app-toolkit';
11
12
  import { ClientService } from '@dxos/client';
12
13
  import { type Space } from '@dxos/client/echo';
13
14
  import { Database, type Key } from '@dxos/echo';
@@ -26,26 +27,25 @@ export const getSpace = (spaceId: Key.SpaceId): Effect.Effect<Space, SpaceNotFou
26
27
  export const spaceIdWithDefault = (spaceId: Option.Option<Key.SpaceId>) =>
27
28
  Effect.gen(function* () {
28
29
  const client = yield* ClientService;
29
- yield* Effect.promise(() => client.spaces.waitUntilReady());
30
- return Option.getOrElse(spaceId, () => client.spaces.default.id);
30
+ return Option.getOrElse(spaceId, () => {
31
+ const personal = getPersonalSpace(client);
32
+ if (!personal) {
33
+ throw new Error('No space ID provided and no personal space found.');
34
+ }
35
+ return personal.id;
36
+ });
31
37
  });
32
38
 
33
39
  // TODO(wittjosiah): Factor out.
34
40
  export const spaceLayer = (
35
41
  spaceId$: Option.Option<Key.SpaceId>,
36
- fallbackToDefaultSpace = false,
42
+ fallbackToPersonalSpace = false,
37
43
  ): Layer.Layer<Database.Service | QueueService, never, ClientService> => {
38
44
  const getSpace = Effect.fn(function* () {
39
45
  const client = yield* ClientService;
40
- yield* Effect.promise(() => client.spaces.waitUntilReady());
41
-
42
- const spaceId = Match.value(fallbackToDefaultSpace).pipe(
43
- Match.when(true, () =>
44
- spaceId$.pipe(
45
- Option.getOrElse(() => client.spaces.default.id),
46
- Option.some,
47
- ),
48
- ),
46
+
47
+ const spaceId = Match.value(fallbackToPersonalSpace).pipe(
48
+ Match.when(true, () => spaceId$.pipe(Option.orElse(() => Option.fromNullable(getPersonalSpace(client)?.id)))),
49
49
  Match.when(false, () => spaceId$),
50
50
  Match.exhaustive,
51
51
  );
@@ -75,7 +75,7 @@ export const spaceLayer = (
75
75
  }
76
76
  return { db: space.db };
77
77
  }),
78
- ({ db }) => Effect.promise(() => db.flush({ indexes: true })),
78
+ ({ db }) => Effect.promise(() => db.flush()),
79
79
  ),
80
80
  );
81
81