@maiaos/cli 0.1.0-canary.2
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 +287 -0
- package/dist/bin/maia.NOTICES.txt +59 -0
- package/dist/bin/maia.cdx.json +145 -0
- package/dist/bin/maia.mjs +2 -0
- package/dist/bootstrap/index.d.ts +3 -0
- package/dist/bootstrap/index.js +3 -0
- package/dist/bootstrap/process.d.ts +5 -0
- package/dist/bootstrap/process.js +45 -0
- package/dist/bootstrap/run.d.ts +25 -0
- package/dist/bootstrap/run.js +95 -0
- package/dist/bootstrap/stdio.d.ts +4 -0
- package/dist/bootstrap/stdio.js +9 -0
- package/dist/cli/cli.d.ts +17 -0
- package/dist/cli/cli.js +481 -0
- package/dist/cli/environment.d.ts +8 -0
- package/dist/cli/environment.js +12 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/services.d.ts +4 -0
- package/dist/cli/services.js +4 -0
- package/dist/command-line/context.d.ts +178 -0
- package/dist/command-line/context.js +2 -0
- package/dist/command-line/index.d.ts +7 -0
- package/dist/command-line/index.js +6 -0
- package/dist/command-line/input/arguments.d.ts +55 -0
- package/dist/command-line/input/arguments.js +220 -0
- package/dist/command-line/input/index.d.ts +4 -0
- package/dist/command-line/input/index.js +4 -0
- package/dist/command-line/input/prompt.d.ts +8 -0
- package/dist/command-line/input/prompt.js +44 -0
- package/dist/command-line/input/stdin-stream.d.ts +4 -0
- package/dist/command-line/input/stdin-stream.js +3 -0
- package/dist/command-line/input/stdin.d.ts +11 -0
- package/dist/command-line/input/stdin.js +23 -0
- package/dist/command-line/json-decoder.d.ts +3 -0
- package/dist/command-line/json-decoder.js +3 -0
- package/dist/command-line/json.d.ts +3 -0
- package/dist/command-line/json.js +4 -0
- package/dist/command-line/output.d.ts +57 -0
- package/dist/command-line/output.js +94 -0
- package/dist/command-line/rows.d.ts +10 -0
- package/dist/command-line/rows.js +32 -0
- package/dist/command-line/two-phase.d.ts +57 -0
- package/dist/command-line/two-phase.js +148 -0
- package/dist/command-receipt/command.d.ts +4 -0
- package/dist/command-receipt/command.js +59 -0
- package/dist/command-receipt/compact-list.d.ts +20 -0
- package/dist/command-receipt/compact-list.js +29 -0
- package/dist/command-receipt/index.d.ts +3 -0
- package/dist/command-receipt/index.js +3 -0
- package/dist/command-tree/commands.d.ts +17 -0
- package/dist/command-tree/commands.js +41 -0
- package/dist/command-tree/completion.d.ts +6 -0
- package/dist/command-tree/completion.js +36 -0
- package/dist/command-tree/grammar.d.ts +18 -0
- package/dist/command-tree/grammar.js +160 -0
- package/dist/command-tree/help.d.ts +62 -0
- package/dist/command-tree/help.js +219 -0
- package/dist/command-tree/index.d.ts +8 -0
- package/dist/command-tree/index.js +6 -0
- package/dist/command-tree/local.d.ts +3 -0
- package/dist/command-tree/local.js +126 -0
- package/dist/command-tree/placeholder.d.ts +3 -0
- package/dist/command-tree/placeholder.js +4 -0
- package/dist/command-tree/row.d.ts +29 -0
- package/dist/command-tree/row.js +2 -0
- package/dist/command-tree/suggest.d.ts +3 -0
- package/dist/command-tree/suggest.js +81 -0
- package/dist/command-tree/tree.d.ts +34 -0
- package/dist/command-tree/tree.js +124 -0
- package/dist/connection/client.d.ts +692 -0
- package/dist/connection/client.js +28 -0
- package/dist/connection/commands.d.ts +15 -0
- package/dist/connection/commands.js +118 -0
- package/dist/connection/index.d.ts +7 -0
- package/dist/connection/index.js +7 -0
- package/dist/connection/input.d.ts +50 -0
- package/dist/connection/input.js +90 -0
- package/dist/connection/login.d.ts +13 -0
- package/dist/connection/login.js +69 -0
- package/dist/connection/output/format.d.ts +32 -0
- package/dist/connection/output/format.js +94 -0
- package/dist/connection/output/index.d.ts +2 -0
- package/dist/connection/output/index.js +2 -0
- package/dist/connection/resolve.d.ts +60 -0
- package/dist/connection/resolve.js +30 -0
- package/dist/connection/signin.d.ts +4 -0
- package/dist/connection/signin.js +32 -0
- package/dist/connection/system.d.ts +4 -0
- package/dist/connection/system.js +190 -0
- package/dist/connection/tree/index.d.ts +2 -0
- package/dist/connection/tree/index.js +2 -0
- package/dist/connection/tree/tree.d.ts +3 -0
- package/dist/connection/tree/tree.js +209 -0
- package/dist/container/client.d.ts +142 -0
- package/dist/container/client.js +11 -0
- package/dist/container/commands.d.ts +7 -0
- package/dist/container/commands.js +100 -0
- package/dist/container/index.d.ts +3 -0
- package/dist/container/index.js +3 -0
- package/dist/container/output/format.d.ts +11 -0
- package/dist/container/output/format.js +28 -0
- package/dist/container/output/index.d.ts +2 -0
- package/dist/container/output/index.js +2 -0
- package/dist/context/client.d.ts +7 -0
- package/dist/context/client.js +21 -0
- package/dist/context/commands.d.ts +3 -0
- package/dist/context/commands.js +27 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.js +3 -0
- package/dist/development/cli.d.ts +3 -0
- package/dist/development/cli.js +44 -0
- package/dist/execution/client.d.ts +25 -0
- package/dist/execution/client.js +24 -0
- package/dist/execution/index.d.ts +3 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/relocation.d.ts +6 -0
- package/dist/execution/relocation.js +123 -0
- package/dist/execution/tree/index.d.ts +2 -0
- package/dist/execution/tree/index.js +2 -0
- package/dist/execution/tree/tree.d.ts +3 -0
- package/dist/execution/tree/tree.js +137 -0
- package/dist/hold/client.d.ts +137 -0
- package/dist/hold/client.js +12 -0
- package/dist/hold/commands.d.ts +5 -0
- package/dist/hold/commands.js +91 -0
- package/dist/hold/index.d.ts +3 -0
- package/dist/hold/index.js +3 -0
- package/dist/hold/output/format.d.ts +11 -0
- package/dist/hold/output/format.js +29 -0
- package/dist/hold/output/index.d.ts +2 -0
- package/dist/hold/output/index.js +2 -0
- package/dist/hold/tree/index.d.ts +2 -0
- package/dist/hold/tree/index.js +2 -0
- package/dist/hold/tree/tree.d.ts +3 -0
- package/dist/hold/tree/tree.js +96 -0
- package/dist/import/client.d.ts +14 -0
- package/dist/import/client.js +16 -0
- package/dist/import/commands.d.ts +5 -0
- package/dist/import/commands.js +76 -0
- package/dist/import/index.d.ts +3 -0
- package/dist/import/index.js +3 -0
- package/dist/import/input.d.ts +16 -0
- package/dist/import/input.js +92 -0
- package/dist/import/output.d.ts +6 -0
- package/dist/import/output.js +40 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/integration/client.d.ts +1284 -0
- package/dist/integration/client.js +24 -0
- package/dist/integration/commands.d.ts +10 -0
- package/dist/integration/commands.js +104 -0
- package/dist/integration/index.d.ts +3 -0
- package/dist/integration/index.js +3 -0
- package/dist/integration/output.d.ts +22 -0
- package/dist/integration/output.js +20 -0
- package/dist/local-node/call.d.ts +7 -0
- package/dist/local-node/call.js +13 -0
- package/dist/local-node/client.d.ts +67 -0
- package/dist/local-node/client.js +241 -0
- package/dist/local-node/index.d.ts +3 -0
- package/dist/local-node/index.js +3 -0
- package/dist/login/agent-provider.d.ts +20 -0
- package/dist/login/agent-provider.js +109 -0
- package/dist/login/commands.d.ts +4 -0
- package/dist/login/commands.js +93 -0
- package/dist/login/failure.d.ts +3 -0
- package/dist/login/failure.js +14 -0
- package/dist/login/gateway.d.ts +12 -0
- package/dist/login/gateway.js +71 -0
- package/dist/login/index.d.ts +3 -0
- package/dist/login/index.js +2 -0
- package/dist/login/menu.d.ts +4 -0
- package/dist/login/menu.js +105 -0
- package/dist/login/output/format.d.ts +16 -0
- package/dist/login/output/format.js +31 -0
- package/dist/login/output/index.d.ts +2 -0
- package/dist/login/output/index.js +2 -0
- package/dist/login/vendor-account.d.ts +95 -0
- package/dist/login/vendor-account.js +75 -0
- package/dist/login/vendor-input.d.ts +14 -0
- package/dist/login/vendor-input.js +36 -0
- package/dist/mcp/calls.d.ts +7 -0
- package/dist/mcp/calls.js +202 -0
- package/dist/mcp/commands.d.ts +9 -0
- package/dist/mcp/commands.js +21 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/server.d.ts +11 -0
- package/dist/mcp/server.js +57 -0
- package/dist/orchestration/client.d.ts +78 -0
- package/dist/orchestration/client.js +89 -0
- package/dist/orchestration/commands.d.ts +14 -0
- package/dist/orchestration/commands.js +312 -0
- package/dist/orchestration/index.d.ts +3 -0
- package/dist/orchestration/index.js +3 -0
- package/dist/orchestration/output/compact-aggregate.d.ts +121 -0
- package/dist/orchestration/output/compact-aggregate.js +110 -0
- package/dist/orchestration/output/compact-run-list.d.ts +20 -0
- package/dist/orchestration/output/compact-run-list.js +16 -0
- package/dist/orchestration/output/human.d.ts +80 -0
- package/dist/orchestration/output/human.js +252 -0
- package/dist/orchestration/output/index.d.ts +4 -0
- package/dist/orchestration/output/index.js +4 -0
- package/dist/orchestration/tree/index.d.ts +2 -0
- package/dist/orchestration/tree/index.js +2 -0
- package/dist/orchestration/tree/tree.d.ts +3 -0
- package/dist/orchestration/tree/tree.js +142 -0
- package/dist/port-lease/client.d.ts +160 -0
- package/dist/port-lease/client.js +11 -0
- package/dist/port-lease/commands.d.ts +6 -0
- package/dist/port-lease/commands.js +17 -0
- package/dist/port-lease/index.d.ts +3 -0
- package/dist/port-lease/index.js +3 -0
- package/dist/port-lease/input.d.ts +65 -0
- package/dist/port-lease/input.js +67 -0
- package/dist/port-lease/output/format.d.ts +11 -0
- package/dist/port-lease/output/format.js +24 -0
- package/dist/port-lease/output/index.d.ts +2 -0
- package/dist/port-lease/output/index.js +2 -0
- package/dist/presentation/client.d.ts +10 -0
- package/dist/presentation/client.js +9 -0
- package/dist/presentation/commands.d.ts +6 -0
- package/dist/presentation/commands.js +78 -0
- package/dist/presentation/index.d.ts +4 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/output/format.d.ts +11 -0
- package/dist/presentation/output/format.js +32 -0
- package/dist/presentation/output/index.d.ts +3 -0
- package/dist/presentation/output/index.js +2 -0
- package/dist/project-guard/client.d.ts +88 -0
- package/dist/project-guard/client.js +7 -0
- package/dist/project-guard/commands.d.ts +4 -0
- package/dist/project-guard/commands.js +39 -0
- package/dist/project-guard/index.d.ts +3 -0
- package/dist/project-guard/index.js +3 -0
- package/dist/project-guard/input.d.ts +18 -0
- package/dist/project-guard/input.js +47 -0
- package/dist/project-guard/output/format.d.ts +11 -0
- package/dist/project-guard/output/format.js +35 -0
- package/dist/project-guard/output/index.d.ts +2 -0
- package/dist/project-guard/output/index.js +2 -0
- package/dist/project-workspace/client.d.ts +86 -0
- package/dist/project-workspace/client.js +159 -0
- package/dist/project-workspace/commands.d.ts +30 -0
- package/dist/project-workspace/commands.js +700 -0
- package/dist/project-workspace/index.d.ts +5 -0
- package/dist/project-workspace/index.js +5 -0
- package/dist/project-workspace/metadata-client.d.ts +99 -0
- package/dist/project-workspace/metadata-client.js +8 -0
- package/dist/project-workspace/metadata-commands.d.ts +4 -0
- package/dist/project-workspace/metadata-commands.js +56 -0
- package/dist/project-workspace/output/human.d.ts +126 -0
- package/dist/project-workspace/output/human.js +103 -0
- package/dist/project-workspace/output/index.d.ts +3 -0
- package/dist/project-workspace/output/index.js +3 -0
- package/dist/project-workspace/output/metadata.d.ts +11 -0
- package/dist/project-workspace/output/metadata.js +17 -0
- package/dist/project-workspace/tree/index.d.ts +2 -0
- package/dist/project-workspace/tree/index.js +2 -0
- package/dist/project-workspace/tree/tree.d.ts +3 -0
- package/dist/project-workspace/tree/tree.js +197 -0
- package/dist/provider/client.d.ts +6 -0
- package/dist/provider/client.js +5 -0
- package/dist/provider/commands.d.ts +3 -0
- package/dist/provider/commands.js +38 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/index.js +3 -0
- package/dist/reference/commands.d.ts +3 -0
- package/dist/reference/commands.js +39 -0
- package/dist/reference/index.d.ts +3 -0
- package/dist/reference/index.js +3 -0
- package/dist/reference/resolve.d.ts +29 -0
- package/dist/reference/resolve.js +294 -0
- package/dist/reference/tree/index.d.ts +2 -0
- package/dist/reference/tree/index.js +2 -0
- package/dist/reference/tree/tree.d.ts +3 -0
- package/dist/reference/tree/tree.js +17 -0
- package/dist/remote-node/client.d.ts +258 -0
- package/dist/remote-node/client.js +12 -0
- package/dist/remote-node/commands.d.ts +6 -0
- package/dist/remote-node/commands.js +264 -0
- package/dist/remote-node/connector.d.ts +59 -0
- package/dist/remote-node/connector.js +122 -0
- package/dist/remote-node/index.d.ts +4 -0
- package/dist/remote-node/index.js +4 -0
- package/dist/remote-node/reachability.d.ts +22 -0
- package/dist/remote-node/reachability.js +34 -0
- package/dist/remote-node/text.d.ts +9 -0
- package/dist/remote-node/text.js +64 -0
- package/dist/remote-node/tree/index.d.ts +2 -0
- package/dist/remote-node/tree/index.js +2 -0
- package/dist/remote-node/tree/tree.d.ts +3 -0
- package/dist/remote-node/tree/tree.js +51 -0
- package/dist/run-ledger/client.d.ts +358 -0
- package/dist/run-ledger/client.js +13 -0
- package/dist/run-ledger/commands.d.ts +8 -0
- package/dist/run-ledger/commands.js +19 -0
- package/dist/run-ledger/index.d.ts +3 -0
- package/dist/run-ledger/index.js +3 -0
- package/dist/run-ledger/input.d.ts +42 -0
- package/dist/run-ledger/input.js +107 -0
- package/dist/run-ledger/output/format.d.ts +11 -0
- package/dist/run-ledger/output/format.js +49 -0
- package/dist/run-ledger/output/index.d.ts +2 -0
- package/dist/run-ledger/output/index.js +2 -0
- package/dist/session/agent-permission.d.ts +63 -0
- package/dist/session/agent-permission.js +20 -0
- package/dist/session/approval/client.d.ts +117 -0
- package/dist/session/approval/client.js +7 -0
- package/dist/session/approval/commands.d.ts +7 -0
- package/dist/session/approval/commands.js +123 -0
- package/dist/session/approval/index.d.ts +3 -0
- package/dist/session/approval/index.js +3 -0
- package/dist/session/approval/output/format.d.ts +12 -0
- package/dist/session/approval/output/format.js +25 -0
- package/dist/session/approval/output/index.d.ts +2 -0
- package/dist/session/approval/output/index.js +2 -0
- package/dist/session/attach-client.d.ts +16 -0
- package/dist/session/attach-client.js +8 -0
- package/dist/session/attach-render.d.ts +16 -0
- package/dist/session/attach-render.js +154 -0
- package/dist/session/attach.d.ts +5 -0
- package/dist/session/attach.js +106 -0
- package/dist/session/client.d.ts +132 -0
- package/dist/session/client.js +128 -0
- package/dist/session/coding-client.d.ts +16 -0
- package/dist/session/coding-client.js +15 -0
- package/dist/session/coding-commands.d.ts +4 -0
- package/dist/session/coding-commands.js +50 -0
- package/dist/session/commands.d.ts +13 -0
- package/dist/session/commands.js +488 -0
- package/dist/session/create-tasks.d.ts +20 -0
- package/dist/session/create-tasks.js +110 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.js +7 -0
- package/dist/session/interaction/client.d.ts +347 -0
- package/dist/session/interaction/client.js +15 -0
- package/dist/session/interaction/commands.d.ts +7 -0
- package/dist/session/interaction/commands.js +101 -0
- package/dist/session/interaction/index.d.ts +3 -0
- package/dist/session/interaction/index.js +3 -0
- package/dist/session/interaction/input.d.ts +15 -0
- package/dist/session/interaction/input.js +46 -0
- package/dist/session/interaction/output/format.d.ts +11 -0
- package/dist/session/interaction/output/format.js +3 -0
- package/dist/session/interaction/output/index.d.ts +2 -0
- package/dist/session/interaction/output/index.js +2 -0
- package/dist/session/output/diff.d.ts +3 -0
- package/dist/session/output/diff.js +30 -0
- package/dist/session/output/failure.d.ts +11 -0
- package/dist/session/output/failure.js +24 -0
- package/dist/session/output/human.d.ts +112 -0
- package/dist/session/output/human.js +71 -0
- package/dist/session/output/index.d.ts +6 -0
- package/dist/session/output/index.js +6 -0
- package/dist/session/output/observe.d.ts +4 -0
- package/dist/session/output/observe.js +46 -0
- package/dist/session/output/tasks.d.ts +19 -0
- package/dist/session/output/tasks.js +34 -0
- package/dist/session/rename.d.ts +3 -0
- package/dist/session/rename.js +37 -0
- package/dist/session/task-file.d.ts +5 -0
- package/dist/session/task-file.js +23 -0
- package/dist/session/tree/index.d.ts +2 -0
- package/dist/session/tree/index.js +2 -0
- package/dist/session/tree/tree.d.ts +3 -0
- package/dist/session/tree/tree.js +309 -0
- package/dist/session/turn/client.d.ts +25 -0
- package/dist/session/turn/client.js +40 -0
- package/dist/session/turn/commands.d.ts +6 -0
- package/dist/session/turn/commands.js +157 -0
- package/dist/session/turn/index.d.ts +4 -0
- package/dist/session/turn/index.js +3 -0
- package/dist/session/turn/output.d.ts +42 -0
- package/dist/session/turn/output.js +38 -0
- package/dist/status/client.d.ts +119 -0
- package/dist/status/client.js +5 -0
- package/dist/status/command.d.ts +4 -0
- package/dist/status/command.js +40 -0
- package/dist/status/doctor.d.ts +15 -0
- package/dist/status/doctor.js +111 -0
- package/dist/status/index.d.ts +5 -0
- package/dist/status/index.js +4 -0
- package/dist/status/output/compact.d.ts +31 -0
- package/dist/status/output/compact.js +46 -0
- package/dist/status/output/human.d.ts +7 -0
- package/dist/status/output/human.js +30 -0
- package/dist/status/output/index.d.ts +3 -0
- package/dist/status/output/index.js +3 -0
- package/dist/terminal/arguments.d.ts +13 -0
- package/dist/terminal/arguments.js +79 -0
- package/dist/terminal/client.d.ts +79 -0
- package/dist/terminal/client.js +68 -0
- package/dist/terminal/commands.d.ts +7 -0
- package/dist/terminal/commands.js +131 -0
- package/dist/terminal/control-commands.d.ts +10 -0
- package/dist/terminal/control-commands.js +212 -0
- package/dist/terminal/index.d.ts +4 -0
- package/dist/terminal/index.js +4 -0
- package/dist/terminal/output/compact-list.d.ts +147 -0
- package/dist/terminal/output/compact-list.js +152 -0
- package/dist/terminal/output/human.d.ts +59 -0
- package/dist/terminal/output/human.js +55 -0
- package/dist/terminal/output/index.d.ts +3 -0
- package/dist/terminal/output/index.js +3 -0
- package/dist/terminal/tree/index.d.ts +2 -0
- package/dist/terminal/tree/index.js +2 -0
- package/dist/terminal/tree/tree.d.ts +3 -0
- package/dist/terminal/tree/tree.js +104 -0
- package/guidance/maia-cli/SKILL.md +58 -0
- package/guidance/maia-orchestration/SKILL.md +54 -0
- package/package.json +76 -0
package/dist/cli/cli.js
ADDED
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { argumentsAreBounded, CliArgumentError, parseArguments, readGlobalValue, reportError, writeSuccess, } from "../command-line/index.js";
|
|
4
|
+
import { createHelpTree, createNodeHelp, findNode, formatNodeHelp, formatRootHelp, isNodeBacked, REFERENCE_USAGE, unknownPathMessage, usageHint, } from "../command-tree/index.js";
|
|
5
|
+
const createArgumentError = (message) => ({
|
|
6
|
+
code: "invalid_argument",
|
|
7
|
+
message,
|
|
8
|
+
retryable: false,
|
|
9
|
+
});
|
|
10
|
+
const invalidInvocation = (message, output) => ({
|
|
11
|
+
exitCode: reportError(createArgumentError(message), output),
|
|
12
|
+
ok: false,
|
|
13
|
+
});
|
|
14
|
+
const parseInvocation = (input) => {
|
|
15
|
+
const output = { io: input.io, json: input.arguments_.includes("--json") };
|
|
16
|
+
if (!argumentsAreBounded(input.arguments_))
|
|
17
|
+
return invalidInvocation("Command arguments exceed the limit.", output);
|
|
18
|
+
try {
|
|
19
|
+
const parsed = parseArguments(input.arguments_);
|
|
20
|
+
return parsed.jsonFlagCount > 1
|
|
21
|
+
? invalidInvocation("Option '--json' may be used only once.", {
|
|
22
|
+
io: input.io,
|
|
23
|
+
json: true,
|
|
24
|
+
})
|
|
25
|
+
: { ok: true, parsed };
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (!(error instanceof CliArgumentError))
|
|
29
|
+
throw error;
|
|
30
|
+
return invalidInvocation(error.message, output);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const NO_ENVIRONMENT = {};
|
|
34
|
+
const readEnvironment = (leaf) => isNodeBacked(leaf)
|
|
35
|
+
? Effect.flatMap(Effect.promise(() => import("./environment.js")), (module) => module.environmentOptions)
|
|
36
|
+
: Effect.succeed(NO_ENVIRONMENT);
|
|
37
|
+
const fromEnvironment = (option, value) => value === undefined || value === ""
|
|
38
|
+
? undefined
|
|
39
|
+
: readGlobalValue(option, value);
|
|
40
|
+
const checkGlobalOptions = (parsed, leaf, remote) => {
|
|
41
|
+
if (parsed.node !== undefined && !remote)
|
|
42
|
+
throw new CliArgumentError(leaf.remote === false
|
|
43
|
+
? `Option '--node' does not apply to 'maia ${leaf.path.join(" ")}', which manages this machine's Nodes.`
|
|
44
|
+
: "Option '--node' is supported only by Node-backed commands.");
|
|
45
|
+
if (parsed.profile !== undefined && !isNodeBacked(leaf))
|
|
46
|
+
throw new CliArgumentError("Option '--profile' is supported only by Node-backed commands.");
|
|
47
|
+
};
|
|
48
|
+
const noInputFrom = (value) => value !== undefined && value !== "" && value !== "0";
|
|
49
|
+
const resolveOptions = (parsed, leaf, environment) => {
|
|
50
|
+
const nodeBacked = isNodeBacked(leaf);
|
|
51
|
+
const remote = nodeBacked && leaf.remote !== false;
|
|
52
|
+
checkGlobalOptions(parsed, leaf, remote);
|
|
53
|
+
const node = parsed.node ??
|
|
54
|
+
(remote ? fromEnvironment("--node", environment.node) : undefined);
|
|
55
|
+
const profile = parsed.profile ??
|
|
56
|
+
(nodeBacked
|
|
57
|
+
? fromEnvironment("--profile", environment.profile)
|
|
58
|
+
: undefined);
|
|
59
|
+
const noInput = parsed.noInput || noInputFrom(environment.noInput);
|
|
60
|
+
return {
|
|
61
|
+
...parsed,
|
|
62
|
+
noInput,
|
|
63
|
+
...(node === undefined ? {} : { node }),
|
|
64
|
+
...(profile === undefined ? {} : { profile }),
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const resolveInvocationDependencies = (source, parsed, scope) => {
|
|
68
|
+
if (typeof source !== "function") {
|
|
69
|
+
if (parsed.profile !== undefined || parsed.node !== undefined)
|
|
70
|
+
throw new CliArgumentError("This CLI dependency binding does not support '--profile' or '--node'.");
|
|
71
|
+
return source;
|
|
72
|
+
}
|
|
73
|
+
return parsed.node === undefined || scope === undefined
|
|
74
|
+
? source(parsed.profile)
|
|
75
|
+
: source(parsed.profile, { name: parsed.node, scope });
|
|
76
|
+
};
|
|
77
|
+
const commandContext = (input, parsed, scope) => ({
|
|
78
|
+
dependencies: resolveInvocationDependencies(input.dependencies, parsed, scope),
|
|
79
|
+
io: parsed.noInput ? { ...input.io, interactive: false } : input.io,
|
|
80
|
+
json: parsed.json,
|
|
81
|
+
...(parsed.node === undefined ? {} : { node: parsed.node }),
|
|
82
|
+
...(parsed.profile === undefined ? {} : { profile: parsed.profile }),
|
|
83
|
+
version: input.version,
|
|
84
|
+
});
|
|
85
|
+
const reportFailure = (error, context, tokens) => error instanceof CliArgumentError
|
|
86
|
+
? reportError(createArgumentError(error.message), {
|
|
87
|
+
...context,
|
|
88
|
+
usage: usageHint(tokens),
|
|
89
|
+
})
|
|
90
|
+
: reportError({
|
|
91
|
+
code: "internal_error",
|
|
92
|
+
message: "Maia CLI command failed.",
|
|
93
|
+
retryable: false,
|
|
94
|
+
}, context);
|
|
95
|
+
const reportFailures = (effect, context, tokens) => effect.pipe(Effect.catchDefect((defect) => defect instanceof CliArgumentError
|
|
96
|
+
? Effect.fail(defect)
|
|
97
|
+
: Effect.die(defect)), Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)
|
|
98
|
+
? Effect.interrupt
|
|
99
|
+
: Effect.sync(() => reportFailure(Cause.squash(cause), context, tokens))));
|
|
100
|
+
const isHelpInvocation = (parsed) => parsed.help || parsed.tokens[0] === undefined || parsed.tokens[0] === "help";
|
|
101
|
+
const runHelp = (input, parsed) => Effect.sync(() => {
|
|
102
|
+
const strict = parsed.tokens[0] === "help";
|
|
103
|
+
const end = parsed.tokens.indexOf("--");
|
|
104
|
+
const tokens = end === -1 ? parsed.tokens : parsed.tokens.slice(0, end);
|
|
105
|
+
const path = strict ? tokens.slice(1) : tokens;
|
|
106
|
+
const { consumed, node } = findNode(path);
|
|
107
|
+
if (consumed < path.length && (strict || node.forms.length === 0))
|
|
108
|
+
throw new CliArgumentError(unknownPathMessage(path));
|
|
109
|
+
const root = node.path.length === 0;
|
|
110
|
+
writeSuccess(root
|
|
111
|
+
? createHelpTree(input.version)
|
|
112
|
+
: createNodeHelp(input.version, node), { io: input.io, json: parsed.json }, () => (root ? formatRootHelp(input.version) : formatNodeHelp(node)));
|
|
113
|
+
return 0;
|
|
114
|
+
});
|
|
115
|
+
const findLeaf = (typed) => {
|
|
116
|
+
const tokens = typed[0] === "--version" ? ["version", ...typed.slice(1)] : typed;
|
|
117
|
+
const { consumed, node } = findNode(tokens);
|
|
118
|
+
if (node.forms.length === 0)
|
|
119
|
+
throw new CliArgumentError(unknownPathMessage(tokens));
|
|
120
|
+
return { leaf: node, rest: tokens.slice(consumed) };
|
|
121
|
+
};
|
|
122
|
+
const leafProgram = (leaf, rest, context) => {
|
|
123
|
+
const reference = leaf.run;
|
|
124
|
+
if (reference === undefined)
|
|
125
|
+
return Effect.die(new Error("No runner."));
|
|
126
|
+
const [load, name] = reference;
|
|
127
|
+
return Effect.flatMap(Effect.promise(load), (module) => {
|
|
128
|
+
const runner = Reflect.get(module, name);
|
|
129
|
+
return typeof runner === "function"
|
|
130
|
+
? runner(rest, context)
|
|
131
|
+
: Effect.die(new Error(`No runner ${name}.`));
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const withCliServices = (program) => Effect.promise(() => import("./services.js")).pipe(Effect.flatMap((services) => services.provideCliServices(program)));
|
|
135
|
+
const runResolved = (leaf, rest, context) => {
|
|
136
|
+
const usage = leaf.forms[0]?.usage ?? "";
|
|
137
|
+
if (!REFERENCE_USAGE.test(usage) || context.dependencies.call === undefined)
|
|
138
|
+
return withCliServices(leafProgram(leaf, rest, context));
|
|
139
|
+
const program = Effect.promise(() => import("../reference/index.js")).pipe(Effect.flatMap((module) => module.prepareLeaf({
|
|
140
|
+
context,
|
|
141
|
+
cwd: module.workingFolder(context.io.cwd),
|
|
142
|
+
tokens: rest,
|
|
143
|
+
usage,
|
|
144
|
+
})), Effect.flatMap((prepared) => prepared.ok
|
|
145
|
+
? leafProgram(leaf, prepared.tokens, prepared.context)
|
|
146
|
+
: Effect.succeed(prepared.exitCode)));
|
|
147
|
+
return withCliServices(program);
|
|
148
|
+
};
|
|
149
|
+
const runParsed = (input, parsed) => {
|
|
150
|
+
if (isHelpInvocation(parsed))
|
|
151
|
+
return runHelp(input, parsed);
|
|
152
|
+
return Effect.gen(function* () {
|
|
153
|
+
const { leaf, rest } = findLeaf(parsed.tokens);
|
|
154
|
+
const resolved = resolveOptions(parsed, leaf, yield* readEnvironment(leaf));
|
|
155
|
+
if (parsed.node === undefined &&
|
|
156
|
+
resolved.node !== undefined &&
|
|
157
|
+
!parsed.json)
|
|
158
|
+
input.io.stderr(`node: ${resolved.node} (MAIA_NODE)\n`);
|
|
159
|
+
const run = (scope) => Effect.suspend(() => runResolved(leaf, rest, commandContext(input, resolved, scope)));
|
|
160
|
+
return yield* resolved.node === undefined
|
|
161
|
+
? run()
|
|
162
|
+
: Effect.scoped(Effect.flatMap(Effect.scope, run));
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
const executeCli = (input) => Effect.suspend(() => {
|
|
166
|
+
const invocation = parseInvocation(input);
|
|
167
|
+
if (!invocation.ok)
|
|
168
|
+
return Effect.succeed(invocation.exitCode);
|
|
169
|
+
const { parsed } = invocation;
|
|
170
|
+
return reportFailures(runParsed(input, parsed), { io: input.io, json: parsed.json }, parsed.tokens);
|
|
171
|
+
});
|
|
172
|
+
export const makeCli = (dependencies) => (arguments_, version, io) => executeCli({
|
|
173
|
+
arguments_,
|
|
174
|
+
dependencies,
|
|
175
|
+
io,
|
|
176
|
+
version,
|
|
177
|
+
});
|
|
178
|
+
const loadProjectWorkspace = () => import("../project-workspace/index.js");
|
|
179
|
+
const loadProvider = () => import("../provider/index.js");
|
|
180
|
+
const loadOrchestration = () => import("../orchestration/index.js");
|
|
181
|
+
const loadSession = () => import("../session/index.js");
|
|
182
|
+
const loadTerminal = () => import("../terminal/index.js");
|
|
183
|
+
const loadTurn = () => import("../session/turn/index.js");
|
|
184
|
+
const loadStatus = () => import("../status/index.js");
|
|
185
|
+
const loadContext = () => import("../context/index.js");
|
|
186
|
+
const loadContainer = () => import("../container/index.js");
|
|
187
|
+
const loadHold = () => import("../hold/index.js");
|
|
188
|
+
const loadImport = () => import("../import/index.js");
|
|
189
|
+
const loadInteraction = () => import("../session/interaction/index.js");
|
|
190
|
+
const loadConnection = () => import("../connection/index.js");
|
|
191
|
+
const loadIntegration = () => import("../integration/index.js");
|
|
192
|
+
const loadPresentation = () => import("../presentation/index.js");
|
|
193
|
+
const loadMcp = () => import("../mcp/index.js");
|
|
194
|
+
const loadPortLease = () => import("../port-lease/index.js");
|
|
195
|
+
const loadApproval = () => import("../session/approval/index.js");
|
|
196
|
+
const loadRemoteNode = () => import("../remote-node/index.js");
|
|
197
|
+
const loadRunLedger = () => import("../run-ledger/index.js");
|
|
198
|
+
const loadProjectGuard = () => import("../project-guard/index.js");
|
|
199
|
+
const loadLocalNode = () => import("../local-node/index.js");
|
|
200
|
+
const lazyDependencies = (load, makeClient, binding) => Object.fromEntries(binding.names.map((name) => [
|
|
201
|
+
name,
|
|
202
|
+
(...arguments_) => Effect.promise(() => import("../local-node/index.js")).pipe(Effect.flatMap((module) => module.runLazyNodeDependency({
|
|
203
|
+
arguments_,
|
|
204
|
+
binding,
|
|
205
|
+
loadClient: load,
|
|
206
|
+
makeClient,
|
|
207
|
+
name,
|
|
208
|
+
}))),
|
|
209
|
+
]));
|
|
210
|
+
const makeDefaultCliDependencies = (binding) => ({
|
|
211
|
+
runAgent: (arguments_, io) => Effect.tryPromise({
|
|
212
|
+
catch: (error) => error,
|
|
213
|
+
try: () => import("@maiaos/agent").then((module) => module.runMaiaAgent(arguments_, { io })),
|
|
214
|
+
}),
|
|
215
|
+
...lazyDependencies(loadPresentation, (module, node) => module.makePresentationClient(node), {
|
|
216
|
+
...binding,
|
|
217
|
+
names: [
|
|
218
|
+
"showPresentationCatalog",
|
|
219
|
+
"showWorkspaceDirectory",
|
|
220
|
+
"showProjectList",
|
|
221
|
+
"showSessionList",
|
|
222
|
+
],
|
|
223
|
+
}),
|
|
224
|
+
...lazyDependencies(loadIntegration, (module, node) => module.makeIntegrationClient(node), {
|
|
225
|
+
...binding,
|
|
226
|
+
names: [
|
|
227
|
+
"planCodexIntegration",
|
|
228
|
+
"statusCodexIntegration",
|
|
229
|
+
"applyCodexIntegration",
|
|
230
|
+
"removeCodexIntegration",
|
|
231
|
+
"planClaudeCodeIntegration",
|
|
232
|
+
"statusClaudeCodeIntegration",
|
|
233
|
+
"applyClaudeCodeIntegration",
|
|
234
|
+
"removeClaudeCodeIntegration",
|
|
235
|
+
],
|
|
236
|
+
}),
|
|
237
|
+
...lazyDependencies(loadConnection, (module, node) => module.makeConnectionClient(node), {
|
|
238
|
+
...binding,
|
|
239
|
+
names: [
|
|
240
|
+
"createConnection",
|
|
241
|
+
"createGatewayConnection",
|
|
242
|
+
"listConnections",
|
|
243
|
+
"listConnectionModels",
|
|
244
|
+
"showConnection",
|
|
245
|
+
"showConnectionUsage",
|
|
246
|
+
"setConnectionCapacity",
|
|
247
|
+
"setConnectionState",
|
|
248
|
+
"startConnectionLogin",
|
|
249
|
+
"detectConnections",
|
|
250
|
+
"previewSystemConnections",
|
|
251
|
+
"confirmSystemConnections",
|
|
252
|
+
],
|
|
253
|
+
}),
|
|
254
|
+
...lazyDependencies(loadInteraction, (module, node) => module.makeInteractionClient(node), {
|
|
255
|
+
...binding,
|
|
256
|
+
names: [
|
|
257
|
+
"createInteraction",
|
|
258
|
+
"listInteractions",
|
|
259
|
+
"showInteraction",
|
|
260
|
+
"respondToInteraction",
|
|
261
|
+
"cancelInteraction",
|
|
262
|
+
],
|
|
263
|
+
}),
|
|
264
|
+
...lazyDependencies(loadContainer, (module, node) => module.makeContainerClient(node), {
|
|
265
|
+
...binding,
|
|
266
|
+
names: [
|
|
267
|
+
"listContainers",
|
|
268
|
+
"listContainerIndex",
|
|
269
|
+
"showContainer",
|
|
270
|
+
"previewContainerCreate",
|
|
271
|
+
"confirmContainerCreate",
|
|
272
|
+
"previewContainerRename",
|
|
273
|
+
"confirmContainerRename",
|
|
274
|
+
],
|
|
275
|
+
}),
|
|
276
|
+
...lazyDependencies(loadImport, (module, node) => module.makeDiscoveryClient(node), {
|
|
277
|
+
...binding,
|
|
278
|
+
names: [
|
|
279
|
+
"listDiscoveredSessions",
|
|
280
|
+
"readSessionHistory",
|
|
281
|
+
"previewSessionAdopt",
|
|
282
|
+
"confirmSessionAdopt",
|
|
283
|
+
],
|
|
284
|
+
}),
|
|
285
|
+
...lazyDependencies(loadHold, (module, node) => module.makeHoldClient(node), {
|
|
286
|
+
...binding,
|
|
287
|
+
names: [
|
|
288
|
+
"listHolds",
|
|
289
|
+
"previewHoldPlace",
|
|
290
|
+
"confirmHoldPlace",
|
|
291
|
+
"previewHoldRelease",
|
|
292
|
+
"confirmHoldRelease",
|
|
293
|
+
],
|
|
294
|
+
}),
|
|
295
|
+
...lazyDependencies(() => import("../project-workspace/index.js"), (module, node) => module.makeProjectMetadataClient(node), {
|
|
296
|
+
...binding,
|
|
297
|
+
names: [
|
|
298
|
+
"previewProjectCreate",
|
|
299
|
+
"confirmProjectCreate",
|
|
300
|
+
"previewProjectRename",
|
|
301
|
+
"confirmProjectRename",
|
|
302
|
+
],
|
|
303
|
+
}),
|
|
304
|
+
...lazyDependencies(loadProjectWorkspace, (module, node) => module.makeProjectWorkspaceClient(node), {
|
|
305
|
+
...binding,
|
|
306
|
+
names: [
|
|
307
|
+
"attachWorkspaceMembership",
|
|
308
|
+
"attachWorkspaceRepository",
|
|
309
|
+
"configureWorkspaceExecution",
|
|
310
|
+
"createExecutionCheckpoint",
|
|
311
|
+
"createExecutionPlacement",
|
|
312
|
+
"createExecutionWorktree",
|
|
313
|
+
"getReceipt",
|
|
314
|
+
"importExecutionWorktree",
|
|
315
|
+
"listProjectContext",
|
|
316
|
+
"listProjects",
|
|
317
|
+
"listReceipts",
|
|
318
|
+
"listWorkspaces",
|
|
319
|
+
"readExecutionCatalog",
|
|
320
|
+
"readExecutionFile",
|
|
321
|
+
"reconcileExecutionWorktree",
|
|
322
|
+
"recordProjectContext",
|
|
323
|
+
"registerProject",
|
|
324
|
+
"removeExecutionWorktree",
|
|
325
|
+
"runExecutionCommand",
|
|
326
|
+
"selectWorkspace",
|
|
327
|
+
"planExecutionWorktreeRemove",
|
|
328
|
+
"showExecutionCheckpoint",
|
|
329
|
+
"showExecutionPlacement",
|
|
330
|
+
"showExecutionWorktreeStatus",
|
|
331
|
+
"showProject",
|
|
332
|
+
"showProjectContext",
|
|
333
|
+
"showWorkspace",
|
|
334
|
+
"showWorkspaceContext",
|
|
335
|
+
"showWorkspaceExecution",
|
|
336
|
+
],
|
|
337
|
+
}),
|
|
338
|
+
...lazyDependencies(loadProvider, (module, node) => module.makeProviderClient(node), { ...binding, names: ["listProviderPools"] }),
|
|
339
|
+
...lazyDependencies(loadOrchestration, (module, node) => module.makeOrchestrationClient(node), {
|
|
340
|
+
...binding,
|
|
341
|
+
names: [
|
|
342
|
+
"acknowledgeRunDelivery",
|
|
343
|
+
"cancelRunQuestion",
|
|
344
|
+
"checkRunInbox",
|
|
345
|
+
"createRun",
|
|
346
|
+
"listRuns",
|
|
347
|
+
"listTasks",
|
|
348
|
+
"openRunQuestion",
|
|
349
|
+
"replyRunQuestion",
|
|
350
|
+
"settleRunDispatchTerminal",
|
|
351
|
+
"showDispatch",
|
|
352
|
+
"showRun",
|
|
353
|
+
"showTask",
|
|
354
|
+
],
|
|
355
|
+
}),
|
|
356
|
+
...lazyDependencies(loadSession, (module, node) => module.makeSessionClient(node), {
|
|
357
|
+
...binding,
|
|
358
|
+
names: [
|
|
359
|
+
"acknowledgeAttachedSessionDelivery",
|
|
360
|
+
"archiveSession",
|
|
361
|
+
"awaitSessionRunning",
|
|
362
|
+
"attachSession",
|
|
363
|
+
"checkAttachedSessionInbox",
|
|
364
|
+
"applyExecutionRelocation",
|
|
365
|
+
"confirmAgentPermission",
|
|
366
|
+
"previewAgentPermission",
|
|
367
|
+
"createSession",
|
|
368
|
+
"diffSession",
|
|
369
|
+
"listSessionEvents",
|
|
370
|
+
"planExecutionRelocation",
|
|
371
|
+
"reconcileExecutionRelocation",
|
|
372
|
+
"listSessions",
|
|
373
|
+
"observeSessions",
|
|
374
|
+
"planSessions",
|
|
375
|
+
"resumeSession",
|
|
376
|
+
"runSessions",
|
|
377
|
+
"sendAttachedSessionMessage",
|
|
378
|
+
"showExecutionRelocation",
|
|
379
|
+
"showSession",
|
|
380
|
+
"startSession",
|
|
381
|
+
"stopSession",
|
|
382
|
+
],
|
|
383
|
+
}),
|
|
384
|
+
...lazyDependencies(loadTerminal, (module, node) => module.makeTerminalClient(node), {
|
|
385
|
+
...binding,
|
|
386
|
+
names: [
|
|
387
|
+
"acquireTerminalController",
|
|
388
|
+
"closeTerminal",
|
|
389
|
+
"createTerminal",
|
|
390
|
+
"listTerminalEvents",
|
|
391
|
+
"listTerminals",
|
|
392
|
+
"readTerminal",
|
|
393
|
+
"releaseTerminalController",
|
|
394
|
+
"requestTerminalController",
|
|
395
|
+
"resizeTerminal",
|
|
396
|
+
"showTerminal",
|
|
397
|
+
"showTerminalControllerRequest",
|
|
398
|
+
"signalTerminal",
|
|
399
|
+
"writeTerminalInput",
|
|
400
|
+
],
|
|
401
|
+
}),
|
|
402
|
+
...lazyDependencies(loadTurn, (module, node) => module.makeTurnClient(node), {
|
|
403
|
+
...binding,
|
|
404
|
+
names: ["interruptTurn", "sendTurn", "showTurn", "waitTurns"],
|
|
405
|
+
}),
|
|
406
|
+
...lazyDependencies(loadContext, (module, node) => module.makeContextClient(node), { ...binding, names: ["showAttachedCurrentContext", "showCurrentContext"] }),
|
|
407
|
+
...lazyDependencies(loadApproval, (module, node) => module.makeApprovalClient(node), {
|
|
408
|
+
...binding,
|
|
409
|
+
names: ["listApprovals", "respondToApproval", "showApproval"],
|
|
410
|
+
}),
|
|
411
|
+
...lazyDependencies(loadPortLease, (module, node) => module.makePortLeaseClient(node), {
|
|
412
|
+
...binding,
|
|
413
|
+
names: [
|
|
414
|
+
"acquirePortLease",
|
|
415
|
+
"listPortLeases",
|
|
416
|
+
"releasePortLease",
|
|
417
|
+
"renewPortLease",
|
|
418
|
+
],
|
|
419
|
+
}),
|
|
420
|
+
...lazyDependencies(loadRunLedger, (module, node) => module.makeRunLedgerClient(node), {
|
|
421
|
+
...binding,
|
|
422
|
+
names: [
|
|
423
|
+
"createRunLedger",
|
|
424
|
+
"dispatchRunLedgerTask",
|
|
425
|
+
"listRunLedgerTasks",
|
|
426
|
+
"listRunLedgers",
|
|
427
|
+
"settleRunLedgerTask",
|
|
428
|
+
"showRunLedgerTask",
|
|
429
|
+
],
|
|
430
|
+
}),
|
|
431
|
+
...lazyDependencies(loadProjectGuard, (module, node) => module.makeProjectGuardClient(node), {
|
|
432
|
+
...binding,
|
|
433
|
+
names: ["confirmProjectGuard", "previewProjectGuard", "showProjectGuard"],
|
|
434
|
+
}),
|
|
435
|
+
...lazyDependencies(loadRemoteNode, (module, node) => module.makeRemoteNodeClient(node), {
|
|
436
|
+
...binding,
|
|
437
|
+
names: [
|
|
438
|
+
"confirmRemoteNodeInstall",
|
|
439
|
+
"confirmRemoteNodeRemove",
|
|
440
|
+
"listRemoteNodes",
|
|
441
|
+
"previewRemoteNodeInstall",
|
|
442
|
+
"previewRemoteNodeRemove",
|
|
443
|
+
],
|
|
444
|
+
}),
|
|
445
|
+
...lazyDependencies(loadLocalNode, (module, node) => module.makeCallClient(node), { ...binding, names: ["call"] }),
|
|
446
|
+
...lazyDependencies(loadMcp, (module, node) => module.makeMcpClient(node), {
|
|
447
|
+
...binding,
|
|
448
|
+
names: ["serveMcp"],
|
|
449
|
+
}),
|
|
450
|
+
...lazyDependencies(loadStatus, (module, node) => module.makeStatusClient(node), { ...binding, names: ["createMonitorBootstrap", "readStatus"] }),
|
|
451
|
+
});
|
|
452
|
+
const remoteConnector = (remote, local) => {
|
|
453
|
+
const cache = {};
|
|
454
|
+
return (options) => Effect.promise(loadRemoteNode).pipe(Effect.flatMap((module) => {
|
|
455
|
+
cache.connector ??= module.makeRemoteNodeConnector({
|
|
456
|
+
...(local === undefined ? {} : { local }),
|
|
457
|
+
name: remote.name,
|
|
458
|
+
scope: remote.scope,
|
|
459
|
+
});
|
|
460
|
+
return cache.connector(options);
|
|
461
|
+
}));
|
|
462
|
+
};
|
|
463
|
+
const remoteSignIn = (remote, binding) => (connection) => Effect.promise(loadRemoteNode).pipe(Effect.flatMap((module) => module.remoteVendorLogin({ ...binding, name: remote.name })(connection)));
|
|
464
|
+
export const makeCliDependencies = (connector) => (profile, remote) => {
|
|
465
|
+
const binding = {
|
|
466
|
+
...(connector === undefined ? {} : { connector }),
|
|
467
|
+
...(profile === undefined ? {} : { profile }),
|
|
468
|
+
};
|
|
469
|
+
return remote === undefined
|
|
470
|
+
? makeDefaultCliDependencies(binding)
|
|
471
|
+
: {
|
|
472
|
+
...makeDefaultCliDependencies({
|
|
473
|
+
...binding,
|
|
474
|
+
connector: remoteConnector(remote, connector),
|
|
475
|
+
remote: true,
|
|
476
|
+
}),
|
|
477
|
+
runVendorLogin: remoteSignIn(remote, binding),
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
export const runCli = makeCli(makeCliDependencies());
|
|
481
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
export type EnvironmentOptions = {
|
|
3
|
+
readonly node?: string;
|
|
4
|
+
readonly noInput?: string;
|
|
5
|
+
readonly profile?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const environmentOptions: Effect.Effect<EnvironmentOptions>;
|
|
8
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as Config from "effect/Config";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Option from "effect/Option";
|
|
4
|
+
const readVariable = (name) => Effect.map(Effect.orElseSucceed(Config.option(Config.String(name)), Option.none), (value) => Option.getOrUndefined(value));
|
|
5
|
+
export const environmentOptions = Effect.gen(function* () {
|
|
6
|
+
return {
|
|
7
|
+
node: yield* readVariable("MAIA_NODE"),
|
|
8
|
+
noInput: yield* readVariable("MAIA_NO_INPUT"),
|
|
9
|
+
profile: yield* readVariable("MAIA_PROFILE"),
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { type CliDependencies, type CliDependencyResolver, type CliErrorOutput, type CliHelpResult, type CliIo, type CliStatusResult, type CliSuccessOutput, type CliSuccessResult, type CliVersionResult, makeCli, makeCliDependencies, runCli, } from "./cli.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import type { CliServices } from "../command-line/index.js";
|
|
3
|
+
export declare const provideCliServices: <TValue, TError>(command: Effect.Effect<TValue, TError, CliServices>) => Effect.Effect<TValue, TError>;
|
|
4
|
+
//# sourceMappingURL=services.d.ts.map
|