@gizai/cli 2.1.2 → 2.2.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/package.json CHANGED
@@ -1,24 +1,59 @@
1
1
  {
2
2
  "name": "@gizai/cli",
3
- "version": "2.1.2",
4
- "description": "GizStack: natively compiled TypeScript, with the whole stack built in: a modern web framework and server, OLTP and OLAP SQL (PostgreSQL- and Oracle-compatible), vector search, key-value, distributed POSIX and S3 storage, GPU tensors, and local LLM, image and video generation",
5
- "homepage": "https://gizstack.com",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/gizai/gizlang.git"
3
+ "version": "2.2.0",
4
+ "description": "The official command-line interface for giz.ai: run AI models, Drive, Computers and Apps, connect Claude Code, Codex and other agents over MCP, and run Gizlang (giz init, run, deploy), installed on first use.",
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/"
9
23
  },
10
- "license": "MIT",
11
- "publishConfig": {
12
- "access": "public"
24
+ "author": {
25
+ "name": "Giz Inc.",
26
+ "url": "https://www.giz.ai"
13
27
  },
28
+ "license": "UNLICENSED",
29
+ "type": "module",
14
30
  "bin": {
15
- "giz": "bin/giz.js",
16
- "gizdb": "bin/gizdb.js"
31
+ "giz": "cli/giz.mjs",
32
+ "gizdb": "cli/gizdb.mjs"
17
33
  },
18
34
  "files": [
19
- "bin"
35
+ "cli",
36
+ "skills",
37
+ "plugin.json",
38
+ "mcp.json",
39
+ "README.md"
20
40
  ],
21
41
  "engines": {
22
- "node": ">=16"
42
+ "node": ">=20.12"
43
+ },
44
+ "dependencies": {
45
+ "@modelcontextprotocol/sdk": "1.29.0",
46
+ "proper-lockfile": "4.1.2"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/gizai/giz.git",
51
+ "directory": "apps/giz/external"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "scripts": {
57
+ "check": "node --check cli/giz.mjs && node --test test/*.test.mjs"
23
58
  }
24
59
  }
package/plugin.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
+ "name": "giz",
4
+ "version": "2.0.1",
5
+ "description": "Run Giz models, media generation, Drive, tables, Apps and Computers from any agent: the giz skill plus the Giz MCP server.",
6
+ "author": { "name": "Giz", "url": "https://www.giz.ai" },
7
+ "homepage": "https://www.giz.ai/mcp/",
8
+ "license": "UNLICENSED",
9
+ "keywords": ["giz", "mcp", "media", "drive", "computer"]
10
+ }
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: giz
3
+ description: Use Giz text, image, video, audio, speech, embedding, reranking, Drive, and Computer capabilities from an AI agent. Trigger when the user asks to run an AI model through Giz, generate or transform media, embed or rerank content, inspect or modify Giz Drive files, operate a Giz Computer or terminal, or discover live Giz models and their parameters.
4
+ ---
5
+
6
+ # Giz
7
+
8
+ Use the `giz` CLI or the configured Giz MCP server. Prefer MCP when available and the CLI when working in a shell.
9
+
10
+ ## Workflow
11
+
12
+ 1. Run `model_list` before selecting an unfamiliar media model.
13
+ 2. Run `model_get` and treat its live input schema as the source of truth.
14
+ 3. Call `model_run` with the exact model ID and supported inputs.
15
+ 4. Generation returns a durable job. Poll `job_get`; do not resubmit while it is queued or processing.
16
+ 5. Preserve completed Drive URLs and paths. Use Drive tools to inspect or organize results.
17
+ 6. Use `giz_computer_exec` for commands; it runs outside persistent terminals and has a bounded deadline. Use `terminal_list`, `terminal_observe`, and `terminal_send` only to inspect or interact with an existing visible session. Pass a known exact Computer name, slug, or ID directly as `computer`; use `computer_list` only when the target is unknown or ambiguous.
18
+ 7. Ask for explicit confirmation immediately before destructive Drive removal, Computer runtime changes, or commands with material side effects.
19
+
20
+ ## CLI
21
+
22
+ Connect once in a browser:
23
+
24
+ ```bash
25
+ giz auth login
26
+ ```
27
+
28
+ Discover and generate:
29
+
30
+ ```bash
31
+ giz model list --type image-generation
32
+ giz model get MODEL_ID
33
+ giz model run MODEL_ID --input '{"prompt":"..."}'
34
+ ```
35
+
36
+ Use the OpenAI-compatible chat boundary:
37
+
38
+ ```bash
39
+ giz chat gpt-6-luna "..."
40
+ ```
41
+
42
+ Upload local media into an exact model field:
43
+
44
+ ```bash
45
+ giz model run MODEL_ID \
46
+ --input '{"prompt":"Animate this frame"}' \
47
+ --upload image=./frame.png
48
+ ```
49
+
50
+ Invoke an exact item-driven tool:
51
+
52
+ ```bash
53
+ giz invoke drive.readFile --input '{"path":"notes/brief.md"}'
54
+ ```
55
+
56
+ Pass `--json` for machine output. Use `GIZ_TOKEN` only in ephemeral automation.
57
+
58
+ ## Boundaries
59
+
60
+ - Do not guess model ids, parameter names, enum values, or costs.
61
+ - Do not turn argv arrays into shell strings.
62
+ - Do not read binary Drive content unless the task needs it; prefer returned URLs and metadata.
63
+ - Do not retry failed generations blindly. Report the provider or contract error.
64
+
65
+ Read [references/operations.md](references/operations.md) when MCP discovery is unavailable or when choosing between Drive and Computer tools.
66
+
67
+ App changes pass the `revision` read from `giz app list` explicitly.
68
+ `run`, `publish` and `delete` require `--expected-revision REVISION`.
69
+ The `--input` of `create` and `save` carries `id` and `expectedRevision` (0 for a new App).
70
+ The CLI never re-reads the list to substitute a revision, so the server rejects the call if another change landed after your review.
71
+
72
+ The table below is generated from the CLI dispatcher and the tool descriptors. To refresh it, run:
73
+ `GIZ_UPDATE_CLI_SURFACE=1 pnpm --filter giz-app-giz test --runInBand --runTestsByPath server/external/cli-surface.spec.ts`.
74
+ A normal CI run does not write the document; it fails on any difference in the table.
75
+
76
+ <!-- cli-surface:start -->
77
+ | Command | Tool ID | MCP tool | Required input | Scope | Agent discovery |
78
+ | --- | --- | --- | --- | --- | --- |
79
+ | model list | model.list | model_list | - | giz.read | model.list |
80
+ | model get | model.get | model_get | model | giz.read | model.get |
81
+ | model run | model.run | model_run | model, input | giz.inference | model.run |
82
+ | generate image | generateImage | generateImage | prompt | giz.write | generateImage |
83
+ | generate video | generateVideo | generateVideo | prompt | giz.write | generateVideo |
84
+ | generate music | generateMusic | generateMusic | prompt | giz.write | generateMusic |
85
+ | generate talking-head | generateTalkingHead | generateTalkingHead | prompt, references | giz.write | generateTalkingHead |
86
+ | generate audio | generateAudio | generateAudio | purpose | giz.write | generateAudio |
87
+ | job list | job.list | job_list | - | giz.read | server job |
88
+ | job get | job.get | job_get | job | giz.read | server job |
89
+ | job wait | job.get | job_get | job | giz.read | server job |
90
+ | job cancel | job.cancel | job_cancel | job | giz.destructive | server job |
91
+ | credits | account.credits | account_credits | - | giz.read | account.credits |
92
+ | drive ls | drive.list | drive_list | - | giz.read | drive.list |
93
+ | drive list | drive.list | drive_list | - | giz.read | drive.list |
94
+ | drive search | drive.search | drive_search | query | giz.read | drive.search |
95
+ | drive read | drive.readFile | drive_readFile | path | giz.read | drive.readFile |
96
+ | drive write | drive.writeFile | drive_writeFile | path, content | giz.write | drive.writeFile |
97
+ | drive mkdir | drive.makeDirectory | drive_makeDirectory | path | giz.write | drive.makeDirectory |
98
+ | drive move | drive.movePath | drive_movePath | from, to | giz.write | drive.movePath |
99
+ | drive delete | drive.deletePath | drive_deletePath | path | giz.destructive | drive.deletePath |
100
+ | table list | workspace.objects | workspace_objects | - | giz.read | workspace.objects |
101
+ | table get | workspace.objects | workspace_objects | - | giz.read | workspace.objects |
102
+ | table read | table.readRows | table_readRows | table | giz.read | table.readRows |
103
+ | table write | table.writeRows | table_writeRows | table | giz.write | table.writeRows |
104
+ | table action | workspace.executeAction | workspace_executeAction | view, action | giz.execute | workspace.executeAction |
105
+ | computer list | computer.list | computer_list | - | giz.read | computer.list |
106
+ | computer get | computer.get | computer_get | - | giz.read | external only |
107
+ | computer start | computer.start | computer_start | - | giz.execute | external only |
108
+ | computer stop | computer.stop | computer_stop | - | giz.destructive | external only |
109
+ | computer exec | computer.exec | giz_computer_exec | - | giz.execute | computer.exec |
110
+ | app list | app.list | app_list | - | giz.read | app.list |
111
+ | app create | app.save | app_save | id, expectedRevision | giz.execute | app.save |
112
+ | app save | app.save | app_save | id, expectedRevision | giz.execute | app.save |
113
+ | app run | app.run | app_run | id, expectedRevision | giz.execute | app.run |
114
+ | app publish | app.publish | app_publish | id, expectedRevision, visibility | giz.write | app.publish |
115
+ | app open | app.open | app_open | id | giz.read | app.open |
116
+ | app delete | app.delete | app_delete | id, expectedRevision | giz.destructive | app.delete |
117
+ | plugin list | plugin.catalog | plugin_catalog | - | giz.read | plugin.catalog |
118
+ | plugin search | plugin.catalog | plugin_catalog | - | giz.read | plugin.catalog |
119
+ | plugin inspect | plugin.catalog | plugin_catalog | - | giz.read | plugin.catalog |
120
+ | plugin install | plugin.install | plugin_install | - | giz.execute | plugin.install |
121
+ | plugin update | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
122
+ | plugin enable | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
123
+ | plugin disable | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
124
+ | plugin remove | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
125
+ | plugin publish | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
126
+ | plugin unpublish | plugin.manage | plugin_manage | operation | giz.destructive | plugin.manage |
127
+ | connection list | capability.status | capability_status | - | giz.read | capability.status |
128
+ | agent start | agent.start | agent_start | agentId, prompt | giz.execute | external only |
129
+ | agent status | agent.status | agent_status | turnId | giz.read | agent.status |
130
+ | agent cancel | agent.cancel | agent_cancel | turnId | giz.execute | agent.cancel |
131
+ <!-- cli-surface:end -->
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Giz"
3
+ short_description: "Use Giz media, Drive, and Computer tools"
4
+ default_prompt: "Use Giz to create media or work with my Drive and Computer."
@@ -0,0 +1,19 @@
1
+ # Giz operation map
2
+
3
+ | Goal | Operation |
4
+ |---|---|
5
+ | Discover non-LLM models and fields | `model_list`, `model_get` |
6
+ | Run any live non-LLM model | `model_run` |
7
+ | Track durable generation | `job_list`, `job_get`, `job_cancel` |
8
+ | List, search, or read Drive | `drive_list`, `drive_search`, `drive_readFile` |
9
+ | Create or change Drive content | `drive_writeFile`, `drive_makeDirectory`, `drive_movePath`, `drive_importUrl` |
10
+ | Move Drive content to Trash | `drive_deletePath` |
11
+ | Read a table's fields and rows | `table_readRows` |
12
+ | Create, update or remove table rows (one undoable change per call) | `table_writeRows` |
13
+ | Turn rows into a new table | `table_createFromRows` |
14
+ | Discover and control Computers | `computer_list`, `computer_start`, `computer_stop` |
15
+ | Run a Computer command | `giz_computer_exec` |
16
+ | Find, inspect, or interact with an existing terminal | `terminal_list`, `terminal_observe`, `terminal_send` |
17
+ | Record, inspect or transform media | `media_capture`, `media_probe`, `media_process` |
18
+
19
+ Always prefer the live `tools/list` result over this map. Streamable HTTP MCP is `/api/mcp`; ChatGPT OpenAPI is `/api/openapi.json`; the authenticated HTTP manifest is `/api/tools`. `giz_computer_exec` accepts an exact Computer name, slug, or ID as `computer`, argv `command`, optional `stdin`, `cwd`, and `deadlineMs`; do not send `timeoutMs`, `yieldMs`, `sessionId`, or shell command strings. Omit `computer` for the default Computer and use `computer_list` only when the target is unknown or ambiguous.
@@ -0,0 +1,95 @@
1
+ # Giz Presentation & Slide Authoring
2
+
3
+ The requested deliverable is a presentation: editable PPTX and, when requested,
4
+ PDF. Choose the design workflow from the user's intent. Image-designed proposals
5
+ start with complete slide images; direct SVG authoring remains an option.
6
+ `slides.create/read/edit/inspect/export` share one Drive document for reconstruction
7
+ and subsequent edits. The SVG is an intermediate representation and live preview;
8
+ it must not dictate or simplify the image model's design.
9
+
10
+ ## Image-designed proposals
11
+
12
+ 1. Read the source material and reference pages. Establish the audience, narrative,
13
+ approved wording, numbers and sources. Retain this content separately from image
14
+ recognition: generated pixels do not override approved facts.
15
+ 2. Discover the requested image model with `model.list/model.get`. Use its actual
16
+ quality, size and reference-image contract. Honor the requested model; report a
17
+ failure instead of silently substituting the default or a cheaper model. Use
18
+ `model.run` with the exact retrieved input schema for model-specific quality or
19
+ variant controls, including subsequent reference-image cleanup.
20
+ 3. Generate **complete slide designs**, including typography, headings, body copy,
21
+ diagrams, cards and artwork, through the existing image generation tools. Match
22
+ the reference's visual ambition, information density and aspect ratio. Pass reference images
23
+ to maintain composition and consistent design across pages. Save the finished
24
+ slide images in Drive; they are the visual targets for conversion.
25
+ 4. Inspect each target at readable resolution. Inventory all visible components,
26
+ including icons and decorative marks, before cleanup; account for every one in
27
+ the reconstructed layers. Reconstruct its actual composition,
28
+ text bounds, line breaks, hierarchy, colors, borders and grouping in reference
29
+ pixel coordinates. Do not redesign it as a generic template. Native text uses
30
+ the approved source wording even where the image misspells or changes a number.
31
+ 5. Extract photographs, logos and complex artwork with `assets` pixel crops.
32
+ Where editable labels overlap artwork, edit the original image through
33
+ the same image model and quality settings with that reference. Remove only the
34
+ labels and preserve the composition. Inspect the cleaned pixels for leftover glyphs and unwanted design
35
+ changes. Cropping alone does not clean text; flat masks cannot restore complex
36
+ backgrounds. Rebuild simple cards, lines, arrows and labels as native objects.
37
+ If retaining a background layer, remove those editable objects from its pixels
38
+ too: moving a card or text box must not leave its original raster version behind.
39
+ 6. Compose the reconstructed layers in one SVG document. Match the actual reference
40
+ dimensions on every page, preserve stable object IDs and logical `g` groups,
41
+ and use visible `text`/`tspan` with explicit line baselines and page fonts.
42
+ Do not outline glyphs or use invisible text over full-slide screenshots.
43
+ Preserve notes/citations and the original design image Drive path in each page's
44
+ `desc` so future edits can repeat the same reference comparison. Match the
45
+ reference typography and geometry; do not shrink body copy merely to hide an incorrect reconstruction.
46
+ 7. Run `slides.inspect` with `previewPages` and corresponding `referenceImages`.
47
+ This renders the deck once through PPTX and LibreOffice and returns each
48
+ original image beside its exported counterpart in the observation sequence.
49
+ Compare composition, artwork, typography, line breaks, content and cleanliness.
50
+ `info.export.textBounds` gives measured rendered lines in SVG coordinates;
51
+ use them to correct placement through `slides.read/edit`, then inspect again.
52
+ The technical `passed` flag does not measure similarity to the reference.
53
+ 8. Export the exact inspected revision with `slides.export`. Deliver the PPTX/PDF,
54
+ retain the original design images and editable source, and disclose raster-only
55
+ areas or unresolved differences. LibreOffice rendering does not establish pixel
56
+ identity in Microsoft PowerPoint.
57
+
58
+ ## Direct SVG authoring
59
+
60
+ When direct vector authoring suits the request, create native text, shapes, groups
61
+ and optional artwork directly, then use the same inspection and export path.
62
+ This option does not replace a requested image-model design workflow. The live
63
+ SVG editor and PowerPoint use different text renderers.
64
+
65
+ ## Canonical source and asset placement
66
+
67
+ ```json
68
+ {
69
+ "path": "Proposals/inventory.svg",
70
+ "content": "<svg xmlns=\"http://www.w3.org/2000/svg\" id=\"deck\" viewBox=\"0 0 1920 1080\"><svg data-slide=\"true\" id=\"slide-1\" viewBox=\"0 0 1920 1080\"><title>Inventory</title><rect width=\"1920\" height=\"1080\" fill=\"#FFFFFF\"/><image id=\"hero\" x=\"1000\" y=\"100\" width=\"800\" height=\"600\"/><g id=\"value\"><rect x=\"80\" y=\"160\" width=\"840\" height=\"320\" rx=\"16\" fill=\"#EEF4FA\"/><text id=\"headline\" x=\"120\" y=\"250\" font-family=\"Noto Sans CJK KR\" font-size=\"48\" fill=\"#123456\">재고를 한눈에 확인</text></g></svg></svg>",
71
+ "assets": {
72
+ "hero": { "path": "Proposals/artwork.png", "crop": { "left": 620, "top": 70, "width": 800, "height": 600 } }
73
+ }
74
+ }
75
+ ```
76
+
77
+ Asset paths are relative to the Drive root. A plain string embeds the whole image;
78
+ `{path,crop}` extracts exact pixels after EXIF orientation, without resizing.
79
+ SVG geometry controls placement. Out-of-bounds crops fail before saving. The same
80
+ asset map works for creation and element edits; an existing image requires its
81
+ replacement fingerprint. Embedded bytes make the saved document self-contained.
82
+
83
+ `slides.read` returns a compact outline. Selected text/shapes return exact XML and
84
+ opaque `before` values. Images and groups containing images return attributes and
85
+ `imageIds` instead of embedded bytes. Use `changes:[{id,before,attributes:{x:"80"}}]`
86
+ to change geometry without resending content; `null` removes an attribute. Use
87
+ `attributes:{}` together with `assets` to replace artwork. Attribute changes and
88
+ `after` XML replacements are mutually exclusive and share the same fingerprint/CAS.
89
+ Read individual child IDs when changing the contents of a group. Insert a page under the root with `slides.edit.inserts`; preserve
90
+ unrelated objects. Whole-document replacement requires `expectedRevision`.
91
+
92
+ Inspection example: `slides.inspect({path:"Proposals/inventory.svg", expectedRevision,
93
+ previewPages:[1], referenceImages:[{page:1,path:"Proposals/design-1.png"}], language:"ko-KR"})`. Export requires `path`, `expectedRevision`, `format` (`pptx` or
94
+ `pdf`) and a new `outputPath`. Set `language:"ko-KR"` for Korean. `reversePages`
95
+ changes export page order only when requested for the actual printing workflow.
package/LICENSE DELETED
@@ -1,21 +0,0 @@
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/bin/giz.js DELETED
@@ -1,103 +0,0 @@
1
- #!/usr/bin/env node
2
- // The npm entry of GizStack 0.1.0-preview.20261023.8 (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.20261023.8";
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
- // Once a day a detached node asks npm for the newest @gizai/cli; a later run in a terminal names a newer one in one line on
52
- // stderr. Off in CI, without a terminal and with GIZ_NO_UPDATE_CHECK, and it never delays or fails the command.
53
- function notice() {
54
- if (!process.stderr.isTTY || process.env.CI || process.env.GIZ_NO_UPDATE_CHECK) return;
55
- const file = path.join(os.homedir(), ".giz", "update-check.json");
56
- let seen = {};
57
- try { seen = JSON.parse(fs.readFileSync(file, "utf8")); } catch {}
58
- const newer = (a, b) => { const x = a.split("."), y = b.split("."); for (let i = 0; i < 3; i += 1) { if (+x[i] !== +y[i]) return +x[i] > +y[i]; } return false; };
59
- if (typeof seen.latest === "string" && /^\d+\.\d+\.\d+$/.test(seen.latest) && newer(seen.latest, "2.1.2")) {
60
- process.stderr.write("giz " + seen.latest + " is out (you have 2.1.2): giz update\n");
61
- }
62
- if (Date.now() - (seen.checked || 0) < 86400000) return;
63
- try {
64
- fs.mkdirSync(path.dirname(file), { recursive: true });
65
- fs.writeFileSync(file, JSON.stringify({ ...seen, checked: Date.now() }));
66
- const check = "fetch('https://registry.npmjs.org/@gizai/cli/latest').then(r => r.json()).then(j => { const f = process.argv[1]; const s = JSON.parse(require('fs').readFileSync(f, 'utf8')); require('fs').writeFileSync(f, JSON.stringify({ ...s, latest: j.version })); }).catch(() => {});";
67
- require("child_process").spawn(process.execPath, ["-e", check, file], { detached: true, stdio: "ignore" }).unref();
68
- } catch {}
69
- }
70
- notice();
71
- function run(file, standalone) {
72
- const env = { ...process.env, GIZ_INSTALLER: installer(), GIZ_SELF: process.argv[1],
73
- GIZ_SKILLS: path.join(__dirname, "..", "skills") };
74
- if (standalone) env.GIZ_STANDALONE = "1";
75
- const ran = spawnSync(file, process.argv.slice(2), { stdio: "inherit", env });
76
- if (ran.error) fail(ran.error.message);
77
- if (ran.signal) process.kill(process.pid, ran.signal);
78
- process.exit(ran.status === null ? 1 : ran.status);
79
- }
80
-
81
- // `gizdb` (bin/gizdb.js) is the same package's: the toolchain carries the server, so `npm i -g @gizai/cli && gizdb serve`
82
- // needs no PATH edit. It has no giz.ai commands.
83
- const database = process.env.GIZ_NPM_DATABASE === "1";
84
- delete process.env.GIZ_NPM_DATABASE;
85
- const argv = process.argv.slice(2);
86
- const command = commandOf(argv);
87
- const own = database ? undefined : bundled();
88
- if (process.platform === "win32") {
89
- if (!own) fail("the Windows binary package was not installed; reinstall without --omit=optional");
90
- run(own, true);
91
- }
92
- // `--version` goes to the toolchain: it names the toolchain's version, and the install guide's first command fetches it.
93
- // `help` with an argument (`giz help --all`, `giz help deploy`) is the toolchain's: the 2.0 binary knows only its own commands.
94
- if (own && (ACCOUNT.has(command) || argv.length === 0 || ((command === "help" || command === "-h") && argv.length === 1) || (command === "" && argv.includes("--help")))) {
95
- run(own, true);
96
- }
97
- const root = process.env.GIZ_INSTALL || path.join(os.homedir(), ".giz");
98
- const bin = path.join(root, "bin", database ? "gizdb" : "giz");
99
- const installed = spawnSync("sh", [path.join(__dirname, "install.sh"), ..."".split(" ").filter(Boolean), "--if-missing", "--no-modify-path", "--version", VERSION],
100
- { stdio: ["inherit", process.stderr, "inherit"], env: { ...process.env, GIZ_INSTALL: root } });
101
- if (installed.error) fail("cannot run sh: " + installed.error.message + ". Supported platforms: https://gizstack.com/download");
102
- if (installed.status !== 0) process.exit(installed.status === null ? 1 : installed.status);
103
- run(bin, false);
package/bin/gizdb.js DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- // gizdb of @gizai/cli: giz.js runs the installed toolchain's bin/gizdb.
3
- "use strict";
4
- process.env.GIZ_NPM_DATABASE = "1";
5
- require("./giz.js");