@gizai/cli 2.0.1 → 2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Giz Systems Inc. and the Gizlang contributors
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,184 +1,15 @@
1
- # Giz CLI
1
+ # @gizai/cli
2
2
 
3
- The official command-line interface for [giz.ai](https://www.giz.ai). Run Giz text, image, video and audio models, manage Drive files, tables, Apps and Computers, and connect Claude Code, Codex and other AI agents to your Giz account, all from a terminal.
3
+ GizStack 0.1.0-preview.20261022.1 from npm: a native language, web server and database in one stack. TypeScript syntax; PostgreSQL, Redis and S3 protocols. Docs: https://gizstack.com/docs/start
4
4
 
5
- [Documentation](https://www.giz.ai/mcp/) · [giz.ai](https://www.giz.ai) · [Sign up](https://www.giz.ai)
6
-
7
- ## Install
8
-
9
- Requires Node.js 20.12 or later and a [giz.ai](https://www.giz.ai) account.
10
-
11
- ```bash
5
+ ```sh
12
6
  npm install -g @gizai/cli
13
- giz --version
14
- ```
15
-
16
- Update later with `giz update` (or `npm install -g @gizai/cli`).
17
-
18
- ## Quick start
19
-
20
- ```bash
21
- giz auth login # opens your browser, one-time sign-in
22
- giz chat gpt-6-luna "Say hello in Korean" # chat with a text model
23
- giz generate image "A paper observatory at blue hour"
24
- giz credits # check your balance
25
- giz --help # every command
26
- ```
27
-
28
- ## Run any model
29
-
30
- Discover a model's live inputs, upload local files, and run it:
31
-
32
- ```bash
33
- giz model list --type video-generation
34
- giz model get ltx2-distilled
35
- giz model run ltx2-distilled \
36
- --input '{"prompt":"A slow camera push through morning fog"}' \
37
- --upload image=./first-frame.png
7
+ npx @gizai/cli --version
8
+ bunx @gizai/cli --version
38
9
  ```
39
10
 
40
- Media jobs run independently. Track them with `giz job get JOB` or block with `giz job wait JOB` (exit status 1 if the job failed or was cancelled). Add `--json` to any command for machine-readable output on stdout; progress goes to stderr.
41
-
42
- ## Use Giz from Claude Code, Codex and other agents
43
-
44
- Register the Giz MCP server with your agent (install the client first):
45
-
46
- ```bash
47
- giz auth login
48
- giz mcp add claude
49
- giz mcp add codex
50
- giz mcp check --json # verifies the MCP handshake and lists tool names
51
- ```
52
-
53
- This registers `giz mcp serve` over stdio. It forwards Giz's live MCP protocol and shares the CLI's credentials, so no token is copied into the client's configuration. For clients that run their own OAuth session, use `giz mcp add claude --transport http` (then sign in with `/mcp`) or `giz mcp add codex --transport http`. The remote endpoint is `https://www.giz.ai/api/mcp`; it supports OAuth discovery and scoped API keys.
54
-
55
- Install the Giz agent skill with `giz skill install`. The package root is also an [Agent Plugins](https://agent-plugins.org) 1.0 plugin (`plugin.json`, the `giz` skill and `mcp.json`), so a client that installs plugins gets the skill and the MCP server together.
56
-
57
- ## Drive, Computers and Apps
58
-
59
- ```bash
60
- giz drive ls
61
- giz drive read /notes/todo.md
62
- giz computer list
63
- giz computer exec --deadline-ms 120000 -- ls -la # up to 15 minutes; the remote exit code is preserved
64
- giz app list
65
- ```
66
-
67
- App changes are explicit: pass the `revision` shown by `giz app list` as `--expected-revision REVISION` to `run`, `publish` and `delete`, and as `expectedRevision` in the `--input` of `create` and `save` (use 0 for a new App). A concurrent change is rejected by the server instead of being overwritten.
68
-
69
- Free Computers have a runtime limit; check your plan before starting long workflows. Signing in does not extend that runtime.
70
-
71
- ### Inside a Giz Computer
72
-
73
- `giz` is already installed in every Giz Computer, and no login is needed: the Computer signs in as itself and can reach only its own Drive, model discovery and inference, and jobs it started. API keys, billing, organization administration, destructive operations and external writes need a separate user sign-in with `giz auth login`. `giz auth status` shows who you are.
74
-
75
- ## Plugins
76
-
77
- ```bash
78
- giz plugin search QUERY [--origin skill|mcp]
79
- giz plugin install ID --query QUERY
80
- giz plugin list
81
- giz connection list # connected apps
82
- ```
83
-
84
- Also available: `plugin inspect`, `update`, `remove`, `enable`, `disable`, `publish` and `unpublish`.
85
-
86
- ## Authentication and security
87
-
88
- - `giz auth login` uses browser OAuth with a loopback callback; the CLI never sees or stores your password.
89
- - Credentials are stored as JSON in `~/.config/giz/credentials.json` with mode `0600` (owner only), written atomically. `GIZ_CONFIG` overrides the path. `giz auth logout` revokes the token and removes the file.
90
- - `giz auth status --json` shows the granted scopes; a missing scope error names the permission it needs. After updating from 1.0.1, sign in again to grant `giz.inference`.
91
- - Create a scoped API key with `giz api-key create "My app"` (the secret is shown once). Set `GIZ_TOKEN` only for short-lived automation.
92
- - An OAuth access token copied by hand expires after one hour. Prefer `giz mcp add`, which refreshes it for you.
93
-
94
- ## Configuration
95
-
96
- | Variable | Purpose |
97
- | --- | --- |
98
- | `GIZ_TOKEN` | Use this API key or token instead of the stored login |
99
- | `GIZ_CONFIG` | Path of the credentials file |
100
- | `GIZ_NO_UPDATE_CHECK=1` | Turn off the update notice (or set `updates.mode` to `off` in `credentials.json`) |
101
-
102
- The update check is cached for up to 24 hours and prints only in interactive terminals.
103
-
104
- ## Upgrading from 1.x
105
-
106
- Version 2.0 removes `giz capability` with no alias. Skills, MCP servers and Agents now install as one plugin.
107
-
108
- | 1.x | 2.0 |
109
- | --- | --- |
110
- | `giz capability list` | `giz connection list` (connected apps), `giz plugin list` (installed plugins) |
111
- | `giz capability search skill\|mcp QUERY` | `giz plugin search QUERY [--origin skill\|mcp]` |
112
- | `giz capability install skill\|mcp ID --query QUERY` | `giz plugin install ID --query QUERY` |
113
- | `giz capability update\|remove ID` | `giz plugin update\|remove NAME` |
114
-
115
- New in 2.0: `plugin inspect`, `install --path`, `enable`, `disable`, `publish` and `unpublish`. A Giz server that supports plugins reports 2.0.0 as its minimum CLI, so 1.x prints an update warning there.
116
-
117
- ## Command reference
118
-
119
- Generated from the CLI dispatcher and the Giz tool descriptors.
120
-
121
- <!-- cli-surface:start -->
122
- | Command | Tool ID | MCP tool | Required input | Scope | Agent discovery |
123
- | --- | --- | --- | --- | --- | --- |
124
- | model list | model.list | model_list | - | giz.read | model.list |
125
- | model get | model.get | model_get | model | giz.read | model.get |
126
- | model run | model.run | model_run | model, input | giz.inference | model.run |
127
- | generate image | generateImage | generateImage | prompt | giz.write | generateImage |
128
- | generate video | generateVideo | generateVideo | prompt | giz.write | generateVideo |
129
- | generate music | generateMusic | generateMusic | prompt | giz.write | generateMusic |
130
- | generate talking-head | generateTalkingHead | generateTalkingHead | prompt, references | giz.write | generateTalkingHead |
131
- | generate audio | generateAudio | generateAudio | purpose | giz.write | generateAudio |
132
- | job list | job.list | job_list | - | giz.read | server job |
133
- | job get | job.get | job_get | job | giz.read | server job |
134
- | job wait | job.get | job_get | job | giz.read | server job |
135
- | job cancel | job.cancel | job_cancel | job | giz.destructive | server job |
136
- | credits | account.credits | account_credits | - | giz.read | account.credits |
137
- | drive ls | drive.list | drive_list | - | giz.read | drive.list |
138
- | drive list | drive.list | drive_list | - | giz.read | drive.list |
139
- | drive search | drive.search | drive_search | query | giz.read | drive.search |
140
- | drive read | drive.readFile | drive_readFile | path | giz.read | drive.readFile |
141
- | drive write | drive.writeFile | drive_writeFile | path, content | giz.write | drive.writeFile |
142
- | drive mkdir | drive.makeDirectory | drive_makeDirectory | path | giz.write | drive.makeDirectory |
143
- | drive move | drive.movePath | drive_movePath | from, to | giz.write | drive.movePath |
144
- | drive delete | drive.deletePath | drive_deletePath | path | giz.destructive | drive.deletePath |
145
- | table list | workspace.objects | workspace_objects | - | giz.read | workspace.objects |
146
- | table get | workspace.objects | workspace_objects | - | giz.read | workspace.objects |
147
- | table read | table.readRows | table_readRows | table | giz.read | table.readRows |
148
- | table write | table.writeRows | table_writeRows | table | giz.write | table.writeRows |
149
- | table action | workspace.executeAction | workspace_executeAction | view, action | giz.execute | workspace.executeAction |
150
- | computer list | computer.list | computer_list | - | giz.read | computer.list |
151
- | computer get | computer.get | computer_get | - | giz.read | external only |
152
- | computer start | computer.start | computer_start | - | giz.execute | external only |
153
- | computer stop | computer.stop | computer_stop | - | giz.destructive | external only |
154
- | computer exec | computer.exec | giz_computer_exec | - | giz.execute | computer.exec |
155
- | app list | app.list | app_list | - | giz.read | app.list |
156
- | app create | app.save | app_save | id, expectedRevision | giz.execute | app.save |
157
- | app save | app.save | app_save | id, expectedRevision | giz.execute | app.save |
158
- | app run | app.run | app_run | id, expectedRevision | giz.execute | app.run |
159
- | app publish | app.publish | app_publish | id, expectedRevision, visibility | giz.write | app.publish |
160
- | app open | app.open | app_open | id | giz.read | app.open |
161
- | app delete | app.delete | app_delete | id, expectedRevision | giz.destructive | app.delete |
162
- | plugin list | plugin.catalog | plugin_catalog | - | giz.read | plugin.catalog |
163
- | plugin search | plugin.catalog | plugin_catalog | - | giz.read | plugin.catalog |
164
- | plugin inspect | plugin.catalog | plugin_catalog | - | giz.read | plugin.catalog |
165
- | plugin install | plugin.install | plugin_install | - | giz.execute | plugin.install |
166
- | plugin update | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
167
- | plugin enable | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
168
- | plugin disable | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
169
- | plugin remove | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
170
- | plugin publish | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
171
- | plugin unpublish | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
172
- | connection list | capability.status | capability_status | - | giz.read | capability.status |
173
- | agent start | agent.start | agent_start | agentId, prompt | giz.execute | external only |
174
- | agent status | agent.status | agent_status | turnId | giz.read | agent.status |
175
- | agent cancel | agent.cancel | agent_cancel | turnId | giz.execute | agent.cancel |
176
- <!-- cli-surface:end -->
177
-
178
- ## Support
179
-
180
- Questions and bug reports: [support@giz.ai](mailto:support@giz.ai) or the Support Forum at [giz.ai](https://www.giz.ai).
181
-
182
- ## License
11
+ One package serves every platform and runs no install script. The first run installs GizStack into `~/.giz`
12
+ (`GIZ_INSTALL`): `bin/install.sh` finds your platform, downloads its installer from the content address
13
+ written in the script, checks its SHA-256, and the installer checks the release signature and every file.
183
14
 
184
- Proprietary. Copyright Giz Inc. All rights reserved. Use of the service is governed by the [Terms of Use](https://www.giz.ai/terms-of-use).
15
+ GizStack is open source under the MIT license: https://github.com/gizai/gizlang
package/bin/giz.js ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ // The npm entry of GizStack 0.1.0-preview.20261022.1 (generated by tools/distribution/channels).
3
+ // The giz.ai commands (auth api-key credits model models chat generate job drive table upload computer app connection plugin agent invoke mcp skill engine update __update-check), help and --version run the command line binary of this platform's package
4
+ // (@gizai/cli-OS-CPU, an optional dependency), which needs no toolchain: giz.ai CLI 2.0's users keep working right after
5
+ // `npm install`. Every other command needs the toolchain: the first such run installs this version with install.sh, which
6
+ // finds the platform, downloads its installer from the content address, checks the SHA-256 against the table in this
7
+ // package, and runs it; the installer checks the release signature and every file. Then each run executes the installed
8
+ // giz, which selects the version (a project pin or the active one).
9
+ "use strict";
10
+ const { spawnSync } = require("child_process");
11
+ const fs = require("fs");
12
+ const os = require("os");
13
+ const path = require("path");
14
+
15
+ const VERSION = "0.1.0-preview.20261022.1";
16
+ const ACCOUNT = new Set("auth api-key credits model models chat generate job drive table upload computer app connection plugin agent invoke mcp skill engine update __update-check".split(" ").filter(Boolean));
17
+ // 2.0's flags that take no value: the command is the first word that is not a flag or a flag's value.
18
+ const BOOLEANS = new Set(["help", "json", "no-open", "version", "device"]);
19
+
20
+ function fail(message) {
21
+ process.stderr.write("giz: " + message + "\n");
22
+ process.exit(1);
23
+ }
24
+ function commandOf(argv) {
25
+ for (let i = 0; i < argv.length; i += 1) {
26
+ const word = argv[i];
27
+ if (word === "--") return argv[i + 1] || "";
28
+ if (!word.startsWith("--")) return word;
29
+ const name = word.slice(2).split("=")[0];
30
+ if (!word.includes("=") && !BOOLEANS.has(name) && argv[i + 1] && !argv[i + 1].startsWith("--")) i += 1;
31
+ }
32
+ return "";
33
+ }
34
+ // The package manager that installed this package, for `giz update`.
35
+ function installer() {
36
+ const at = __dirname.toLowerCase();
37
+ if (at.includes(path.sep + ".pnpm" + path.sep) || /[\\/]pnpm[\\/]global[\\/]/.test(at)) return "pnpm";
38
+ if (at.includes(path.sep + ".bun" + path.sep)) return "bun";
39
+ if (at.includes(path.sep + ".yarn" + path.sep) || at.includes(path.sep + "yarn" + path.sep + "global" + path.sep)) return "yarn";
40
+ return "npm";
41
+ }
42
+ function bundled() {
43
+ const system = { linux: "linux", darwin: "darwin", win32: "win32" }[process.platform];
44
+ const cpu = { x64: "x64", arm64: "arm64" }[process.arch];
45
+ if (!system || !cpu || ACCOUNT.size === 0) return undefined;
46
+ try {
47
+ const file = path.join(path.dirname(require.resolve("@gizai/cli-" + system + "-" + cpu + "/package.json")), "bin", "giz" + (system === "win32" ? ".exe" : ""));
48
+ return fs.existsSync(file) ? file : undefined;
49
+ } catch { return undefined; }
50
+ }
51
+ function run(file, standalone) {
52
+ const env = { ...process.env, GIZ_INSTALLER: installer(), GIZ_SELF: process.argv[1],
53
+ GIZ_SKILLS: path.join(__dirname, "..", "skills") };
54
+ if (standalone) env.GIZ_STANDALONE = "1";
55
+ const ran = spawnSync(file, process.argv.slice(2), { stdio: "inherit", env });
56
+ if (ran.error) fail(ran.error.message);
57
+ if (ran.signal) process.kill(process.pid, ran.signal);
58
+ process.exit(ran.status === null ? 1 : ran.status);
59
+ }
60
+
61
+ const argv = process.argv.slice(2);
62
+ const command = commandOf(argv);
63
+ const own = bundled();
64
+ if (process.platform === "win32") {
65
+ if (!own) fail("the Windows binary package was not installed; reinstall without --omit=optional");
66
+ run(own, true);
67
+ }
68
+ if (own && (ACCOUNT.has(command) || argv.length === 0 || command === "help" || command === "-h" || (command === "" && (argv.includes("--version") || argv.includes("--help"))))) {
69
+ run(own, true);
70
+ }
71
+ const root = process.env.GIZ_INSTALL || path.join(os.homedir(), ".giz");
72
+ const bin = path.join(root, "bin", "giz");
73
+ const installed = spawnSync("sh", [path.join(__dirname, "install.sh"), ..."".split(" ").filter(Boolean), "--if-missing", "--no-modify-path", "--version", VERSION],
74
+ { stdio: ["inherit", process.stderr, "inherit"], env: { ...process.env, GIZ_INSTALL: root } });
75
+ if (installed.error) fail("cannot run sh: " + installed.error.message + ". Supported platforms: https://gizstack.com/download");
76
+ if (installed.status !== 0) process.exit(installed.status === null ? 1 : installed.status);
77
+ run(bin, false);
package/bin/install.sh ADDED
@@ -0,0 +1,261 @@
1
+ #!/bin/sh
2
+ # Install GizStack: curl -fsSL https://gizstack.com/install | sh
3
+ # Install the GizDB server alone: curl -fsSL https://gizstack.com/install | sh -s -- --only gizdb
4
+ # While gizstack.com is in private preview, the command on your signed-in page adds
5
+ # -H "Authorization: Bearer TOKEN": the script served for it carries that access token
6
+ # and stores it in ~/.config/gizstack/access-token, where the installer and
7
+ # `giz upgrade` read it.
8
+ #
9
+ # This script downloads the official installer for your platform from its
10
+ # content address, checks its SHA-256 against that address and runs it. The
11
+ # installer verifies the release signature and every file hash before it
12
+ # activates the version. Nothing needs root. Docs: https://gizstack.com/docs/start
13
+ #
14
+ # Options (sh -s -- OPTION...):
15
+ # --only gizdb install only the GizDB server (bin/gizdb): the same
16
+ # signed release, without the compiler, into ~/.gizdb
17
+ # --version VERSION install this published version (default: the newest)
18
+ # --no-modify-path do not add the bin directory to shell profiles
19
+ # --installer FILE use this downloaded installer (the npm and Homebrew
20
+ # packages carry it); its SHA-256 is checked the same way
21
+ # --if-missing do nothing when this version is installed already
22
+ # (the package wrappers run it before each command)
23
+ # Environment: GIZ_INSTALL (default ~/.giz; with --only gizdb,
24
+ # GIZDB_INSTALL, default ~/.gizdb), NO_MODIFY_PATH=1.
25
+ #
26
+ # Everything runs inside main(), called on the last line, so a download that
27
+ # is cut off does nothing.
28
+
29
+ set -u
30
+
31
+ SITE="https://gizstack.com"
32
+ # The access token this script was served for (the server writes it here), or empty.
33
+ ACCESS=''
34
+
35
+ # Published installers: product (toolchain, or gizdb for the server alone),
36
+ # target, version, installer SHA-256.
37
+ # Generated from $SITE/api/releases when this script was served.
38
+ releases() {
39
+ cat <<'RELEASES'
40
+ toolchain x86_64-unknown-linux-gnu 0.1.0-preview.20261022.1 e628a629819b7e9a4f965ca8038ec5d364644ee3c526316be2a577c5d300b506
41
+ gizdb x86_64-unknown-linux-gnu 0.1.0-preview.20261015.5 cc102bb96abcbe04a98dbc697595310e28b7d997a716f979258ff2afaf4620c6
42
+ RELEASES
43
+ }
44
+
45
+ say() { printf '%s\n' "$*"; }
46
+ fail() { printf 'giz-install: %s\n' "$*" >&2; exit 1; }
47
+
48
+ detect_target() {
49
+ os=$(uname -s)
50
+ arch=$(uname -m)
51
+ case "$arch" in
52
+ x86_64 | amd64) arch=x86_64 ;;
53
+ aarch64 | arm64) arch=aarch64 ;;
54
+ *) fail "unsupported CPU architecture: $arch. Supported platforms: $SITE/download" ;;
55
+ esac
56
+ case "$os" in
57
+ Linux)
58
+ libc=gnu
59
+ if ls /lib/ld-musl-* >/dev/null 2>&1 || (ldd --version 2>&1 | grep -qi musl); then libc=musl; fi
60
+ target="$arch-unknown-linux-$libc" ;;
61
+ Darwin)
62
+ # A shell under Rosetta reports x86_64 on Apple Silicon.
63
+ if [ "$arch" = x86_64 ] && [ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = 1 ]; then arch=aarch64; fi
64
+ target="$arch-apple-darwin" ;;
65
+ MINGW* | MSYS* | CYGWIN* | Windows_NT)
66
+ fail "on Windows, run in PowerShell: irm $SITE/install.ps1 | iex" ;;
67
+ *) fail "unsupported operating system: $os. Supported platforms: $SITE/download" ;;
68
+ esac
69
+ }
70
+
71
+ # Sets digest and version from the table, or explains what exists.
72
+ select_release() {
73
+ digest=""
74
+ [ -n "$(releases)" ] || fail "no GizStack release supports this install script yet. Download an installer: $SITE/download"
75
+ found=$(releases | while read -r p t v d; do
76
+ if [ "$p" = "$product" ] && [ "$t" = "$target" ] && { [ -z "$wanted" ] || [ "$v" = "$wanted" ]; }; then say "$v $d"; break; fi
77
+ done)
78
+ if [ -n "$found" ]; then version=${found% *}; digest=${found#* }; return; fi
79
+ available=$(releases | while read -r p t v d; do if [ "$p" = "$product" ] && [ "$t" = "$target" ]; then printf ' %s' "$v"; fi; done)
80
+ if [ -n "$available" ]; then fail "$name $wanted is not published for $target. Published:$available"; fi
81
+ platforms=$(releases | while read -r p t v d; do if [ "$p" = "$product" ]; then printf '\n %s' "$t"; fi; done)
82
+ [ -n "$platforms" ] || fail "no $name release supports this install script yet. Release status: $SITE/download"
83
+ fail "no $name release for $target yet. Published platforms:$platforms
84
+ Use the browser Playground meanwhile: $SITE/play. Release status: $SITE/download"
85
+ }
86
+
87
+ download() { # URL FILE
88
+ if command -v curl >/dev/null 2>&1; then
89
+ if [ -n "$KEY" ]; then curl --proto '=https' --tlsv1.2 -fsSL --retry 3 -H "Authorization: Bearer $KEY" -o "$2" "$1"
90
+ else curl --proto '=https' --tlsv1.2 -fsSL --retry 3 -o "$2" "$1"; fi
91
+ elif command -v wget >/dev/null 2>&1; then
92
+ if [ -n "$KEY" ]; then wget --https-only -q --header="Authorization: Bearer $KEY" -O "$2" "$1"
93
+ else wget --https-only -q -O "$2" "$1"; fi
94
+ else
95
+ fail "curl or wget is required"
96
+ fi
97
+ }
98
+
99
+ sha256() {
100
+ if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | cut -d ' ' -f 1
101
+ elif command -v shasum >/dev/null 2>&1; then shasum -a 256 "$1" | cut -d ' ' -f 1
102
+ elif command -v openssl >/dev/null 2>&1; then openssl dgst -sha256 -r "$1" | cut -d ' ' -f 1
103
+ else fail "sha256sum, shasum or openssl is required to check the installer"
104
+ fi
105
+ }
106
+
107
+ add_line() { # FILE LINE: append LINE once
108
+ if [ -f "$1" ] && grep -qxF "$2" "$1"; then return; fi
109
+ printf '\n%s\n' "$2" >>"$1" && changed="$changed $1"
110
+ }
111
+
112
+ # One line in each profile sources $root/env, which adds bin to PATH once.
113
+ modify_path() {
114
+ bin="$root/bin"
115
+ cat >"$root/env" <<ENV
116
+ # Added by the $name installer.
117
+ case ":\${PATH}:" in *":$bin:"*) ;; *) export PATH="$bin:\$PATH" ;; esac
118
+ ENV
119
+ cat >"$root/env.fish" <<ENV
120
+ # Added by the $name installer.
121
+ if not contains -- "$bin" \$PATH; set -gx PATH "$bin" \$PATH; end
122
+ ENV
123
+ line=". \"$root/env\""
124
+ zshrc="${ZDOTDIR:-$HOME}/.zshrc"
125
+ for profile in "$HOME/.profile" "$HOME/.bashrc" "$HOME/.bash_profile" "$zshrc"; do
126
+ case "$profile" in
127
+ "$HOME/.bash_profile") [ -f "$profile" ] || continue ;;
128
+ "$zshrc") [ -f "$profile" ] || command -v zsh >/dev/null 2>&1 || continue ;;
129
+ esac
130
+ add_line "$profile" "$line"
131
+ done
132
+ if command -v fish >/dev/null 2>&1 || [ -d "$HOME/.config/fish" ]; then
133
+ mkdir -p "$HOME/.config/fish/conf.d"
134
+ fishline="source \"$root/env.fish\""
135
+ fishrc="$HOME/.config/fish/conf.d/$command.fish"
136
+ add_line "$fishrc" "$fishline"
137
+ fi
138
+ }
139
+
140
+ # The installer, `giz upgrade` and package reads send this token to gizstack.com.
141
+ store_access() {
142
+ [ -n "$ACCESS" ] || return 0
143
+ config="${XDG_CONFIG_HOME:-$HOME/.config}/gizstack"
144
+ (umask 077 && mkdir -p "$config" && printf '%s\n' "$ACCESS" >"$config/access-token.new" && mv "$config/access-token.new" "$config/access-token") || fail "cannot store the access token in $config"
145
+ }
146
+
147
+ # A script not served with a key (npm, or a rerun) takes the key the way access.giz does: GIZ_ACCESS_TOKEN, else the
148
+ # file. Only the downloads below use it, and only from $SITE. A value outside the token alphabet is refused whole, as
149
+ # access.giz refuses it, so a bad value is never sent.
150
+ resolve_access() {
151
+ KEY=$ACCESS
152
+ if [ -z "$KEY" ]; then KEY=$(printf '%s' "${GIZ_ACCESS_TOKEN:-}" | tr -d ' \t\r\n'); fi
153
+ if [ -z "$KEY" ] && [ -n "${HOME:-}" ]; then
154
+ KEY=$(tr -d ' \t\r\n' 2>/dev/null <"${XDG_CONFIG_HOME:-$HOME/.config}/gizstack/access-token")
155
+ fi
156
+ case "$KEY" in *[!0-9a-z_]*) KEY='' ;; esac
157
+ }
158
+
159
+ main() {
160
+ wanted=""
161
+ local_installer=""
162
+ if_missing=0
163
+ product=toolchain
164
+ path_changes=1
165
+ if [ -n "${NO_MODIFY_PATH:-}" ]; then path_changes=0; fi
166
+ while [ $# -gt 0 ]; do
167
+ case "$1" in
168
+ --only) [ $# -ge 2 ] || fail "--only needs a value"; [ "$2" = gizdb ] || fail "--only takes gizdb (the GizDB server alone), not $2"; product=gizdb; shift 2 ;;
169
+ --version) [ $# -ge 2 ] || fail "--version needs a value"; wanted=$2; shift 2 ;;
170
+ --no-modify-path) path_changes=0; shift ;;
171
+ --if-missing) if_missing=1; shift ;;
172
+ --installer) [ $# -ge 2 ] || fail "--installer needs a value"; local_installer=$2; shift 2 ;;
173
+ -h | --help) say "Usage: curl -fsSL $SITE/install | sh -s -- [--only gizdb] [--version VERSION] [--no-modify-path]"; say "Docs: $SITE/docs/start"; exit 0 ;;
174
+ *) fail "unknown option: $1 (see $SITE/docs/start)" ;;
175
+ esac
176
+ done
177
+ # The GizDB server alone is its own installation, beside a toolchain's, never inside it.
178
+ if [ "$product" = gizdb ]; then
179
+ name=GizDB; command=gizdb; variable=GIZDB_INSTALL; root="${GIZDB_INSTALL:-}"; home=.gizdb
180
+ else
181
+ name=GizStack; command=giz; variable=GIZ_INSTALL; root="${GIZ_INSTALL:-}"; home=.giz
182
+ fi
183
+ if [ -z "$root" ]; then
184
+ [ -n "${HOME:-}" ] || fail "HOME is not set; set $variable to the installation directory"
185
+ root="$HOME/$home"
186
+ # An install from before the command was gizstack (~/.gizlang) is upgraded in place: the installer then removes
187
+ # its gizlang command, and no second command stays on PATH.
188
+ if [ "$product" != gizdb ] && [ ! -e "$root" ] && [ -f "$HOME/.gizlang/active-toolchain" ]; then root="$HOME/.gizlang"; fi
189
+ fi
190
+ if [ "$wanted" = latest ]; then wanted=""; fi
191
+ case "$root" in
192
+ /*) ;;
193
+ *) fail "$variable must be an absolute path: $root" ;;
194
+ esac
195
+ case "$root" in
196
+ *[\"\$\`\\]*) fail "$variable cannot contain quotes, \$, backquotes or backslashes: $root" ;;
197
+ esac
198
+
199
+ detect_target
200
+ select_release
201
+ if [ "$if_missing" = 1 ]; then
202
+ for installed in "$root/versions/$product-$target-$version-"*; do
203
+ if [ -f "$installed/release.json" ]; then exit 0; fi
204
+ done
205
+ fi
206
+
207
+ work=$(mktemp -d 2>/dev/null || mktemp -d -t giz) || fail "cannot create a temporary directory"
208
+ trap 'rm -rf "$work"' EXIT
209
+ installer="$work/$command-installer"
210
+ if [ -n "$local_installer" ]; then
211
+ cp "$local_installer" "$installer" || fail "cannot read the installer $local_installer"
212
+ else
213
+ say "Downloading the $name $version installer for $target"
214
+ resolve_access
215
+ if ! download "$SITE/objects/sha256/$digest" "$installer"; then
216
+ [ -n "$KEY" ] || fail "the installer download was refused: $name is in private preview. Signed in at $SITE, your install command on $SITE/download carries your access key (or set GIZ_ACCESS_TOKEN). No invitation yet: $SITE/access-request"
217
+ fail "the installer download failed: $SITE/objects/sha256/$digest"
218
+ fi
219
+ fi
220
+ actual=$(sha256 "$installer")
221
+ [ "$actual" = "$digest" ] || fail "the installer SHA-256 is $actual, not $digest; nothing was installed"
222
+ chmod u+x "$installer"
223
+ # A copy that came through a browser or an archive tool carries the macOS
224
+ # quarantine attribute, and Gatekeeper then refuses the ad-hoc signed program.
225
+ # The SHA-256 check above replaces what the attribute would have asked the user to trust.
226
+ if [ "$os" = Darwin ] && command -v xattr >/dev/null 2>&1; then xattr -d com.apple.quarantine "$installer" 2>/dev/null || :; fi
227
+
228
+ store_access
229
+ mkdir -p "$root" || fail "cannot create $root"
230
+ "$installer" --root "$root" || fail "the installer failed; the previous version, if any, stays active"
231
+
232
+ changed=""
233
+ if [ "$path_changes" = 1 ]; then modify_path; fi
234
+ say ""
235
+ if [ "$product" = gizdb ]; then
236
+ # gizdb has no --version; its usage proves the installed server runs here.
237
+ "$root/bin/gizdb" --help >/dev/null || fail "$root/bin/gizdb does not run on this computer"
238
+ say "GizDB $version for $target is installed: $root/bin/gizdb"
239
+ else
240
+ "$root/bin/giz" --version || fail "$root/bin/giz does not run on this computer"
241
+ fi
242
+ say ""
243
+ if [ -n "$changed" ]; then
244
+ say "Added $root/bin to PATH in:$changed"
245
+ say "Open a new terminal, or run: . \"$root/env\""
246
+ elif [ "$path_changes" = 1 ]; then
247
+ say "$root/bin is already on PATH in your shell profiles."
248
+ else
249
+ say "Add $root/bin to PATH to run $command."
250
+ fi
251
+ say ""
252
+ if [ "$product" = gizdb ]; then
253
+ say "Next: GIZDB_PASSWORD=... gizdb serve --dir ~/gizdb-data --port 5432"
254
+ say "Docs: $SITE/docs/operations/gizdb-server (systemd unit, backups, upgrades)"
255
+ else
256
+ say "Next: giz init hello && cd hello && giz run main.giz"
257
+ say "Docs: $SITE/docs/start"
258
+ fi
259
+ }
260
+
261
+ main "$@"
package/package.json CHANGED
@@ -1,58 +1,28 @@
1
1
  {
2
2
  "name": "@gizai/cli",
3
- "version": "2.0.1",
4
- "description": "The official command-line interface for giz.ai: run AI models, Drive, Computers and Apps, and connect Claude Code, Codex and other agents over MCP.",
5
- "keywords": [
6
- "giz",
7
- "giz.ai",
8
- "cli",
9
- "mcp",
10
- "model-context-protocol",
11
- "ai",
12
- "llm",
13
- "agent",
14
- "claude-code",
15
- "codex",
16
- "image-generation",
17
- "video-generation"
18
- ],
19
- "homepage": "https://www.giz.ai/mcp/",
20
- "bugs": {
21
- "email": "support@giz.ai",
22
- "url": "https://www.giz.ai/mcp/"
3
+ "version": "2.1.0",
4
+ "description": "GizStack: a native language, web server and database in one stack. TypeScript syntax; PostgreSQL, Redis and S3 protocols",
5
+ "homepage": "https://gizstack.com",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/gizai/gizlang.git"
23
9
  },
24
- "author": {
25
- "name": "Giz Inc.",
26
- "url": "https://www.giz.ai"
10
+ "license": "MIT",
11
+ "publishConfig": {
12
+ "access": "public"
27
13
  },
28
- "license": "UNLICENSED",
29
- "type": "module",
30
14
  "bin": {
31
- "giz": "cli/giz.mjs"
15
+ "giz": "bin/giz.js"
32
16
  },
33
17
  "files": [
34
- "cli",
35
- "skills",
36
- "plugin.json",
37
- "mcp.json",
38
- "README.md"
18
+ "bin",
19
+ "skills"
39
20
  ],
40
21
  "engines": {
41
- "node": ">=20.12"
42
- },
43
- "dependencies": {
44
- "@modelcontextprotocol/sdk": "1.29.0",
45
- "proper-lockfile": "4.1.2"
46
- },
47
- "repository": {
48
- "type": "git",
49
- "url": "git+https://github.com/GizAI/giz.git",
50
- "directory": "apps/giz/external"
51
- },
52
- "publishConfig": {
53
- "access": "public"
22
+ "node": ">=16"
54
23
  },
55
- "scripts": {
56
- "check": "node --check cli/giz.mjs && node --test test/*.test.mjs"
24
+ "optionalDependencies": {
25
+ "@gizai/cli-linux-x64": "2.1.0",
26
+ "@gizai/cli-win32-x64": "2.1.0"
57
27
  }
58
28
  }