@maiaos/cli 0.1.0-canary.10
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 +60 -0
- package/dist/address-space/address-space.d.ts +38 -0
- package/dist/address-space/address-space.js +130 -0
- package/dist/address-space/index.d.ts +2 -0
- package/dist/address-space/index.js +2 -0
- package/dist/agents/client.d.ts +171 -0
- package/dist/agents/client.js +8 -0
- package/dist/agents/commands.d.ts +7 -0
- package/dist/agents/commands.js +65 -0
- package/dist/agents/index.d.ts +3 -0
- package/dist/agents/index.js +3 -0
- package/dist/agents/input.d.ts +130 -0
- package/dist/agents/input.js +99 -0
- package/dist/agents/output/format.d.ts +8 -0
- package/dist/agents/output/format.js +47 -0
- package/dist/agents/output/index.d.ts +2 -0
- package/dist/agents/output/index.js +2 -0
- package/dist/agents/tree/index.d.ts +2 -0
- package/dist/agents/tree/index.js +2 -0
- package/dist/agents/tree/tree.d.ts +3 -0
- package/dist/agents/tree/tree.js +43 -0
- package/dist/bin/maia.NOTICES.txt +59 -0
- package/dist/bin/maia.cdx.json +168 -0
- package/dist/bin/maia.mjs +2 -0
- package/dist/bootstrap/exit.d.ts +14 -0
- package/dist/bootstrap/exit.js +42 -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 +23 -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 +545 -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 +188 -0
- package/dist/command-line/context.js +2 -0
- package/dist/command-line/index.d.ts +7 -0
- package/dist/command-line/index.js +7 -0
- package/dist/command-line/input/arguments.d.ts +62 -0
- package/dist/command-line/input/arguments.js +232 -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 +12 -0
- package/dist/command-line/input/stdin.js +24 -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 +4 -0
- package/dist/command-line/json.js +27 -0
- package/dist/command-line/output.d.ts +64 -0
- package/dist/command-line/output.js +113 -0
- package/dist/command-line/rows.d.ts +12 -0
- package/dist/command-line/rows.js +41 -0
- package/dist/command-line/two-phase.d.ts +62 -0
- package/dist/command-line/two-phase.js +173 -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 +220 -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 +138 -0
- package/dist/command-tree/placeholder.d.ts +4 -0
- package/dist/command-tree/placeholder.js +5 -0
- package/dist/command-tree/row.d.ts +31 -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 +35 -0
- package/dist/command-tree/tree.js +140 -0
- package/dist/connection/access/client.d.ts +13 -0
- package/dist/connection/access/client.js +19 -0
- package/dist/connection/access/commands.d.ts +6 -0
- package/dist/connection/access/commands.js +60 -0
- package/dist/connection/access/format.d.ts +8 -0
- package/dist/connection/access/format.js +61 -0
- package/dist/connection/access/index.d.ts +3 -0
- package/dist/connection/access/index.js +3 -0
- package/dist/connection/access/input.d.ts +53 -0
- package/dist/connection/access/input.js +83 -0
- package/dist/connection/client.d.ts +790 -0
- package/dist/connection/client.js +36 -0
- package/dist/connection/commands.d.ts +15 -0
- package/dist/connection/commands.js +118 -0
- package/dist/connection/index.d.ts +8 -0
- package/dist/connection/index.js +8 -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 +5 -0
- package/dist/connection/system.js +294 -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 +260 -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 +27 -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/dashboard/cockpit-client.d.ts +6 -0
- package/dist/dashboard/cockpit-client.js +27 -0
- package/dist/dashboard/cockpits.d.ts +29 -0
- package/dist/dashboard/cockpits.js +65 -0
- package/dist/dashboard/dashboard.d.ts +7 -0
- package/dist/dashboard/dashboard.js +47 -0
- package/dist/dashboard/draw.d.ts +15 -0
- package/dist/dashboard/draw.js +30 -0
- package/dist/dashboard/frame.d.ts +4 -0
- package/dist/dashboard/frame.js +15 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.js +2 -0
- package/dist/dashboard/modes.d.ts +5 -0
- package/dist/dashboard/modes.js +16 -0
- package/dist/dashboard/node-connection.d.ts +15 -0
- package/dist/dashboard/node-connection.js +51 -0
- package/dist/dashboard/pi-tui.d.ts +6 -0
- package/dist/dashboard/pi-tui.js +35 -0
- package/dist/dashboard/status-bar.d.ts +4 -0
- package/dist/dashboard/status-bar.js +60 -0
- package/dist/dashboard/terminal.d.ts +53 -0
- package/dist/dashboard/terminal.js +165 -0
- package/dist/dashboard/tree-model.d.ts +28 -0
- package/dist/dashboard/tree-model.js +97 -0
- package/dist/dashboard/tree.d.ts +10 -0
- package/dist/dashboard/tree.js +76 -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/fleet/fleet.d.ts +70 -0
- package/dist/fleet/fleet.js +91 -0
- package/dist/fleet/index.d.ts +2 -0
- package/dist/fleet/index.js +2 -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 +25 -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 +97 -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 +75 -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 +37 -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 +72 -0
- package/dist/local-node/client.js +253 -0
- package/dist/local-node/index.d.ts +4 -0
- package/dist/local-node/index.js +4 -0
- package/dist/local-node/wait.d.ts +10 -0
- package/dist/local-node/wait.js +17 -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 +94 -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 +8 -0
- package/dist/mcp/calls.js +236 -0
- package/dist/mcp/commands.d.ts +12 -0
- package/dist/mcp/commands.js +47 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/routing.d.ts +24 -0
- package/dist/mcp/routing.js +188 -0
- package/dist/mcp/server.d.ts +20 -0
- package/dist/mcp/server.js +80 -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 +33 -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 +48 -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 +710 -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 +139 -0
- package/dist/project-workspace/output/human.js +115 -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 +212 -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 +41 -0
- package/dist/reference/index.d.ts +3 -0
- package/dist/reference/index.js +3 -0
- package/dist/reference/resolve.d.ts +31 -0
- package/dist/reference/resolve.js +304 -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 +338 -0
- package/dist/remote-node/client.js +17 -0
- package/dist/remote-node/commands.d.ts +15 -0
- package/dist/remote-node/commands.js +342 -0
- package/dist/remote-node/connector.d.ts +67 -0
- package/dist/remote-node/connector.js +143 -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 +64 -0
- package/dist/remote-node/reachability.js +44 -0
- package/dist/remote-node/text.d.ts +10 -0
- package/dist/remote-node/text.js +111 -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 +71 -0
- package/dist/routine/client.d.ts +398 -0
- package/dist/routine/client.js +28 -0
- package/dist/routine/commands.d.ts +9 -0
- package/dist/routine/commands.js +109 -0
- package/dist/routine/index.d.ts +3 -0
- package/dist/routine/index.js +3 -0
- package/dist/routine/input.d.ts +28 -0
- package/dist/routine/input.js +44 -0
- package/dist/routine/output/format.d.ts +23 -0
- package/dist/routine/output/format.js +83 -0
- package/dist/routine/output/index.d.ts +2 -0
- package/dist/routine/output/index.js +2 -0
- package/dist/routine/tree/index.d.ts +2 -0
- package/dist/routine/tree/index.js +2 -0
- package/dist/routine/tree/tree.d.ts +3 -0
- package/dist/routine/tree/tree.js +70 -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 +145 -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 +23 -0
- package/dist/session/approval/output/format.js +33 -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 +17 -0
- package/dist/session/attach-render.d.ts +16 -0
- package/dist/session/attach-render.js +162 -0
- package/dist/session/attach.d.ts +5 -0
- package/dist/session/attach.js +120 -0
- package/dist/session/client.d.ts +140 -0
- package/dist/session/client.js +129 -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 +14 -0
- package/dist/session/commands.js +585 -0
- package/dist/session/create-tasks.d.ts +20 -0
- package/dist/session/create-tasks.js +128 -0
- package/dist/session/index.d.ts +9 -0
- package/dist/session/index.js +8 -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 +4 -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 +23 -0
- package/dist/session/output/failure.d.ts +11 -0
- package/dist/session/output/failure.js +17 -0
- package/dist/session/output/human.d.ts +113 -0
- package/dist/session/output/human.js +82 -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 +34 -0
- package/dist/session/output/tasks.js +48 -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 +368 -0
- package/dist/session/turn/client.d.ts +28 -0
- package/dist/session/turn/client.js +51 -0
- package/dist/session/turn/commands.d.ts +8 -0
- package/dist/session/turn/commands.js +185 -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 +47 -0
- package/dist/session/turn/output.js +61 -0
- package/dist/status/client.d.ts +124 -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 +32 -0
- package/dist/status/output/compact.js +49 -0
- package/dist/status/output/human.d.ts +7 -0
- package/dist/status/output/human.js +87 -0
- package/dist/status/output/index.d.ts +3 -0
- package/dist/status/output/index.js +3 -0
- package/dist/team-workspace/ceremony.d.ts +19 -0
- package/dist/team-workspace/ceremony.js +141 -0
- package/dist/team-workspace/client.d.ts +58 -0
- package/dist/team-workspace/client.js +6 -0
- package/dist/team-workspace/commands.d.ts +3 -0
- package/dist/team-workspace/commands.js +85 -0
- package/dist/team-workspace/confirmation.d.ts +4 -0
- package/dist/team-workspace/confirmation.js +8 -0
- package/dist/team-workspace/dependencies.d.ts +8 -0
- package/dist/team-workspace/dependencies.js +2 -0
- package/dist/team-workspace/index.d.ts +6 -0
- package/dist/team-workspace/index.js +5 -0
- package/dist/team-workspace/launcher.d.ts +17 -0
- package/dist/team-workspace/launcher.js +30 -0
- package/dist/team-workspace/output.d.ts +15 -0
- package/dist/team-workspace/output.js +28 -0
- package/dist/team-workspace/terminal.d.ts +9 -0
- package/dist/team-workspace/terminal.js +46 -0
- package/dist/terminal/arguments.d.ts +13 -0
- package/dist/terminal/arguments.js +79 -0
- package/dist/terminal/client.d.ts +83 -0
- package/dist/terminal/client.js +71 -0
- package/dist/terminal/commands.d.ts +7 -0
- package/dist/terminal/commands.js +143 -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 +148 -0
- package/dist/terminal/output/compact-list.js +153 -0
- package/dist/terminal/output/human.d.ts +42 -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 +78 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
const project = () => import("../index.js");
|
|
2
|
+
const guard = () => import("../../project-guard/index.js");
|
|
3
|
+
const container = () => import("../../container/index.js");
|
|
4
|
+
export const PROJECT_TREE = {
|
|
5
|
+
groups: [
|
|
6
|
+
["project", "Projects: registered repositories."],
|
|
7
|
+
["project guard", "A Project's guards."],
|
|
8
|
+
["project context", "A Project's context notes."],
|
|
9
|
+
["workspace", "Workspaces of a Project."],
|
|
10
|
+
["workspace context", "The active Workspace context."],
|
|
11
|
+
["workspace membership", "Repositories attached to a Workspace."],
|
|
12
|
+
["workspace execution", "A Workspace's execution settings."],
|
|
13
|
+
["workspace repository", "A Workspace's repositories."],
|
|
14
|
+
["container", "Workspace containers."],
|
|
15
|
+
["container index", "Every container with its Projects."],
|
|
16
|
+
],
|
|
17
|
+
leaves: [
|
|
18
|
+
[
|
|
19
|
+
"project register <path> [--name <name>] [--command-id <id>]",
|
|
20
|
+
0,
|
|
21
|
+
"project.register",
|
|
22
|
+
"Register a Git repository as a Project.",
|
|
23
|
+
{
|
|
24
|
+
example: "maia --json project register . --name app --command-id project-1",
|
|
25
|
+
run: [project, "runProjectRegister"],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
"project list [--limit <1..100>] [--after <cursor>]",
|
|
30
|
+
0,
|
|
31
|
+
"project.list",
|
|
32
|
+
"List Projects.",
|
|
33
|
+
{
|
|
34
|
+
example: "maia --json project list --limit 20",
|
|
35
|
+
run: [project, "runProjectList"],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"project show <project-id>",
|
|
40
|
+
0,
|
|
41
|
+
"project.show",
|
|
42
|
+
"Show one Project.",
|
|
43
|
+
{ route: "<project-id>", run: [project, "runProjectShow"] },
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
"project create (--input-stdin --dry-run | --confirm-stdin)",
|
|
47
|
+
1,
|
|
48
|
+
["project.create.preview", "project.create.confirm"],
|
|
49
|
+
"Create a Project after a preview.",
|
|
50
|
+
{ kind: "two-phase", run: [project, "runProjectCreate"] },
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
"project rename (--input-stdin --dry-run | --confirm-stdin)",
|
|
54
|
+
1,
|
|
55
|
+
["project.rename.preview", "project.rename.confirm"],
|
|
56
|
+
"Rename a Project after a preview.",
|
|
57
|
+
{ kind: "two-phase", run: [project, "runProjectRename"] },
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"project guard show <project-id>",
|
|
61
|
+
1,
|
|
62
|
+
"project.guard.show",
|
|
63
|
+
"Show a Project's guards.",
|
|
64
|
+
{ route: "<project-id>", run: [guard, "runProjectGuardShow"] },
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"project guard set (<project-id> --expected-revision <revision> --max-depth <1..4> --max-live-children <1..64> --max-messages-per-minute <1..600> --max-leases-per-session <1..64> [--command-id <id>] [--dry-run] | --confirm-stdin)",
|
|
68
|
+
1,
|
|
69
|
+
["project.guard.preview", "project.guard.confirm"],
|
|
70
|
+
"Set a Project's guards after a preview.",
|
|
71
|
+
{
|
|
72
|
+
kind: "two-phase",
|
|
73
|
+
route: "<project-id>",
|
|
74
|
+
run: [guard, "runProjectGuardSet"],
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"project context record --project <project-id> --body-stdin [--command-id <id>]",
|
|
79
|
+
0,
|
|
80
|
+
"project.context.record",
|
|
81
|
+
"Record a context note for a Project.",
|
|
82
|
+
{ route: "--project", run: [project, "runProjectContextRecord"] },
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
"project context list --project <project-id> [--limit <1..100>] [--after <cursor>]",
|
|
86
|
+
0,
|
|
87
|
+
"project.context.list",
|
|
88
|
+
"List a Project's context notes.",
|
|
89
|
+
{ route: "--project", run: [project, "runProjectContextList"] },
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
"project context show <note-id>",
|
|
93
|
+
0,
|
|
94
|
+
"project.context.show",
|
|
95
|
+
"Show one context note.",
|
|
96
|
+
{ run: [project, "runProjectContextShow"] },
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
"workspace list --project <project-id> [--limit <1..100>] [--after <cursor>]",
|
|
100
|
+
0,
|
|
101
|
+
"workspace.list",
|
|
102
|
+
"List a Project's Workspaces.",
|
|
103
|
+
{ route: "--project", run: [project, "runWorkspaceList"] },
|
|
104
|
+
],
|
|
105
|
+
[
|
|
106
|
+
"workspace show <workspace-id>",
|
|
107
|
+
0,
|
|
108
|
+
"workspace.show",
|
|
109
|
+
"Show one Workspace.",
|
|
110
|
+
{ route: "<workspace-id>", run: [project, "runWorkspaceShow"] },
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
"workspace select <workspace-id> --project <project-id> --repository <repository-id> --expected-active-workspace-id <workspace-id> --expected-active-context-revision <revision> --expected-workspace-revision <revision> --expected-context-revision <revision> [--command-id <id>]",
|
|
114
|
+
1,
|
|
115
|
+
"workspace.select",
|
|
116
|
+
"Select the active Workspace.",
|
|
117
|
+
{ route: "<workspace-id>", run: [project, "runWorkspaceSelect"] },
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"workspace context show",
|
|
121
|
+
1,
|
|
122
|
+
"workspace.context.show",
|
|
123
|
+
"Show the active Workspace context.",
|
|
124
|
+
{ run: [project, "runWorkspaceContextShow"] },
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
"workspace execution show <workspace-id>",
|
|
128
|
+
1,
|
|
129
|
+
"workspace.execution.show",
|
|
130
|
+
"Show a Workspace's execution settings.",
|
|
131
|
+
{ route: "<workspace-id>", run: [project, "runWorkspaceExecutionShow"] },
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
"workspace execution set <workspace-id> (--execution-profile <profile-id> | --policy <policy-id>) --expected-revision <revision> [--command-id <id>]",
|
|
135
|
+
1,
|
|
136
|
+
"workspace.execution.configure",
|
|
137
|
+
"Set a Workspace's execution profile or policy.",
|
|
138
|
+
{
|
|
139
|
+
kind: "discriminant",
|
|
140
|
+
route: "<workspace-id>",
|
|
141
|
+
run: [project, "runWorkspaceExecutionSet"],
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
"workspace execution clear <workspace-id> --expected-revision <revision> [--command-id <id>]",
|
|
146
|
+
1,
|
|
147
|
+
"workspace.execution.configure",
|
|
148
|
+
"Clear a Workspace's execution settings.",
|
|
149
|
+
{
|
|
150
|
+
kind: "discriminant",
|
|
151
|
+
route: "<workspace-id>",
|
|
152
|
+
run: [project, "runWorkspaceExecutionClear"],
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
[
|
|
156
|
+
"workspace membership attach <workspace-id> --project <project-id> --repository <repository-id> --expected-workspace-revision <revision> --expected-context-revision <revision> [--command-id <id>]",
|
|
157
|
+
1,
|
|
158
|
+
"workspace.membership.attach",
|
|
159
|
+
"Attach a Project repository to a Workspace.",
|
|
160
|
+
{
|
|
161
|
+
route: "<workspace-id>",
|
|
162
|
+
run: [project, "runWorkspaceMembershipAttach"],
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"workspace repository attach <path> --workspace <workspace-id> --expected-revision <revision> [--name <name>] [--command-id <id>]",
|
|
167
|
+
0,
|
|
168
|
+
"workspace.repository.attach",
|
|
169
|
+
"Attach a repository to a Workspace.",
|
|
170
|
+
{ run: [project, "runWorkspaceRepositoryAttach"] },
|
|
171
|
+
],
|
|
172
|
+
[
|
|
173
|
+
"container list [--limit <1..100>] [--after <cursor>]",
|
|
174
|
+
1,
|
|
175
|
+
"container.list",
|
|
176
|
+
"List containers.",
|
|
177
|
+
{ run: [container, "runContainerList"] },
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
"container show <container-id> [--limit <1..100>] [--after <cursor>]",
|
|
181
|
+
1,
|
|
182
|
+
"container.show",
|
|
183
|
+
"Show one container and its Projects.",
|
|
184
|
+
{ run: [container, "runContainerShow"] },
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
"container index list [--limit <1..500>] [--after <cursor>]",
|
|
188
|
+
1,
|
|
189
|
+
"container.index.list",
|
|
190
|
+
"List every container with its Projects and their paths.",
|
|
191
|
+
{
|
|
192
|
+
example: "maia --json container index list --limit 500",
|
|
193
|
+
run: [container, "runContainerIndexList"],
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"container create (--input-stdin --dry-run | --confirm-stdin)",
|
|
198
|
+
1,
|
|
199
|
+
["container.create.preview", "container.create.confirm"],
|
|
200
|
+
"Create a container after a preview.",
|
|
201
|
+
{ kind: "two-phase", run: [container, "runContainerCreate"] },
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"container rename (--input-stdin --dry-run | --confirm-stdin)",
|
|
205
|
+
1,
|
|
206
|
+
["container.rename.preview", "container.rename.confirm"],
|
|
207
|
+
"Rename a container after a preview.",
|
|
208
|
+
{ kind: "two-phase", run: [container, "runContainerRename"] },
|
|
209
|
+
],
|
|
210
|
+
],
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ProviderPoolListResult } from "@maiaos/sdk";
|
|
2
|
+
import type { CliNodeEffect, CliNodeOperations } from "../local-node/index.js";
|
|
3
|
+
export declare const makeProviderClient: (node: CliNodeOperations) => {
|
|
4
|
+
listProviderPools: () => CliNodeEffect<ProviderPoolListResult>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { providerPoolListParametersSchema } from "@maiaos/sdk";
|
|
2
|
+
export const makeProviderClient = (node) => ({
|
|
3
|
+
listProviderPools: () => node.runValidatedNodeOperation({}, providerPoolListParametersSchema, (client, parameters, options) => client.listProviderPools(parameters, options)),
|
|
4
|
+
});
|
|
5
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { cell, formatRows, parseOptions, requirePositionals, tab, writeNodeResult, } from "../command-line/index.js";
|
|
3
|
+
const formatPools = ({ result }) => formatRows(result.pools, (pool) => tab([
|
|
4
|
+
cell(pool.poolId),
|
|
5
|
+
cell(pool.providerId),
|
|
6
|
+
cell(pool.model),
|
|
7
|
+
`${String(pool.availableCredentialCount)}/${String(pool.credentialCount)}`,
|
|
8
|
+
pool.default ? "default" : "-",
|
|
9
|
+
]), {
|
|
10
|
+
empty: "No model-provider pools.",
|
|
11
|
+
headers: ["POOL", "PROVIDER", "MODEL", "CREDENTIALS", "DEFAULT"],
|
|
12
|
+
});
|
|
13
|
+
export const runProviderPoolList = (tokens, context) => Effect.gen(function* () {
|
|
14
|
+
const parsed = parseOptions(tokens, new Set());
|
|
15
|
+
requirePositionals(parsed.positionals, 0);
|
|
16
|
+
const operation = context.dependencies.listProviderPools;
|
|
17
|
+
if (operation === undefined)
|
|
18
|
+
return yield* Effect.die(new Error("Missing provider client."));
|
|
19
|
+
const result = yield* operation();
|
|
20
|
+
return writeNodeResult(result, context, {
|
|
21
|
+
toResult: (value) => ({
|
|
22
|
+
command: "provider.pool.list",
|
|
23
|
+
result: {
|
|
24
|
+
pools: value.pools.map((pool) => ({
|
|
25
|
+
availableCredentialCount: pool.availableCredentialCount,
|
|
26
|
+
credentialCount: pool.credentialCount,
|
|
27
|
+
default: pool.default,
|
|
28
|
+
model: pool.model,
|
|
29
|
+
poolId: pool.poolId,
|
|
30
|
+
providerId: pool.providerId,
|
|
31
|
+
})),
|
|
32
|
+
releaseQualified: value.releaseQualified,
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
toText: formatPools,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { cell, CliArgumentError, LOCAL_NODE, parseOptions, writeNodeResult, } from "../command-line/index.js";
|
|
3
|
+
import { workingFolder } from "./resolve.js";
|
|
4
|
+
const KINDS = new Set([
|
|
5
|
+
"connection",
|
|
6
|
+
"container",
|
|
7
|
+
"project",
|
|
8
|
+
"session",
|
|
9
|
+
"workspace",
|
|
10
|
+
]);
|
|
11
|
+
const isKind = (value) => KINDS.has(value ?? "");
|
|
12
|
+
const readParameters = (tokens, context) => {
|
|
13
|
+
const parsed = parseOptions(tokens, new Set(["--project"]));
|
|
14
|
+
const [kind, reference, ...extra] = parsed.positionals;
|
|
15
|
+
if (!isKind(kind) || extra.length > 0)
|
|
16
|
+
throw new CliArgumentError("Name one kind (connection, container, project, session or workspace) and at most one reference.");
|
|
17
|
+
const projectId = parsed.options.get("--project");
|
|
18
|
+
const path = context.node === undefined || context.node === LOCAL_NODE
|
|
19
|
+
? workingFolder(context.io.cwd)
|
|
20
|
+
: undefined;
|
|
21
|
+
if (reference === undefined)
|
|
22
|
+
return { kind, ...(path === undefined ? {} : { path }) };
|
|
23
|
+
return { kind, reference, ...(projectId === undefined ? {} : { projectId }) };
|
|
24
|
+
};
|
|
25
|
+
const line = (id, label) => `${id}${label === undefined ? "" : `\t${cell(label)}`}\n`;
|
|
26
|
+
const formatResolution = (value) => value.outcome === "resolved"
|
|
27
|
+
? line(value.id, value.label)
|
|
28
|
+
: value.candidates
|
|
29
|
+
.map((candidate) => line(candidate.id, candidate.label))
|
|
30
|
+
.join("");
|
|
31
|
+
export const runReferenceResolve = (tokens, context) => {
|
|
32
|
+
const parameters = readParameters(tokens, context);
|
|
33
|
+
const { call } = context.dependencies;
|
|
34
|
+
if (call === undefined)
|
|
35
|
+
return Effect.die(new Error("Missing the typed Node call."));
|
|
36
|
+
return Effect.map(call("reference.resolve", parameters), (result) => writeNodeResult(result, context, {
|
|
37
|
+
toResult: (value) => ({ command: "reference.resolve", result: value }),
|
|
38
|
+
toText: ({ result: value }) => formatResolution(value),
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { runReferenceResolve } from "./commands.js";
|
|
2
|
+
export { argumentValue, describeResolution, isExactId, type LeafArguments, type PreparedLeaf, prepareLeaf, type ResolvedArguments, resolveLeafArguments, workingFolder, } from "./resolve.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { CliArgumentError, type CliResolution, type CliServices, type CommandContext } from "../command-line/index.js";
|
|
3
|
+
export type ResolvedArguments = {
|
|
4
|
+
readonly exitCode: number;
|
|
5
|
+
readonly ok: false;
|
|
6
|
+
} | {
|
|
7
|
+
readonly ok: true;
|
|
8
|
+
readonly resolutions: readonly CliResolution[];
|
|
9
|
+
readonly tokens: readonly string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const isExactId: (kind: string, value: string) => boolean;
|
|
12
|
+
export declare const argumentValue: (usage: string, tokens: readonly string[], argument: string) => Effect.Effect<string | undefined, CliArgumentError>;
|
|
13
|
+
export declare const describeResolution: (item: CliResolution) => string;
|
|
14
|
+
export type LeafArguments = {
|
|
15
|
+
readonly context: CommandContext;
|
|
16
|
+
readonly cwd?: string;
|
|
17
|
+
readonly tokens: readonly string[];
|
|
18
|
+
readonly usage: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const resolveLeafArguments: ({ context, cwd, tokens, usage, }: LeafArguments) => Effect.Effect<ResolvedArguments, CliArgumentError, CliServices>;
|
|
21
|
+
export type PreparedLeaf = {
|
|
22
|
+
readonly context: CommandContext;
|
|
23
|
+
readonly ok: true;
|
|
24
|
+
readonly tokens: readonly string[];
|
|
25
|
+
} | {
|
|
26
|
+
readonly exitCode: number;
|
|
27
|
+
readonly ok: false;
|
|
28
|
+
};
|
|
29
|
+
export declare const prepareLeaf: (input: LeafArguments) => Effect.Effect<PreparedLeaf, CliArgumentError, CliServices>;
|
|
30
|
+
export declare const workingFolder: (cwd?: string) => string | undefined;
|
|
31
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { cell, CliArgumentError, LOCAL_NODE, parseOptionsWith, reportError, tokenizeArguments, } from "../command-line/index.js";
|
|
4
|
+
import { parseUsage, REFERENCE_PLACEHOLDER, } from "../command-tree/index.js";
|
|
5
|
+
class ReferenceRefused extends Data.TaggedError("ReferenceRefused") {
|
|
6
|
+
}
|
|
7
|
+
const NOUNS = {
|
|
8
|
+
connection: "Connection",
|
|
9
|
+
container: "Container",
|
|
10
|
+
project: "Project",
|
|
11
|
+
session: "Session",
|
|
12
|
+
workspace: "Workspace",
|
|
13
|
+
};
|
|
14
|
+
const MAX_REFERENCES = 32;
|
|
15
|
+
const SCOPE_NAMES = new Set([
|
|
16
|
+
"--all",
|
|
17
|
+
"--project",
|
|
18
|
+
"--workspace",
|
|
19
|
+
]);
|
|
20
|
+
const isKind = (value) => Object.hasOwn(NOUNS, value);
|
|
21
|
+
const kindOf = (placeholder) => {
|
|
22
|
+
const word = REFERENCE_PLACEHOLDER.exec(placeholder ?? "")?.[1] ?? "";
|
|
23
|
+
return isKind(word) ? word : undefined;
|
|
24
|
+
};
|
|
25
|
+
export const isExactId = (kind, value) => new RegExp(`^${kind}_[0-9a-f]{32}$`, "u").test(value);
|
|
26
|
+
const grammarOf = (arguments_) => ({
|
|
27
|
+
options: new Map(arguments_.flatMap((argument) => argument.name.startsWith("--") && argument.value !== undefined
|
|
28
|
+
? [
|
|
29
|
+
[
|
|
30
|
+
argument.name,
|
|
31
|
+
argument.name.startsWith("--expected-")
|
|
32
|
+
? undefined
|
|
33
|
+
: kindOf(argument.value),
|
|
34
|
+
],
|
|
35
|
+
]
|
|
36
|
+
: [])),
|
|
37
|
+
positionals: arguments_.filter((argument) => argument.name.startsWith("<")),
|
|
38
|
+
});
|
|
39
|
+
const repeatableOf = (arguments_) => new Set(arguments_.flatMap((argument) => argument.name.startsWith("--") && argument.value?.includes("...") === true
|
|
40
|
+
? [argument.name]
|
|
41
|
+
: []));
|
|
42
|
+
const slotOf = (grammar, position) => {
|
|
43
|
+
const { positionals } = grammar;
|
|
44
|
+
const last = positionals.at(-1);
|
|
45
|
+
return positionals[position] ?? (last?.repeated === true ? last : undefined);
|
|
46
|
+
};
|
|
47
|
+
const valueOf = (token, inline) => inline ? token.slice(token.indexOf("=") + 1) : token;
|
|
48
|
+
const placeOf = (grammar, role, position) => {
|
|
49
|
+
if (role.kind === "value") {
|
|
50
|
+
const kind = grammar.options.get(role.name);
|
|
51
|
+
return {
|
|
52
|
+
argument: role.name,
|
|
53
|
+
index: role.index,
|
|
54
|
+
inline: role.inline,
|
|
55
|
+
...(kind === undefined ? {} : { kind }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const slot = slotOf(grammar, position);
|
|
59
|
+
const kind = kindOf(slot?.name);
|
|
60
|
+
return {
|
|
61
|
+
argument: slot?.name ?? "",
|
|
62
|
+
index: role.index,
|
|
63
|
+
inline: false,
|
|
64
|
+
...(kind === undefined ? {} : { kind }),
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const placementsOf = (grammar, tokens, roles) => {
|
|
68
|
+
const kept = roles.filter((role) => role.kind !== "flag");
|
|
69
|
+
const positionals = kept.filter((role) => role.kind === "positional");
|
|
70
|
+
return kept.map((role) => {
|
|
71
|
+
const place = placeOf(grammar, role, positionals.indexOf(role));
|
|
72
|
+
return {
|
|
73
|
+
...place,
|
|
74
|
+
reference: valueOf(tokens[role.index] ?? "", place.inline),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const targetsOf = (placements) => placements.flatMap((place) => {
|
|
79
|
+
const { kind } = place;
|
|
80
|
+
return kind === undefined ? [] : [{ ...place, kind }];
|
|
81
|
+
});
|
|
82
|
+
const flagsOf = (arguments_) => new Set(arguments_.flatMap((argument) => argument.name.startsWith("--") && argument.value === undefined
|
|
83
|
+
? [argument.name]
|
|
84
|
+
: []));
|
|
85
|
+
const locate = (arguments_, tokens) => Effect.try({
|
|
86
|
+
catch: (error) => error instanceof CliArgumentError
|
|
87
|
+
? error
|
|
88
|
+
: new CliArgumentError("The command arguments are invalid."),
|
|
89
|
+
try: () => {
|
|
90
|
+
const grammar = grammarOf(arguments_);
|
|
91
|
+
const valueOptions = new Set(grammar.options.keys());
|
|
92
|
+
const end = tokens.indexOf("--");
|
|
93
|
+
parseOptionsWith(end === -1 ? tokens : tokens.slice(0, end), {
|
|
94
|
+
allowed: valueOptions,
|
|
95
|
+
allowedFlags: flagsOf(arguments_),
|
|
96
|
+
repeatable: repeatableOf(arguments_),
|
|
97
|
+
});
|
|
98
|
+
const roles = tokenizeArguments(tokens, valueOptions);
|
|
99
|
+
const placements = placementsOf(grammar, tokens, roles);
|
|
100
|
+
return {
|
|
101
|
+
given: new Set(roles.flatMap((role) => ("name" in role ? [role.name] : []))),
|
|
102
|
+
placements,
|
|
103
|
+
targets: targetsOf(placements),
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
export const argumentValue = (usage, tokens, argument) => Effect.map(locate(parseUsage(usage).args, tokens), ({ placements }) => placements.find((place) => place.argument === argument)?.reference);
|
|
108
|
+
const missingScope = (arguments_, given) => {
|
|
109
|
+
const scope = arguments_.find((argument) => argument.required === true &&
|
|
110
|
+
(argument.name === "--workspace" || argument.name === "--project"));
|
|
111
|
+
if (scope === undefined)
|
|
112
|
+
return undefined;
|
|
113
|
+
const group = scope.oneOf === undefined
|
|
114
|
+
? [scope]
|
|
115
|
+
: arguments_.filter((argument) => argument.oneOf === scope.oneOf && argument.required === true);
|
|
116
|
+
return group.some((argument) => given.has(argument.name)) ? undefined : group;
|
|
117
|
+
};
|
|
118
|
+
const labelled = (id, label) => label === undefined ? id : `${id} (${cell(label)})`;
|
|
119
|
+
const ambiguous = (argument, reference, result) => new CliArgumentError(`${reference === undefined ? `The default ${argument}` : `'${cell(reference)}'`} matches ${String(result.candidates.length)} ${NOUNS[result.kind]}s: ${result.candidates
|
|
120
|
+
.map((candidate) => labelled(candidate.id, candidate.label))
|
|
121
|
+
.join(", ")}. Pass ${argument} with a full ID.`);
|
|
122
|
+
const foreignAnswer = () => new ReferenceRefused({
|
|
123
|
+
error: {
|
|
124
|
+
code: "internal_error",
|
|
125
|
+
message: "The Node resolved a reference to another kind of resource.",
|
|
126
|
+
retryable: false,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
const ask = (call, parameters) => Effect.flatMap(call("reference.resolve", parameters), (result) => {
|
|
130
|
+
if (!result.ok)
|
|
131
|
+
return Effect.fail(new ReferenceRefused({ error: result.error }));
|
|
132
|
+
const answer = result.value;
|
|
133
|
+
const matches = answer.kind === parameters.kind &&
|
|
134
|
+
(answer.outcome === "ambiguous" ||
|
|
135
|
+
answer.id.startsWith(`${parameters.kind}_`));
|
|
136
|
+
return matches ? Effect.succeed(answer) : Effect.fail(foreignAnswer());
|
|
137
|
+
});
|
|
138
|
+
const resolution = (argument, result, reference) => ({
|
|
139
|
+
argument,
|
|
140
|
+
id: result.id,
|
|
141
|
+
kind: result.kind,
|
|
142
|
+
...(result.label === undefined ? {} : { label: result.label }),
|
|
143
|
+
match: result.match,
|
|
144
|
+
...(reference === undefined ? {} : { reference }),
|
|
145
|
+
});
|
|
146
|
+
const scoped = (kind, scope) => scope === undefined || (kind !== "session" && kind !== "workspace")
|
|
147
|
+
? {}
|
|
148
|
+
: { projectId: scope };
|
|
149
|
+
const answerFor = (call, state, parameters) => {
|
|
150
|
+
const key = JSON.stringify(parameters);
|
|
151
|
+
const known = state.answers.get(key);
|
|
152
|
+
if (known !== undefined)
|
|
153
|
+
return Effect.succeed({ answer: known, key });
|
|
154
|
+
if (state.answers.size >= MAX_REFERENCES)
|
|
155
|
+
return Effect.fail(new CliArgumentError(`A command resolves at most ${String(MAX_REFERENCES)} references.`));
|
|
156
|
+
return Effect.map(ask(call, parameters), (answer) => ({ answer, key }));
|
|
157
|
+
};
|
|
158
|
+
const rewrite = (state, target, id) => state.tokens.with(target.index, target.inline ? `${target.argument}=${id}` : id);
|
|
159
|
+
const exact = (state, target) => ({
|
|
160
|
+
...state,
|
|
161
|
+
resolutions: [
|
|
162
|
+
...state.resolutions,
|
|
163
|
+
{
|
|
164
|
+
argument: target.argument,
|
|
165
|
+
id: target.reference,
|
|
166
|
+
kind: target.kind,
|
|
167
|
+
match: "id",
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
...(target.kind === "project" ? { scope: target.reference } : {}),
|
|
171
|
+
});
|
|
172
|
+
const accept = (state, target, found) => ({
|
|
173
|
+
...state,
|
|
174
|
+
answers: new Map(state.answers).set(found.key, found.answer),
|
|
175
|
+
resolutions: [
|
|
176
|
+
...state.resolutions,
|
|
177
|
+
resolution(target.argument, found.answer, target.reference),
|
|
178
|
+
],
|
|
179
|
+
...(target.kind === "project" ? { scope: found.answer.id } : {}),
|
|
180
|
+
tokens: rewrite(state, target, found.answer.id),
|
|
181
|
+
});
|
|
182
|
+
const resolveTarget = (call, state, target) => {
|
|
183
|
+
if (isExactId(target.kind, target.reference))
|
|
184
|
+
return Effect.succeed(exact(state, target));
|
|
185
|
+
const parameters = {
|
|
186
|
+
kind: target.kind,
|
|
187
|
+
reference: target.reference,
|
|
188
|
+
...scoped(target.kind, state.scope),
|
|
189
|
+
};
|
|
190
|
+
return Effect.flatMap(answerFor(call, state, parameters), ({ answer, key }) => answer.outcome === "ambiguous"
|
|
191
|
+
? Effect.fail(ambiguous(target.argument, target.reference, answer))
|
|
192
|
+
: Effect.succeed(accept(state, target, { answer, key })));
|
|
193
|
+
};
|
|
194
|
+
const resolveEach = (call, initial, targets) => Effect.reduce(targets, () => initial, (state, target) => resolveTarget(call, state, target));
|
|
195
|
+
const noDefault = (group) => ({ error, }) => error.code === "resource_not_found"
|
|
196
|
+
? Effect.fail(new CliArgumentError(`Pass ${group
|
|
197
|
+
.map((argument) => argument.name)
|
|
198
|
+
.filter((name) => SCOPE_NAMES.has(name))
|
|
199
|
+
.join(" or ")}: ${error.message}`))
|
|
200
|
+
: Effect.fail(new ReferenceRefused({ error }));
|
|
201
|
+
const orElse = (first, second) => Effect.catchTag(first, "CliArgumentError", (missing) => Effect.catchTag(second, "CliArgumentError", () => Effect.fail(missing)));
|
|
202
|
+
const resolveDefault = (call, group, path) => {
|
|
203
|
+
const names = new Set(group.map((argument) => argument.name));
|
|
204
|
+
const askDefault = (kind) => ask(call, { kind, ...(path === undefined ? {} : { path }) }).pipe(Effect.catchTag("ReferenceRefused", noDefault(group)));
|
|
205
|
+
const settle = (kind, result) => result.outcome === "resolved"
|
|
206
|
+
? Effect.succeed(result)
|
|
207
|
+
: Effect.fail(ambiguous(`--${kind}`, undefined, result));
|
|
208
|
+
const project = Effect.flatMap(askDefault("project"), (result) => settle("project", result));
|
|
209
|
+
if (!names.has("--workspace"))
|
|
210
|
+
return project;
|
|
211
|
+
const workspace = Effect.flatMap(askDefault("workspace"), (result) => result.outcome === "ambiguous" && names.has("--project")
|
|
212
|
+
? project
|
|
213
|
+
: settle("workspace", result));
|
|
214
|
+
return names.has("--project") ? orElse(workspace, project) : workspace;
|
|
215
|
+
};
|
|
216
|
+
const withDefault = (call, group, path) => {
|
|
217
|
+
return (state) => {
|
|
218
|
+
if (group === undefined)
|
|
219
|
+
return Effect.succeed(state);
|
|
220
|
+
return Effect.map(resolveDefault(call, group, path), (fallback) => {
|
|
221
|
+
const argument = `--${fallback.kind}`;
|
|
222
|
+
const end = state.tokens.indexOf("--");
|
|
223
|
+
const at = end === -1 ? state.tokens.length : end;
|
|
224
|
+
return {
|
|
225
|
+
...state,
|
|
226
|
+
resolutions: [...state.resolutions, resolution(argument, fallback)],
|
|
227
|
+
scope: fallback.kind === "project" ? fallback.id : fallback.projectId,
|
|
228
|
+
tokens: state.tokens.toSpliced(at, 0, argument, fallback.id),
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
const SOURCES = {
|
|
234
|
+
id: "its ID",
|
|
235
|
+
name: "its name",
|
|
236
|
+
path: "the current folder",
|
|
237
|
+
prefix: "its ID prefix",
|
|
238
|
+
selection: "the selected Workspace",
|
|
239
|
+
};
|
|
240
|
+
export const describeResolution = (item) => `${item.argument}: ${labelled(item.id, item.label)} from ${SOURCES[item.match]}\n`;
|
|
241
|
+
const plan = (group, path, targets) => ({
|
|
242
|
+
...(group === undefined ? {} : { group }),
|
|
243
|
+
...(path === undefined ? {} : { path }),
|
|
244
|
+
targets,
|
|
245
|
+
});
|
|
246
|
+
const resolveAll = (call, tokens, plan) => {
|
|
247
|
+
const initial = { answers: new Map(), resolutions: [], tokens };
|
|
248
|
+
const isProject = (target) => target.kind === "project";
|
|
249
|
+
return resolveEach(call, initial, plan.targets.filter(isProject)).pipe(Effect.flatMap(withDefault(call, plan.group, plan.path)), Effect.flatMap((state) => resolveEach(call, state, plan.targets.filter((target) => !isProject(target)))));
|
|
250
|
+
};
|
|
251
|
+
const unresolved = (tokens) => ({
|
|
252
|
+
answers: new Map(),
|
|
253
|
+
resolutions: [],
|
|
254
|
+
tokens,
|
|
255
|
+
});
|
|
256
|
+
const reported = (context) => ({ error }) => Effect.succeed({
|
|
257
|
+
exitCode: reportError(error, context),
|
|
258
|
+
ok: false,
|
|
259
|
+
});
|
|
260
|
+
const settled = ({ resolutions, tokens }) => ({
|
|
261
|
+
ok: true,
|
|
262
|
+
resolutions,
|
|
263
|
+
tokens,
|
|
264
|
+
});
|
|
265
|
+
export const resolveLeafArguments = ({ context, cwd, tokens, usage, }) => {
|
|
266
|
+
const { call } = context.dependencies;
|
|
267
|
+
if (call === undefined)
|
|
268
|
+
return Effect.succeed(settled(unresolved(tokens)));
|
|
269
|
+
const { args } = parseUsage(usage);
|
|
270
|
+
const path = context.node === undefined || context.node === LOCAL_NODE ? cwd : undefined;
|
|
271
|
+
return locate(args, tokens).pipe(Effect.flatMap(({ given, targets }) => given.has("--attached")
|
|
272
|
+
? Effect.succeed(unresolved(tokens))
|
|
273
|
+
: resolveAll(call, tokens, plan(missingScope(args, given), path, targets))), Effect.map(settled), Effect.catchTag("ReferenceRefused", reported(context)));
|
|
274
|
+
};
|
|
275
|
+
export const prepareLeaf = (input) => Effect.map(resolveLeafArguments(input), (outcome) => {
|
|
276
|
+
if (!outcome.ok)
|
|
277
|
+
return outcome;
|
|
278
|
+
const changed = outcome.resolutions.filter((item) => item.match !== "id");
|
|
279
|
+
const { context } = input;
|
|
280
|
+
if (!context.json)
|
|
281
|
+
changed.forEach((item) => {
|
|
282
|
+
context.io.stderr(describeResolution(item));
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
context: changed.length === 0
|
|
286
|
+
? context
|
|
287
|
+
: { ...context, resolved: [...(context.resolved ?? []), ...changed] },
|
|
288
|
+
ok: true,
|
|
289
|
+
tokens: outcome.tokens,
|
|
290
|
+
};
|
|
291
|
+
});
|
|
292
|
+
const currentFolder = () => {
|
|
293
|
+
try {
|
|
294
|
+
return process.cwd();
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
export const workingFolder = (cwd) => {
|
|
301
|
+
const folder = cwd ?? currentFolder();
|
|
302
|
+
return folder?.startsWith("/") === true ? folder : undefined;
|
|
303
|
+
};
|
|
304
|
+
//# sourceMappingURL=resolve.js.map
|