@lazco/cli 0.0.0-stage → 0.1.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/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +146 -2
- package/dist/cli.js +5932 -0
- package/package.json +62 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All releases of `@lazco/cli` are in this file.
|
|
4
|
+
The newest release is at the top.
|
|
5
|
+
|
|
6
|
+
## [0.1.0]
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- The `lazco` command, with every Lazco Cloud API operation as a command, read from the API's machine spec at run time.
|
|
11
|
+
- JSON on stdout, one error shape on stderr with fixed `CLI_` codes, and exit codes 0 and 1.
|
|
12
|
+
- `--describe`, `--dry-run`, `--fields`, `--page-all`, `--json`, `--yes`, `--wait`, `--timeout`, `--human`, `--profile` and `--api-url`.
|
|
13
|
+
- An `Idempotency-Key` on every request whose operation declares one, kept the same on every retry, so a retry after a lost answer never charges twice.
|
|
14
|
+
Where the spec requires the header, `--idempotency-key <key>` chooses it, and a run with a generated key and no final answer names the key on stderr.
|
|
15
|
+
- A command that spends asks the API for a quote first, shows it on stderr, asks or needs `--yes`, and spends exactly the quoted amount from the account balance.
|
|
16
|
+
`--dry-run` asks for the quote only, `--quote-id` with `--expected-amount` spends with a quote you already have, and a refused quote is never replaced by a new one.
|
|
17
|
+
- `lazco auth login` with your Lazco account in a browser (`--sso`), on this machine or with a code on another device (`--device`), or with an API token (`--with-token`), kept in the OS keychain, or in the config file with mode 0600 when there is no keychain.
|
|
18
|
+
- `lazco auth status`, and `lazco auth logout`, which revokes an SSO sign-in.
|
|
19
|
+
- An SSO sign-in refreshes its access token by itself, and two processes of one profile share one refresh.
|
|
20
|
+
- `lazco profile list` and `profile use`.
|
|
21
|
+
- `lazco labs pages deployments create <site> <directory>` and the MCP tool `labs_pages_create_deployment` publish a local directory to a Lazco Pages site, upload only the changed files, and wait until the site is live.
|
|
22
|
+
- `lazco mcp`, a local MCP server over stdio, and `lazco mcp install` for eight MCP clients.
|
|
23
|
+
- `lazco mcp --allow-writes --allow-spend` adds the tools that spend from the account balance, each with its quote tool, and asks the user through MCP elicitation when the client supports it.
|
|
24
|
+
- Binaries for macOS, Linux and Windows on the GitHub release, and `scripts/install.sh`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lazco Corporation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,147 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Lazco CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`lazco` is the command line and the local MCP server of [Lazco Cloud](https://lazco.tw).
|
|
4
|
+
Its commands come from the API itself, so every API operation is a command as soon as the API ships it.
|
|
5
|
+
Output is JSON by default, so scripts and agents can read it.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
With Node.js 22 or later, run it without installing:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npx -y @lazco/cli --version
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or install it globally:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install -g @lazco/cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or install the binary, which needs no Node.js, on macOS or Linux:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
curl -fsSL https://raw.githubusercontent.com/Lazco-Corporation/cloud-cli/main/scripts/install.sh | bash -s -- install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The installer puts `lazco` in `~/.local/bin`, or in `$LAZCO_INSTALL_DIR`, and checks the archive against `SHA256SUMS`.
|
|
28
|
+
Run it with `update` or `uninstall` later.
|
|
29
|
+
Each [release](https://github.com/Lazco-Corporation/cloud-cli/releases) also has the archives for darwin-arm64, darwin-x64, linux-x64, linux-arm64 and windows-x64.
|
|
30
|
+
|
|
31
|
+
## Sign in
|
|
32
|
+
|
|
33
|
+
Sign in with your Lazco account:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
lazco auth login --sso
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Your browser opens the Lazco Cloud sign-in. Pick the organization and the access, read only or read and write, and return to the terminal.
|
|
40
|
+
Over SSH, on Linux without a display, or with `--device`, `lazco` prints a URL and a code instead. Open the URL on any device and enter the code there, and only there.
|
|
41
|
+
|
|
42
|
+
| Option | Does |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `--device` | Prints a URL and a code to sign in on another device, with no browser on this machine |
|
|
45
|
+
| `--org <organization id>` | Preselects that organization |
|
|
46
|
+
| `--read-only` | Asks for read-only access |
|
|
47
|
+
| `--switch` | Picks the organization again, and signs out the previous sign-in of the profile. When that sign-out fails, stderr says so, and the old sign-in stays in the list until you end it there |
|
|
48
|
+
|
|
49
|
+
The sign-in renews itself while you use it, and ends after 30 days without use.
|
|
50
|
+
You can see and end it in the signed-in products of the Cloud panel's settings.
|
|
51
|
+
|
|
52
|
+
Or sign in with an API token, which you create on the API page of the Lazco Cloud panel.
|
|
53
|
+
Without a flag, `lazco auth login` asks on a terminal which way to sign in, and asks for the token without showing it.
|
|
54
|
+
In a script, pipe the token in:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
printf '%s' "$TOKEN" | lazco auth login --with-token
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Login checks the credential and stores it in the system keychain.
|
|
61
|
+
It prints the profile, the method, the API URL, the organization, the access and where the credential is stored:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{"profile":"default","method":"sso","apiUrl":"https://api.lazco.tw/v1","organization":{"id":"<uuid>","name":"<name>"},"scope":"read_write","store":"keychain","current":true}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
When there is no keychain, the credential goes into the config file with mode 0600, `store` is `file`, and `path` names the file.
|
|
68
|
+
|
|
69
|
+
| Command | Prints |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `lazco auth status` | `profile`, `method`, `apiUrl`, `store`, `organization`, `role`, `scope` and `expiresAt` |
|
|
72
|
+
| `lazco auth logout` | `{"profile":"<name>","loggedOut":true}`. It ends an SSO sign-in. When it cannot reach the API, it still forgets the profile, but exits with `CLI_NETWORK`, and the sign-in stays in the list until you end it there or it is unused for 30 days. An API token stays valid until you revoke it in the panel, and stderr names the page |
|
|
73
|
+
| `lazco profile list` | One line per profile, never its credential |
|
|
74
|
+
| `lazco profile use <name>` | Makes a profile the current one |
|
|
75
|
+
|
|
76
|
+
`--profile <name>` signs in or uses another profile, for example one organization each.
|
|
77
|
+
A profile name is 1 to 64 letters, digits, `.`, `_` or `-`, and starts with a letter or a digit.
|
|
78
|
+
Without `--profile`, the profile is `default`.
|
|
79
|
+
`LAZCO_TOKEN` overrides every profile, and `LAZCO_PROFILE` picks one.
|
|
80
|
+
|
|
81
|
+
## Use it
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
lazco compute list
|
|
85
|
+
lazco compute get <server-id>
|
|
86
|
+
lazco --describe compute create # the command and its input as JSON Schema
|
|
87
|
+
lazco compute create --json - < server.json --dry-run
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`lazco --help` lists the command groups, and `lazco --describe` lists every command.
|
|
91
|
+
|
|
92
|
+
- stdout holds the answer only: one JSON object, or one JSON object per line for a list.
|
|
93
|
+
- An error is one line `{"error":{"code":"...","message":"...",...}}` on stderr, and the exit code is 1. A code starting with `CLI_` comes from `lazco`, and any other code from the API.
|
|
94
|
+
- Every other line on stderr starts with `lazco: `, such as a warning or the flag that gets the next page.
|
|
95
|
+
- `--human` prints a table instead. `NO_COLOR` turns its color off.
|
|
96
|
+
- `--page-all` follows every page of a list.
|
|
97
|
+
- A command that deletes or spends asks first on a terminal. `--yes` confirms without asking, and a command that needs the resource's name still needs it in its field.
|
|
98
|
+
- A command that spends asks the API for a quote first, and shows it on stderr: the amount it takes from the account balance, each line, the period, the recurring charge, and when the quote expires.
|
|
99
|
+
It then asks, or needs `--yes`, and spends exactly the quoted amount.
|
|
100
|
+
Without a yes it exits 1 with `CLI_CONFIRM_REQUIRED`, and the error's `details.quote` holds the quote.
|
|
101
|
+
- `--dry-run` of a command that spends asks for its quote, which charges nothing, and prints the request it would send with the quote in `body` and in `quote`.
|
|
102
|
+
`--quote-id <id>` with `--expected-amount <amount>` spends with a quote you already have, such as the one of a dry run, and asks for no new one.
|
|
103
|
+
A quote is good for 10 minutes and for one spend.
|
|
104
|
+
When the API refuses a quote, `lazco` never asks for a new one by itself, because that is a price nobody saw.
|
|
105
|
+
- A command that spends sends an `Idempotency-Key`, so a retry after a lost answer never charges twice.
|
|
106
|
+
`--idempotency-key <key>` chooses the key: run the same command again with the same key, within 24 hours, to get the first result instead of a second charge.
|
|
107
|
+
- A task such as a deploy is waited for. `--no-wait` prints the accepted task at once.
|
|
108
|
+
|
|
109
|
+
### Publish a Lazco Pages site
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
lazco labs pages deployments create <site-id> ./dist
|
|
113
|
+
lazco labs pages deployments create <site-id> ./dist --dry-run
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The directory is the site's root, and every file in it becomes public.
|
|
117
|
+
Paths with a segment that starts with a dot, `__MACOSX` and `node_modules` are skipped, so a `.env` next to a build is never published.
|
|
118
|
+
A link, a zip archive or a single file is refused: unpack an archive first.
|
|
119
|
+
The command checks the API's limits before it sends anything, uploads only the files that changed since the live deploy, and waits until the deployment is live, for 600 seconds or `--timeout`.
|
|
120
|
+
A failed or interrupted upload cancels the deployment, so the next deploy can start at once.
|
|
121
|
+
`--dry-run` reads the limits and the site, and prints the manifest it would send.
|
|
122
|
+
|
|
123
|
+
## Use it from an MCP client
|
|
124
|
+
|
|
125
|
+
`lazco mcp` is a local MCP server with the same sign-in, and it renews an SSO sign-in as it runs.
|
|
126
|
+
Add it to a client with:
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
lazco mcp install --client <client>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`<client>` is one of `claude-code`, `claude-desktop`, `codex`, `cursor`, `devin`, `gemini`, `pi` or `vscode`.
|
|
133
|
+
The entry holds the command only, never a credential.
|
|
134
|
+
`--profile <name>`, `--allow-writes` and `--allow-spend` go into the entry, and `--dry-run` shows the entry without writing it.
|
|
135
|
+
|
|
136
|
+
Without `--allow-writes` the server offers read tools only.
|
|
137
|
+
With it, the server adds the tools that change things, and the deleting ones that need the resource's name.
|
|
138
|
+
With `--allow-spend` too, it adds the tools that spend from the account balance, each with its quote tool.
|
|
139
|
+
A spend tool needs a quote from its quote tool, and its description tells the model to show the quote and get your yes first.
|
|
140
|
+
When the client can ask you itself (MCP elicitation), the server shows you the quote from the API and spends only after you accept.
|
|
141
|
+
A read-only token gets read tools only.
|
|
142
|
+
|
|
143
|
+
For a desktop client, install `lazco` globally first, so the entry names it by its full path.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT. The binaries carry the notices of the code compiled into them in `THIRD_PARTY_NOTICES.txt`.
|