t3code-cli 0.11.0 → 0.12.0
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 +42 -10
- package/dist/application.js +2 -2
- package/dist/auth.js +1 -1
- package/dist/bin.js +85526 -2662
- package/dist/cli.js +15 -2
- package/dist/config.js +120 -2
- package/dist/connection.js +2 -2
- package/dist/index.js +1 -1
- package/dist/node.js +6 -2
- package/dist/orchestration.js +2 -2
- package/dist/rpc.js +1 -1
- package/dist/runtime.js +2 -2
- package/dist/shared.js +42956 -38119
- package/dist/src/application/actions.d.ts +25 -0
- package/dist/src/application/index.d.ts +3 -3
- package/dist/src/application/layer.d.ts +51 -35
- package/dist/src/application/model-selection.d.ts +2 -2
- package/dist/src/application/models.d.ts +1 -1
- package/dist/src/application/project-commands.d.ts +22 -2
- package/dist/src/application/projects.d.ts +7 -7
- package/dist/src/application/service.d.ts +65 -2
- package/dist/src/application/shell-sequence.d.ts +11 -0
- package/dist/src/application/terminals.d.ts +2 -2
- package/dist/src/application/thread-commands.d.ts +1 -1
- package/dist/src/application/thread-wait.d.ts +9 -0
- package/dist/src/application/threads.d.ts +56 -5
- package/dist/src/auth/error.d.ts +2 -1
- package/dist/src/auth/index.d.ts +1 -1
- package/dist/src/auth/layer.d.ts +34 -6
- package/dist/src/auth/local-base-dir.d.ts +5 -2
- package/dist/src/auth/local-origin.d.ts +3 -3
- package/dist/src/auth/local-token.d.ts +3 -3
- package/dist/src/auth/service.d.ts +15 -3
- package/dist/src/auth/type.d.ts +40 -1
- package/dist/src/cli/env/flag.d.ts +2 -0
- package/dist/src/cli/env/index.d.ts +2 -0
- package/dist/src/cli/env/selection-layer.d.ts +3 -0
- package/dist/src/cli/flags.d.ts +2 -0
- package/dist/src/cli/format/index.d.ts +1 -0
- package/dist/src/cli/format/output.d.ts +12 -0
- package/dist/src/cli/index.d.ts +4 -0
- package/dist/src/cli/runtime/index.d.ts +1 -0
- package/dist/src/cli/runtime/service.d.ts +16 -0
- package/dist/src/{scope → cli/scope}/resolve.d.ts +5 -4
- package/dist/src/config/config.d.ts +49 -0
- package/dist/src/config/credential/cipher-node.d.ts +3 -0
- package/dist/src/config/credential/cipher-web.d.ts +3 -0
- package/dist/src/config/credential/cipher.d.ts +29 -0
- package/dist/src/config/credential/env.d.ts +3 -0
- package/dist/src/config/credential/error.d.ts +8 -0
- package/dist/src/config/credential/index.d.ts +6 -0
- package/dist/src/config/credential/service.d.ts +34 -0
- package/dist/src/config/env/env.d.ts +55 -0
- package/dist/src/config/env/index.d.ts +2 -0
- package/dist/src/{layout/base-dir.d.ts → config/env/layout.d.ts} +0 -1
- package/dist/src/config/environment-name/index.d.ts +1 -0
- package/dist/src/config/environment-name/name.d.ts +10 -0
- package/dist/src/config/error.d.ts +4 -11
- package/dist/src/config/index.d.ts +10 -5
- package/dist/src/config/keystore/error.d.ts +8 -0
- package/dist/src/config/keystore/file.d.ts +9 -0
- package/dist/src/config/keystore/index.d.ts +4 -0
- package/dist/src/config/keystore/keyring-node.d.ts +4 -0
- package/dist/src/config/keystore/service.d.ts +33 -0
- package/dist/src/config/paths/index.d.ts +1 -0
- package/dist/src/config/paths/paths.d.ts +6 -0
- package/dist/src/config/persist/file-mode.d.ts +4 -0
- package/dist/src/config/persist/migration.d.ts +68 -0
- package/dist/src/config/persist/persist.d.ts +40 -0
- package/dist/src/config/persist/schema.d.ts +68 -0
- package/dist/src/config/resolve/resolve.d.ts +40 -0
- package/dist/src/config/selection/index.d.ts +1 -0
- package/dist/src/config/selection/resolve.d.ts +4 -0
- package/dist/src/config/selection/service.d.ts +10 -0
- package/dist/src/config/types.d.ts +36 -0
- package/dist/src/config/url/error.d.ts +10 -0
- package/dist/src/config/url/index.d.ts +2 -0
- package/dist/src/connection/index.d.ts +0 -1
- package/dist/src/contracts/index.d.ts +1 -1
- package/dist/src/domain/error.d.ts +14 -1
- package/dist/src/domain/helpers.d.ts +16 -1
- package/dist/src/domain/model-config.d.ts +4 -1
- package/dist/src/domain/thread-activities.d.ts +1 -1
- package/dist/src/domain/thread-lifecycle.d.ts +10 -1
- package/dist/src/index.d.ts +1 -2
- package/dist/src/{connection/node.d.ts → node/connection.d.ts} +1 -1
- package/dist/src/node/index.d.ts +1 -2
- package/dist/src/orchestration/index.d.ts +0 -1
- package/dist/src/orchestration/layer.d.ts +153 -7
- package/dist/src/orchestration/service.d.ts +1 -1
- package/dist/src/rpc/error.d.ts +2 -2
- package/dist/src/rpc/index.d.ts +2 -3
- package/dist/src/rpc/layer.d.ts +574 -46
- package/dist/src/rpc/operation.d.ts +574 -46
- package/dist/src/rpc/ws-group.d.ts +184 -19
- package/dist/src/runtime/index.d.ts +1 -2
- package/dist/src/runtime/layer.d.ts +12 -8
- package/dist/src/t3tools/index.d.ts +1 -1
- package/dist/t3tools.js +2 -2
- package/package.json +25 -21
- package/src/application/actions.test.ts +328 -0
- package/src/application/actions.ts +475 -0
- package/src/application/index.ts +9 -5
- package/src/application/layer.ts +9 -0
- package/src/application/model-selection.ts +2 -2
- package/src/application/project-commands.ts +23 -5
- package/src/application/projects.ts +6 -7
- package/src/application/service.ts +79 -1
- package/src/application/shell-sequence.ts +1 -1
- package/src/application/terminals.ts +2 -1
- package/src/application/thread-commands.ts +1 -1
- package/src/application/thread-update.ts +1 -1
- package/src/application/thread-wait.ts +1 -1
- package/src/application/threads.test.ts +9 -3
- package/src/application/threads.ts +6 -6
- package/src/auth/error.ts +2 -1
- package/src/auth/index.ts +7 -0
- package/src/auth/layer.test-utils.ts +34 -0
- package/src/auth/layer.ts +116 -34
- package/src/auth/local-base-dir.ts +13 -6
- package/src/auth/local-origin.ts +10 -7
- package/src/auth/local-token.ts +28 -23
- package/src/auth/service.test.ts +200 -0
- package/src/auth/service.ts +27 -3
- package/src/auth/transport.ts +2 -2
- package/src/auth/type.ts +47 -1
- package/src/bin.ts +24 -6
- package/src/cli/action-format.ts +110 -0
- package/src/cli/action.ts +398 -0
- package/src/cli/app.ts +6 -0
- package/src/cli/auth.ts +76 -23
- package/src/cli/env/flag.ts +8 -0
- package/src/cli/env/index.ts +2 -0
- package/src/cli/env/selection-layer.test.ts +49 -0
- package/src/cli/env/selection-layer.ts +27 -0
- package/src/cli/env.ts +107 -0
- package/src/cli/extra-args.test.ts +32 -0
- package/src/cli/extra-args.ts +22 -0
- package/src/cli/flags.ts +11 -1
- package/src/cli/format/auth.ts +92 -0
- package/src/cli/format/human.ts +131 -0
- package/src/cli/format/index.ts +12 -0
- package/src/cli/format/model.ts +29 -0
- package/src/cli/format/output.ts +51 -0
- package/src/cli/format/project.ts +32 -0
- package/src/cli/format/terminal.ts +87 -0
- package/src/cli/{thread-format.test.ts → format/thread.test.ts} +6 -4
- package/src/cli/format/thread.ts +185 -0
- package/src/cli/index.ts +20 -0
- package/src/cli/interaction/confirm.ts +64 -0
- package/src/cli/{self-action.ts → interaction/self-action.ts} +8 -6
- package/src/cli/message-input.ts +1 -1
- package/src/cli/model.ts +9 -5
- package/src/cli/project.ts +13 -7
- package/src/cli/projects/delete.ts +13 -12
- package/src/cli/require.ts +9 -7
- package/src/cli/runtime/index.ts +1 -0
- package/src/cli/runtime/service.ts +28 -0
- package/src/{scope → cli/scope}/resolve.ts +11 -9
- package/src/cli/terminal/attach.ts +3 -6
- package/src/cli/terminal/create.ts +10 -9
- package/src/cli/terminal/destroy.ts +13 -11
- package/src/cli/terminal/list.ts +10 -9
- package/src/cli/terminal/read.test-utils.ts +48 -0
- package/src/cli/terminal/read.test.ts +35 -0
- package/src/cli/terminal/read.ts +3 -6
- package/src/cli/terminal/scope.ts +10 -5
- package/src/cli/terminal/shared.ts +1 -1
- package/src/cli/terminal/stream.ts +3 -6
- package/src/cli/terminal/wait.test.ts +5 -3
- package/src/cli/terminal/wait.ts +10 -9
- package/src/cli/terminal/write.test.ts +34 -0
- package/src/cli/terminal/write.ts +10 -9
- package/src/cli/threads/approve.ts +11 -7
- package/src/cli/threads/archive.ts +14 -9
- package/src/cli/threads/callback.ts +6 -4
- package/src/cli/threads/delete.ts +17 -11
- package/src/cli/threads/interrupt.ts +14 -9
- package/src/cli/threads/list.test.ts +5 -3
- package/src/cli/threads/list.ts +10 -10
- package/src/cli/threads/messages.ts +11 -7
- package/src/cli/threads/respond.ts +11 -7
- package/src/cli/threads/send.ts +19 -9
- package/src/cli/threads/show.ts +11 -7
- package/src/cli/threads/start.ts +18 -13
- package/src/cli/threads/unarchive.ts +11 -7
- package/src/cli/threads/update.ts +14 -9
- package/src/cli/threads/wait.ts +11 -7
- package/src/cli/wait-events.ts +1 -1
- package/src/config/config.ts +260 -0
- package/src/config/credential/cipher-node.ts +40 -0
- package/src/config/credential/cipher-web.ts +82 -0
- package/src/config/credential/cipher.ts +39 -0
- package/src/config/credential/env.ts +13 -0
- package/src/config/credential/error.ts +9 -0
- package/src/config/credential/index.ts +6 -0
- package/src/config/credential/service.test-utils.ts +25 -0
- package/src/config/credential/service.test.ts +116 -0
- package/src/config/credential/service.ts +205 -0
- package/src/config/env/env.test-utils.ts +14 -0
- package/src/config/env/env.ts +81 -0
- package/src/config/env/index.ts +2 -0
- package/src/{layout/base-dir.ts → config/env/layout.ts} +0 -9
- package/src/config/environment-name/index.ts +7 -0
- package/src/config/environment-name/name.test.ts +66 -0
- package/src/config/environment-name/name.ts +49 -0
- package/src/config/error.ts +6 -8
- package/src/config/index.ts +16 -5
- package/src/config/keystore/error.ts +9 -0
- package/src/config/keystore/file.ts +96 -0
- package/src/config/keystore/index.ts +4 -0
- package/src/config/keystore/keyring-node.test.ts +12 -0
- package/src/config/keystore/keyring-node.ts +100 -0
- package/src/config/keystore/service.test-utils.ts +15 -0
- package/src/config/keystore/service.test.ts +18 -0
- package/src/config/keystore/service.ts +29 -0
- package/src/config/layer.test-utils.ts +45 -0
- package/src/config/layer.test.ts +209 -0
- package/src/config/paths/index.ts +1 -0
- package/src/config/paths/paths.ts +36 -0
- package/src/config/persist/file-mode.ts +21 -0
- package/src/config/persist/migration.test.ts +71 -0
- package/src/config/persist/migration.ts +82 -0
- package/src/config/persist/persist.test.ts +113 -0
- package/src/config/persist/persist.ts +65 -0
- package/src/config/persist/schema.ts +37 -0
- package/src/config/platform.test-utils.ts +20 -0
- package/src/config/resolve/resolve.test-utils.ts +20 -0
- package/src/config/resolve/resolve.test.ts +137 -0
- package/src/config/resolve/resolve.ts +104 -0
- package/src/config/selection/index.ts +1 -0
- package/src/config/selection/resolve.ts +14 -0
- package/src/config/selection/service.ts +29 -0
- package/src/config/temp-home.test-utils.ts +7 -0
- package/src/config/types.ts +49 -0
- package/src/config/url/error.ts +8 -0
- package/src/config/url/index.ts +7 -0
- package/src/config/url/url.test.ts +31 -0
- package/src/connection/index.ts +0 -1
- package/src/contracts/index.ts +1 -1
- package/src/domain/error.ts +20 -1
- package/src/domain/helpers.test.ts +1 -1
- package/src/domain/helpers.ts +1 -1
- package/src/domain/model-config.ts +1 -1
- package/src/domain/thread-activities.test.ts +1 -1
- package/src/domain/thread-activities.ts +1 -1
- package/src/domain/thread-lifecycle.test.ts +1 -1
- package/src/domain/thread-lifecycle.ts +1 -1
- package/src/effect.test-utils.ts +25 -0
- package/src/index.ts +1 -1
- package/src/{connection/node.ts → node/connection.ts} +1 -1
- package/src/node/index.ts +1 -2
- package/src/orchestration/index.ts +0 -1
- package/src/orchestration/layer.ts +1 -1
- package/src/orchestration/service.ts +1 -1
- package/src/rpc/error.ts +2 -2
- package/src/rpc/index.ts +2 -3
- package/src/rpc/layer.ts +1 -1
- package/src/rpc/ws-group.ts +1 -1
- package/src/runtime/index.ts +2 -1
- package/src/runtime/layer.test-utils.ts +32 -0
- package/src/runtime/layer.test.ts +66 -0
- package/src/runtime/layer.ts +15 -9
- package/src/t3tools/index.ts +1 -1
- package/src/types/marked-terminal.d.ts +11 -0
- package/dist/layout.js +0 -2
- package/dist/scope.js +0 -2
- package/dist/src/cli/output-format.d.ts +0 -11
- package/dist/src/config/layer.d.ts +0 -22
- package/dist/src/config/service.d.ts +0 -22
- package/dist/src/environment/layer.d.ts +0 -3
- package/dist/src/environment/service.d.ts +0 -12
- package/dist/src/layout/index.d.ts +0 -1
- package/dist/upstream-t3code/packages/contracts/src/auth.d.ts +0 -441
- package/dist/upstream-t3code/packages/contracts/src/baseSchemas.d.ts +0 -38
- package/dist/upstream-t3code/packages/contracts/src/desktopBootstrap.d.ts +0 -14
- package/dist/upstream-t3code/packages/contracts/src/editor.d.ts +0 -124
- package/dist/upstream-t3code/packages/contracts/src/environment.d.ts +0 -64
- package/dist/upstream-t3code/packages/contracts/src/environmentHttp.d.ts +0 -762
- package/dist/upstream-t3code/packages/contracts/src/filesystem.d.ts +0 -26
- package/dist/upstream-t3code/packages/contracts/src/git.d.ts +0 -500
- package/dist/upstream-t3code/packages/contracts/src/index.d.ts +0 -25
- package/dist/upstream-t3code/packages/contracts/src/ipc.d.ts +0 -490
- package/dist/upstream-t3code/packages/contracts/src/keybindings.d.ts +0 -133
- package/dist/upstream-t3code/packages/contracts/src/model.d.ts +0 -112
- package/dist/upstream-t3code/packages/contracts/src/orchestration.d.ts +0 -6682
- package/dist/upstream-t3code/packages/contracts/src/project.d.ts +0 -45
- package/dist/upstream-t3code/packages/contracts/src/provider.d.ts +0 -116
- package/dist/upstream-t3code/packages/contracts/src/providerInstance.d.ts +0 -99
- package/dist/upstream-t3code/packages/contracts/src/providerRuntime.d.ts +0 -4276
- package/dist/upstream-t3code/packages/contracts/src/relay.d.ts +0 -1262
- package/dist/upstream-t3code/packages/contracts/src/relayClient.d.ts +0 -48
- package/dist/upstream-t3code/packages/contracts/src/remoteAccess.d.ts +0 -45
- package/dist/upstream-t3code/packages/contracts/src/review.d.ts +0 -37
- package/dist/upstream-t3code/packages/contracts/src/rpc.d.ts +0 -8218
- package/dist/upstream-t3code/packages/contracts/src/server.d.ts +0 -2291
- package/dist/upstream-t3code/packages/contracts/src/settings.d.ts +0 -271
- package/dist/upstream-t3code/packages/contracts/src/sourceControl.d.ts +0 -177
- package/dist/upstream-t3code/packages/contracts/src/terminal.d.ts +0 -330
- package/dist/upstream-t3code/packages/contracts/src/vcs.d.ts +0 -148
- package/src/cli/auth-format.ts +0 -45
- package/src/cli/confirm.ts +0 -31
- package/src/cli/model-format.ts +0 -18
- package/src/cli/output-format.ts +0 -45
- package/src/cli/project-format.ts +0 -18
- package/src/cli/terminal/commands.test.ts +0 -101
- package/src/cli/terminal-format.ts +0 -167
- package/src/cli/thread-format.ts +0 -128
- package/src/config/layer.ts +0 -105
- package/src/config/service.ts +0 -26
- package/src/environment/layer.ts +0 -12
- package/src/environment/service.ts +0 -13
- package/src/layout/index.ts +0 -1
- /package/dist/src/{scope → cli/scope}/index.d.ts +0 -0
- /package/dist/src/config/{url.d.ts → url/url.d.ts} +0 -0
- /package/src/{scope → cli/scope}/index.ts +0 -0
- /package/src/config/{url.ts → url/url.ts} +0 -0
package/src/domain/error.ts
CHANGED
|
@@ -55,6 +55,23 @@ export class TerminalLookupError extends Schema.TaggedErrorClass<TerminalLookupE
|
|
|
55
55
|
},
|
|
56
56
|
) {}
|
|
57
57
|
|
|
58
|
+
export class ProjectActionLookupError extends Schema.TaggedErrorClass<ProjectActionLookupError>()(
|
|
59
|
+
"ProjectActionLookupError",
|
|
60
|
+
{
|
|
61
|
+
message: Schema.String,
|
|
62
|
+
projectId: Schema.String,
|
|
63
|
+
selector: Schema.String,
|
|
64
|
+
},
|
|
65
|
+
) {}
|
|
66
|
+
|
|
67
|
+
export class ProjectActionValidationError extends Schema.TaggedErrorClass<ProjectActionValidationError>()(
|
|
68
|
+
"ProjectActionValidationError",
|
|
69
|
+
{
|
|
70
|
+
message: Schema.String,
|
|
71
|
+
projectId: Schema.String,
|
|
72
|
+
},
|
|
73
|
+
) {}
|
|
74
|
+
|
|
58
75
|
export type DomainError =
|
|
59
76
|
| ProjectLookupError
|
|
60
77
|
| ModelSelectionError
|
|
@@ -62,4 +79,6 @@ export type DomainError =
|
|
|
62
79
|
| ThreadSessionError
|
|
63
80
|
| ThreadLookupError
|
|
64
81
|
| ProjectCreateVisibilityError
|
|
65
|
-
| TerminalLookupError
|
|
82
|
+
| TerminalLookupError
|
|
83
|
+
| ProjectActionLookupError
|
|
84
|
+
| ProjectActionValidationError;
|
|
@@ -5,7 +5,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
|
5
5
|
import { assert, describe, it } from "@effect/vitest";
|
|
6
6
|
import { fromPartial } from "@total-typescript/shoehorn";
|
|
7
7
|
|
|
8
|
-
import type { OrchestrationShellSnapshot } from "
|
|
8
|
+
import type { OrchestrationShellSnapshot } from "@t3tools/contracts";
|
|
9
9
|
|
|
10
10
|
import { resolveProjectScope } from "./helpers.ts";
|
|
11
11
|
|
package/src/domain/helpers.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Path from "effect/Path";
|
|
3
|
-
import type { OrchestrationProjectShell, OrchestrationShellSnapshot } from "
|
|
3
|
+
import type { OrchestrationProjectShell, OrchestrationShellSnapshot } from "@t3tools/contracts";
|
|
4
4
|
|
|
5
5
|
export type ResolvedProjectScope = {
|
|
6
6
|
readonly project: OrchestrationProjectShell;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "vite-plus/test/config";
|
|
2
2
|
|
|
3
|
-
import { EventId, TurnId, type OrchestrationThreadActivity } from "
|
|
3
|
+
import { EventId, TurnId, type OrchestrationThreadActivity } from "@t3tools/contracts";
|
|
4
4
|
import { describe, expect, it } from "vite-plus/test";
|
|
5
5
|
|
|
6
6
|
import { derivePendingApprovals, derivePendingUserInputs } from "./thread-activities.ts";
|
|
@@ -3,7 +3,7 @@ import "vite-plus/test/config";
|
|
|
3
3
|
import { describe, expect, it } from "vite-plus/test";
|
|
4
4
|
import { fromPartial } from "@total-typescript/shoehorn";
|
|
5
5
|
|
|
6
|
-
import type { OrchestrationThread } from "
|
|
6
|
+
import type { OrchestrationThread } from "@t3tools/contracts";
|
|
7
7
|
|
|
8
8
|
import { isThreadActive, isThreadCompleteEnough } from "./thread-lifecycle.ts";
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type OrchestrationSession,
|
|
6
6
|
type OrchestrationThread,
|
|
7
7
|
type OrchestrationThreadShell,
|
|
8
|
-
} from "
|
|
8
|
+
} from "@t3tools/contracts";
|
|
9
9
|
import * as Schema from "effect/Schema";
|
|
10
10
|
|
|
11
11
|
type SessionStatusForDelete = OrchestrationSession["status"] | "closed";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { assert } from "@effect/vitest";
|
|
2
|
+
import { assertInstanceOf } from "@effect/vitest/utils";
|
|
3
|
+
import * as Cause from "effect/Cause";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Exit from "effect/Exit";
|
|
6
|
+
import * as Option from "effect/Option";
|
|
7
|
+
|
|
8
|
+
export const expectFailWithMessage = <E extends { readonly message: string }, R>(
|
|
9
|
+
effect: Effect.Effect<unknown, E, R>,
|
|
10
|
+
ErrorClass: new (...args: never) => E,
|
|
11
|
+
message: string,
|
|
12
|
+
): Effect.Effect<void, never, R> =>
|
|
13
|
+
Effect.gen(function* () {
|
|
14
|
+
const exit = yield* effect.pipe(Effect.exit);
|
|
15
|
+
if (!Exit.isFailure(exit)) {
|
|
16
|
+
return yield* Effect.die("expected failure");
|
|
17
|
+
}
|
|
18
|
+
const error = Cause.findErrorOption(exit.cause);
|
|
19
|
+
if (Option.isNone(error)) {
|
|
20
|
+
return yield* Effect.die("expected failure cause");
|
|
21
|
+
}
|
|
22
|
+
assertInstanceOf(error.value, ErrorClass);
|
|
23
|
+
assert.equal(error.value.message, message);
|
|
24
|
+
return yield* Effect.void;
|
|
25
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as Layer from "effect/Layer";
|
|
|
2
2
|
import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";
|
|
3
3
|
import * as NodeSocket from "@effect/platform-node/NodeSocket";
|
|
4
4
|
|
|
5
|
-
import { T3CodeRpcLayer } from "
|
|
5
|
+
import { T3CodeRpcLayer } from "../connection/index.ts";
|
|
6
6
|
|
|
7
7
|
const NodeConnectionPlatformLayer = Layer.mergeAll(
|
|
8
8
|
NodeHttpClient.layerUndici,
|
package/src/node/index.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { T3CodeNodeRpcLayer } from "
|
|
2
|
-
export { NodeEnvironmentLive } from "../environment/layer.ts";
|
|
1
|
+
export { T3CodeNodeRpcLayer } from "./connection.ts";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type ClientOrchestrationCommand,
|
|
11
11
|
type OrchestrationShellStreamItem,
|
|
12
12
|
type OrchestrationThreadStreamItem,
|
|
13
|
-
} from "
|
|
13
|
+
} from "@t3tools/contracts";
|
|
14
14
|
|
|
15
15
|
import { RpcError } from "../rpc/error.ts";
|
|
16
16
|
import { T3RpcOperations } from "../rpc/operation.ts";
|
package/src/rpc/error.ts
CHANGED
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
TerminalHistoryError,
|
|
10
10
|
TerminalNotRunningError,
|
|
11
11
|
TerminalSessionLookupError,
|
|
12
|
-
} from "
|
|
12
|
+
} from "@t3tools/contracts";
|
|
13
13
|
import { HttpClientError } from "effect/unstable/http";
|
|
14
14
|
import { RpcClientError } from "effect/unstable/rpc";
|
|
15
15
|
|
|
16
16
|
import { AuthTransportError } from "../auth/error.ts";
|
|
17
17
|
import { T3CodeConnectionError } from "../connection/error.ts";
|
|
18
|
-
import { UrlError } from "../config/error.ts";
|
|
18
|
+
import { UrlError } from "../config/url/error.ts";
|
|
19
19
|
|
|
20
20
|
const RpcErrorCauseSchema = Schema.Union([
|
|
21
21
|
RpcClientError.RpcClientError,
|
package/src/rpc/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { RpcError
|
|
1
|
+
export { RpcError } from "./error.ts";
|
|
2
2
|
export { makeT3RpcLayer, T3RpcLive } from "./layer.ts";
|
|
3
3
|
export { T3RpcOperations, T3RpcOperationsLive, makeT3RpcOperations } from "./operation.ts";
|
|
4
|
-
export type { T3RpcOperationsService } from "./operation.ts";
|
|
5
4
|
export { T3Rpc } from "./service.ts";
|
|
6
|
-
export type {
|
|
5
|
+
export type { WsClient } from "./service.ts";
|
package/src/rpc/layer.ts
CHANGED
|
@@ -12,7 +12,7 @@ import * as Socket from "effect/unstable/socket/Socket";
|
|
|
12
12
|
|
|
13
13
|
import { T3AuthTransport } from "../auth/transport.ts";
|
|
14
14
|
import { T3CodeConnectionProvider } from "../connection/service.ts";
|
|
15
|
-
import { normalizeHttpBaseUrl, toWebSocketEndpointUrl } from "../config/url.ts";
|
|
15
|
+
import { normalizeHttpBaseUrl, toWebSocketEndpointUrl } from "../config/url/url.ts";
|
|
16
16
|
import { CliWsRpcGroup } from "./ws-group.ts";
|
|
17
17
|
import { RpcError } from "./error.ts";
|
|
18
18
|
import { T3Rpc, type WsClient } from "./service.ts";
|
package/src/rpc/ws-group.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
WsOrchestrationGetArchivedShellSnapshotRpc,
|
|
23
23
|
WsOrchestrationSubscribeShellRpc,
|
|
24
24
|
WsOrchestrationSubscribeThreadRpc,
|
|
25
|
-
} from "
|
|
25
|
+
} from "@t3tools/contracts";
|
|
26
26
|
import * as Schema from "effect/Schema";
|
|
27
27
|
import { Rpc, RpcGroup } from "effect/unstable/rpc";
|
|
28
28
|
|
package/src/runtime/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export {
|
|
2
2
|
AppLayer,
|
|
3
3
|
AuthAppLayer,
|
|
4
|
+
BaseAppLayer,
|
|
5
|
+
BaseAuthAppLayer,
|
|
4
6
|
T3AuthLayer,
|
|
5
7
|
T3AuthPairingLayer,
|
|
6
8
|
T3AuthTransportLayer,
|
|
@@ -9,4 +11,3 @@ export {
|
|
|
9
11
|
T3LocalAuthTokenLayer,
|
|
10
12
|
T3OrchestrationLayer,
|
|
11
13
|
} from "./layer.ts";
|
|
12
|
-
export { NodeEnvironmentLive } from "../environment/layer.ts";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as Layer from "effect/Layer";
|
|
2
|
+
|
|
3
|
+
import * as CliSelection from "../cli/env/selection-layer.ts";
|
|
4
|
+
import * as CliRuntime from "../cli/runtime/service.ts";
|
|
5
|
+
import * as Config from "../config/config.ts";
|
|
6
|
+
import * as Credential from "../config/credential/service.ts";
|
|
7
|
+
import * as CredentialCipherNode from "../config/credential/cipher-node.ts";
|
|
8
|
+
import { ConfigPlatformLayer } from "../config/platform.test-utils.ts";
|
|
9
|
+
import { t3CliEnvConfigLayer } from "../config/env/env.test-utils.ts";
|
|
10
|
+
import * as Keystore from "../config/keystore/service.test-utils.ts";
|
|
11
|
+
|
|
12
|
+
export function cliConfigRoutingLayerTest(homeDir: string) {
|
|
13
|
+
const cliRuntimeLayer = CliRuntime.CliRuntime.layerTest({ cwd: homeDir });
|
|
14
|
+
const configLayer = t3CliEnvConfigLayer(homeDir, { T3CLI_ENV: "home" });
|
|
15
|
+
const platformEnvLayer = Layer.mergeAll(cliRuntimeLayer, configLayer);
|
|
16
|
+
|
|
17
|
+
return Layer.mergeAll(
|
|
18
|
+
ConfigPlatformLayer,
|
|
19
|
+
platformEnvLayer,
|
|
20
|
+
Config.layer.pipe(
|
|
21
|
+
Layer.provide(Credential.layer),
|
|
22
|
+
Layer.provide(
|
|
23
|
+
Layer.mergeAll(
|
|
24
|
+
platformEnvLayer,
|
|
25
|
+
CliSelection.layer.pipe(Layer.provide(platformEnvLayer)),
|
|
26
|
+
CredentialCipherNode.layerNode,
|
|
27
|
+
Keystore.unavailableKeystoreFactoryLayer,
|
|
28
|
+
),
|
|
29
|
+
),
|
|
30
|
+
),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import "vite-plus/test/config";
|
|
2
|
+
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Ref from "effect/Ref";
|
|
5
|
+
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
6
|
+
import { assert, describe, it } from "@effect/vitest";
|
|
7
|
+
import { Command } from "effect/unstable/cli";
|
|
8
|
+
|
|
9
|
+
import { cliEnvironmentSetting } from "../cli/env/flag.ts";
|
|
10
|
+
import type { ResolvedConfig } from "../config/types.ts";
|
|
11
|
+
import { T3Config } from "../config/config.ts";
|
|
12
|
+
import { makeTempHomeScoped } from "../config/temp-home.test-utils.ts";
|
|
13
|
+
import { cliConfigRoutingLayerTest } from "./layer.test-utils.ts";
|
|
14
|
+
|
|
15
|
+
describe("CLI config routing", () => {
|
|
16
|
+
it.effect(
|
|
17
|
+
"routes --environment through Command.run to T3Config.resolve ahead of default and T3CLI_ENV",
|
|
18
|
+
() =>
|
|
19
|
+
Effect.gen(function* () {
|
|
20
|
+
return yield* makeTempHomeScoped("t3cli-runtime-");
|
|
21
|
+
}).pipe(
|
|
22
|
+
Effect.flatMap((homeDir) => {
|
|
23
|
+
const testLayer = cliConfigRoutingLayerTest(homeDir);
|
|
24
|
+
return Effect.gen(function* () {
|
|
25
|
+
const resolvedRef = yield* Ref.make<ResolvedConfig | undefined>(undefined);
|
|
26
|
+
const resolveProbeCommand = Command.make("resolve-probe", {}, () =>
|
|
27
|
+
Effect.gen(function* () {
|
|
28
|
+
const config = yield* T3Config;
|
|
29
|
+
const resolved = yield* config.resolve();
|
|
30
|
+
yield* Ref.set(resolvedRef, resolved);
|
|
31
|
+
}),
|
|
32
|
+
).pipe(Command.withGlobalFlags([cliEnvironmentSetting]));
|
|
33
|
+
const runResolveProbe = Command.runWith(resolveProbeCommand, { version: "0.0.0-test" });
|
|
34
|
+
|
|
35
|
+
yield* Effect.gen(function* () {
|
|
36
|
+
const config = yield* T3Config;
|
|
37
|
+
yield* config.upsertEnvironment({
|
|
38
|
+
name: "home",
|
|
39
|
+
url: "https://home.example",
|
|
40
|
+
token: "home-token",
|
|
41
|
+
local: false,
|
|
42
|
+
});
|
|
43
|
+
yield* config.upsertEnvironment({
|
|
44
|
+
name: "work",
|
|
45
|
+
url: "https://work.example",
|
|
46
|
+
token: "work-token",
|
|
47
|
+
local: false,
|
|
48
|
+
});
|
|
49
|
+
}).pipe(Effect.provide(testLayer));
|
|
50
|
+
|
|
51
|
+
yield* runResolveProbe(["--environment", "work"]).pipe(Effect.provide(testLayer));
|
|
52
|
+
|
|
53
|
+
const resolved = yield* Ref.get(resolvedRef);
|
|
54
|
+
assert.isDefined(resolved);
|
|
55
|
+
assert.equal(resolved.source, "config");
|
|
56
|
+
if (resolved.source === "config") {
|
|
57
|
+
assert.equal(resolved.environment, "work");
|
|
58
|
+
assert.equal(resolved.token, "work-token");
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}),
|
|
62
|
+
Effect.provide(NodeServices.layer),
|
|
63
|
+
Effect.scoped,
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
});
|
package/src/runtime/layer.ts
CHANGED
|
@@ -10,8 +10,9 @@ import { T3LocalAuthOriginLive } from "../auth/local-origin.ts";
|
|
|
10
10
|
import { T3LocalAuthTokenLive } from "../auth/local-token.ts";
|
|
11
11
|
import { T3AuthPairingLive } from "../auth/pairing.ts";
|
|
12
12
|
import { T3AuthTransportLive } from "../auth/transport.ts";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import * as Config from "../config/config.ts";
|
|
14
|
+
import * as Credential from "../config/credential/service.ts";
|
|
15
|
+
import * as Selection from "../config/selection/service.ts";
|
|
15
16
|
import { T3CodeConnectionError } from "../connection/error.ts";
|
|
16
17
|
import { T3CodeConnectionProvider, makeT3CodeConnectionProvider } from "../connection/service.ts";
|
|
17
18
|
import { T3OrchestrationLive } from "../orchestration/layer.ts";
|
|
@@ -20,6 +21,7 @@ import { T3RpcOperationsLive } from "../rpc/operation.ts";
|
|
|
20
21
|
import { NodeSqlClientFactoryLive } from "../sql/node-sqlite-client.ts";
|
|
21
22
|
import { NodeCliPathLayer } from "../cli-path/layer.ts";
|
|
22
23
|
|
|
24
|
+
export const T3ConfigLayer = Config.layer.pipe(Layer.provide(Credential.layer));
|
|
23
25
|
export const T3AuthTransportLayer = T3AuthTransportLive.pipe(
|
|
24
26
|
Layer.provide(NodeHttpClient.layerUndici),
|
|
25
27
|
);
|
|
@@ -33,13 +35,13 @@ export const T3LocalAuthLayer = T3LocalAuthLive.pipe(
|
|
|
33
35
|
export const T3AuthPairingLayer = T3AuthPairingLive.pipe(Layer.provide(T3AuthTransportLayer));
|
|
34
36
|
export const T3AuthLayer = T3AuthLive.pipe(
|
|
35
37
|
Layer.provide(
|
|
36
|
-
Layer.mergeAll(
|
|
38
|
+
Layer.mergeAll(T3ConfigLayer, T3AuthTransportLayer, T3LocalAuthLayer, T3AuthPairingLayer),
|
|
37
39
|
),
|
|
38
40
|
);
|
|
39
41
|
const T3ConfigConnectionProviderLayer = Layer.effect(
|
|
40
42
|
T3CodeConnectionProvider,
|
|
41
43
|
Effect.gen(function* () {
|
|
42
|
-
const config = yield* T3Config;
|
|
44
|
+
const config = yield* Config.T3Config;
|
|
43
45
|
return makeT3CodeConnectionProvider(
|
|
44
46
|
config.resolve().pipe(
|
|
45
47
|
Effect.map((resolved) => ({
|
|
@@ -56,7 +58,7 @@ const T3ConfigConnectionProviderLayer = Layer.effect(
|
|
|
56
58
|
),
|
|
57
59
|
);
|
|
58
60
|
}),
|
|
59
|
-
).pipe(Layer.provide(
|
|
61
|
+
).pipe(Layer.provide(T3ConfigLayer));
|
|
60
62
|
|
|
61
63
|
const T3RpcLayer = T3RpcLive.pipe(
|
|
62
64
|
Layer.provide(
|
|
@@ -73,10 +75,8 @@ const T3ApplicationLayer = T3ApplicationLive.pipe(
|
|
|
73
75
|
Layer.provide(Layer.mergeAll(T3RpcOperationsLayer, T3OrchestrationLayer)),
|
|
74
76
|
);
|
|
75
77
|
|
|
76
|
-
export const
|
|
77
|
-
|
|
78
|
-
export const AppLayer = Layer.mergeAll(
|
|
79
|
-
T3ConfigLive,
|
|
78
|
+
export const BaseAppLayer = Layer.mergeAll(
|
|
79
|
+
T3ConfigLayer,
|
|
80
80
|
T3AuthLayer,
|
|
81
81
|
T3RpcLayer,
|
|
82
82
|
T3RpcOperationsLayer,
|
|
@@ -84,3 +84,9 @@ export const AppLayer = Layer.mergeAll(
|
|
|
84
84
|
T3ApplicationLayer,
|
|
85
85
|
NodeCliPathLayer,
|
|
86
86
|
);
|
|
87
|
+
|
|
88
|
+
export const BaseAuthAppLayer = Layer.mergeAll(T3ConfigLayer, T3AuthLayer);
|
|
89
|
+
|
|
90
|
+
export const AuthAppLayer = BaseAuthAppLayer.pipe(Layer.provideMerge(Selection.layer));
|
|
91
|
+
|
|
92
|
+
export const AppLayer = BaseAppLayer.pipe(Layer.provideMerge(Selection.layer));
|
package/src/t3tools/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "@t3tools/contracts";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module "marked-terminal" {
|
|
2
|
+
import type { MarkedExtension } from "marked";
|
|
3
|
+
|
|
4
|
+
export type TerminalRendererOptions = {
|
|
5
|
+
readonly reflowText?: boolean;
|
|
6
|
+
readonly showSectionPrefix?: boolean;
|
|
7
|
+
readonly width?: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function markedTerminal(options?: TerminalRendererOptions): MarkedExtension;
|
|
11
|
+
}
|
package/dist/layout.js
DELETED
package/dist/scope.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { EnvironmentShape } from "../environment/service.ts";
|
|
2
|
-
export declare const humanJsonFormatChoices: readonly ["auto", "human", "json"];
|
|
3
|
-
export declare const humanNdjsonFormatChoices: readonly ["auto", "human", "ndjson"];
|
|
4
|
-
export declare const humanJsonNdjsonFormatChoices: readonly ["auto", "human", "json", "ndjson"];
|
|
5
|
-
export type HumanJsonFormat = (typeof humanJsonFormatChoices)[number];
|
|
6
|
-
export type HumanNdjsonFormat = (typeof humanNdjsonFormatChoices)[number];
|
|
7
|
-
export type HumanJsonNdjsonFormat = (typeof humanJsonNdjsonFormatChoices)[number];
|
|
8
|
-
export declare function resolveOutputFormat<T extends "json" | "ndjson">(format: "auto" | "human" | T, environment: EnvironmentShape, nonHumanFormat: T): "human" | T;
|
|
9
|
-
export declare function canRenderLiveTerminal(environment: EnvironmentShape): boolean;
|
|
10
|
-
export declare function isInteractiveHumanTerminal(environment: EnvironmentShape): boolean;
|
|
11
|
-
export declare function isAgentEnvironment(environment: EnvironmentShape): boolean;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as FileSystem from "effect/FileSystem";
|
|
3
|
-
import * as Layer from "effect/Layer";
|
|
4
|
-
import * as Path from "effect/Path";
|
|
5
|
-
import { Environment } from "../environment/service.ts";
|
|
6
|
-
import { ConfigError } from "./error.ts";
|
|
7
|
-
import { T3Config, type StoredConfig } from "./service.ts";
|
|
8
|
-
export declare const makeT3Config: () => Effect.Effect<{
|
|
9
|
-
readStored: () => Effect.Effect<{
|
|
10
|
-
readonly url?: string;
|
|
11
|
-
readonly token?: string;
|
|
12
|
-
readonly local?: boolean;
|
|
13
|
-
}, ConfigError, never>;
|
|
14
|
-
writeStored: (config: StoredConfig) => Effect.Effect<void, ConfigError, never>;
|
|
15
|
-
resolve: () => Effect.Effect<{
|
|
16
|
-
url: string;
|
|
17
|
-
token: string;
|
|
18
|
-
source: "config" | "env";
|
|
19
|
-
local: boolean;
|
|
20
|
-
}, import("./error.ts").UrlError | ConfigError, never>;
|
|
21
|
-
}, never, Environment | Path.Path | FileSystem.FileSystem>;
|
|
22
|
-
export declare const T3ConfigLive: Layer.Layer<T3Config, never, Environment | Path.Path | FileSystem.FileSystem>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import type * as Effect from "effect/Effect";
|
|
3
|
-
import type { ConfigError, ConfigServiceError } from "./error.ts";
|
|
4
|
-
export type StoredConfig = {
|
|
5
|
-
readonly url?: string;
|
|
6
|
-
readonly token?: string;
|
|
7
|
-
readonly local?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type ResolvedConfig = {
|
|
10
|
-
readonly url: string;
|
|
11
|
-
readonly token: string;
|
|
12
|
-
readonly source: "env" | "config";
|
|
13
|
-
readonly local: boolean;
|
|
14
|
-
};
|
|
15
|
-
declare const T3Config_base: Context.ServiceClass<T3Config, "t3cli/T3Config", {
|
|
16
|
-
readonly readStored: () => Effect.Effect<StoredConfig, ConfigError>;
|
|
17
|
-
readonly writeStored: (config: StoredConfig) => Effect.Effect<void, ConfigError>;
|
|
18
|
-
readonly resolve: () => Effect.Effect<ResolvedConfig, ConfigServiceError>;
|
|
19
|
-
}>;
|
|
20
|
-
export declare class T3Config extends T3Config_base {
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
export type EnvironmentShape = {
|
|
3
|
-
readonly cwd: string;
|
|
4
|
-
readonly homeDir: string;
|
|
5
|
-
readonly env: Readonly<Record<string, string | undefined>>;
|
|
6
|
-
readonly stdoutIsTTY: boolean;
|
|
7
|
-
readonly stderrIsTTY: boolean;
|
|
8
|
-
};
|
|
9
|
-
declare const Environment_base: Context.ServiceClass<Environment, "t3cli/Environment", EnvironmentShape>;
|
|
10
|
-
export declare class Environment extends Environment_base {
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { readT3LayoutFromNodeProcess, resolveT3BaseDir, type T3Layout } from "./base-dir.ts";
|