stow-cli 2.2.0 → 2.2.3
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 +10 -10
- package/dist/app-ZIHTOHXL.js +255 -0
- package/dist/backfill-BG65X4TP.js +65 -0
- package/dist/backfill-JCNPLFJU.js +67 -0
- package/dist/backfill-KW46AEAL.js +67 -0
- package/dist/backfill-VAORMLMY.js +67 -0
- package/dist/buckets-AFNX7FV3.js +137 -0
- package/dist/buckets-FPMMPRR2.js +130 -0
- package/dist/buckets-JJBWUVKF.js +137 -0
- package/dist/buckets-VYI2QVLO.js +137 -0
- package/dist/chunk-533UGNLM.js +42 -0
- package/dist/chunk-5BVMPHKH.js +147 -0
- package/dist/chunk-5IX3ASXH.js +153 -0
- package/dist/chunk-AHBVZRDR.js +29 -0
- package/dist/chunk-KPIQZBTO.js +151 -0
- package/dist/chunk-MYFLRBWC.js +312 -0
- package/dist/chunk-NBHBVKP5.js +54 -0
- package/dist/chunk-PE6V3MVP.js +46 -0
- package/dist/chunk-RH4BOSYB.js +153 -0
- package/dist/chunk-XVKIRHTX.js +29 -0
- package/dist/cli.js +184 -200
- package/dist/delete-3UDS4RMH.js +34 -0
- package/dist/delete-CQJEGLP3.js +34 -0
- package/dist/describe-CU5FBHZS.js +79 -0
- package/dist/describe-HSEHMJVD.js +79 -0
- package/dist/describe-NH3K3LLW.js +79 -0
- package/dist/describe-W3ED4VW3.js +79 -0
- package/dist/drops-XO4CZ4BH.js +39 -0
- package/dist/files-BIMA5L2G.js +206 -0
- package/dist/files-CFOTEASC.js +206 -0
- package/dist/files-SQURZ7VO.js +194 -0
- package/dist/files-XU6MDPP4.js +206 -0
- package/dist/health-3U3RHXFS.js +56 -0
- package/dist/health-SH6T6DZS.js +61 -0
- package/dist/health-TIJU6U2D.js +61 -0
- package/dist/health-YLNNKAFP.js +61 -0
- package/dist/jobs-HUW6Z6A7.js +87 -0
- package/dist/jobs-KK5IZYO5.js +99 -0
- package/dist/jobs-RMRGXLAA.js +90 -0
- package/dist/jobs-ROJFRPMR.js +90 -0
- package/dist/jobs-SX7DIN6T.js +90 -0
- package/dist/jobs-TND5AHCL.js +102 -0
- package/dist/jobs-TOLVGN6K.js +102 -0
- package/dist/jobs-XUAXWUAK.js +102 -0
- package/dist/maintenance-6XNJ56LL.js +79 -0
- package/dist/maintenance-7UBKZOR3.js +79 -0
- package/dist/maintenance-US3PUKFF.js +79 -0
- package/dist/maintenance-V2TXPXQE.js +79 -0
- package/dist/mcp-TUZZB2C7.js +189 -0
- package/dist/profiles-FOLKZZRU.js +53 -0
- package/dist/profiles-MB3TZQE4.js +53 -0
- package/dist/profiles-NVCJCYXR.js +53 -0
- package/dist/profiles-XXVM3UKI.js +53 -0
- package/dist/queues-AUGTAFBT.js +61 -0
- package/dist/queues-MTA2RWUP.js +56 -0
- package/dist/queues-NR25TGT7.js +61 -0
- package/dist/queues-X6IU3KBZ.js +61 -0
- package/dist/search-ETC2EXKM.js +135 -0
- package/dist/search-ICJO264J.js +135 -0
- package/dist/search-ULMFDWHE.js +135 -0
- package/dist/search-UWLK4OL2.js +119 -0
- package/dist/tags-75SSHS26.js +90 -0
- package/dist/tags-OFZQ2XCX.js +90 -0
- package/dist/tags-TBFPDHIQ.js +90 -0
- package/dist/tags-V43DCLPQ.js +90 -0
- package/dist/upload-F5I2SJRB.js +126 -0
- package/dist/upload-N7NAVN3Q.js +126 -0
- package/dist/whoami-WUQDFC5P.js +28 -0
- package/package.json +20 -20
- package/LICENSE +0 -21
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createStow
|
|
3
|
+
} from "./chunk-5LU25QZK.js";
|
|
4
|
+
import "./chunk-TOADDO2F.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/mcp.ts
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
async function startMcpServer() {
|
|
9
|
+
const { McpServer } = await import("@modelcontextprotocol/sdk/server/mcp.js");
|
|
10
|
+
const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
11
|
+
const server = new McpServer({
|
|
12
|
+
name: "stow",
|
|
13
|
+
version: "2.0.4"
|
|
14
|
+
});
|
|
15
|
+
server.tool("stow_whoami", "Show current user and organization", {}, async () => {
|
|
16
|
+
const stow = createStow();
|
|
17
|
+
const result = await stow.whoami();
|
|
18
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
19
|
+
});
|
|
20
|
+
server.tool("stow_buckets_list", "List all buckets", {}, async () => {
|
|
21
|
+
const stow = createStow();
|
|
22
|
+
const result = await stow.listBuckets();
|
|
23
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
24
|
+
});
|
|
25
|
+
server.tool(
|
|
26
|
+
"stow_files_list",
|
|
27
|
+
"List files in a bucket",
|
|
28
|
+
{
|
|
29
|
+
bucket: z.string().describe("Bucket name"),
|
|
30
|
+
limit: z.number().optional().describe("Max results (default 50)")
|
|
31
|
+
},
|
|
32
|
+
async (params) => {
|
|
33
|
+
const stow = createStow();
|
|
34
|
+
const result = await stow.listFiles({
|
|
35
|
+
bucket: params.bucket,
|
|
36
|
+
limit: params.limit
|
|
37
|
+
});
|
|
38
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
server.tool(
|
|
42
|
+
"stow_files_get",
|
|
43
|
+
"Get file details",
|
|
44
|
+
{
|
|
45
|
+
bucket: z.string().describe("Bucket name"),
|
|
46
|
+
key: z.string().describe("File key")
|
|
47
|
+
},
|
|
48
|
+
async (params) => {
|
|
49
|
+
const stow = createStow();
|
|
50
|
+
const result = await stow.getFile(params.key, {
|
|
51
|
+
bucket: params.bucket
|
|
52
|
+
});
|
|
53
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
server.tool(
|
|
57
|
+
"stow_search_text",
|
|
58
|
+
"Search files by text query",
|
|
59
|
+
{
|
|
60
|
+
query: z.string().describe("Search query"),
|
|
61
|
+
bucket: z.string().optional().describe("Bucket name (optional)"),
|
|
62
|
+
limit: z.number().optional().describe("Max results (default 10)")
|
|
63
|
+
},
|
|
64
|
+
async (params) => {
|
|
65
|
+
const stow = createStow();
|
|
66
|
+
const result = await stow.search.text({
|
|
67
|
+
query: params.query,
|
|
68
|
+
bucket: params.bucket,
|
|
69
|
+
limit: params.limit
|
|
70
|
+
});
|
|
71
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
server.tool(
|
|
75
|
+
"stow_search_similar",
|
|
76
|
+
"Find visually similar files",
|
|
77
|
+
{
|
|
78
|
+
fileKey: z.string().describe("File key to find similar files for"),
|
|
79
|
+
bucket: z.string().optional().describe("Bucket name (optional)"),
|
|
80
|
+
limit: z.number().optional().describe("Max results (default 10)")
|
|
81
|
+
},
|
|
82
|
+
async (params) => {
|
|
83
|
+
const stow = createStow();
|
|
84
|
+
const result = await stow.search.similar({
|
|
85
|
+
fileKey: params.fileKey,
|
|
86
|
+
bucket: params.bucket,
|
|
87
|
+
limit: params.limit
|
|
88
|
+
});
|
|
89
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
server.tool(
|
|
93
|
+
"stow_search_color",
|
|
94
|
+
"Search files by hex color",
|
|
95
|
+
{
|
|
96
|
+
hex: z.string().describe("Hex color code (e.g. #ff0000)"),
|
|
97
|
+
bucket: z.string().optional().describe("Bucket name (optional)"),
|
|
98
|
+
limit: z.number().optional().describe("Max results (default 10)")
|
|
99
|
+
},
|
|
100
|
+
async (params) => {
|
|
101
|
+
const stow = createStow();
|
|
102
|
+
const result = await stow.search.color({
|
|
103
|
+
hex: params.hex,
|
|
104
|
+
bucket: params.bucket,
|
|
105
|
+
limit: params.limit
|
|
106
|
+
});
|
|
107
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
server.tool(
|
|
111
|
+
"stow_search_diverse",
|
|
112
|
+
"Get a diverse set of files from a bucket",
|
|
113
|
+
{
|
|
114
|
+
bucket: z.string().optional().describe("Bucket name (optional)"),
|
|
115
|
+
limit: z.number().optional().describe("Max results (default 10)")
|
|
116
|
+
},
|
|
117
|
+
async (params) => {
|
|
118
|
+
const stow = createStow();
|
|
119
|
+
const result = await stow.search.diverse({
|
|
120
|
+
bucket: params.bucket,
|
|
121
|
+
limit: params.limit
|
|
122
|
+
});
|
|
123
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
server.tool(
|
|
127
|
+
"stow_search_image",
|
|
128
|
+
"Search by image URL or existing file key",
|
|
129
|
+
{
|
|
130
|
+
url: z.string().optional().describe("Image URL to search by"),
|
|
131
|
+
fileKey: z.string().optional().describe("Existing file key to search by"),
|
|
132
|
+
bucket: z.string().optional().describe("Bucket name (optional)"),
|
|
133
|
+
limit: z.number().optional().describe("Max results (default 12)")
|
|
134
|
+
},
|
|
135
|
+
async (params) => {
|
|
136
|
+
const stow = createStow();
|
|
137
|
+
const input = {};
|
|
138
|
+
if (params.url) {
|
|
139
|
+
input.url = params.url;
|
|
140
|
+
}
|
|
141
|
+
if (params.fileKey) {
|
|
142
|
+
input.fileKey = params.fileKey;
|
|
143
|
+
}
|
|
144
|
+
const result = await stow.search.image(input, {
|
|
145
|
+
bucket: params.bucket,
|
|
146
|
+
limit: params.limit ?? 12
|
|
147
|
+
});
|
|
148
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
server.tool("stow_tags_list", "List all tags", {}, async () => {
|
|
152
|
+
const stow = createStow();
|
|
153
|
+
const result = await stow.tags.list();
|
|
154
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
155
|
+
});
|
|
156
|
+
server.tool(
|
|
157
|
+
"stow_anchors_list",
|
|
158
|
+
"List anchors in a bucket",
|
|
159
|
+
{
|
|
160
|
+
bucket: z.string().optional().describe("Bucket name (optional)")
|
|
161
|
+
},
|
|
162
|
+
async (params) => {
|
|
163
|
+
const stow = createStow();
|
|
164
|
+
const result = await stow.anchors.list({ bucket: params.bucket });
|
|
165
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
server.tool(
|
|
169
|
+
"stow_anchors_create",
|
|
170
|
+
"Create a text anchor for semantic search",
|
|
171
|
+
{
|
|
172
|
+
text: z.string().describe("Anchor text to embed"),
|
|
173
|
+
label: z.string().optional().describe("Human-readable label (optional)")
|
|
174
|
+
},
|
|
175
|
+
async (params) => {
|
|
176
|
+
const stow = createStow();
|
|
177
|
+
const result = await stow.anchors.create({
|
|
178
|
+
text: params.text,
|
|
179
|
+
label: params.label
|
|
180
|
+
});
|
|
181
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
const transport = new StdioServerTransport();
|
|
185
|
+
await server.connect(transport);
|
|
186
|
+
}
|
|
187
|
+
export {
|
|
188
|
+
startMcpServer
|
|
189
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
output
|
|
3
|
+
} from "./chunk-RH4BOSYB.js";
|
|
4
|
+
import {
|
|
5
|
+
formatTable
|
|
6
|
+
} from "./chunk-FZGOTXTE.js";
|
|
7
|
+
import {
|
|
8
|
+
createStow
|
|
9
|
+
} from "./chunk-5LU25QZK.js";
|
|
10
|
+
import "./chunk-TOADDO2F.js";
|
|
11
|
+
|
|
12
|
+
// src/commands/profiles.ts
|
|
13
|
+
async function createProfile(options) {
|
|
14
|
+
const stow = createStow();
|
|
15
|
+
const profile = await stow.profiles.create({
|
|
16
|
+
name: options.name,
|
|
17
|
+
...options.bucket ? { bucketId: options.bucket } : {}
|
|
18
|
+
});
|
|
19
|
+
output(profile, () => `Created profile: ${profile.name} (${profile.id})`, {
|
|
20
|
+
json: options.json
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async function getProfile(id, options) {
|
|
24
|
+
const stow = createStow();
|
|
25
|
+
const profile = await stow.profiles.get(id);
|
|
26
|
+
output(
|
|
27
|
+
profile,
|
|
28
|
+
() => {
|
|
29
|
+
const lines = [`Profile: ${profile.name} (${profile.id})`];
|
|
30
|
+
if (profile.clusters && profile.clusters.length > 0) {
|
|
31
|
+
lines.push("\nClusters:");
|
|
32
|
+
const rows = profile.clusters.map((c) => [
|
|
33
|
+
String(c.index),
|
|
34
|
+
c.name ?? "(unnamed)",
|
|
35
|
+
String(c.signalCount)
|
|
36
|
+
]);
|
|
37
|
+
lines.push(formatTable(["Index", "Name", "Signals"], rows));
|
|
38
|
+
}
|
|
39
|
+
return lines.join("\n");
|
|
40
|
+
},
|
|
41
|
+
{ json: options.json }
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
async function deleteProfile(id) {
|
|
45
|
+
const stow = createStow();
|
|
46
|
+
await stow.profiles.delete(id);
|
|
47
|
+
console.log(`Deleted profile: ${id}`);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
createProfile,
|
|
51
|
+
deleteProfile,
|
|
52
|
+
getProfile
|
|
53
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
output
|
|
3
|
+
} from "./chunk-5IX3ASXH.js";
|
|
4
|
+
import {
|
|
5
|
+
formatTable
|
|
6
|
+
} from "./chunk-FZGOTXTE.js";
|
|
7
|
+
import {
|
|
8
|
+
createStow
|
|
9
|
+
} from "./chunk-5LU25QZK.js";
|
|
10
|
+
import "./chunk-TOADDO2F.js";
|
|
11
|
+
|
|
12
|
+
// src/commands/profiles.ts
|
|
13
|
+
async function createProfile(options) {
|
|
14
|
+
const stow = createStow();
|
|
15
|
+
const profile = await stow.profiles.create({
|
|
16
|
+
name: options.name,
|
|
17
|
+
...options.bucket ? { bucketId: options.bucket } : {}
|
|
18
|
+
});
|
|
19
|
+
output(profile, () => `Created profile: ${profile.name} (${profile.id})`, {
|
|
20
|
+
json: options.json
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async function getProfile(id, options) {
|
|
24
|
+
const stow = createStow();
|
|
25
|
+
const profile = await stow.profiles.get(id);
|
|
26
|
+
output(
|
|
27
|
+
profile,
|
|
28
|
+
() => {
|
|
29
|
+
const lines = [`Profile: ${profile.name} (${profile.id})`];
|
|
30
|
+
if (profile.clusters && profile.clusters.length > 0) {
|
|
31
|
+
lines.push("\nClusters:");
|
|
32
|
+
const rows = profile.clusters.map((c) => [
|
|
33
|
+
String(c.index),
|
|
34
|
+
c.name ?? "(unnamed)",
|
|
35
|
+
String(c.signalCount)
|
|
36
|
+
]);
|
|
37
|
+
lines.push(formatTable(["Index", "Name", "Signals"], rows));
|
|
38
|
+
}
|
|
39
|
+
return lines.join("\n");
|
|
40
|
+
},
|
|
41
|
+
{ json: options.json }
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
async function deleteProfile(id) {
|
|
45
|
+
const stow = createStow();
|
|
46
|
+
await stow.profiles.delete(id);
|
|
47
|
+
console.log(`Deleted profile: ${id}`);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
createProfile,
|
|
51
|
+
deleteProfile,
|
|
52
|
+
getProfile
|
|
53
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
output
|
|
3
|
+
} from "./chunk-5BVMPHKH.js";
|
|
4
|
+
import {
|
|
5
|
+
formatTable
|
|
6
|
+
} from "./chunk-FZGOTXTE.js";
|
|
7
|
+
import {
|
|
8
|
+
createStow
|
|
9
|
+
} from "./chunk-5LU25QZK.js";
|
|
10
|
+
import "./chunk-TOADDO2F.js";
|
|
11
|
+
|
|
12
|
+
// src/commands/profiles.ts
|
|
13
|
+
async function createProfile(options) {
|
|
14
|
+
const stow = createStow();
|
|
15
|
+
const profile = await stow.profiles.create({
|
|
16
|
+
name: options.name,
|
|
17
|
+
...options.bucket ? { bucketId: options.bucket } : {}
|
|
18
|
+
});
|
|
19
|
+
output(profile, () => `Created profile: ${profile.name} (${profile.id})`, {
|
|
20
|
+
json: options.json
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async function getProfile(id, options) {
|
|
24
|
+
const stow = createStow();
|
|
25
|
+
const profile = await stow.profiles.get(id);
|
|
26
|
+
output(
|
|
27
|
+
profile,
|
|
28
|
+
() => {
|
|
29
|
+
const lines = [`Profile: ${profile.name} (${profile.id})`];
|
|
30
|
+
if (profile.clusters && profile.clusters.length > 0) {
|
|
31
|
+
lines.push("\nClusters:");
|
|
32
|
+
const rows = profile.clusters.map((c) => [
|
|
33
|
+
String(c.index),
|
|
34
|
+
c.name ?? "(unnamed)",
|
|
35
|
+
String(c.signalCount)
|
|
36
|
+
]);
|
|
37
|
+
lines.push(formatTable(["Index", "Name", "Signals"], rows));
|
|
38
|
+
}
|
|
39
|
+
return lines.join("\n");
|
|
40
|
+
},
|
|
41
|
+
{ json: options.json }
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
async function deleteProfile(id) {
|
|
45
|
+
const stow = createStow();
|
|
46
|
+
await stow.profiles.delete(id);
|
|
47
|
+
console.log(`Deleted profile: ${id}`);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
createProfile,
|
|
51
|
+
deleteProfile,
|
|
52
|
+
getProfile
|
|
53
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
output
|
|
3
|
+
} from "./chunk-KPIQZBTO.js";
|
|
4
|
+
import {
|
|
5
|
+
formatTable
|
|
6
|
+
} from "./chunk-PE6V3MVP.js";
|
|
7
|
+
import {
|
|
8
|
+
createStow
|
|
9
|
+
} from "./chunk-5LU25QZK.js";
|
|
10
|
+
import "./chunk-TOADDO2F.js";
|
|
11
|
+
|
|
12
|
+
// src/commands/profiles.ts
|
|
13
|
+
async function createProfile(options) {
|
|
14
|
+
const stow = createStow();
|
|
15
|
+
const profile = await stow.profiles.create({
|
|
16
|
+
name: options.name,
|
|
17
|
+
...options.bucket ? { bucketId: options.bucket } : {}
|
|
18
|
+
});
|
|
19
|
+
output(profile, () => `Created profile: ${profile.name} (${profile.id})`, {
|
|
20
|
+
json: options.json
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async function getProfile(id, options) {
|
|
24
|
+
const stow = createStow();
|
|
25
|
+
const profile = await stow.profiles.get(id);
|
|
26
|
+
output(
|
|
27
|
+
profile,
|
|
28
|
+
() => {
|
|
29
|
+
const lines = [`Profile: ${profile.name} (${profile.id})`];
|
|
30
|
+
if (profile.clusters && profile.clusters.length > 0) {
|
|
31
|
+
lines.push("\nClusters:");
|
|
32
|
+
const rows = profile.clusters.map((c) => [
|
|
33
|
+
String(c.index),
|
|
34
|
+
c.name ?? "(unnamed)",
|
|
35
|
+
String(c.signalCount)
|
|
36
|
+
]);
|
|
37
|
+
lines.push(formatTable(["Index", "Name", "Signals"], rows));
|
|
38
|
+
}
|
|
39
|
+
return lines.join("\n");
|
|
40
|
+
},
|
|
41
|
+
{ json: options.json }
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
async function deleteProfile(id) {
|
|
45
|
+
const stow = createStow();
|
|
46
|
+
await stow.profiles.delete(id);
|
|
47
|
+
console.log(`Deleted profile: ${id}`);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
createProfile,
|
|
51
|
+
deleteProfile,
|
|
52
|
+
getProfile
|
|
53
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
isJsonOutput,
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-5BVMPHKH.js";
|
|
8
|
+
import {
|
|
9
|
+
formatTable
|
|
10
|
+
} from "./chunk-FZGOTXTE.js";
|
|
11
|
+
import "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/admin/queues.ts
|
|
14
|
+
async function listQueues(options) {
|
|
15
|
+
const result = await adminRequest({
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: "/admin/queues"
|
|
18
|
+
});
|
|
19
|
+
const entries = Object.entries(result.queues);
|
|
20
|
+
if (entries.length === 0) {
|
|
21
|
+
if (isJsonOutput() || options.json) {
|
|
22
|
+
output(result.queues, void 0, { json: options.json });
|
|
23
|
+
} else {
|
|
24
|
+
console.log("No queues found.");
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
output(
|
|
29
|
+
result.queues,
|
|
30
|
+
() => {
|
|
31
|
+
const rows = entries.map(([name, counts]) => [
|
|
32
|
+
name,
|
|
33
|
+
String(counts.waiting),
|
|
34
|
+
String(counts.active),
|
|
35
|
+
String(counts.completed),
|
|
36
|
+
String(counts.failed)
|
|
37
|
+
]);
|
|
38
|
+
return formatTable(
|
|
39
|
+
["Queue", "Waiting", "Active", "Completed", "Failed"],
|
|
40
|
+
rows
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
{ json: options.json }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
async function cleanQueue(queueName, options) {
|
|
47
|
+
const status = options.failed ? "failed" : "completed";
|
|
48
|
+
const grace = options.grace ? Number(options.grace) : 0;
|
|
49
|
+
const result = await adminRequest({
|
|
50
|
+
method: "POST",
|
|
51
|
+
path: `/admin/queues/${encodeURIComponent(queueName)}/clean`,
|
|
52
|
+
body: { status, grace }
|
|
53
|
+
});
|
|
54
|
+
console.log(
|
|
55
|
+
`Cleaned ${result.cleaned} ${result.status} jobs from ${result.queue}.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
cleanQueue,
|
|
60
|
+
listQueues
|
|
61
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
isJsonOutput,
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-KPIQZBTO.js";
|
|
8
|
+
import {
|
|
9
|
+
formatTable
|
|
10
|
+
} from "./chunk-PE6V3MVP.js";
|
|
11
|
+
import "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/admin/queues.ts
|
|
14
|
+
async function listQueues(options) {
|
|
15
|
+
const result = await adminRequest({
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: "/admin/queues"
|
|
18
|
+
});
|
|
19
|
+
const entries = Object.entries(result.queues);
|
|
20
|
+
if (entries.length === 0) {
|
|
21
|
+
if (isJsonOutput() || options.json) {
|
|
22
|
+
output(result.queues, void 0, { json: options.json });
|
|
23
|
+
} else {
|
|
24
|
+
console.log("No queues found.");
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
output(
|
|
29
|
+
result.queues,
|
|
30
|
+
() => {
|
|
31
|
+
const rows = entries.map(([name, counts]) => [
|
|
32
|
+
name,
|
|
33
|
+
String(counts.waiting),
|
|
34
|
+
String(counts.active),
|
|
35
|
+
String(counts.completed),
|
|
36
|
+
String(counts.failed)
|
|
37
|
+
]);
|
|
38
|
+
return formatTable(["Queue", "Waiting", "Active", "Completed", "Failed"], rows);
|
|
39
|
+
},
|
|
40
|
+
{ json: options.json }
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
async function cleanQueue(queueName, options) {
|
|
44
|
+
const status = options.failed ? "failed" : "completed";
|
|
45
|
+
const grace = options.grace ? Number(options.grace) : 0;
|
|
46
|
+
const result = await adminRequest({
|
|
47
|
+
method: "POST",
|
|
48
|
+
path: `/admin/queues/${encodeURIComponent(queueName)}/clean`,
|
|
49
|
+
body: { status, grace }
|
|
50
|
+
});
|
|
51
|
+
console.log(`Cleaned ${result.cleaned} ${result.status} jobs from ${result.queue}.`);
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
cleanQueue,
|
|
55
|
+
listQueues
|
|
56
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
isJsonOutput,
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-5IX3ASXH.js";
|
|
8
|
+
import {
|
|
9
|
+
formatTable
|
|
10
|
+
} from "./chunk-FZGOTXTE.js";
|
|
11
|
+
import "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/admin/queues.ts
|
|
14
|
+
async function listQueues(options) {
|
|
15
|
+
const result = await adminRequest({
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: "/admin/queues"
|
|
18
|
+
});
|
|
19
|
+
const entries = Object.entries(result.queues);
|
|
20
|
+
if (entries.length === 0) {
|
|
21
|
+
if (isJsonOutput() || options.json) {
|
|
22
|
+
output(result.queues, void 0, { json: options.json });
|
|
23
|
+
} else {
|
|
24
|
+
console.log("No queues found.");
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
output(
|
|
29
|
+
result.queues,
|
|
30
|
+
() => {
|
|
31
|
+
const rows = entries.map(([name, counts]) => [
|
|
32
|
+
name,
|
|
33
|
+
String(counts.waiting),
|
|
34
|
+
String(counts.active),
|
|
35
|
+
String(counts.completed),
|
|
36
|
+
String(counts.failed)
|
|
37
|
+
]);
|
|
38
|
+
return formatTable(
|
|
39
|
+
["Queue", "Waiting", "Active", "Completed", "Failed"],
|
|
40
|
+
rows
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
{ json: options.json }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
async function cleanQueue(queueName, options) {
|
|
47
|
+
const status = options.failed ? "failed" : "completed";
|
|
48
|
+
const grace = options.grace ? Number(options.grace) : 0;
|
|
49
|
+
const result = await adminRequest({
|
|
50
|
+
method: "POST",
|
|
51
|
+
path: `/admin/queues/${encodeURIComponent(queueName)}/clean`,
|
|
52
|
+
body: { status, grace }
|
|
53
|
+
});
|
|
54
|
+
console.log(
|
|
55
|
+
`Cleaned ${result.cleaned} ${result.status} jobs from ${result.queue}.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
cleanQueue,
|
|
60
|
+
listQueues
|
|
61
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
isJsonOutput,
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-RH4BOSYB.js";
|
|
8
|
+
import {
|
|
9
|
+
formatTable
|
|
10
|
+
} from "./chunk-FZGOTXTE.js";
|
|
11
|
+
import "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/admin/queues.ts
|
|
14
|
+
async function listQueues(options) {
|
|
15
|
+
const result = await adminRequest({
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: "/admin/queues"
|
|
18
|
+
});
|
|
19
|
+
const entries = Object.entries(result.queues);
|
|
20
|
+
if (entries.length === 0) {
|
|
21
|
+
if (isJsonOutput() || options.json) {
|
|
22
|
+
output(result.queues, void 0, { json: options.json });
|
|
23
|
+
} else {
|
|
24
|
+
console.log("No queues found.");
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
output(
|
|
29
|
+
result.queues,
|
|
30
|
+
() => {
|
|
31
|
+
const rows = entries.map(([name, counts]) => [
|
|
32
|
+
name,
|
|
33
|
+
String(counts.waiting),
|
|
34
|
+
String(counts.active),
|
|
35
|
+
String(counts.completed),
|
|
36
|
+
String(counts.failed)
|
|
37
|
+
]);
|
|
38
|
+
return formatTable(
|
|
39
|
+
["Queue", "Waiting", "Active", "Completed", "Failed"],
|
|
40
|
+
rows
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
{ json: options.json }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
async function cleanQueue(queueName, options) {
|
|
47
|
+
const status = options.failed ? "failed" : "completed";
|
|
48
|
+
const grace = options.grace ? Number(options.grace) : 0;
|
|
49
|
+
const result = await adminRequest({
|
|
50
|
+
method: "POST",
|
|
51
|
+
path: `/admin/queues/${encodeURIComponent(queueName)}/clean`,
|
|
52
|
+
body: { status, grace }
|
|
53
|
+
});
|
|
54
|
+
console.log(
|
|
55
|
+
`Cleaned ${result.cleaned} ${result.status} jobs from ${result.queue}.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
cleanQueue,
|
|
60
|
+
listQueues
|
|
61
|
+
};
|