@neta-art/cohub-cli 10.23.0 → 10.25.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/README.md +18 -5
- package/bin/cohub.js +4 -1
- package/dist/board-gpu/page.js +1566 -71230
- package/dist/bootstrap.js +67 -27
- package/dist/build.json +1 -1
- package/dist/{board-kernel/FilterPipe.js → chunks/Geometry.js} +10447 -10469
- package/dist/chunks/about.js +102 -0
- package/dist/chunks/app-realtime.js +2216 -0
- package/dist/chunks/app-realtime2.js +2 -0
- package/dist/chunks/app-ref.js +88 -0
- package/dist/chunks/apps.js +1423 -0
- package/dist/chunks/auth.js +175 -0
- package/dist/chunks/avatar.js +146 -0
- package/dist/chunks/board-export-resources.js +232 -0
- package/dist/chunks/board-export.js +874 -0
- package/dist/chunks/board-export2.js +2 -0
- package/dist/{board-kernel.js → chunks/board-kernel.js} +18032 -28512
- package/dist/chunks/board-kernel2.js +4 -0
- package/dist/chunks/board-profile.js +69 -0
- package/dist/chunks/board-simulate.js +315 -0
- package/dist/chunks/board-time.js +34 -0
- package/dist/chunks/boards.js +1943 -0
- package/dist/{board-kernel → chunks}/browserAll.js +9 -8
- package/dist/chunks/channels.js +64 -0
- package/dist/chunks/client.js +12606 -0
- package/dist/chunks/command-input.js +17 -0
- package/dist/chunks/commander.js +2962 -0
- package/dist/chunks/cron-jobs.js +163 -0
- package/dist/chunks/daemon.js +545 -0
- package/dist/chunks/daemon2.js +2 -0
- package/dist/chunks/desktop.js +172 -0
- package/dist/chunks/endpoint-options.js +26 -0
- package/dist/chunks/env-proxy.js +35 -0
- package/dist/chunks/environment.js +154 -0
- package/dist/chunks/feedback.js +120 -0
- package/dist/chunks/generations.js +379 -0
- package/dist/chunks/host.js +9 -0
- package/dist/chunks/http-put.js +131 -0
- package/dist/chunks/id.js +2416 -0
- package/dist/{board-kernel → chunks}/init.js +1 -1
- package/dist/chunks/install.js +11959 -0
- package/dist/chunks/launch.js +374 -0
- package/dist/chunks/local-media.js +47 -0
- package/dist/chunks/me.js +134 -0
- package/dist/chunks/media.js +315 -0
- package/dist/chunks/models.js +242 -0
- package/dist/chunks/operands.js +46 -0
- package/dist/chunks/package-paths.js +13 -0
- package/dist/chunks/policy.js +221 -0
- package/dist/chunks/preferences.js +29 -0
- package/dist/chunks/profile.js +64 -0
- package/dist/chunks/prompts.js +41 -0
- package/dist/chunks/public.js +2 -0
- package/dist/chunks/public2.js +244 -0
- package/dist/chunks/references.js +197 -0
- package/dist/chunks/referrals.js +90 -0
- package/dist/chunks/rolldown-runtime.js +26 -0
- package/dist/chunks/rooms-connect.js +2 -0
- package/dist/chunks/rooms-connect2.js +151 -0
- package/dist/chunks/rooms-rtc.js +309 -0
- package/dist/chunks/rooms.js +211 -0
- package/dist/chunks/run.js +220 -0
- package/dist/chunks/runtime.js +638 -0
- package/dist/chunks/runtime2.js +286 -0
- package/dist/chunks/runtimes.js +48 -0
- package/dist/chunks/safe-remote-image.js +198 -0
- package/dist/chunks/schemas.js +6017 -0
- package/dist/chunks/search.js +113 -0
- package/dist/chunks/self-update.js +238 -0
- package/dist/chunks/serve.js +1246 -0
- package/dist/chunks/session-status.js +24 -0
- package/dist/chunks/skills.js +35 -0
- package/dist/chunks/spaces.js +5080 -0
- package/dist/chunks/src.js +405 -0
- package/dist/chunks/supervisor.js +2511 -0
- package/dist/chunks/supervisor2.js +2 -0
- package/dist/chunks/tasks.js +82 -0
- package/dist/chunks/themes.js +2898 -0
- package/dist/chunks/version.js +2 -0
- package/dist/chunks/version2.js +22 -0
- package/dist/chunks/version3.js +18 -0
- package/dist/chunks/web.js +7 -0
- package/dist/{board-kernel → chunks}/webworkerAll.js +1 -1
- package/dist/runtime/native/pi-extension.js +174 -166
- package/dist/runtime/worker.js +27 -16
- package/package.json +8 -9
- package/dist/about.d.ts +0 -2
- package/dist/about.js +0 -71
- package/dist/app-download.d.ts +0 -11
- package/dist/app-download.js +0 -252
- package/dist/app-ref.d.ts +0 -5
- package/dist/app-ref.js +0 -8
- package/dist/app-target.d.ts +0 -26
- package/dist/app-target.js +0 -55
- package/dist/auth.d.ts +0 -45
- package/dist/auth.js +0 -307
- package/dist/avatar.d.ts +0 -55
- package/dist/avatar.js +0 -104
- package/dist/board-command-support.d.ts +0 -6
- package/dist/board-command-support.js +0 -88
- package/dist/board-export-resources.d.ts +0 -12
- package/dist/board-export-resources.js +0 -51
- package/dist/board-export.d.ts +0 -110
- package/dist/board-export.js +0 -592
- package/dist/board-fonts.d.ts +0 -11
- package/dist/board-fonts.js +0 -10
- package/dist/board-gpu/daemon.d.ts +0 -11
- package/dist/board-gpu/daemon.js +0 -295
- package/dist/board-gpu/index.d.ts +0 -33
- package/dist/board-gpu/index.js +0 -189
- package/dist/board-gpu/protocol.d.ts +0 -77
- package/dist/board-gpu/protocol.js +0 -1
- package/dist/board-kernel.d.ts +0 -5
- package/dist/board-media-export.d.ts +0 -17
- package/dist/board-media-export.js +0 -164
- package/dist/board-media.d.ts +0 -5
- package/dist/board-media.js +0 -66
- package/dist/board-profile.d.ts +0 -21
- package/dist/board-profile.js +0 -67
- package/dist/board-simulate.d.ts +0 -67
- package/dist/board-simulate.js +0 -259
- package/dist/board-time.d.ts +0 -3
- package/dist/board-time.js +0 -34
- package/dist/bootstrap.d.ts +0 -2
- package/dist/client.d.ts +0 -5
- package/dist/client.js +0 -24
- package/dist/command-input.d.ts +0 -4
- package/dist/command-input.js +0 -16
- package/dist/commands/app-commerce.d.ts +0 -2
- package/dist/commands/app-commerce.js +0 -228
- package/dist/commands/app-domains.d.ts +0 -2
- package/dist/commands/app-domains.js +0 -133
- package/dist/commands/apps.d.ts +0 -4
- package/dist/commands/apps.js +0 -827
- package/dist/commands/auth.d.ts +0 -2
- package/dist/commands/auth.js +0 -186
- package/dist/commands/boards/authoring.d.ts +0 -2
- package/dist/commands/boards/authoring.js +0 -166
- package/dist/commands/boards/examples.d.ts +0 -10
- package/dist/commands/boards/examples.js +0 -118
- package/dist/commands/boards.d.ts +0 -13
- package/dist/commands/boards.js +0 -836
- package/dist/commands/channels.d.ts +0 -2
- package/dist/commands/channels.js +0 -74
- package/dist/commands/cron-jobs.d.ts +0 -2
- package/dist/commands/cron-jobs.js +0 -155
- package/dist/commands/decision.d.ts +0 -4
- package/dist/commands/decision.js +0 -113
- package/dist/commands/desktop.d.ts +0 -10
- package/dist/commands/desktop.js +0 -233
- package/dist/commands/feedback.d.ts +0 -2
- package/dist/commands/feedback.js +0 -131
- package/dist/commands/generations.d.ts +0 -2
- package/dist/commands/generations.js +0 -427
- package/dist/commands/host.d.ts +0 -2
- package/dist/commands/host.js +0 -11
- package/dist/commands/me.d.ts +0 -2
- package/dist/commands/me.js +0 -118
- package/dist/commands/models.d.ts +0 -28
- package/dist/commands/models.js +0 -271
- package/dist/commands/profile.d.ts +0 -2
- package/dist/commands/profile.js +0 -81
- package/dist/commands/prompts.d.ts +0 -2
- package/dist/commands/prompts.js +0 -37
- package/dist/commands/public.d.ts +0 -20
- package/dist/commands/public.js +0 -291
- package/dist/commands/references.d.ts +0 -2
- package/dist/commands/references.js +0 -193
- package/dist/commands/referrals.d.ts +0 -2
- package/dist/commands/referrals.js +0 -88
- package/dist/commands/rooms-connect.d.ts +0 -17
- package/dist/commands/rooms-connect.js +0 -140
- package/dist/commands/rooms-rtc-binary.d.ts +0 -2
- package/dist/commands/rooms-rtc-binary.js +0 -107
- package/dist/commands/rooms-rtc.d.ts +0 -21
- package/dist/commands/rooms-rtc.js +0 -171
- package/dist/commands/rooms.d.ts +0 -3
- package/dist/commands/rooms.js +0 -277
- package/dist/commands/run.d.ts +0 -13
- package/dist/commands/run.js +0 -246
- package/dist/commands/runtime.d.ts +0 -3
- package/dist/commands/runtime.js +0 -320
- package/dist/commands/sandboxd-binary.d.ts +0 -11
- package/dist/commands/sandboxd-binary.js +0 -238
- package/dist/commands/search.d.ts +0 -2
- package/dist/commands/search.js +0 -114
- package/dist/commands/session-access.d.ts +0 -2
- package/dist/commands/session-access.js +0 -70
- package/dist/commands/skills.d.ts +0 -2
- package/dist/commands/skills.js +0 -34
- package/dist/commands/space-activity.d.ts +0 -26
- package/dist/commands/space-activity.js +0 -147
- package/dist/commands/space-commerce.d.ts +0 -2
- package/dist/commands/space-commerce.js +0 -514
- package/dist/commands/space-displays.d.ts +0 -2
- package/dist/commands/space-displays.js +0 -620
- package/dist/commands/space-files.d.ts +0 -5
- package/dist/commands/space-files.js +0 -215
- package/dist/commands/space-invitations.d.ts +0 -29
- package/dist/commands/space-invitations.js +0 -189
- package/dist/commands/space-turns.d.ts +0 -49
- package/dist/commands/space-turns.js +0 -205
- package/dist/commands/space-wallet.d.ts +0 -2
- package/dist/commands/space-wallet.js +0 -64
- package/dist/commands/space-webhooks.d.ts +0 -7
- package/dist/commands/space-webhooks.js +0 -73
- package/dist/commands/spaces.d.ts +0 -25
- package/dist/commands/spaces.js +0 -2139
- package/dist/commands/tasks.d.ts +0 -8
- package/dist/commands/tasks.js +0 -80
- package/dist/commands/version.d.ts +0 -2
- package/dist/commands/version.js +0 -21
- package/dist/endpoint-options.d.ts +0 -4
- package/dist/endpoint-options.js +0 -26
- package/dist/env-proxy.d.ts +0 -5
- package/dist/env-proxy.js +0 -20
- package/dist/help-path.d.ts +0 -18
- package/dist/help-path.js +0 -223
- package/dist/host/auth.d.ts +0 -20
- package/dist/host/auth.js +0 -119
- package/dist/host/login-env.d.ts +0 -1
- package/dist/host/login-env.js +0 -31
- package/dist/host/runtime.d.ts +0 -35
- package/dist/host/runtime.js +0 -395
- package/dist/host/runtimes.d.ts +0 -9
- package/dist/host/runtimes.js +0 -42
- package/dist/host/serve.d.ts +0 -2
- package/dist/host/serve.js +0 -117
- package/dist/host/workspaces.d.ts +0 -2
- package/dist/host/workspaces.js +0 -18
- package/dist/http-put.d.ts +0 -25
- package/dist/http-put.js +0 -132
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -129
- package/dist/launcher.d.ts +0 -4
- package/dist/launcher.js +0 -38
- package/dist/local-media.d.ts +0 -2
- package/dist/local-media.js +0 -30
- package/dist/network-error.d.ts +0 -3
- package/dist/network-error.js +0 -22
- package/dist/output.d.ts +0 -46
- package/dist/output.js +0 -244
- package/dist/runtime/archive-store.d.ts +0 -54
- package/dist/runtime/archive-store.js +0 -379
- package/dist/runtime/cli-path.d.ts +0 -5
- package/dist/runtime/cli-path.js +0 -27
- package/dist/runtime/codex-usage.d.ts +0 -7
- package/dist/runtime/codex-usage.js +0 -11
- package/dist/runtime/connection.d.ts +0 -42
- package/dist/runtime/connection.js +0 -789
- package/dist/runtime/diagnostics.d.ts +0 -107
- package/dist/runtime/diagnostics.js +0 -392
- package/dist/runtime/harnesses/chained-projection.d.ts +0 -40
- package/dist/runtime/harnesses/chained-projection.js +0 -95
- package/dist/runtime/harnesses/chained-transcript.d.ts +0 -24
- package/dist/runtime/harnesses/chained-transcript.js +0 -62
- package/dist/runtime/harnesses/claude-approval.d.ts +0 -34
- package/dist/runtime/harnesses/claude-approval.js +0 -124
- package/dist/runtime/harnesses/claude-transcript.d.ts +0 -8
- package/dist/runtime/harnesses/claude-transcript.js +0 -138
- package/dist/runtime/harnesses/claude.d.ts +0 -8
- package/dist/runtime/harnesses/claude.js +0 -225
- package/dist/runtime/harnesses/codex-approval.d.ts +0 -25
- package/dist/runtime/harnesses/codex-approval.js +0 -69
- package/dist/runtime/harnesses/codex.d.ts +0 -4
- package/dist/runtime/harnesses/codex.js +0 -269
- package/dist/runtime/harnesses/cursor-transcript.d.ts +0 -37
- package/dist/runtime/harnesses/cursor-transcript.js +0 -183
- package/dist/runtime/harnesses/cursor.d.ts +0 -24
- package/dist/runtime/harnesses/cursor.js +0 -620
- package/dist/runtime/harnesses/index.d.ts +0 -16
- package/dist/runtime/harnesses/index.js +0 -73
- package/dist/runtime/harnesses/pi.d.ts +0 -4
- package/dist/runtime/harnesses/pi.js +0 -247
- package/dist/runtime/harnesses/process.d.ts +0 -31
- package/dist/runtime/harnesses/process.js +0 -75
- package/dist/runtime/harnesses/stream-json.d.ts +0 -48
- package/dist/runtime/harnesses/stream-json.js +0 -336
- package/dist/runtime/harnesses/types.d.ts +0 -117
- package/dist/runtime/harnesses/types.js +0 -1
- package/dist/runtime/harnesses/workbuddy-transcript.d.ts +0 -8
- package/dist/runtime/harnesses/workbuddy-transcript.js +0 -127
- package/dist/runtime/harnesses/workbuddy.d.ts +0 -21
- package/dist/runtime/harnesses/workbuddy.js +0 -123
- package/dist/runtime/instance.d.ts +0 -20
- package/dist/runtime/instance.js +0 -247
- package/dist/runtime/json-rpc.d.ts +0 -53
- package/dist/runtime/json-rpc.js +0 -212
- package/dist/runtime/launch.d.ts +0 -25
- package/dist/runtime/launch.js +0 -247
- package/dist/runtime/local-workspace.d.ts +0 -15
- package/dist/runtime/local-workspace.js +0 -52
- package/dist/runtime/model-catalog.d.ts +0 -12
- package/dist/runtime/model-catalog.js +0 -84
- package/dist/runtime/native/adapters.d.ts +0 -15
- package/dist/runtime/native/adapters.js +0 -11
- package/dist/runtime/native/approvals.d.ts +0 -18
- package/dist/runtime/native/approvals.js +0 -54
- package/dist/runtime/native/archive.d.ts +0 -19
- package/dist/runtime/native/archive.js +0 -142
- package/dist/runtime/native/attach.d.ts +0 -36
- package/dist/runtime/native/attach.js +0 -128
- package/dist/runtime/native/codex-link.d.ts +0 -60
- package/dist/runtime/native/codex-link.js +0 -322
- package/dist/runtime/native/config.d.ts +0 -16
- package/dist/runtime/native/config.js +0 -24
- package/dist/runtime/native/daemon.d.ts +0 -92
- package/dist/runtime/native/daemon.js +0 -380
- package/dist/runtime/native/execution.d.ts +0 -26
- package/dist/runtime/native/execution.js +0 -34
- package/dist/runtime/native/identity.d.ts +0 -9
- package/dist/runtime/native/identity.js +0 -15
- package/dist/runtime/native/ingest.d.ts +0 -263
- package/dist/runtime/native/ingest.js +0 -884
- package/dist/runtime/native/install.d.ts +0 -9
- package/dist/runtime/native/install.js +0 -113
- package/dist/runtime/native/paths.d.ts +0 -2
- package/dist/runtime/native/paths.js +0 -7
- package/dist/runtime/native/pi-extension.d.ts +0 -36
- package/dist/runtime/native/pi-link.d.ts +0 -69
- package/dist/runtime/native/pi-link.js +0 -269
- package/dist/runtime/native/results.d.ts +0 -41
- package/dist/runtime/native/results.js +0 -128
- package/dist/runtime/native/sessions.d.ts +0 -45
- package/dist/runtime/native/sessions.js +0 -87
- package/dist/runtime/native/transcript.d.ts +0 -89
- package/dist/runtime/native/transcript.js +0 -656
- package/dist/runtime/native/translate.d.ts +0 -46
- package/dist/runtime/native/translate.js +0 -299
- package/dist/runtime/native/transport.d.ts +0 -7
- package/dist/runtime/native/transport.js +0 -16
- package/dist/runtime/native/version.d.ts +0 -5
- package/dist/runtime/native/version.js +0 -21
- package/dist/runtime/preferences.d.ts +0 -7
- package/dist/runtime/preferences.js +0 -22
- package/dist/runtime/presentation.d.ts +0 -32
- package/dist/runtime/presentation.js +0 -124
- package/dist/runtime/process-group.d.ts +0 -5
- package/dist/runtime/process-group.js +0 -161
- package/dist/runtime/projection-store.d.ts +0 -27
- package/dist/runtime/projection-store.js +0 -30
- package/dist/runtime/space-binding.d.ts +0 -48
- package/dist/runtime/space-binding.js +0 -342
- package/dist/runtime/supervisor.d.ts +0 -19
- package/dist/runtime/supervisor.js +0 -441
- package/dist/runtime/turn-projection.d.ts +0 -41
- package/dist/runtime/turn-projection.js +0 -120
- package/dist/runtime/worker.d.ts +0 -1
- package/dist/safe-remote-image.d.ts +0 -36
- package/dist/safe-remote-image.js +0 -191
- package/dist/self-update.d.ts +0 -7
- package/dist/self-update.js +0 -202
- package/dist/session-status.d.ts +0 -6
- package/dist/session-status.js +0 -16
- package/dist/space-files/limit.d.ts +0 -2
- package/dist/space-files/limit.js +0 -16
- package/dist/space-files/operands.d.ts +0 -17
- package/dist/space-files/operands.js +0 -33
- package/dist/space-files/transfer.d.ts +0 -53
- package/dist/space-files/transfer.js +0 -297
- package/dist/space-files/upload.d.ts +0 -17
- package/dist/space-files/upload.js +0 -76
- package/dist/space.d.ts +0 -44
- package/dist/space.js +0 -192
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -17
- package/dist/web.d.ts +0 -1
- package/dist/web.js +0 -4
- /package/dist/{board-kernel → chunks}/lexer.js +0 -0
package/dist/commands/search.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { isUuid } from "@neta-art/cohub";
|
|
2
|
-
import { createClient } from "../client.js";
|
|
3
|
-
import { formatLocalDateTime, table, json as outJson, jsonRequested, error, handleHttp, truncateText } from "../output.js";
|
|
4
|
-
const DEFAULT_LIMIT = 20;
|
|
5
|
-
const MAX_TITLE_LENGTH = 72;
|
|
6
|
-
const MAX_CONTEXT_LENGTH = 42;
|
|
7
|
-
const MAX_MATCH_LENGTH = 60;
|
|
8
|
-
const SEARCH_TYPES = new Set(["chat", "space", "label"]);
|
|
9
|
-
function clampLimit(value) {
|
|
10
|
-
const parsed = Number(value ?? DEFAULT_LIMIT);
|
|
11
|
-
if (!Number.isFinite(parsed))
|
|
12
|
-
return DEFAULT_LIMIT;
|
|
13
|
-
return Math.min(Math.max(Math.floor(parsed), 1), 50);
|
|
14
|
-
}
|
|
15
|
-
function contextFor(item) {
|
|
16
|
-
const owner = item.ownerProfile;
|
|
17
|
-
if (owner?.username)
|
|
18
|
-
return `@${owner.username}`;
|
|
19
|
-
if (owner?.displayName)
|
|
20
|
-
return owner.displayName;
|
|
21
|
-
if (item.type === "label")
|
|
22
|
-
return item.labelRef ?? "";
|
|
23
|
-
return item.spaceName ?? "";
|
|
24
|
-
}
|
|
25
|
-
function matchFor(item) {
|
|
26
|
-
if (item.hit)
|
|
27
|
-
return item.hit.excerpt;
|
|
28
|
-
return item.matchedField;
|
|
29
|
-
}
|
|
30
|
-
function parseTypes(value) {
|
|
31
|
-
const types = value
|
|
32
|
-
?.split(",")
|
|
33
|
-
.map((type) => type.trim())
|
|
34
|
-
.filter(Boolean);
|
|
35
|
-
if (!types?.length)
|
|
36
|
-
return undefined;
|
|
37
|
-
const invalidType = types.find((type) => !SEARCH_TYPES.has(type));
|
|
38
|
-
if (invalidType)
|
|
39
|
-
throw new Error(`Invalid search type: ${invalidType}`);
|
|
40
|
-
return [...new Set(types)];
|
|
41
|
-
}
|
|
42
|
-
function parseSearchInput(opts) {
|
|
43
|
-
const types = parseTypes(opts.types);
|
|
44
|
-
const spaceId = opts.spaceId?.trim();
|
|
45
|
-
if (spaceId && !isUuid(spaceId))
|
|
46
|
-
throw new Error("Invalid space id");
|
|
47
|
-
return { types, spaceId: spaceId || undefined, labelRef: opts.labelRef?.trim() || undefined };
|
|
48
|
-
}
|
|
49
|
-
function rowsFor(items) {
|
|
50
|
-
return items.map((item) => ({
|
|
51
|
-
type: item.type,
|
|
52
|
-
title: truncateText(item.title || "New chat", MAX_TITLE_LENGTH),
|
|
53
|
-
context: truncateText(contextFor(item), MAX_CONTEXT_LENGTH),
|
|
54
|
-
match: truncateText(matchFor(item), MAX_MATCH_LENGTH),
|
|
55
|
-
updated: item.updatedAt ? formatLocalDateTime(item.updatedAt).slice(0, 10) : "",
|
|
56
|
-
href: item.href,
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
export function registerSearch(program) {
|
|
60
|
-
program
|
|
61
|
-
.command("search")
|
|
62
|
-
.description("Search spaces, chats, and label items")
|
|
63
|
-
.argument("[query]", "Search query")
|
|
64
|
-
.option("--limit <n>", "Maximum results, 1-50", String(DEFAULT_LIMIT))
|
|
65
|
-
.option("--types <types>", "Comma-separated result types: chat,space,label")
|
|
66
|
-
.option("--space-id <id>", "Limit search to a space")
|
|
67
|
-
.option("--label-ref <ref>", "Search items under an exact label ref")
|
|
68
|
-
.option("--json", "Output as JSON")
|
|
69
|
-
.addHelpText("after", `
|
|
70
|
-
|
|
71
|
-
Examples:
|
|
72
|
-
cohub search "release notes"
|
|
73
|
-
cohub search "failing tests" --limit 10
|
|
74
|
-
cohub search "bug" --types chat --space-id <spaceId>
|
|
75
|
-
cohub search --types label --label-ref bug
|
|
76
|
-
cohub search "login" --types label --label-ref bug
|
|
77
|
-
cohub search "design review" --json
|
|
78
|
-
`)
|
|
79
|
-
.action(async (query, opts) => {
|
|
80
|
-
const client = createClient();
|
|
81
|
-
try {
|
|
82
|
-
const input = parseSearchInput(opts);
|
|
83
|
-
const q = query ?? "";
|
|
84
|
-
if (!q.trim() && !input.labelRef)
|
|
85
|
-
return error("Search query is required unless --label-ref is provided.");
|
|
86
|
-
const result = await client.search.query({
|
|
87
|
-
q,
|
|
88
|
-
limit: clampLimit(opts.limit),
|
|
89
|
-
types: input.types,
|
|
90
|
-
spaceId: input.spaceId,
|
|
91
|
-
labelRef: input.labelRef,
|
|
92
|
-
});
|
|
93
|
-
if (jsonRequested(opts))
|
|
94
|
-
return outJson(result);
|
|
95
|
-
if (result.degraded) {
|
|
96
|
-
process.stderr.write(" Search is temporarily degraded; results may be incomplete.\n");
|
|
97
|
-
}
|
|
98
|
-
table(rowsFor(result.items), [
|
|
99
|
-
{ key: "type", label: "Type" },
|
|
100
|
-
{ key: "title", label: "Title" },
|
|
101
|
-
{ key: "context", label: "Context" },
|
|
102
|
-
{ key: "match", label: "Match" },
|
|
103
|
-
{ key: "updated", label: "Updated" },
|
|
104
|
-
{ key: "href", label: "Href" },
|
|
105
|
-
]);
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
if (e instanceof Error && (e.message === "Invalid space id" || e.message.startsWith("Invalid search type:"))) {
|
|
109
|
-
return error(e.message);
|
|
110
|
-
}
|
|
111
|
-
handleHttp(e);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { createClient } from "../client.js";
|
|
2
|
-
import { table, json as outJson, jsonRequested, error, handleHttp } from "../output.js";
|
|
3
|
-
const SPACE_ROLES = ["host", "builder", "guest"];
|
|
4
|
-
function parseAnonymousRole(value) {
|
|
5
|
-
if (value === undefined || value === "null")
|
|
6
|
-
return null;
|
|
7
|
-
if (SPACE_ROLES.includes(value))
|
|
8
|
-
return value;
|
|
9
|
-
return error("Invalid anonymous role", "Use one of: host, builder, guest, null");
|
|
10
|
-
}
|
|
11
|
-
export function registerSessionAccess(program) {
|
|
12
|
-
const cmd = program
|
|
13
|
-
.command("session-access")
|
|
14
|
-
.description("Session-level access control");
|
|
15
|
-
cmd
|
|
16
|
-
.command("get <id>")
|
|
17
|
-
.description("Get session access policy")
|
|
18
|
-
.option("--json", "Output as JSON")
|
|
19
|
-
.action(async (id, opts) => {
|
|
20
|
-
const client = createClient();
|
|
21
|
-
try {
|
|
22
|
-
const policy = await client.sessionAccess.get(id);
|
|
23
|
-
if (jsonRequested(opts))
|
|
24
|
-
return outJson(policy);
|
|
25
|
-
table([policy], [
|
|
26
|
-
{ key: "signed_in_user", label: "Signed-in" },
|
|
27
|
-
{ key: "anonymous_user", label: "Anonymous" },
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
handleHttp(e);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
cmd
|
|
35
|
-
.command("set <id>")
|
|
36
|
-
.description("Set session anonymous access")
|
|
37
|
-
.option("--anonymous <role>", "Anonymous role (host|builder|guest|null)")
|
|
38
|
-
.option("--json", "Output as JSON")
|
|
39
|
-
.action(async (id, opts) => {
|
|
40
|
-
const client = createClient();
|
|
41
|
-
try {
|
|
42
|
-
const policy = await client.sessionAccess.set(id, {
|
|
43
|
-
anonymous_user: parseAnonymousRole(opts.anonymous),
|
|
44
|
-
});
|
|
45
|
-
if (jsonRequested(opts))
|
|
46
|
-
return outJson(policy);
|
|
47
|
-
console.log("Session access updated");
|
|
48
|
-
table([policy], [
|
|
49
|
-
{ key: "signed_in_user", label: "Signed-in" },
|
|
50
|
-
{ key: "anonymous_user", label: "Anonymous" },
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
handleHttp(e);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
cmd
|
|
58
|
-
.command("remove <id>")
|
|
59
|
-
.description("Remove session access override")
|
|
60
|
-
.action(async (id) => {
|
|
61
|
-
const client = createClient();
|
|
62
|
-
try {
|
|
63
|
-
await client.sessionAccess.remove(id);
|
|
64
|
-
console.log(`Session access override removed: ${id}`);
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
handleHttp(e);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
package/dist/commands/skills.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createClient } from "../client.js";
|
|
2
|
-
import { table, json as outJson, jsonRequested, handleHttp } from "../output.js";
|
|
3
|
-
export function registerSkills(program) {
|
|
4
|
-
const cmd = program.command("skills").description("Skill management");
|
|
5
|
-
cmd
|
|
6
|
-
.command("ls")
|
|
7
|
-
.alias("list")
|
|
8
|
-
.description("List skills available for slash commands")
|
|
9
|
-
.option("--space <id>", "Filter by space")
|
|
10
|
-
.option("--json", "Output as JSON")
|
|
11
|
-
.action(async (opts) => {
|
|
12
|
-
const client = createClient();
|
|
13
|
-
try {
|
|
14
|
-
const spaceId = opts.space ?? program.opts().space;
|
|
15
|
-
const result = await client.skills.list({ spaceId });
|
|
16
|
-
if (jsonRequested(opts))
|
|
17
|
-
return outJson(result);
|
|
18
|
-
if (result.skills.length === 0)
|
|
19
|
-
return console.log(" (empty)");
|
|
20
|
-
table(result.skills.map((skill) => ({
|
|
21
|
-
command: `/skill:${skill.name}`,
|
|
22
|
-
source: skill.source?.type === "mod" ? `mod:${skill.source.mountSlug}` : skill.scope,
|
|
23
|
-
description: skill.description,
|
|
24
|
-
})), [
|
|
25
|
-
{ key: "command", label: "Command" },
|
|
26
|
-
{ key: "source", label: "Source" },
|
|
27
|
-
{ key: "description", label: "Description" },
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
handleHttp(e);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { SpaceActivityAppRanking, SpaceActivityContributor, SpaceActivityResponse } from "@neta-art/cohub";
|
|
2
|
-
import type { Command } from "commander";
|
|
3
|
-
import { type Row } from "../output.js";
|
|
4
|
-
export type SpaceActivityCliOptions = {
|
|
5
|
-
json?: boolean;
|
|
6
|
-
};
|
|
7
|
-
type SpaceActivityCommandClient = {
|
|
8
|
-
space(spaceId: string): {
|
|
9
|
-
activity: {
|
|
10
|
-
get(days: number): Promise<SpaceActivityResponse>;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export declare class InvalidSpaceActivityDaysError extends Error {
|
|
15
|
-
readonly detail: string;
|
|
16
|
-
constructor(message: string, detail: string);
|
|
17
|
-
}
|
|
18
|
-
/** Shared with the API: any positive day count up to a full leap year. */
|
|
19
|
-
export declare function parseActivityDays(value: string | undefined): number;
|
|
20
|
-
export declare function toContributorRows(items: SpaceActivityContributor[]): Row[];
|
|
21
|
-
export declare function toAppRankingRows(apps: SpaceActivityAppRanking[]): Row[];
|
|
22
|
-
export declare function printActivityReport(activity: SpaceActivityResponse): void;
|
|
23
|
-
export declare function registerSpaceActivity(spacesCmd: Command, dependencies?: {
|
|
24
|
-
createClient?: () => SpaceActivityCommandClient;
|
|
25
|
-
}): void;
|
|
26
|
-
export {};
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { createClient } from "../client.js";
|
|
2
|
-
import { error, handleHttp, json as outJson, jsonRequested, table, } from "../output.js";
|
|
3
|
-
import { resolveSpace } from "../space.js";
|
|
4
|
-
const DEFAULT_DAYS = 30;
|
|
5
|
-
const MAX_DAYS = 365;
|
|
6
|
-
export class InvalidSpaceActivityDaysError extends Error {
|
|
7
|
-
detail;
|
|
8
|
-
constructor(message, detail) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.detail = detail;
|
|
11
|
-
this.name = "InvalidSpaceActivityDaysError";
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/** Shared with the API: any positive day count up to a full leap year. */
|
|
15
|
-
export function parseActivityDays(value) {
|
|
16
|
-
const raw = (value ?? String(DEFAULT_DAYS)).trim();
|
|
17
|
-
if (!/^\d+$/.test(raw)) {
|
|
18
|
-
throw new InvalidSpaceActivityDaysError("Invalid days", "days must be a positive integer");
|
|
19
|
-
}
|
|
20
|
-
const days = Number.parseInt(raw, 10);
|
|
21
|
-
if (days < 1 || days > MAX_DAYS) {
|
|
22
|
-
throw new InvalidSpaceActivityDaysError("Invalid days", `days must be between 1 and ${MAX_DAYS}`);
|
|
23
|
-
}
|
|
24
|
-
return days;
|
|
25
|
-
}
|
|
26
|
-
const formatNumber = (value) => new Intl.NumberFormat("en-US").format(Number(value) || 0);
|
|
27
|
-
const formatCost = (value) => `$${(Number(value) || 0).toFixed(2)}`;
|
|
28
|
-
function relativeTime(timestamp) {
|
|
29
|
-
if (!timestamp)
|
|
30
|
-
return "";
|
|
31
|
-
const at = new Date(timestamp).getTime();
|
|
32
|
-
if (!Number.isFinite(at))
|
|
33
|
-
return "";
|
|
34
|
-
const deltaMs = Date.now() - at;
|
|
35
|
-
const minutes = Math.round(deltaMs / 60_000);
|
|
36
|
-
if (minutes < 1)
|
|
37
|
-
return "just now";
|
|
38
|
-
if (minutes < 60)
|
|
39
|
-
return `${minutes}m ago`;
|
|
40
|
-
const hours = Math.round(minutes / 60);
|
|
41
|
-
if (hours < 24)
|
|
42
|
-
return `${hours}h ago`;
|
|
43
|
-
return `${Math.round(hours / 24)}d ago`;
|
|
44
|
-
}
|
|
45
|
-
export function toContributorRows(items) {
|
|
46
|
-
return items.map((contributor) => ({
|
|
47
|
-
name: contributor.profile?.displayName ||
|
|
48
|
-
contributor.profile?.username ||
|
|
49
|
-
contributor.userUuid,
|
|
50
|
-
role: contributor.role ?? "",
|
|
51
|
-
tokens: formatNumber(contributor.tokens),
|
|
52
|
-
requests: formatNumber(contributor.requests),
|
|
53
|
-
sessions: contributor.sessionCount,
|
|
54
|
-
cost: formatCost(contributor.costTotal),
|
|
55
|
-
lastActive: relativeTime(contributor.lastActiveAt),
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
58
|
-
export function toAppRankingRows(apps) {
|
|
59
|
-
return apps.map((app) => ({
|
|
60
|
-
title: app.title,
|
|
61
|
-
status: app.status,
|
|
62
|
-
views: formatNumber(app.viewCount),
|
|
63
|
-
id: app.appId,
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
export function printActivityReport(activity) {
|
|
67
|
-
const { totals } = activity;
|
|
68
|
-
const showCost = totals.costTotal !== 0;
|
|
69
|
-
console.log(`\n Summary (last ${activity.days} days):`);
|
|
70
|
-
table([totals], [
|
|
71
|
-
{ key: "totalTokens", label: "Tokens", format: formatNumber },
|
|
72
|
-
{ key: "requestCount", label: "Requests", format: formatNumber },
|
|
73
|
-
...(showCost ? [{ key: "costTotal", label: "Cost", format: formatCost }] : []),
|
|
74
|
-
{ key: "successCount", label: "Success", format: formatNumber },
|
|
75
|
-
{ key: "errorCount", label: "Errors", format: formatNumber },
|
|
76
|
-
]);
|
|
77
|
-
if (activity.contributors.items.length > 0) {
|
|
78
|
-
console.log(`\n Contributors (${activity.contributors.memberCount} members):`);
|
|
79
|
-
table(toContributorRows(activity.contributors.items), [
|
|
80
|
-
{ key: "name", label: "Name" },
|
|
81
|
-
{ key: "role", label: "Role" },
|
|
82
|
-
{ key: "tokens", label: "Tokens" },
|
|
83
|
-
{ key: "requests", label: "Requests" },
|
|
84
|
-
{ key: "sessions", label: "Sessions" },
|
|
85
|
-
...(showCost ? [{ key: "cost", label: "Cost" }] : []),
|
|
86
|
-
{ key: "lastActive", label: "Last active" },
|
|
87
|
-
]);
|
|
88
|
-
}
|
|
89
|
-
const { llmModels, generationModels, apps } = activity.rankings;
|
|
90
|
-
if (llmModels.length > 0) {
|
|
91
|
-
console.log("\n Top LLM models:");
|
|
92
|
-
table(llmModels, [
|
|
93
|
-
{ key: "model", label: "Model" },
|
|
94
|
-
{ key: "provider", label: "Provider" },
|
|
95
|
-
{ key: "totalTokens", label: "Tokens", format: formatNumber },
|
|
96
|
-
{ key: "requestCount", label: "Requests", format: formatNumber },
|
|
97
|
-
...(showCost ? [{ key: "costTotal", label: "Cost", format: formatCost }] : []),
|
|
98
|
-
]);
|
|
99
|
-
}
|
|
100
|
-
if (generationModels.length > 0) {
|
|
101
|
-
console.log("\n Top generation models:");
|
|
102
|
-
table(generationModels, [
|
|
103
|
-
{ key: "model", label: "Model" },
|
|
104
|
-
{ key: "provider", label: "Provider" },
|
|
105
|
-
{ key: "requestCount", label: "Calls", format: formatNumber },
|
|
106
|
-
...(showCost ? [{ key: "costTotal", label: "Cost", format: formatCost }] : []),
|
|
107
|
-
]);
|
|
108
|
-
}
|
|
109
|
-
if (apps.length > 0) {
|
|
110
|
-
console.log("\n Most viewed apps:");
|
|
111
|
-
table(toAppRankingRows(apps), [
|
|
112
|
-
{ key: "title", label: "App" },
|
|
113
|
-
{ key: "views", label: "Views" },
|
|
114
|
-
{ key: "status", label: "Status" },
|
|
115
|
-
{ key: "id", label: "ID" },
|
|
116
|
-
]);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
export function registerSpaceActivity(spacesCmd, dependencies = {}) {
|
|
120
|
-
spacesCmd
|
|
121
|
-
.command("activity [days]")
|
|
122
|
-
.description("Space activity overview: usage, contributors, rankings")
|
|
123
|
-
.option("--json", "Output as JSON")
|
|
124
|
-
.action(async (days, opts) => {
|
|
125
|
-
const spaceId = await resolveSpace(spacesCmd);
|
|
126
|
-
let parsedDays;
|
|
127
|
-
try {
|
|
128
|
-
parsedDays = parseActivityDays(days);
|
|
129
|
-
}
|
|
130
|
-
catch (cause) {
|
|
131
|
-
if (cause instanceof InvalidSpaceActivityDaysError) {
|
|
132
|
-
return error(cause.message, cause.detail);
|
|
133
|
-
}
|
|
134
|
-
throw cause;
|
|
135
|
-
}
|
|
136
|
-
const client = dependencies.createClient?.() ?? createClient();
|
|
137
|
-
try {
|
|
138
|
-
const activity = await client.space(spaceId).activity.get(parsedDays);
|
|
139
|
-
if (jsonRequested(opts))
|
|
140
|
-
return outJson(activity);
|
|
141
|
-
printActivityReport(activity);
|
|
142
|
-
}
|
|
143
|
-
catch (cause) {
|
|
144
|
-
handleHttp(cause);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|