Look after projects
List your projects and their states with ls, open an app, and read its logs, live or from the past.
Three commands help you keep an eye on what you have put online: ls lists projects, open takes you to one, and logs shows what an app has been saying. Think of a caretaker's walk-round. First the list of flats, then the key to one door, then a look at its notice board.
Versions and rollbacks are on versions and rollback. Backups are on backup and restore.
ls
cohostly ls cohostly list
ls and list are the same. There are no flags and no --json. It asks the platform for your projects and prints one line each.
$ cohostly ls PROJECTS: - hello LIVE (v2, private, you are admin, https://hello-4k2xq.cohostly.cloud) - shop CRASHED [1 approval waiting] (v7, public, you are admin, https://shop-9m3tz.cohostly.cloud) The tool stopped running. It ran out of memory. Next: Restart
Each line is - <name> <STATE>[ [badges]] (v<version or none>, <visibility>, you are <role>, <address>). A project in any state other than Live or Asleep gets two more lines: the reason, and Next: with what to do.
The states
The state prints in capital letters.
LIVEASLEEPNOT DEPLOYED YETUPLOADING, BUILDING, STARTINGWAKINGAWAITING APPROVALBUILD FAILED, FIRST DEPLOY FAILEDCode: line.CRASHED, DEGRADEDBUSYOVER LIMIT, SUSPENDEDNext: line says what to do.PAUSED BY YOUDELETINGThere is no stopped state. The closest are ASLEEP and PAUSED BY YOU.
Which projects you see
The CLI's key belongs to one account, so ls lists that account's projects only. Each shows you are admin, because a CLI key acts as an admin on every project in its account. Projects another account shared with you by invitation do not appear. See sign in and keys.
If your platform also answers a local address for "active instances", ls adds an ACTIVE INSTANCES: block. On the hosted platform you will not see it.
Failures: Failed to list projects: <status text> and Failed to connect to API: <message>. Exit 1.
open
cohostly open [project] [--print] cohostly open --project <name>
[project]text--project <name>text--printon or offIt prints the address first, then opens it in your browser. If PLATFORM_NO_BROWSER is set to any value, it never opens a browser. Any role, viewer or higher, may run it.
There is no project called "<x>" that you can see. Run "platform ls" to list yours.Could not look up <x>: <status text><x> has no live version yet. Run "platform deploy" first.1.logs
cohostly logs <project> [-f | --follow] [--version <N>] [--since <id>] [--lines <N> | -n <N>] [--json]
The project is positional (cohostly logs hello), or --project <name>.
-f, --followon or off--version <N>number--since <id>number--lines <N>, -n <N>number-f.--jsonon or offThe help list shows only -f, --version, --lines and --json. --since and -n work too.
Who may run it: an editor or higher. Logs can hold visitors' data, so a viewer gets a permission error and a stranger gets "not found".
What a line looks like
$ cohostly logs hello -f 12:34:56.789 listening on 8080 12:35:02.114 GET / 12:35:09.870 ! [r_8f21c3] TypeError: Cannot read properties of undefined (reading 'id')
A time, then a marker, then an optional request id in brackets, then the text. The marker is two spaces for normal output, ! for error output and # for a note from the platform.
Following
-f listens for new lines. A new line appears within about a second. The platform ends a follow after 60 minutes, and the CLI then exits quietly with 0. Run it again to keep following.
When there is nothing
With no lines, the CLI asks the platform why and prints (no log lines yet) <reason>, followed by the app's last output with a | in front of each line. If that also fails: (no log lines yet) If the app should be running, open it once; logs appear a second after it writes them.
Logs are kept for a limited time, 7 days by default on the hosted platform.
Failures
Error: --version needs a version number, for example --version 3--lines needs a number from 1 to 1000I do not know "<x>". Use: ...project name required (platform logs <project> -f)Could not read logs: <error>1.Files read and written
None in your folder. All three commands use the saved key (or PLATFORM_API_KEY) and API_URL.
Exit codes
0 on success, 1 on any failure.
Examples
See everything, then open the app that is not live:
cohostly ls cohostly open shop --print
The last 100 lines of version 3, as JSON for a script:
cohostly logs shop --version 3 -n 100 --json
Follow, and pick up where you left off after a pause:
cohostly logs shop -f cohostly logs shop --since 4182