@gobi-ai/cli 1.1.0 → 1.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.
@@ -1,141 +0,0 @@
1
- import { existsSync, readFileSync } from "fs";
2
- import { join } from "path";
3
- import { apiGet, apiPost } from "../client.js";
4
- import { WEBDRIVE_BASE_URL } from "../constants.js";
5
- import { getValidToken } from "../auth/manager.js";
6
- import { getVaultSlug } from "./init.js";
7
- import { isJsonMode, jsonOut, unwrapResp } from "./utils.js";
8
- export function registerVaultCommand(program) {
9
- const vaultCmd = program
10
- .command("vault")
11
- .description("Vault commands. A Vault is your personal knowledge container — search public vaults, ask them questions, and publish a PUBLISH.md to make a vault public.");
12
- // ── Search ──
13
- vaultCmd
14
- .command("search")
15
- .description("Search public vaults by text and semantic similarity.")
16
- .requiredOption("--query <query>", "Search query")
17
- .action(async (opts) => {
18
- const resp = (await apiGet(`/vault/public/search`, {
19
- query: opts.query,
20
- }));
21
- const results = (Array.isArray(resp) ? resp : resp.data || resp);
22
- if (isJsonMode(vaultCmd)) {
23
- jsonOut(results || []);
24
- return;
25
- }
26
- if (!results || results.length === 0) {
27
- console.log(`No vaults found matching "${opts.query}".`);
28
- return;
29
- }
30
- const lines = [];
31
- for (const entry of results) {
32
- const vault = (entry.vault || entry);
33
- const owner = (entry.owner || {});
34
- const ownerName = owner.name ? ` by ${owner.name}` : "";
35
- const sim = entry.similarity != null
36
- ? ` [similarity: ${entry.similarity.toFixed(3)}]`
37
- : "";
38
- const spaceSlug = (entry.spaceSlug || vault.spaceSlug || "");
39
- const vaultSlug = (vault.slug || vault.vaultSlug || vault.id || "N/A");
40
- lines.push(`- ${vault.name || vault.title || "N/A"} (vault: ${vaultSlug}, space: ${spaceSlug || "N/A"})${ownerName}${sim}`);
41
- }
42
- console.log(`Vaults matching "${opts.query}":\n` + lines.join("\n"));
43
- });
44
- // ── Ask ──
45
- vaultCmd
46
- .command("ask")
47
- .description("Ask a vault a question. Creates a targeted session (1:1 conversation).")
48
- .requiredOption("--vault-slug <vaultSlug>", "Slug of the vault to ask")
49
- .option("--question <question>", "The question to ask (markdown supported)")
50
- .option("--rich-text <richText>", "Rich-text JSON array (e.g. [{\"type\":\"text\",\"text\":\"hello\"}])")
51
- .option("--mode <mode>", 'Session mode: "auto" or "manual"')
52
- .action(async (opts) => {
53
- if (!opts.question && !opts.richText) {
54
- throw new Error("Provide either --question or --rich-text.");
55
- }
56
- if (opts.question && opts.richText) {
57
- throw new Error("--question and --rich-text are mutually exclusive.");
58
- }
59
- const body = {
60
- vaultSlug: opts.vaultSlug,
61
- };
62
- if (opts.question != null)
63
- body.question = opts.question;
64
- if (opts.richText != null) {
65
- let parsed;
66
- try {
67
- parsed = JSON.parse(opts.richText);
68
- }
69
- catch {
70
- throw new Error("Invalid --rich-text JSON.");
71
- }
72
- body.richText = parsed;
73
- }
74
- if (opts.mode != null)
75
- body.mode = opts.mode;
76
- const resp = (await apiPost(`/chat/targeted`, body));
77
- const data = unwrapResp(resp);
78
- if (isJsonMode(vaultCmd)) {
79
- jsonOut(data);
80
- return;
81
- }
82
- const session = (data.session || {});
83
- const members = (data.members || []);
84
- console.log(`Session created!\n` +
85
- ` Session ID: ${session.id}\n` +
86
- ` Mode: ${session.mode}\n` +
87
- ` Members: ${members.length}\n` +
88
- ` Question sent.`);
89
- });
90
- // ── Publish ──
91
- vaultCmd
92
- .command("publish")
93
- .description("Upload PUBLISH.md to the vault root on webdrive. Triggers post-processing (vault sync, metadata update, Discord notification).")
94
- .action(async () => {
95
- const vaultId = getVaultSlug();
96
- const filePath = join(process.cwd(), "PUBLISH.md");
97
- if (!existsSync(filePath)) {
98
- throw new Error(`PUBLISH.md not found in ${process.cwd()}`);
99
- }
100
- const content = readFileSync(filePath, "utf-8");
101
- const token = await getValidToken();
102
- const url = `${WEBDRIVE_BASE_URL}/api/v1/vaults/${vaultId}/file/PUBLISH.md`;
103
- const res = await fetch(url, {
104
- method: "PUT",
105
- headers: {
106
- Authorization: `Bearer ${token}`,
107
- "Content-Type": "text/markdown",
108
- },
109
- body: content,
110
- });
111
- if (!res.ok) {
112
- throw new Error(`Upload failed: HTTP ${res.status}: ${(await res.text()) || "(no body)"}`);
113
- }
114
- if (isJsonMode(vaultCmd)) {
115
- jsonOut({ vaultId });
116
- return;
117
- }
118
- console.log(`Published PUBLISH.md to vault "${vaultId}"`);
119
- });
120
- // ── Unpublish ──
121
- vaultCmd
122
- .command("unpublish")
123
- .description("Delete PUBLISH.md from the vault on webdrive.")
124
- .action(async () => {
125
- const vaultId = getVaultSlug();
126
- const token = await getValidToken();
127
- const url = `${WEBDRIVE_BASE_URL}/api/v1/vaults/${vaultId}/file/PUBLISH.md`;
128
- const res = await fetch(url, {
129
- method: "DELETE",
130
- headers: { Authorization: `Bearer ${token}` },
131
- });
132
- if (!res.ok) {
133
- throw new Error(`Delete failed: HTTP ${res.status}: ${(await res.text()) || "(no body)"}`);
134
- }
135
- if (isJsonMode(vaultCmd)) {
136
- jsonOut({ vaultId });
137
- return;
138
- }
139
- console.log(`Deleted PUBLISH.md from vault "${vaultId}"`);
140
- });
141
- }
@@ -1,82 +0,0 @@
1
- # gobi global
2
-
3
- ```
4
- Usage: gobi global [options] [command]
5
-
6
- Global thread commands. Global is the platform-wide thread feed visible to everyone on Gobi.
7
-
8
- Options:
9
- -h, --help display help for command
10
-
11
- Commands:
12
- messages [options] List the global unified message feed (threads and replies, newest first).
13
- get-thread [options] <threadId> Get a global thread and its direct replies (paginated).
14
- ancestors <threadId> Show the ancestor lineage of a global thread or reply (root → immediate parent).
15
- create-thread [options] Create a global thread (visible platform-wide).
16
- reply [options] <threadId> Reply to a global thread.
17
- help [command] display help for command
18
- ```
19
-
20
- ## messages
21
-
22
- ```
23
- Usage: gobi global messages [options]
24
-
25
- List the global unified message feed (threads and replies, newest first).
26
-
27
- Options:
28
- --limit <number> Items per page (default: "20")
29
- --cursor <string> Pagination cursor from previous response
30
- -h, --help display help for command
31
- ```
32
-
33
- ## get-thread
34
-
35
- ```
36
- Usage: gobi global get-thread [options] <threadId>
37
-
38
- Get a global thread and its direct replies (paginated).
39
-
40
- Options:
41
- --limit <number> Replies per page (default: "20")
42
- --cursor <string> Pagination cursor from previous response
43
- -h, --help display help for command
44
- ```
45
-
46
- ## ancestors
47
-
48
- ```
49
- Usage: gobi global ancestors [options] <threadId>
50
-
51
- Show the ancestor lineage of a global thread or reply (root → immediate parent).
52
-
53
- Options:
54
- -h, --help display help for command
55
- ```
56
-
57
- ## create-thread
58
-
59
- ```
60
- Usage: gobi global create-thread [options]
61
-
62
- Create a global thread (visible platform-wide).
63
-
64
- Options:
65
- --title <title> Title of the thread
66
- --content <content> Thread content (markdown supported, use "-" for stdin)
67
- --rich-text <richText> Rich-text JSON array (mutually exclusive with --content)
68
- -h, --help display help for command
69
- ```
70
-
71
- ## reply
72
-
73
- ```
74
- Usage: gobi global reply [options] <threadId>
75
-
76
- Reply to a global thread.
77
-
78
- Options:
79
- --content <content> Reply content (markdown supported, use "-" for stdin)
80
- --rich-text <richText> Rich-text JSON array (mutually exclusive with --content)
81
- -h, --help display help for command
82
- ```
@@ -1,100 +0,0 @@
1
- ---
2
- name: gobi-vault
3
- description: >-
4
- Gobi vault commands for knowledge management: search public vaults by text
5
- and semantic similarity, ask vaults questions, and publish/unpublish
6
- PUBLISH.md. Use when the user wants to search knowledge, ask a vault, or
7
- publish their vault document.
8
- allowed-tools: Bash(gobi:*)
9
- metadata:
10
- author: gobi-ai
11
- version: "1.1.0"
12
- ---
13
-
14
- # gobi-vault
15
-
16
- Gobi vault commands for knowledge management (v1.1.0).
17
-
18
- Requires gobi-cli installed and authenticated. See gobi-core skill for setup.
19
-
20
- ## Gobi Vault — Knowledge Management
21
-
22
- `gobi vault` commands manage your vault: search public vaults, ask them questions, and publish/unpublish your `PUBLISH.md`. Public vaults are accessible at `https://gobispace.com/@{vaultSlug}`.
23
-
24
- > **Vault updates have moved to threads.** To post user-level content, use `gobi global create-thread` (platform-wide global) or `gobi space create-thread` (a specific space). See the **gobi-space** skill.
25
-
26
- ## Important: JSON Mode
27
-
28
- For programmatic/agent usage, always pass `--json` as a **global** option (before the subcommand):
29
-
30
- ```bash
31
- gobi --json vault search --query "machine learning"
32
- ```
33
-
34
- ## Available Commands
35
-
36
- - `gobi vault search` — Search public vaults by text and semantic similarity.
37
- - `gobi vault ask` — Ask a vault a question. Creates a targeted session (1:1 conversation).
38
- - `gobi vault publish` — Upload PUBLISH.md to the vault root on webdrive. Triggers post-processing (vault sync, metadata update, Discord notification).
39
- - `gobi vault unpublish` — Delete PUBLISH.md from the vault on webdrive.
40
-
41
- ## PUBLISH.md Frontmatter Reference
42
-
43
- `PUBLISH.md` is the metadata file at the root of every vault. Its YAML frontmatter controls the vault's public profile, homepage, and AI agent behavior. Example:
44
-
45
- ```yaml
46
- ---
47
- title: My Vault
48
- tags:
49
- - topic1
50
- - topic2
51
- description: A short description of what this vault is about.
52
- thumbnail: "[[VAULT.png]]"
53
- homepage: "[[app/home.html?nav=false]]"
54
- prompt: "[[system-prompt.md]]"
55
- ---
56
- ```
57
-
58
- ### Fields
59
-
60
- - **`title`** (required) — Display name of the vault.
61
- - **`description`** (required for public listing) — Short description shown on the vault card and public profile. Without both `title` and `description`, the vault won't appear in the public catalog.
62
- - **`tags`** — Tags for categorization and discovery. Supports YAML block list or inline array format:
63
- ```yaml
64
- # Block list
65
- tags:
66
- - ambient ai
67
- - wearables
68
-
69
- # Inline array
70
- tags: [ambient ai, wearables]
71
- ```
72
- - **`thumbnail`** — Profile image for the vault card. Uses wiki-link syntax pointing to an image file in the vault (e.g. `"[[VAULT.png]]"`).
73
- - **`homepage`** — Custom HTML page to serve as the vault's public homepage at `gobispace.com/@{vaultSlug}`. Uses wiki-link syntax pointing to an HTML file in the vault. Supports a `nav` query parameter to control Gobi's sidebar navigation:
74
- - `"[[app/home.html]]"` — Shows the Gobi sidebar alongside the homepage (default)
75
- - `"[[app/home.html?nav=false]]"` — Full-screen, no Gobi sidebar/chrome
76
- - **`prompt`** — Wiki-link to a custom system prompt file for the vault's AI agent (e.g. `"[[system-prompt.md]]"`).
77
-
78
- > For details on building custom HTML homepages and using the `window.gobi` API, see the **gobi-homepage** skill.
79
-
80
- ## Publishing Workflow
81
-
82
- After editing `PUBLISH.md` frontmatter, follow these steps to make your changes live:
83
-
84
- 1. **Edit `PUBLISH.md`** in the vault root with the desired frontmatter fields.
85
- 2. **Sync referenced files** — if the homepage HTML, thumbnail image, or prompt file is new or updated, upload them first:
86
- ```bash
87
- gobi sync
88
- ```
89
- 3. **Publish the vault**:
90
- ```bash
91
- gobi vault publish
92
- ```
93
- This uploads `PUBLISH.md` to webdrive, triggers post-processing that extracts metadata (title, description, tags, thumbnail, homepage path), updates the vault's public profile, and sends a Discord notification.
94
- 4. The vault is now live at `https://gobispace.com/@{vaultSlug}`.
95
-
96
- > **Important:** Any time you change `PUBLISH.md` frontmatter (e.g. adding or updating `homepage`), you must re-run `gobi vault publish` for the changes to take effect.
97
-
98
- ## Reference Documentation
99
-
100
- - [gobi vault](references/vault.md)
@@ -1,66 +0,0 @@
1
- # gobi vault
2
-
3
- ```
4
- Usage: gobi vault [options] [command]
5
-
6
- Vault commands. A Vault is your personal knowledge container — search public vaults, ask them questions, and publish a PUBLISH.md to make a vault public.
7
-
8
- Options:
9
- -h, --help display help for command
10
-
11
- Commands:
12
- search [options] Search public vaults by text and semantic similarity.
13
- ask [options] Ask a vault a question. Creates a targeted session (1:1 conversation).
14
- publish Upload PUBLISH.md to the vault root on webdrive. Triggers post-processing (vault sync, metadata update, Discord notification).
15
- unpublish Delete PUBLISH.md from the vault on webdrive.
16
- help [command] display help for command
17
- ```
18
-
19
- ## search
20
-
21
- ```
22
- Usage: gobi vault search [options]
23
-
24
- Search public vaults by text and semantic similarity.
25
-
26
- Options:
27
- --query <query> Search query
28
- -h, --help display help for command
29
- ```
30
-
31
- ## ask
32
-
33
- ```
34
- Usage: gobi vault ask [options]
35
-
36
- Ask a vault a question. Creates a targeted session (1:1 conversation).
37
-
38
- Options:
39
- --vault-slug <vaultSlug> Slug of the vault to ask
40
- --question <question> The question to ask (markdown supported)
41
- --rich-text <richText> Rich-text JSON array (e.g. [{"type":"text","text":"hello"}])
42
- --mode <mode> Session mode: "auto" or "manual"
43
- -h, --help display help for command
44
- ```
45
-
46
- ## publish
47
-
48
- ```
49
- Usage: gobi vault publish [options]
50
-
51
- Upload PUBLISH.md to the vault root on webdrive. Triggers post-processing (vault sync, metadata update, Discord notification).
52
-
53
- Options:
54
- -h, --help display help for command
55
- ```
56
-
57
- ## unpublish
58
-
59
- ```
60
- Usage: gobi vault unpublish [options]
61
-
62
- Delete PUBLISH.md from the vault on webdrive.
63
-
64
- Options:
65
- -h, --help display help for command
66
- ```