@tui-sandbox/library 11.6.5 → 11.6.7

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": "@tui-sandbox/library",
3
- "version": "11.6.5",
3
+ "version": "11.6.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mikavilpas/tui-sandbox"
@@ -17,7 +17,7 @@
17
17
  "@xterm/addon-fit": "0.10.0",
18
18
  "@xterm/addon-unicode11": "0.8.0",
19
19
  "@xterm/xterm": "5.5.0",
20
- "concurrently": "9.2.0",
20
+ "concurrently": "9.2.1",
21
21
  "cors": "2.8.5",
22
22
  "cypress": "15.0.0",
23
23
  "dree": "5.1.5",
@@ -27,7 +27,7 @@
27
27
  "prettier": "3.6.2",
28
28
  "type-fest": "4.41.0",
29
29
  "winston": "3.17.0",
30
- "zod": "4.0.17"
30
+ "zod": "4.1.4"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/command-exists": "1.2.3",
@@ -35,7 +35,7 @@
35
35
  "@types/express": "5.0.3",
36
36
  "@types/node": "24.3.0",
37
37
  "nodemon": "3.1.10",
38
- "tsx": "4.20.4",
38
+ "tsx": "4.20.5",
39
39
  "vite": "7.1.3",
40
40
  "vitest": "3.2.4"
41
41
  },
@@ -4,7 +4,7 @@ import "@xterm/xterm/css/xterm.css"
4
4
  import type { StartTerminalBrowserArguments } from "../browser/neovim-client.js"
5
5
  import type { BlockingCommandClientInput } from "../server/blockingCommandInputSchema.js"
6
6
  import type { AppRouter } from "../server/server.js"
7
- import type { BlockingShellCommandOutput, TestDirectory } from "../server/types.js"
7
+ import type { BlockingShellCommandOutput, ServerTestDirectory } from "../server/types.js"
8
8
  import type { TuiTerminalApi } from "./startTerminal.js"
9
9
  import { getTabId, startTerminal } from "./startTerminal.js"
10
10
  import { supportDA1 } from "./terminal-config.js"
@@ -71,7 +71,7 @@ export class TerminalTerminalClient {
71
71
  })
72
72
  }
73
73
 
