@neta-art/cohub-cli 1.13.0 → 1.14.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/dist/commands/search.js +13 -6
- package/package.json +2 -2
package/dist/commands/search.js
CHANGED
|
@@ -3,7 +3,7 @@ import { table, json as outJson, jsonRequested, error, handleHttp } from "../out
|
|
|
3
3
|
const DEFAULT_LIMIT = 20;
|
|
4
4
|
const MAX_TITLE_LENGTH = 72;
|
|
5
5
|
const MAX_CONTEXT_LENGTH = 42;
|
|
6
|
-
const SEARCH_TYPES = new Set(["turn", "session", "space"]);
|
|
6
|
+
const SEARCH_TYPES = new Set(["turn", "session", "space", "label"]);
|
|
7
7
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
8
8
|
function clampLimit(value) {
|
|
9
9
|
const parsed = Number(value ?? DEFAULT_LIMIT);
|
|
@@ -42,7 +42,7 @@ function parseSearchInput(opts) {
|
|
|
42
42
|
const spaceId = opts.spaceId?.trim();
|
|
43
43
|
if (spaceId && !UUID_PATTERN.test(spaceId))
|
|
44
44
|
throw new Error("Invalid space id");
|
|
45
|
-
return { types, spaceId: spaceId || undefined };
|
|
45
|
+
return { types, spaceId: spaceId || undefined, labelRef: opts.labelRef?.trim() || undefined };
|
|
46
46
|
}
|
|
47
47
|
function rowsFor(items) {
|
|
48
48
|
return items.map((item) => ({
|
|
@@ -57,11 +57,12 @@ function rowsFor(items) {
|
|
|
57
57
|
export function registerSearch(program) {
|
|
58
58
|
program
|
|
59
59
|
.command("search")
|
|
60
|
-
.description("Search spaces, chats, and
|
|
61
|
-
.argument("
|
|
60
|
+
.description("Search spaces, chats, turns, and label items")
|
|
61
|
+
.argument("[query]", "Search query")
|
|
62
62
|
.option("--limit <n>", "Maximum results, 1-50", String(DEFAULT_LIMIT))
|
|
63
|
-
.option("--types <types>", "Comma-separated result types: turn,session,space")
|
|
63
|
+
.option("--types <types>", "Comma-separated result types: turn,session,space,label")
|
|
64
64
|
.option("--space-id <id>", "Limit search to a space")
|
|
65
|
+
.option("--label-ref <ref>", "Search items under an exact label ref")
|
|
65
66
|
.option("--json", "Output as JSON")
|
|
66
67
|
.addHelpText("after", `
|
|
67
68
|
|
|
@@ -69,17 +70,23 @@ Examples:
|
|
|
69
70
|
cohub search "release notes"
|
|
70
71
|
cohub search "failing tests" --limit 10
|
|
71
72
|
cohub search "bug" --types turn,session --space-id <spaceId>
|
|
73
|
+
cohub search --types label --label-ref bug
|
|
74
|
+
cohub search "login" --types label --label-ref bug
|
|
72
75
|
cohub search "design review" --json
|
|
73
76
|
`)
|
|
74
77
|
.action(async (query, opts) => {
|
|
75
78
|
const client = createClient();
|
|
76
79
|
try {
|
|
77
80
|
const input = parseSearchInput(opts);
|
|
81
|
+
const q = query ?? "";
|
|
82
|
+
if (!q.trim() && !input.labelRef)
|
|
83
|
+
return error("Search query is required unless --label-ref is provided.");
|
|
78
84
|
const result = await client.search.query({
|
|
79
|
-
q
|
|
85
|
+
q,
|
|
80
86
|
limit: clampLimit(opts.limit),
|
|
81
87
|
types: input.types,
|
|
82
88
|
spaceId: input.spaceId,
|
|
89
|
+
labelRef: input.labelRef,
|
|
83
90
|
});
|
|
84
91
|
if (jsonRequested(opts))
|
|
85
92
|
return outJson(result);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neta-art/cohub-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@neta-art/generation": "^0.1.2",
|
|
17
17
|
"commander": "^14.0.3",
|
|
18
18
|
"sharp": "^0.34.5",
|
|
19
|
-
"@neta-art/cohub": "1.
|
|
19
|
+
"@neta-art/cohub": "1.24.0"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|