@gobi-ai/cli 0.6.7 → 0.6.9

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.
@@ -220,10 +220,18 @@ export function registerBrainCommand(program) {
220
220
  .description("Edit a published brain update. You must be the author.")
221
221
  .option("--title <title>", "New title for the update")
222
222
  .option("--content <content>", "New content for the update (markdown supported)")
223
+ .option("--vault-slug <vaultSlug>", "Vault slug for attachment uploads (overrides .gobi/settings.yaml)")
224
+ .option("--auto-attachments", "Upload wiki-linked [[files]] to webdrive before editing")
223
225
  .action(async (updateId, opts) => {
224
226
  if (!opts.title && !opts.content) {
225
227
  throw new Error("Provide at least --title or --content to update.");
226
228
  }
229
+ if (opts.autoAttachments && opts.content) {
230
+ const vaultSlug = resolveVaultSlug(opts);
231
+ const token = await getValidToken();
232
+ const links = extractWikiLinks(opts.content);
233
+ await uploadAttachments(vaultSlug, links, token, { addToSyncfiles: true });
234
+ }
227
235
  const body = {};
228
236
  if (opts.title != null)
229
237
  body.title = opts.title;
@@ -176,6 +176,8 @@ export function registerSpaceCommand(program) {
176
176
  .description("Edit a thread. You must be the author.")
177
177
  .option("--title <title>", "New title for the thread")
178
178
  .option("--content <content>", "New content for the thread (markdown supported)")
179
+ .option("--auto-attachments", "Upload wiki-linked [[files]] to webdrive before editing")
180
+ .option("--vault-slug <vaultSlug>", "Vault slug for attachment uploads (overrides .gobi/settings.yaml)")
179
181
  .action(async (threadId, opts) => {
180
182
  if (!opts.title && !opts.content) {
181
183
  throw new Error("Provide at least --title or --content to update.");
@@ -184,8 +186,16 @@ export function registerSpaceCommand(program) {
184
186
  const body = {};
185
187
  if (opts.title != null)
186
188
  body.title = opts.title;
187
- if (opts.content != null)
188
- body.content = readContent(opts.content);
189
+ if (opts.content != null) {
190
+ const content = readContent(opts.content);
191
+ if (opts.autoAttachments) {
192
+ const vaultSlug = resolveVaultSlug(opts);
193
+ const token = await getValidToken();
194
+ const links = extractWikiLinks(content);
195
+ await uploadAttachments(vaultSlug, links, token, { addToSyncfiles: true });
196
+ }
197
+ body.content = content;
198
+ }
189
199
  const resp = (await apiPatch(`/spaces/${spaceSlug}/threads/${threadId}`, body));
190
200
  const thread = unwrapResp(resp);
191
201
  if (isJsonMode(space)) {
@@ -228,9 +238,18 @@ export function registerSpaceCommand(program) {
228
238
  .command("edit-reply <replyId>")
229
239
  .description("Edit a reply. You must be the author.")
230
240
  .requiredOption("--content <content>", "New content for the reply (markdown supported)")
241
+ .option("--auto-attachments", "Upload wiki-linked [[files]] to webdrive before editing")
242
+ .option("--vault-slug <vaultSlug>", "Vault slug for attachment uploads (overrides .gobi/settings.yaml)")
231
243
  .action(async (replyId, opts) => {
232
244
  const spaceSlug = resolveSpaceSlug(space);
233
- const resp = (await apiPatch(`/spaces/${spaceSlug}/replies/${replyId}`, { content: readContent(opts.content) }));
245
+ const content = readContent(opts.content);
246
+ if (opts.autoAttachments) {
247
+ const vaultSlug = resolveVaultSlug(opts);
248
+ const token = await getValidToken();
249
+ const links = extractWikiLinks(content);
250
+ await uploadAttachments(vaultSlug, links, token, { addToSyncfiles: true });
251
+ }
252
+ const resp = (await apiPatch(`/spaces/${spaceSlug}/replies/${replyId}`, { content }));
234
253
  const msg = unwrapResp(resp);
235
254
  if (isJsonMode(space)) {
236
255
  jsonOut(msg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobi-ai/cli",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "CLI client for the Gobi collaborative knowledge platform",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,12 +10,12 @@ description: >-
10
10
  allowed-tools: Bash(gobi:*)
11
11
  metadata:
12
12
  author: gobi-ai
13
- version: "0.6.7"
13
+ version: "0.6.9"
14
14
  ---
15
15
 
16
16
  # gobi-cli
17
17
 
18
- A CLI client for the Gobi collaborative knowledge platform (v0.6.7).
18
+ A CLI client for the Gobi collaborative knowledge platform (v0.6.9).
19
19
 
20
20
  ## Prerequisites
21
21