74
- public async startTerminalApplication(args: StartTerminalBrowserArguments): Promise<TestDirectory> {
74
+ public async startTerminalApplication(args: StartTerminalBrowserArguments): Promise<ServerTestDirectory> {
75
75
  await this.ready
76
76
 
77
77
  args.browserSettings.configureTerminal?.({
@@ -57,7 +57,8 @@ switch (command?.action) {
57
57
  // important:
58
58
  //
59
59
  // This is what determines if the test run was successful or not.
60
- process.exit(result)
60
+ process.exitCode = typeof result === "number" ? result : 1
61
+ break
61
62
  }
62
63
  default: {
63
64
  command satisfies undefined
@@ -2,6 +2,7 @@ import type { Except } from "type-fest"
2
2
  import * as z from "zod"
3
3
  import { blockingCommandInputSchema } from "../../blockingCommandInputSchema.js"
4
4
  import { trpc } from "../../connection/trpc.js"
5
+ import { serverTestDirectorySchema } from "../../types.js"
5
6
  import type { DirectoriesConfig } from "../../updateTestdirectorySchemaFile.js"
6
7
  import { tabIdSchema } from "../../utilities/tabId.js"
7
8
  import { timeoutable } from "../../utilities/timeoutable.js"
@@ -59,6 +60,7 @@ export function createNeovimRouter(config: DirectoriesConfig) {
59
60
  }),
60
61
  })
61
62
  )
63
+ .output(serverTestDirectorySchema)
62
64
  .mutation(options => {
63
65
  return neovim.start(
64
66
  options.input.startNeovimArguments,
@@ -1,6 +1,6 @@
1
1
  import assert from "assert"
2
2
  import type { BlockingCommandInput } from "../../blockingCommandInputSchema.js"
3
- import type { BlockingShellCommandOutput } from "../../types.js"
3
+ import type { BlockingShellCommandOutput, TestDirectory } from "../../types.js"
4
4
  import type { DirectoriesConfig } from "../../updateTestdirectorySchemaFile.js"
5
5
  import { convertEventEmitterToAsyncGenerator } from "../../utilities/generator.js"
6
6
  import { Lazy } from "../../utilities/Lazy.js"
@@ -18,7 +18,7 @@ const resources: Lazy<AsyncDisposableStack> = new Lazy(() => {
18
18
  export async function start(
19
19
  { tabId, startTerminalArguments }: StartTerminalInput,
20
20
  config: DirectoriesConfig
21
- ): Promise<void> {
21
+ ): Promise<TestDirectory> {
22
22
  const app = terminals.get(tabId.tabId)
23
23
  assert(app, `Terminal with tabId ${tabId.tabId} not found.`)
24
24
  const testDirectory = await prepareNewTestDirectory(config)
@@ -30,6 +30,8 @@ export async function start(
30
30
  },
31
31
  startTerminalArguments.terminalDimensions
32
32
  )
33
+
34
+ return testDirectory
33
35
  }
34
36
 
35
37
  export async function initializeStdout(
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod"
2
2
  import { blockingCommandInputSchema } from "../../blockingCommandInputSchema.js"
3
3
  import { trpc } from "../../connection/trpc.js"
4
+ import { serverTestDirectorySchema } from "../../types.js"
4
5
  import type { DirectoriesConfig } from "../../updateTestdirectorySchemaFile.js"
5
6
  import { tabIdSchema } from "../../utilities/tabId.js"
6
7
  import * as terminal from "./api.js"
@@ -26,9 +27,12 @@ export function createTerminalRouter(config: DirectoriesConfig) {
26
27
  return terminal.initializeStdout(options.input, options.signal)
27
28
  }),
28
29
 
29
- start: trpc.procedure.input(startTerminalInputSchema).mutation(options => {
30
- return terminal.start(options.input, config)
31
- }),
30
+ start: trpc.procedure
31
+ .input(startTerminalInputSchema)
32
+ .output(serverTestDirectorySchema)
33
+ .mutation(options => {
34
+ return terminal.start(options.input, config)
35
+ }),
32
36
 
33
37
  sendStdin: trpc.procedure.input(z.object({ tabId: tabIdSchema, data: z.string() })).mutation(options => {
34
38
  return terminal.sendStdin(options.input)
@@ -1,4 +1,5 @@
1
1
  import type { VimValue } from "neovim/lib/types/VimValue.js"
2
+ import * as z from "zod"
2
3
 
3
4
  /** Describes the contents of the test directory, which is a blueprint for
4
5
  * files and directories. Tests can create a unique, safe environment for
@@ -8,7 +9,7 @@ import type { VimValue } from "neovim/lib/types/VimValue.js"
8
9
  * be written with confidence that the files and directories they expect are
9
10
  * actually found. Otherwise the tests are brittle and can break easily.
10
11
  */
11
- export type TestDirectory<TContents extends object = object> = {
12
+ export type TestDirectory<TContents extends Record<string, unknown> = Record<string, unknown>> = {
12
13
  /** The path to the unique test directory (the root).
13
14
  *
14
15
  * @example /Users/mikavilpas/git/tui-sandbox/packages/integration-tests/test-environment/testdirs/dir-0199UZ
@@ -31,6 +32,14 @@ export type TestDirectory<TContents extends object = object> = {
31
32
  contents: TContents
32
33
  }
33
34
 
35
+ export const serverTestDirectorySchema = z.object({
36
+ rootPathAbsolute: z.string(),
37
+ testEnvironmentPath: z.string(),
38
+ testEnvironmentPathRelative: z.string(),
39
+ contents: z.record(z.string(), z.unknown()),
40
+ })
41
+ export type ServerTestDirectory = z.infer<typeof serverTestDirectorySchema>
42
+
34
43
  export type TestEnvironmentCommonEnvironmentVariables = {
35
44
  HOME: string
36
45