@miosa/cli 1.3.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -835
- package/bin/miosa.js +75 -0
- package/lib/archive.js +26 -0
- package/lib/checksums.js +29 -0
- package/lib/platforms.js +31 -0
- package/lib/resolve.js +47 -0
- package/package.json +25 -41
- package/scripts/postinstall.js +68 -0
- package/CHANGELOG.md +0 -110
- package/dist/action-authority.d.ts +0 -106
- package/dist/action-authority.d.ts.map +0 -1
- package/dist/action-authority.js +0 -116
- package/dist/action-authority.js.map +0 -1
- package/dist/app-advisor.d.ts +0 -80
- package/dist/app-advisor.d.ts.map +0 -1
- package/dist/app-advisor.js +0 -486
- package/dist/app-advisor.js.map +0 -1
- package/dist/app-contract.d.ts +0 -92
- package/dist/app-contract.d.ts.map +0 -1
- package/dist/app-contract.js +0 -218
- package/dist/app-contract.js.map +0 -1
- package/dist/app-document.d.ts +0 -23
- package/dist/app-document.d.ts.map +0 -1
- package/dist/app-document.js +0 -180
- package/dist/app-document.js.map +0 -1
- package/dist/app-manifest.d.ts +0 -140
- package/dist/app-manifest.d.ts.map +0 -1
- package/dist/app-manifest.js +0 -377
- package/dist/app-manifest.js.map +0 -1
- package/dist/app-operation.d.ts +0 -23
- package/dist/app-operation.d.ts.map +0 -1
- package/dist/app-operation.js +0 -49
- package/dist/app-operation.js.map +0 -1
- package/dist/app-release.d.ts +0 -132
- package/dist/app-release.d.ts.map +0 -1
- package/dist/app-release.js +0 -294
- package/dist/app-release.js.map +0 -1
- package/dist/bin/miosa.d.ts +0 -3
- package/dist/bin/miosa.d.ts.map +0 -1
- package/dist/bin/miosa.js +0 -288
- package/dist/bin/miosa.js.map +0 -1
- package/dist/cli-env.d.ts +0 -12
- package/dist/cli-env.d.ts.map +0 -1
- package/dist/cli-env.js +0 -34
- package/dist/cli-env.js.map +0 -1
- package/dist/client.d.ts +0 -155
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -865
- package/dist/client.js.map +0 -1
- package/dist/commands/actions.d.ts +0 -3
- package/dist/commands/actions.d.ts.map +0 -1
- package/dist/commands/actions.js +0 -222
- package/dist/commands/actions.js.map +0 -1
- package/dist/commands/agent-runtime-profiles.d.ts +0 -3
- package/dist/commands/agent-runtime-profiles.d.ts.map +0 -1
- package/dist/commands/agent-runtime-profiles.js +0 -198
- package/dist/commands/agent-runtime-profiles.js.map +0 -1
- package/dist/commands/agent.d.ts +0 -18
- package/dist/commands/agent.d.ts.map +0 -1
- package/dist/commands/agent.js +0 -737
- package/dist/commands/agent.js.map +0 -1
- package/dist/commands/alerts.d.ts +0 -3
- package/dist/commands/alerts.d.ts.map +0 -1
- package/dist/commands/alerts.js +0 -41
- package/dist/commands/alerts.js.map +0 -1
- package/dist/commands/api-keys.d.ts +0 -3
- package/dist/commands/api-keys.d.ts.map +0 -1
- package/dist/commands/api-keys.js +0 -160
- package/dist/commands/api-keys.js.map +0 -1
- package/dist/commands/api-resource.d.ts +0 -20
- package/dist/commands/api-resource.d.ts.map +0 -1
- package/dist/commands/api-resource.js +0 -120
- package/dist/commands/api-resource.js.map +0 -1
- package/dist/commands/app.d.ts +0 -38
- package/dist/commands/app.d.ts.map +0 -1
- package/dist/commands/app.js +0 -1182
- package/dist/commands/app.js.map +0 -1
- package/dist/commands/apps.d.ts +0 -3
- package/dist/commands/apps.d.ts.map +0 -1
- package/dist/commands/apps.js +0 -218
- package/dist/commands/apps.js.map +0 -1
- package/dist/commands/audit.d.ts +0 -3
- package/dist/commands/audit.d.ts.map +0 -1
- package/dist/commands/audit.js +0 -25
- package/dist/commands/audit.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -3
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js +0 -282
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/backups.d.ts +0 -3
- package/dist/commands/backups.d.ts.map +0 -1
- package/dist/commands/backups.js +0 -23
- package/dist/commands/backups.js.map +0 -1
- package/dist/commands/billing.d.ts +0 -3
- package/dist/commands/billing.d.ts.map +0 -1
- package/dist/commands/billing.js +0 -208
- package/dist/commands/billing.js.map +0 -1
- package/dist/commands/builds.d.ts +0 -3
- package/dist/commands/builds.d.ts.map +0 -1
- package/dist/commands/builds.js +0 -198
- package/dist/commands/builds.js.map +0 -1
- package/dist/commands/capabilities.d.ts +0 -3
- package/dist/commands/capabilities.d.ts.map +0 -1
- package/dist/commands/capabilities.js +0 -1002
- package/dist/commands/capabilities.js.map +0 -1
- package/dist/commands/checkpoints.d.ts +0 -3
- package/dist/commands/checkpoints.d.ts.map +0 -1
- package/dist/commands/checkpoints.js +0 -193
- package/dist/commands/checkpoints.js.map +0 -1
- package/dist/commands/cleanup.d.ts +0 -3
- package/dist/commands/cleanup.d.ts.map +0 -1
- package/dist/commands/cleanup.js +0 -65
- package/dist/commands/cleanup.js.map +0 -1
- package/dist/commands/cloud.d.ts +0 -3
- package/dist/commands/cloud.d.ts.map +0 -1
- package/dist/commands/cloud.js +0 -192
- package/dist/commands/cloud.js.map +0 -1
- package/dist/commands/command-overview.d.ts +0 -13
- package/dist/commands/command-overview.d.ts.map +0 -1
- package/dist/commands/command-overview.js +0 -50
- package/dist/commands/command-overview.js.map +0 -1
- package/dist/commands/completion.d.ts +0 -3
- package/dist/commands/completion.d.ts.map +0 -1
- package/dist/commands/completion.js +0 -183
- package/dist/commands/completion.js.map +0 -1
- package/dist/commands/computers.d.ts +0 -3
- package/dist/commands/computers.d.ts.map +0 -1
- package/dist/commands/computers.js +0 -706
- package/dist/commands/computers.js.map +0 -1
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -114
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/connect.d.ts +0 -6
- package/dist/commands/connect.d.ts.map +0 -1
- package/dist/commands/connect.js +0 -127
- package/dist/commands/connect.js.map +0 -1
- package/dist/commands/connectors.d.ts +0 -3
- package/dist/commands/connectors.d.ts.map +0 -1
- package/dist/commands/connectors.js +0 -172
- package/dist/commands/connectors.js.map +0 -1
- package/dist/commands/containers.d.ts +0 -3
- package/dist/commands/containers.d.ts.map +0 -1
- package/dist/commands/containers.js +0 -20
- package/dist/commands/containers.js.map +0 -1
- package/dist/commands/context.d.ts +0 -3
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -233
- package/dist/commands/context.js.map +0 -1
- package/dist/commands/cp.d.ts +0 -3
- package/dist/commands/cp.d.ts.map +0 -1
- package/dist/commands/cp.js +0 -319
- package/dist/commands/cp.js.map +0 -1
- package/dist/commands/cron.d.ts +0 -3
- package/dist/commands/cron.d.ts.map +0 -1
- package/dist/commands/cron.js +0 -65
- package/dist/commands/cron.js.map +0 -1
- package/dist/commands/dashboard.d.ts +0 -13
- package/dist/commands/dashboard.d.ts.map +0 -1
- package/dist/commands/dashboard.js +0 -54
- package/dist/commands/dashboard.js.map +0 -1
- package/dist/commands/databases.d.ts +0 -3
- package/dist/commands/databases.d.ts.map +0 -1
- package/dist/commands/databases.js +0 -714
- package/dist/commands/databases.js.map +0 -1
- package/dist/commands/db.d.ts +0 -3
- package/dist/commands/db.d.ts.map +0 -1
- package/dist/commands/db.js +0 -385
- package/dist/commands/db.js.map +0 -1
- package/dist/commands/deploy.d.ts +0 -3
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js +0 -1234
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/desktop.d.ts +0 -3
- package/dist/commands/desktop.d.ts.map +0 -1
- package/dist/commands/desktop.js +0 -277
- package/dist/commands/desktop.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -3
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -245
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/devices.d.ts +0 -3
- package/dist/commands/devices.d.ts.map +0 -1
- package/dist/commands/devices.js +0 -279
- package/dist/commands/devices.js.map +0 -1
- package/dist/commands/docker-deploy.d.ts +0 -3
- package/dist/commands/docker-deploy.d.ts.map +0 -1
- package/dist/commands/docker-deploy.js +0 -659
- package/dist/commands/docker-deploy.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -69
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -596
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/domains.d.ts +0 -3
- package/dist/commands/domains.d.ts.map +0 -1
- package/dist/commands/domains.js +0 -307
- package/dist/commands/domains.js.map +0 -1
- package/dist/commands/enterprise-util.d.ts +0 -39
- package/dist/commands/enterprise-util.d.ts.map +0 -1
- package/dist/commands/enterprise-util.js +0 -217
- package/dist/commands/enterprise-util.js.map +0 -1
- package/dist/commands/env-input.d.ts +0 -26
- package/dist/commands/env-input.d.ts.map +0 -1
- package/dist/commands/env-input.js +0 -68
- package/dist/commands/env-input.js.map +0 -1
- package/dist/commands/env.d.ts +0 -3
- package/dist/commands/env.d.ts.map +0 -1
- package/dist/commands/env.js +0 -189
- package/dist/commands/env.js.map +0 -1
- package/dist/commands/exec.d.ts +0 -3
- package/dist/commands/exec.d.ts.map +0 -1
- package/dist/commands/exec.js +0 -110
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/forge.d.ts +0 -3
- package/dist/commands/forge.d.ts.map +0 -1
- package/dist/commands/forge.js +0 -254
- package/dist/commands/forge.js.map +0 -1
- package/dist/commands/functions.d.ts +0 -3
- package/dist/commands/functions.d.ts.map +0 -1
- package/dist/commands/functions.js +0 -47
- package/dist/commands/functions.js.map +0 -1
- package/dist/commands/gha-runners.d.ts +0 -3
- package/dist/commands/gha-runners.d.ts.map +0 -1
- package/dist/commands/gha-runners.js +0 -33
- package/dist/commands/gha-runners.js.map +0 -1
- package/dist/commands/groups.d.ts +0 -3
- package/dist/commands/groups.d.ts.map +0 -1
- package/dist/commands/groups.js +0 -38
- package/dist/commands/groups.js.map +0 -1
- package/dist/commands/host.d.ts +0 -3
- package/dist/commands/host.d.ts.map +0 -1
- package/dist/commands/host.js +0 -74
- package/dist/commands/host.js.map +0 -1
- package/dist/commands/hosts.d.ts +0 -7
- package/dist/commands/hosts.d.ts.map +0 -1
- package/dist/commands/hosts.js +0 -91
- package/dist/commands/hosts.js.map +0 -1
- package/dist/commands/link.d.ts +0 -8
- package/dist/commands/link.d.ts.map +0 -1
- package/dist/commands/link.js +0 -124
- package/dist/commands/link.js.map +0 -1
- package/dist/commands/login.d.ts +0 -10
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -263
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -3
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -43
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/logs.d.ts +0 -3
- package/dist/commands/logs.d.ts.map +0 -1
- package/dist/commands/logs.js +0 -401
- package/dist/commands/logs.js.map +0 -1
- package/dist/commands/ls.d.ts +0 -3
- package/dist/commands/ls.d.ts.map +0 -1
- package/dist/commands/ls.js +0 -121
- package/dist/commands/ls.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -46
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -3413
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/menu.d.ts +0 -29
- package/dist/commands/menu.d.ts.map +0 -1
- package/dist/commands/menu.js +0 -147
- package/dist/commands/menu.js.map +0 -1
- package/dist/commands/meshes.d.ts +0 -3
- package/dist/commands/meshes.d.ts.map +0 -1
- package/dist/commands/meshes.js +0 -27
- package/dist/commands/meshes.js.map +0 -1
- package/dist/commands/network-policy.d.ts +0 -3
- package/dist/commands/network-policy.d.ts.map +0 -1
- package/dist/commands/network-policy.js +0 -155
- package/dist/commands/network-policy.js.map +0 -1
- package/dist/commands/new.d.ts +0 -3
- package/dist/commands/new.d.ts.map +0 -1
- package/dist/commands/new.js +0 -296
- package/dist/commands/new.js.map +0 -1
- package/dist/commands/opencomputers.d.ts +0 -10
- package/dist/commands/opencomputers.d.ts.map +0 -1
- package/dist/commands/opencomputers.js +0 -25
- package/dist/commands/opencomputers.js.map +0 -1
- package/dist/commands/operating-contract.d.ts +0 -3
- package/dist/commands/operating-contract.d.ts.map +0 -1
- package/dist/commands/operating-contract.js +0 -651
- package/dist/commands/operating-contract.js.map +0 -1
- package/dist/commands/project.d.ts +0 -4
- package/dist/commands/project.d.ts.map +0 -1
- package/dist/commands/project.js +0 -25
- package/dist/commands/project.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -14
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -156
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/regions.d.ts +0 -3
- package/dist/commands/regions.d.ts.map +0 -1
- package/dist/commands/regions.js +0 -103
- package/dist/commands/regions.js.map +0 -1
- package/dist/commands/releases.d.ts +0 -3
- package/dist/commands/releases.d.ts.map +0 -1
- package/dist/commands/releases.js +0 -365
- package/dist/commands/releases.js.map +0 -1
- package/dist/commands/rm.d.ts +0 -3
- package/dist/commands/rm.d.ts.map +0 -1
- package/dist/commands/rm.js +0 -42
- package/dist/commands/rm.js.map +0 -1
- package/dist/commands/rollback.d.ts +0 -3
- package/dist/commands/rollback.d.ts.map +0 -1
- package/dist/commands/rollback.js +0 -62
- package/dist/commands/rollback.js.map +0 -1
- package/dist/commands/run-groups.d.ts +0 -3
- package/dist/commands/run-groups.d.ts.map +0 -1
- package/dist/commands/run-groups.js +0 -364
- package/dist/commands/run-groups.js.map +0 -1
- package/dist/commands/run.d.ts +0 -3
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js +0 -130
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/runs.d.ts +0 -3
- package/dist/commands/runs.d.ts.map +0 -1
- package/dist/commands/runs.js +0 -365
- package/dist/commands/runs.js.map +0 -1
- package/dist/commands/runtime-env.d.ts +0 -3
- package/dist/commands/runtime-env.d.ts.map +0 -1
- package/dist/commands/runtime-env.js +0 -114
- package/dist/commands/runtime-env.js.map +0 -1
- package/dist/commands/sandbox-delete-guard.d.ts +0 -4
- package/dist/commands/sandbox-delete-guard.d.ts.map +0 -1
- package/dist/commands/sandbox-delete-guard.js +0 -32
- package/dist/commands/sandbox-delete-guard.js.map +0 -1
- package/dist/commands/sandbox-dev.d.ts +0 -20
- package/dist/commands/sandbox-dev.d.ts.map +0 -1
- package/dist/commands/sandbox-dev.js +0 -583
- package/dist/commands/sandbox-dev.js.map +0 -1
- package/dist/commands/sandbox.d.ts +0 -36
- package/dist/commands/sandbox.d.ts.map +0 -1
- package/dist/commands/sandbox.js +0 -3796
- package/dist/commands/sandbox.js.map +0 -1
- package/dist/commands/scale.d.ts +0 -3
- package/dist/commands/scale.d.ts.map +0 -1
- package/dist/commands/scale.js +0 -61
- package/dist/commands/scale.js.map +0 -1
- package/dist/commands/schedules.d.ts +0 -3
- package/dist/commands/schedules.d.ts.map +0 -1
- package/dist/commands/schedules.js +0 -37
- package/dist/commands/schedules.js.map +0 -1
- package/dist/commands/secrets.d.ts +0 -3
- package/dist/commands/secrets.d.ts.map +0 -1
- package/dist/commands/secrets.js +0 -200
- package/dist/commands/secrets.js.map +0 -1
- package/dist/commands/services.d.ts +0 -3
- package/dist/commands/services.d.ts.map +0 -1
- package/dist/commands/services.js +0 -70
- package/dist/commands/services.js.map +0 -1
- package/dist/commands/shell.d.ts +0 -16
- package/dist/commands/shell.d.ts.map +0 -1
- package/dist/commands/shell.js +0 -555
- package/dist/commands/shell.js.map +0 -1
- package/dist/commands/snapshot.d.ts +0 -10
- package/dist/commands/snapshot.d.ts.map +0 -1
- package/dist/commands/snapshot.js +0 -181
- package/dist/commands/snapshot.js.map +0 -1
- package/dist/commands/ssh.d.ts +0 -3
- package/dist/commands/ssh.d.ts.map +0 -1
- package/dist/commands/ssh.js +0 -93
- package/dist/commands/ssh.js.map +0 -1
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -302
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/storage.d.ts +0 -3
- package/dist/commands/storage.d.ts.map +0 -1
- package/dist/commands/storage.js +0 -456
- package/dist/commands/storage.js.map +0 -1
- package/dist/commands/teams.d.ts +0 -3
- package/dist/commands/teams.d.ts.map +0 -1
- package/dist/commands/teams.js +0 -169
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/templates.d.ts +0 -3
- package/dist/commands/templates.d.ts.map +0 -1
- package/dist/commands/templates.js +0 -690
- package/dist/commands/templates.js.map +0 -1
- package/dist/commands/tenant.d.ts +0 -3
- package/dist/commands/tenant.d.ts.map +0 -1
- package/dist/commands/tenant.js +0 -95
- package/dist/commands/tenant.js.map +0 -1
- package/dist/commands/tunnel.d.ts +0 -3
- package/dist/commands/tunnel.d.ts.map +0 -1
- package/dist/commands/tunnel.js +0 -418
- package/dist/commands/tunnel.js.map +0 -1
- package/dist/commands/up.d.ts +0 -14
- package/dist/commands/up.d.ts.map +0 -1
- package/dist/commands/up.js +0 -720
- package/dist/commands/up.js.map +0 -1
- package/dist/commands/update.d.ts +0 -3
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js +0 -166
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/util.d.ts +0 -25
- package/dist/commands/util.d.ts.map +0 -1
- package/dist/commands/util.js +0 -199
- package/dist/commands/util.js.map +0 -1
- package/dist/commands/volumes.d.ts +0 -3
- package/dist/commands/volumes.d.ts.map +0 -1
- package/dist/commands/volumes.js +0 -196
- package/dist/commands/volumes.js.map +0 -1
- package/dist/commands/watch.d.ts +0 -6
- package/dist/commands/watch.d.ts.map +0 -1
- package/dist/commands/watch.js +0 -414
- package/dist/commands/watch.js.map +0 -1
- package/dist/commands/webhooks.d.ts +0 -3
- package/dist/commands/webhooks.d.ts.map +0 -1
- package/dist/commands/webhooks.js +0 -23
- package/dist/commands/webhooks.js.map +0 -1
- package/dist/commands/whoami.d.ts +0 -3
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -156
- package/dist/commands/whoami.js.map +0 -1
- package/dist/commands/workspaces.d.ts +0 -3
- package/dist/commands/workspaces.d.ts.map +0 -1
- package/dist/commands/workspaces.js +0 -147
- package/dist/commands/workspaces.js.map +0 -1
- package/dist/config.d.ts +0 -54
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -275
- package/dist/config.js.map +0 -1
- package/dist/errors.d.ts +0 -30
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -92
- package/dist/errors.js.map +0 -1
- package/dist/framework-detector.d.ts +0 -22
- package/dist/framework-detector.d.ts.map +0 -1
- package/dist/framework-detector.js +0 -373
- package/dist/framework-detector.js.map +0 -1
- package/dist/generated/action-capabilities.d.ts +0 -826
- package/dist/generated/action-capabilities.d.ts.map +0 -1
- package/dist/generated/action-capabilities.js +0 -1035
- package/dist/generated/action-capabilities.js.map +0 -1
- package/dist/net-diagnosis.d.ts +0 -87
- package/dist/net-diagnosis.d.ts.map +0 -1
- package/dist/net-diagnosis.js +0 -408
- package/dist/net-diagnosis.js.map +0 -1
- package/dist/pty/raw-mode.d.ts +0 -7
- package/dist/pty/raw-mode.d.ts.map +0 -1
- package/dist/pty/raw-mode.js +0 -22
- package/dist/pty/raw-mode.js.map +0 -1
- package/dist/pty/ws-pty-client.d.ts +0 -13
- package/dist/pty/ws-pty-client.d.ts.map +0 -1
- package/dist/pty/ws-pty-client.js +0 -73
- package/dist/pty/ws-pty-client.js.map +0 -1
- package/dist/tui/dashboard.d.ts +0 -35
- package/dist/tui/dashboard.d.ts.map +0 -1
- package/dist/tui/dashboard.js +0 -191
- package/dist/tui/dashboard.js.map +0 -1
- package/dist/tui/logs.d.ts +0 -26
- package/dist/tui/logs.d.ts.map +0 -1
- package/dist/tui/logs.js +0 -276
- package/dist/tui/logs.js.map +0 -1
- package/dist/types.d.ts +0 -362
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -16
- package/dist/types.js.map +0 -1
- package/dist/ui/picker.d.ts +0 -41
- package/dist/ui/picker.d.ts.map +0 -1
- package/dist/ui/picker.js +0 -77
- package/dist/ui/picker.js.map +0 -1
- package/dist/ui/progress.d.ts +0 -10
- package/dist/ui/progress.d.ts.map +0 -1
- package/dist/ui/progress.js +0 -36
- package/dist/ui/progress.js.map +0 -1
- package/dist/ui/render.d.ts +0 -91
- package/dist/ui/render.d.ts.map +0 -1
- package/dist/ui/render.js +0 -138
- package/dist/ui/render.js.map +0 -1
- package/dist/ui/spinner.d.ts +0 -4
- package/dist/ui/spinner.d.ts.map +0 -1
- package/dist/ui/spinner.js +0 -7
- package/dist/ui/spinner.js.map +0 -1
- package/dist/ui/table.d.ts +0 -8
- package/dist/ui/table.d.ts.map +0 -1
- package/dist/ui/table.js +0 -46
- package/dist/ui/table.js.map +0 -1
- package/dist/update-check.d.ts +0 -13
- package/dist/update-check.d.ts.map +0 -1
- package/dist/update-check.js +0 -94
- package/dist/update-check.js.map +0 -1
- package/dist/version.d.ts +0 -3
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -5
- package/dist/version.js.map +0 -1
|
@@ -1,690 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { loadConfig } from "../config.js";
|
|
4
|
-
import { MiosaClient } from "../client.js";
|
|
5
|
-
import { renderTable } from "../ui/table.js";
|
|
6
|
-
import { spin } from "../ui/spinner.js";
|
|
7
|
-
import { handleError, isJsonMode, printJson } from "./util.js";
|
|
8
|
-
function productTemplates(raw) {
|
|
9
|
-
const rows = Array.isArray(raw["data"])
|
|
10
|
-
? raw["data"]
|
|
11
|
-
: Array.isArray(raw["templates"])
|
|
12
|
-
? raw["templates"]
|
|
13
|
-
: [];
|
|
14
|
-
return rows;
|
|
15
|
-
}
|
|
16
|
-
function unwrapTemplates(raw) {
|
|
17
|
-
if (Array.isArray(raw))
|
|
18
|
-
return raw;
|
|
19
|
-
return raw.data ?? raw.templates ?? [];
|
|
20
|
-
}
|
|
21
|
-
function unwrapTemplate(raw) {
|
|
22
|
-
if ("data" in raw && raw.data)
|
|
23
|
-
return raw.data;
|
|
24
|
-
if ("template" in raw && raw.template)
|
|
25
|
-
return raw.template;
|
|
26
|
-
return raw;
|
|
27
|
-
}
|
|
28
|
-
function unwrapBuilds(raw) {
|
|
29
|
-
if (Array.isArray(raw))
|
|
30
|
-
return raw;
|
|
31
|
-
return raw.data ?? raw.builds ?? [];
|
|
32
|
-
}
|
|
33
|
-
function fmtTemplateState(state) {
|
|
34
|
-
if (!state)
|
|
35
|
-
return chalk.dim("-");
|
|
36
|
-
if (state === "ready" || state === "active")
|
|
37
|
-
return chalk.green(state);
|
|
38
|
-
if (state === "building" || state === "pending")
|
|
39
|
-
return chalk.yellow(state);
|
|
40
|
-
if (state === "failed" || state === "error")
|
|
41
|
-
return chalk.red(state);
|
|
42
|
-
return chalk.dim(state);
|
|
43
|
-
}
|
|
44
|
-
function templateState(template) {
|
|
45
|
-
return template.state ?? template.status;
|
|
46
|
-
}
|
|
47
|
-
function templateImage(template) {
|
|
48
|
-
return template.image ?? template.image_id;
|
|
49
|
-
}
|
|
50
|
-
function templateCreatedAt(template) {
|
|
51
|
-
return template.created_at ?? template.inserted_at;
|
|
52
|
-
}
|
|
53
|
-
function templatePresence(template) {
|
|
54
|
-
const state = templateState(template);
|
|
55
|
-
const image = templateImage(template);
|
|
56
|
-
if (image) {
|
|
57
|
-
return { presence: "present", why: `image ${image} is recorded on the template` };
|
|
58
|
-
}
|
|
59
|
-
// A draft or failed build has no image BY DEFINITION - that is a confirmed
|
|
60
|
-
// absence, not a gap in our knowledge.
|
|
61
|
-
if (state === "draft" || state === "failed" || state === "error") {
|
|
62
|
-
return { presence: "absent", why: `template is ${state}, so no image was ever published` };
|
|
63
|
-
}
|
|
64
|
-
if (state === "building" || state === "pending" || state === "queued") {
|
|
65
|
-
return { presence: "absent", why: `build is ${state}, no image published yet` };
|
|
66
|
-
}
|
|
67
|
-
// Ready, but no image recorded. We genuinely cannot tell.
|
|
68
|
-
return {
|
|
69
|
-
presence: "unknown",
|
|
70
|
-
why: `template reports ${state ?? "no state"} but records no image - cannot confirm either way`,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function fmtPresence(p) {
|
|
74
|
-
if (p === "present")
|
|
75
|
-
return chalk.green("present");
|
|
76
|
-
if (p === "absent")
|
|
77
|
-
return chalk.yellow("absent");
|
|
78
|
-
return chalk.dim("unverified");
|
|
79
|
-
}
|
|
80
|
-
function fmtBuildState(state) {
|
|
81
|
-
if (!state)
|
|
82
|
-
return chalk.dim("-");
|
|
83
|
-
if (state === "success" || state === "complete")
|
|
84
|
-
return chalk.green(state);
|
|
85
|
-
if (state === "building" || state === "running" || state === "pending")
|
|
86
|
-
return chalk.yellow(state);
|
|
87
|
-
if (state === "failed" || state === "error")
|
|
88
|
-
return chalk.red(state);
|
|
89
|
-
return chalk.dim(state);
|
|
90
|
-
}
|
|
91
|
-
// The whole point of a template is to reference it from your own code. Print
|
|
92
|
-
// ready-to-paste create() calls for both SDKs and the CLI, using this exact
|
|
93
|
-
// template's id, so a customer never has to guess the field name or hunt for
|
|
94
|
-
// the id in a truncated table. If the template has no usable image yet, we say
|
|
95
|
-
// so instead of implying the snippet will boot today.
|
|
96
|
-
function printIntegrationSnippet(t) {
|
|
97
|
-
const ref = t.id;
|
|
98
|
-
const isReady = (templateState(t) ?? "") === "ready" && !!templateImage(t);
|
|
99
|
-
console.log(` ${chalk.bold("Use this template")}`);
|
|
100
|
-
console.log();
|
|
101
|
-
console.log(chalk.dim(" # Python SDK"));
|
|
102
|
-
console.log(" from miosa import Miosa");
|
|
103
|
-
console.log(" client = Miosa()");
|
|
104
|
-
console.log(` sandbox = client.sandboxes.create(template_id=${JSON.stringify(ref)})`);
|
|
105
|
-
console.log();
|
|
106
|
-
console.log(chalk.dim(" # TypeScript SDK"));
|
|
107
|
-
console.log(' import { Miosa } from "@miosa/sdk";');
|
|
108
|
-
console.log(" const client = new Miosa();");
|
|
109
|
-
console.log(` const sandbox = await client.sandboxes.create({ templateId: ${JSON.stringify(ref)} });`);
|
|
110
|
-
console.log();
|
|
111
|
-
console.log(chalk.dim(" # CLI"));
|
|
112
|
-
console.log(` miosa sandbox create --template ${ref}`);
|
|
113
|
-
console.log();
|
|
114
|
-
if (!isReady) {
|
|
115
|
-
console.log(chalk.yellow(" Note: this template has no usable image yet, so create() will not boot it"));
|
|
116
|
-
console.log(chalk.dim(` until its build completes. Check: miosa templates builds ${ref}`));
|
|
117
|
-
console.log();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// PUBLISHED named-size shortcuts, kept in lockstep with the sandbox size
|
|
121
|
-
// vocabulary so `templates create --size` and `sandbox create --size` accept
|
|
122
|
-
// the same names. MIOSA bills per resource consumed (vCPU-hr + GB-RAM-hr +
|
|
123
|
-
// GB-disk), never a forced tier -- an off-tier vCPU/memory pair (e.g. 4 vCPU
|
|
124
|
-
// / 4096 MiB) is a genuinely custom shape and is passed through to the
|
|
125
|
-
// server as-is (see {@link resolveTemplateResources}), not rejected or
|
|
126
|
-
// snapped to the nearest named size. Disk is always free-form.
|
|
127
|
-
const TEMPLATE_SIZE_CONTRACTS = {
|
|
128
|
-
xs: { cpu: 1, memory: 2_048, disk: 10_240 },
|
|
129
|
-
small: { cpu: 2, memory: 4_096, disk: 10_240 },
|
|
130
|
-
medium: { cpu: 4, memory: 8_192, disk: 20_480 },
|
|
131
|
-
large: { cpu: 8, memory: 16_384, disk: 40_960 },
|
|
132
|
-
xl: { cpu: 16, memory: 32_768, disk: 81_920 },
|
|
133
|
-
};
|
|
134
|
-
const TEMPLATE_SIZES = Object.keys(TEMPLATE_SIZE_CONTRACTS);
|
|
135
|
-
function parseTemplateSize(value) {
|
|
136
|
-
const size = String(value).trim().toLowerCase();
|
|
137
|
-
if (size in TEMPLATE_SIZE_CONTRACTS)
|
|
138
|
-
return size;
|
|
139
|
-
throw new Error(`Invalid --size: ${value}. Expected one of: ${TEMPLATE_SIZES.join(", ")}.`);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Resolve the resource fields for `templates create`.
|
|
143
|
-
*
|
|
144
|
-
* MIOSA bills per resource consumed, not per named tier: any cpu/memory/disk
|
|
145
|
-
* triple is valid. A raw --cpu/--memory pair is passed through to the create
|
|
146
|
-
* request UNCHANGED, whether or not it happens to match a published named
|
|
147
|
-
* size -- it is never rejected, snapped to the nearest tier, or forced into
|
|
148
|
-
* a size. `size` is only ever sent when a pinned pair happens to exactly
|
|
149
|
-
* match one (a convenience label, not a requirement), or when the caller
|
|
150
|
-
* asked for it directly via --size.
|
|
151
|
-
*
|
|
152
|
-
* - No --cpu/--memory: forward only what was given (size and/or disk); the
|
|
153
|
-
* server picks its own default shape. Never pin a pair from the CLI.
|
|
154
|
-
* - With --cpu and/or --memory: fill the missing member from --size (or
|
|
155
|
-
* small), then forward the resulting pair as-is. If it happens to match a
|
|
156
|
-
* published size, that size is also sent. The one guard kept is a
|
|
157
|
-
* genuine caller contradiction: an explicit --size that disagrees with an
|
|
158
|
-
* explicit --cpu/--memory pair still fails fast, since the caller named
|
|
159
|
-
* two different shapes.
|
|
160
|
-
*/
|
|
161
|
-
function resolveTemplateResources(opts) {
|
|
162
|
-
const pinned = opts.cpu != null || opts.memory != null;
|
|
163
|
-
if (!pinned) {
|
|
164
|
-
return {
|
|
165
|
-
...(opts.size ? { size: opts.size } : {}),
|
|
166
|
-
...(opts.disk != null ? { disk: opts.disk } : {}),
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
const base = TEMPLATE_SIZE_CONTRACTS[opts.size ?? "small"];
|
|
170
|
-
const cpu = opts.cpu ?? base.cpu;
|
|
171
|
-
const memory = opts.memory ?? base.memory;
|
|
172
|
-
const match = TEMPLATE_SIZES.find((size) => TEMPLATE_SIZE_CONTRACTS[size].cpu === cpu &&
|
|
173
|
-
TEMPLATE_SIZE_CONTRACTS[size].memory === memory);
|
|
174
|
-
if (opts.size && opts.size !== match) {
|
|
175
|
-
throw new Error(`--cpu/--memory ${cpu}/${memory} match ${match ?? "no published size"}, ` +
|
|
176
|
-
`not --size ${opts.size}.`);
|
|
177
|
-
}
|
|
178
|
-
return {
|
|
179
|
-
cpu,
|
|
180
|
-
memory,
|
|
181
|
-
...(match ? { size: match } : {}),
|
|
182
|
-
...(opts.disk != null ? { disk: opts.disk } : {}),
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
function parseCpuCount(value) {
|
|
186
|
-
const n = Number.parseInt(String(value).trim(), 10);
|
|
187
|
-
if (!Number.isInteger(n) || n <= 0) {
|
|
188
|
-
throw new Error(`Invalid --cpu: ${value}. Expected a positive integer.`);
|
|
189
|
-
}
|
|
190
|
-
return n;
|
|
191
|
-
}
|
|
192
|
-
// Parse a memory/disk size to an integer number of MiB. Accepts a bare number
|
|
193
|
-
// (already MiB), or a value suffixed with a unit: mb/m/mib are treated as MiB,
|
|
194
|
-
// gb/g/gib as GiB (1 GiB = 1024 MiB). Examples: "4gb", "4096", "4096mib".
|
|
195
|
-
function parseToMib(value, flag) {
|
|
196
|
-
const match = String(value)
|
|
197
|
-
.trim()
|
|
198
|
-
.match(/^(\d+)\s*(mib|gib|mb|gb|m|g)?$/i);
|
|
199
|
-
if (!match) {
|
|
200
|
-
throw new Error(`Invalid ${flag} value: ${value}. Use e.g. 4gb, 4096, or 4096mib.`);
|
|
201
|
-
}
|
|
202
|
-
const amount = Number(match[1]);
|
|
203
|
-
const unit = (match[2] ?? "mib").toLowerCase();
|
|
204
|
-
if (unit === "gb" || unit === "g" || unit === "gib")
|
|
205
|
-
return amount * 1024;
|
|
206
|
-
return amount; // mb / m / mib → MiB
|
|
207
|
-
}
|
|
208
|
-
export function register(program) {
|
|
209
|
-
const templates = program
|
|
210
|
-
.command("templates")
|
|
211
|
-
.description("Manage sandbox templates");
|
|
212
|
-
templates
|
|
213
|
-
.command("catalog")
|
|
214
|
-
.description("List canonical product templates, image generations, shapes, and readiness")
|
|
215
|
-
.option("--product <product>", "Filter by product, for example sandbox")
|
|
216
|
-
.option("--json", "Output the complete catalog as JSON")
|
|
217
|
-
.action(async (opts) => {
|
|
218
|
-
try {
|
|
219
|
-
const config = loadConfig();
|
|
220
|
-
const client = new MiosaClient(config);
|
|
221
|
-
const raw = await client.apiGet("/api/v1/templates");
|
|
222
|
-
const rows = productTemplates(raw);
|
|
223
|
-
const filtered = opts.product
|
|
224
|
-
? rows.filter((template) => template.product === opts.product)
|
|
225
|
-
: rows;
|
|
226
|
-
if (isJsonMode(opts)) {
|
|
227
|
-
printJson(opts.product ? { ...raw, templates: filtered } : raw);
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
renderTable(filtered, [
|
|
231
|
-
{ header: "ID", key: "id", width: 28 },
|
|
232
|
-
{ header: "PRODUCT", key: "product", width: 18 },
|
|
233
|
-
{ header: "DEFAULT", key: (t) => t.default_size ?? "-", width: 10 },
|
|
234
|
-
{
|
|
235
|
-
header: "IMAGE GENERATION",
|
|
236
|
-
key: (t) => t.image_id ?? "-",
|
|
237
|
-
width: 32,
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
header: "READINESS",
|
|
241
|
-
key: (t) => t.readiness ?? "missing",
|
|
242
|
-
width: 18,
|
|
243
|
-
},
|
|
244
|
-
]);
|
|
245
|
-
}
|
|
246
|
-
catch (err) {
|
|
247
|
-
handleError(err);
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
templates
|
|
251
|
-
.command("readiness <id>")
|
|
252
|
-
.description("Show fleet readiness and exact resource contracts for a product template")
|
|
253
|
-
.option("--product <product>", "Filter by product, for example sandbox")
|
|
254
|
-
.option("--json", "Output raw readiness rows")
|
|
255
|
-
.action(async (id, opts) => {
|
|
256
|
-
try {
|
|
257
|
-
const config = loadConfig();
|
|
258
|
-
const client = new MiosaClient(config);
|
|
259
|
-
const raw = await client.apiGet("/api/v1/templates");
|
|
260
|
-
const rows = productTemplates(raw);
|
|
261
|
-
const template = rows.find((candidate) => candidate.id === id && (!opts.product || candidate.product === opts.product));
|
|
262
|
-
if (!template)
|
|
263
|
-
throw new Error(`Product template not found: ${id}`);
|
|
264
|
-
const readiness = template.sizes ?? [];
|
|
265
|
-
if (isJsonMode(opts)) {
|
|
266
|
-
printJson(readiness);
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
renderTable(readiness, [
|
|
270
|
-
{ header: "SIZE", key: "size", width: 10 },
|
|
271
|
-
{ header: "STATE", key: (row) => row.state ?? "missing", width: 18 },
|
|
272
|
-
{
|
|
273
|
-
header: "VCPU",
|
|
274
|
-
key: (row) => String(row.resource_contract?.vcpus ?? "-"),
|
|
275
|
-
width: 8,
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
header: "MEMORY MIB",
|
|
279
|
-
key: (row) => String(row.resource_contract?.memory_mb ?? "-"),
|
|
280
|
-
width: 12,
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
header: "DISK MIB",
|
|
284
|
-
key: (row) => String(row.resource_contract?.disk_size_mb ?? "-"),
|
|
285
|
-
width: 12,
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
header: "CONTRACT",
|
|
289
|
-
key: (row) => row.resource_contract?.contract_id ?? "-",
|
|
290
|
-
width: 26,
|
|
291
|
-
},
|
|
292
|
-
]);
|
|
293
|
-
}
|
|
294
|
-
catch (err) {
|
|
295
|
-
handleError(err);
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
// list
|
|
299
|
-
templates
|
|
300
|
-
.command("list")
|
|
301
|
-
.description("List sandbox templates, distinguishing confirmed-absent from cannot-verify")
|
|
302
|
-
.option("--json", "Output raw JSON")
|
|
303
|
-
.action(async (opts) => {
|
|
304
|
-
const config = loadConfig();
|
|
305
|
-
const client = new MiosaClient(config);
|
|
306
|
-
const json = isJsonMode(opts);
|
|
307
|
-
const spinner = json ? null : spin("Fetching templates...");
|
|
308
|
-
const checkedAt = new Date().toISOString();
|
|
309
|
-
let rows;
|
|
310
|
-
try {
|
|
311
|
-
rows = unwrapTemplates(await client.apiGet("/api/v1/sandbox-templates"));
|
|
312
|
-
}
|
|
313
|
-
catch (err) {
|
|
314
|
-
// The listing could NOT be verified. This is emphatically not "no
|
|
315
|
-
// templates" - reporting an empty list here would tell a customer their
|
|
316
|
-
// templates are gone when we simply failed to ask.
|
|
317
|
-
spinner?.stop();
|
|
318
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
319
|
-
if (json) {
|
|
320
|
-
printJson({
|
|
321
|
-
listing: {
|
|
322
|
-
state: "unverified",
|
|
323
|
-
source: "live",
|
|
324
|
-
checkedAt,
|
|
325
|
-
reason,
|
|
326
|
-
},
|
|
327
|
-
templates: null,
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
console.log();
|
|
332
|
-
console.log(` ${chalk.yellow("Cannot verify")} - the template list could not be retrieved.`);
|
|
333
|
-
console.log(` ${chalk.dim(reason)}`);
|
|
334
|
-
console.log(` ${chalk.dim("This is NOT the same as having no templates. Run: miosa doctor")}`);
|
|
335
|
-
}
|
|
336
|
-
// Non-zero: a script must be able to tell an unverified listing from an
|
|
337
|
-
// empty one.
|
|
338
|
-
process.exitCode = 1;
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
spinner?.stop();
|
|
342
|
-
try {
|
|
343
|
-
if (json) {
|
|
344
|
-
printJson({
|
|
345
|
-
// Never presented as current without saying when it was checked,
|
|
346
|
-
// and never cached: this is a live read every time.
|
|
347
|
-
listing: {
|
|
348
|
-
state: "confirmed",
|
|
349
|
-
source: "live",
|
|
350
|
-
checkedAt,
|
|
351
|
-
count: rows.length,
|
|
352
|
-
},
|
|
353
|
-
templates: rows.map((t) => {
|
|
354
|
-
const { presence, why } = templatePresence(t);
|
|
355
|
-
return { ...t, presence, presenceReason: why };
|
|
356
|
-
}),
|
|
357
|
-
});
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
if (rows.length === 0) {
|
|
361
|
-
console.log(chalk.dim(`No templates. Confirmed empty by a live read at ${checkedAt}.`));
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
renderTable(rows, [
|
|
365
|
-
{ header: "ID", key: (t) => t.id.slice(0, 12), width: 14 },
|
|
366
|
-
{ header: "NAME", key: "name", width: 28 },
|
|
367
|
-
{
|
|
368
|
-
header: "STATE",
|
|
369
|
-
key: (t) => fmtTemplateState(templateState(t)),
|
|
370
|
-
width: 12,
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
header: "IMAGE",
|
|
374
|
-
key: (t) => fmtPresence(templatePresence(t).presence),
|
|
375
|
-
width: 12,
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
header: "IMAGE ID",
|
|
379
|
-
key: (t) => {
|
|
380
|
-
const image = templateImage(t);
|
|
381
|
-
return image
|
|
382
|
-
? image.length > 26
|
|
383
|
-
? `${image.slice(0, 23)}...`
|
|
384
|
-
: image
|
|
385
|
-
: chalk.dim("-");
|
|
386
|
-
},
|
|
387
|
-
width: 28,
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
header: "CREATED",
|
|
391
|
-
key: (t) => {
|
|
392
|
-
const createdAt = templateCreatedAt(t);
|
|
393
|
-
return createdAt ? createdAt.slice(0, 10) : chalk.dim("-");
|
|
394
|
-
},
|
|
395
|
-
width: 12,
|
|
396
|
-
},
|
|
397
|
-
]);
|
|
398
|
-
const unverified = rows.filter((t) => templatePresence(t).presence === "unknown");
|
|
399
|
-
if (unverified.length > 0) {
|
|
400
|
-
console.log();
|
|
401
|
-
console.log(chalk.dim(` ${unverified.length} template(s) report no image and could not be confirmed either way.`));
|
|
402
|
-
}
|
|
403
|
-
// The ID column is truncated to keep the table readable. Point users at
|
|
404
|
-
// the one command that prints the FULL, copyable id plus paste-ready
|
|
405
|
-
// SDK/CLI code for wiring the template into their own app.
|
|
406
|
-
console.log();
|
|
407
|
-
console.log(chalk.dim(` Run "miosa templates get <id>" for the full id and copy-paste integration code.`));
|
|
408
|
-
}
|
|
409
|
-
catch (err) {
|
|
410
|
-
handleError(err);
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
// versions
|
|
414
|
-
templates
|
|
415
|
-
.command("versions <id>")
|
|
416
|
-
.description("List a template's versions (a version is a build; specs are immutable)")
|
|
417
|
-
.option("--json", "Output raw JSON")
|
|
418
|
-
.action(async (id, opts) => {
|
|
419
|
-
try {
|
|
420
|
-
const config = loadConfig();
|
|
421
|
-
const client = new MiosaClient(config);
|
|
422
|
-
const json = isJsonMode(opts);
|
|
423
|
-
const spinner = json ? null : spin("Fetching versions...");
|
|
424
|
-
const raw = (await client.apiGet(`/api/v1/sandbox-templates/${encodeURIComponent(id)}/versions`));
|
|
425
|
-
spinner?.stop();
|
|
426
|
-
const rows = Array.isArray(raw) ? raw : (raw.data ?? []);
|
|
427
|
-
if (json) {
|
|
428
|
-
printJson(rows);
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
if (rows.length === 0) {
|
|
432
|
-
console.log(chalk.dim("No versions yet."));
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
renderTable(rows, [
|
|
436
|
-
{
|
|
437
|
-
header: "VERSION",
|
|
438
|
-
key: (v) => (v.current ? chalk.bold(`v${v.version} *`) : `v${v.version}`),
|
|
439
|
-
width: 10,
|
|
440
|
-
},
|
|
441
|
-
{ header: "REF", key: (v) => v.ref ?? chalk.dim("-"), width: 26 },
|
|
442
|
-
{
|
|
443
|
-
header: "STATE",
|
|
444
|
-
key: (v) => fmtBuildState(v.state),
|
|
445
|
-
width: 12,
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
// Whether this version can actually be run or migrated to. A failed
|
|
449
|
-
// build is listed - you need to see it to understand why the next
|
|
450
|
-
// version is unavailable - but it is not usable.
|
|
451
|
-
header: "USABLE",
|
|
452
|
-
key: (v) => (v.usable ? chalk.green("yes") : chalk.dim("no")),
|
|
453
|
-
width: 8,
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
header: "IMAGE",
|
|
457
|
-
key: (v) => v.image_id ?? chalk.dim("-"),
|
|
458
|
-
width: 26,
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
header: "CREATED",
|
|
462
|
-
key: (v) => (v.created_at ? String(v.created_at).slice(0, 10) : chalk.dim("-")),
|
|
463
|
-
width: 12,
|
|
464
|
-
},
|
|
465
|
-
]);
|
|
466
|
-
console.log();
|
|
467
|
-
console.log(chalk.dim(" * = current. Specs are immutable: editing a template mints a new version,"));
|
|
468
|
-
console.log(chalk.dim(" and existing sandboxes keep running the version they were created from."));
|
|
469
|
-
}
|
|
470
|
-
catch (err) {
|
|
471
|
-
handleError(err);
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
// get
|
|
475
|
-
templates
|
|
476
|
-
.command("get <id>")
|
|
477
|
-
.description("Get sandbox template details")
|
|
478
|
-
.option("--json", "Output raw JSON")
|
|
479
|
-
.action(async (id, opts) => {
|
|
480
|
-
try {
|
|
481
|
-
const config = loadConfig();
|
|
482
|
-
const client = new MiosaClient(config);
|
|
483
|
-
const json = isJsonMode(opts);
|
|
484
|
-
const spinner = json ? null : spin("Fetching template...");
|
|
485
|
-
const tmpl = unwrapTemplate(await client.apiGet(`/api/v1/sandbox-templates/${encodeURIComponent(id)}`));
|
|
486
|
-
spinner?.stop();
|
|
487
|
-
if (json) {
|
|
488
|
-
printJson(tmpl);
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
console.log();
|
|
492
|
-
console.log(` ${chalk.bold("ID")} ${tmpl.id}`);
|
|
493
|
-
console.log(` ${chalk.bold("Name")} ${tmpl.name}`);
|
|
494
|
-
if (tmpl.slug)
|
|
495
|
-
console.log(` ${chalk.bold("Slug")} ${tmpl.slug}`);
|
|
496
|
-
console.log(` ${chalk.bold("State")} ${fmtTemplateState(templateState(tmpl))}`);
|
|
497
|
-
const image = templateImage(tmpl);
|
|
498
|
-
if (image)
|
|
499
|
-
console.log(` ${chalk.bold("Image")} ${image}`);
|
|
500
|
-
const createdAt = templateCreatedAt(tmpl);
|
|
501
|
-
if (createdAt)
|
|
502
|
-
console.log(` ${chalk.bold("Created")} ${createdAt}`);
|
|
503
|
-
if (tmpl.updated_at)
|
|
504
|
-
console.log(` ${chalk.bold("Updated")} ${tmpl.updated_at}`);
|
|
505
|
-
console.log();
|
|
506
|
-
printIntegrationSnippet(tmpl);
|
|
507
|
-
console.log(chalk.dim(` Run "miosa templates builds ${tmpl.id}" to view build history.`));
|
|
508
|
-
console.log();
|
|
509
|
-
}
|
|
510
|
-
catch (err) {
|
|
511
|
-
handleError(err);
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
// create
|
|
515
|
-
templates
|
|
516
|
-
.command("create")
|
|
517
|
-
.description("Create a sandbox template from a Dockerfile")
|
|
518
|
-
.requiredOption("--name <name>", "Template name")
|
|
519
|
-
.requiredOption("--dockerfile <path>", "Path to Dockerfile to build the template from")
|
|
520
|
-
.option("--cpu <n>", "vCPU count for the template's default shape", parseCpuCount)
|
|
521
|
-
.option("--memory <val>", "Memory for the default shape, e.g. 4gb, 4096, or 4096mib", (v) => parseToMib(v, "--memory"))
|
|
522
|
-
.option("--disk <val>", "Disk floor for the default shape, e.g. 30gb or 30720", (v) => parseToMib(v, "--disk"))
|
|
523
|
-
.option("--size <name>", `Named default shape: ${TEMPLATE_SIZES.join(", ")}`, parseTemplateSize)
|
|
524
|
-
.option("--json", "Output raw JSON")
|
|
525
|
-
.action(async (opts) => {
|
|
526
|
-
// Resolve JSON mode once. In JSON mode NOTHING but the single JSON
|
|
527
|
-
// payload may reach stdout - no spinner, no status lines, no hints.
|
|
528
|
-
const json = isJsonMode(opts);
|
|
529
|
-
try {
|
|
530
|
-
// Resolve resource flags. A pinned --cpu/--memory pair is passed
|
|
531
|
-
// through as-is (any triple is a valid billable shape); the only
|
|
532
|
-
// local check kept is a genuine contradiction between an explicit
|
|
533
|
-
// --size and an explicit --cpu/--memory pair.
|
|
534
|
-
const resources = resolveTemplateResources(opts);
|
|
535
|
-
let dockerfileContent;
|
|
536
|
-
try {
|
|
537
|
-
dockerfileContent = readFileSync(opts.dockerfile, "utf8");
|
|
538
|
-
}
|
|
539
|
-
catch (err) {
|
|
540
|
-
const message = `Cannot read Dockerfile at ${opts.dockerfile}: ${err instanceof Error ? err.message : String(err)}`;
|
|
541
|
-
if (json) {
|
|
542
|
-
printJson({
|
|
543
|
-
ok: false,
|
|
544
|
-
error: { code: "DOCKERFILE_UNREADABLE", message },
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
else {
|
|
548
|
-
console.error(chalk.red(message));
|
|
549
|
-
}
|
|
550
|
-
process.exit(1);
|
|
551
|
-
}
|
|
552
|
-
const config = loadConfig();
|
|
553
|
-
const client = new MiosaClient(config);
|
|
554
|
-
// Only forward resource fields the user actually set. When none are
|
|
555
|
-
// given they are omitted so the server picks its own default. The
|
|
556
|
-
// server bills for exact resources consumed, so cpu/memory/disk are
|
|
557
|
-
// sent as-is even off a published tier; `size` is only present when
|
|
558
|
-
// the pair happens to resolve to one, or the caller asked for it.
|
|
559
|
-
const body = {
|
|
560
|
-
name: opts.name,
|
|
561
|
-
dockerfile: dockerfileContent,
|
|
562
|
-
};
|
|
563
|
-
if (resources.cpu != null)
|
|
564
|
-
body["cpu_count"] = resources.cpu;
|
|
565
|
-
if (resources.memory != null)
|
|
566
|
-
body["memory_mb"] = resources.memory;
|
|
567
|
-
if (resources.disk != null)
|
|
568
|
-
body["disk_size_mb"] = resources.disk;
|
|
569
|
-
if (resources.size)
|
|
570
|
-
body["size"] = resources.size;
|
|
571
|
-
const spinner = json ? null : spin(`Creating template ${opts.name}...`);
|
|
572
|
-
let tmpl;
|
|
573
|
-
try {
|
|
574
|
-
tmpl = unwrapTemplate(await client.apiPost("/api/v1/sandbox-templates", body));
|
|
575
|
-
}
|
|
576
|
-
catch (err) {
|
|
577
|
-
spinner?.stop();
|
|
578
|
-
throw err;
|
|
579
|
-
}
|
|
580
|
-
spinner?.succeed(`Created template ${tmpl.name}`);
|
|
581
|
-
if (json) {
|
|
582
|
-
printJson(tmpl);
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
console.log();
|
|
586
|
-
console.log(` ${chalk.bold("ID")} ${tmpl.id}`);
|
|
587
|
-
console.log(` ${chalk.bold("Name")} ${tmpl.name}`);
|
|
588
|
-
console.log(` ${chalk.bold("State")} ${fmtTemplateState(tmpl.state)}`);
|
|
589
|
-
console.log();
|
|
590
|
-
console.log(chalk.dim(` Run "miosa templates builds ${tmpl.id}" to track the build.`));
|
|
591
|
-
console.log();
|
|
592
|
-
}
|
|
593
|
-
catch (err) {
|
|
594
|
-
handleError(err, { json });
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
// builds
|
|
598
|
-
templates
|
|
599
|
-
.command("builds <id>")
|
|
600
|
-
.description("List builds for a sandbox template")
|
|
601
|
-
.option("--json", "Output raw JSON")
|
|
602
|
-
.action(async (id, opts) => {
|
|
603
|
-
try {
|
|
604
|
-
const config = loadConfig();
|
|
605
|
-
const client = new MiosaClient(config);
|
|
606
|
-
const json = isJsonMode(opts);
|
|
607
|
-
const spinner = json ? null : spin("Fetching builds...");
|
|
608
|
-
const rows = unwrapBuilds(await client.apiGet(`/api/v1/sandbox-templates/${encodeURIComponent(id)}/builds`));
|
|
609
|
-
spinner?.stop();
|
|
610
|
-
if (json) {
|
|
611
|
-
printJson(rows);
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
|
-
if (rows.length === 0) {
|
|
615
|
-
console.log(chalk.dim("No builds found."));
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
renderTable(rows, [
|
|
619
|
-
{ header: "BUILD ID", key: (b) => b.id.slice(0, 12), width: 14 },
|
|
620
|
-
{
|
|
621
|
-
header: "STATE",
|
|
622
|
-
key: (b) => fmtBuildState(b.state),
|
|
623
|
-
width: 12,
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
header: "STARTED",
|
|
627
|
-
key: (b) => b.started_at
|
|
628
|
-
? b.started_at.slice(0, 19).replace("T", " ")
|
|
629
|
-
: chalk.dim("-"),
|
|
630
|
-
width: 20,
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
header: "FINISHED",
|
|
634
|
-
key: (b) => b.finished_at
|
|
635
|
-
? b.finished_at.slice(0, 19).replace("T", " ")
|
|
636
|
-
: chalk.dim("-"),
|
|
637
|
-
width: 20,
|
|
638
|
-
},
|
|
639
|
-
{
|
|
640
|
-
header: "ERROR",
|
|
641
|
-
key: (b) => b.error
|
|
642
|
-
? chalk.red(b.error.length > 30
|
|
643
|
-
? `${b.error.slice(0, 27)}...`
|
|
644
|
-
: b.error)
|
|
645
|
-
: chalk.dim("-"),
|
|
646
|
-
width: 32,
|
|
647
|
-
},
|
|
648
|
-
]);
|
|
649
|
-
}
|
|
650
|
-
catch (err) {
|
|
651
|
-
handleError(err);
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
// delete
|
|
655
|
-
templates
|
|
656
|
-
.command("delete <id>")
|
|
657
|
-
.description("Delete a sandbox template")
|
|
658
|
-
.option("-f, --force", "Skip confirmation prompt")
|
|
659
|
-
.option("--json", "Output raw JSON")
|
|
660
|
-
.action(async (id, opts) => {
|
|
661
|
-
try {
|
|
662
|
-
if (!opts.force) {
|
|
663
|
-
const { default: inquirer } = await import("inquirer");
|
|
664
|
-
const { ok } = await inquirer.prompt([
|
|
665
|
-
{
|
|
666
|
-
type: "confirm",
|
|
667
|
-
name: "ok",
|
|
668
|
-
message: chalk.red(`Delete template ${id}? This will remove the template and its build history.`),
|
|
669
|
-
default: false,
|
|
670
|
-
},
|
|
671
|
-
]);
|
|
672
|
-
if (!ok) {
|
|
673
|
-
console.log(chalk.dim(" Cancelled."));
|
|
674
|
-
process.exit(0);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
const config = loadConfig();
|
|
678
|
-
const client = new MiosaClient(config);
|
|
679
|
-
const spinner = spin("Deleting template...");
|
|
680
|
-
const result = await client.apiDelete(`/api/v1/sandbox-templates/${encodeURIComponent(id)}`);
|
|
681
|
-
spinner.succeed("Template deleted");
|
|
682
|
-
if (opts.json)
|
|
683
|
-
console.log(JSON.stringify(result ?? { ok: true }, null, 2));
|
|
684
|
-
}
|
|
685
|
-
catch (err) {
|
|
686
|
-
handleError(err);
|
|
687
|
-
}
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
//# sourceMappingURL=templates.js.map
|