@helm-ai/cli 0.16.0 → 0.18.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/cli.js +40 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ function renderSplash(ctx) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// src/version.ts
|
|
28
|
-
var version = "0.
|
|
28
|
+
var version = "0.17.0";
|
|
29
29
|
|
|
30
30
|
// src/commands/auth.ts
|
|
31
31
|
import prompts from "prompts";
|
|
@@ -222,6 +222,14 @@ var HelmClient = class _HelmClient {
|
|
|
222
222
|
const data = await this.request("update_task", "POST", { task_id: taskId, ...input });
|
|
223
223
|
return data.task;
|
|
224
224
|
},
|
|
225
|
+
comments: async (taskId, opts = {}) => {
|
|
226
|
+
const data = await this.request("get_task_comments", "GET", {
|
|
227
|
+
task_id: taskId,
|
|
228
|
+
limit: opts.limit,
|
|
229
|
+
offset: opts.offset
|
|
230
|
+
});
|
|
231
|
+
return data;
|
|
232
|
+
},
|
|
225
233
|
addComment: async (taskId, content, attachments) => {
|
|
226
234
|
const data = await this.request("add_task_comment", "POST", { task_id: taskId, content, attachments });
|
|
227
235
|
return data.comment;
|
|
@@ -302,7 +310,7 @@ var HelmClient = class _HelmClient {
|
|
|
302
310
|
},
|
|
303
311
|
get: async (dealId) => {
|
|
304
312
|
const data = await this.request("get_deal", "GET", { deal_id: dealId });
|
|
305
|
-
return data.deal;
|
|
313
|
+
return { ...data.deal, revenue: data.revenue };
|
|
306
314
|
},
|
|
307
315
|
create: async (input) => {
|
|
308
316
|
const data = await this.request("add_deal", "POST", input);
|
|
@@ -1941,6 +1949,36 @@ function registerTaskCommands(parent) {
|
|
|
1941
1949
|
return;
|
|
1942
1950
|
}
|
|
1943
1951
|
});
|
|
1952
|
+
cmd.command("comments <id>").description("Read the comment thread on a task").option("-l, --limit <n>", "max comments", (v) => parseInt(v, 10), 100).option("--offset <n>", "comments to skip, counting from the oldest", (v) => parseInt(v, 10), 0).option("-o, --output <format>").option("-p, --profile <name>").action(async (id, opts) => {
|
|
1953
|
+
try {
|
|
1954
|
+
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|
|
1955
|
+
const result = await client.tasks.comments(id, { limit: opts.limit, offset: opts.offset });
|
|
1956
|
+
const format = opts.output ?? defaultFormat();
|
|
1957
|
+
if (format === "json") {
|
|
1958
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
if (result.comments.length === 0) {
|
|
1962
|
+
console.log(`No comments on ${id}.`);
|
|
1963
|
+
return;
|
|
1964
|
+
}
|
|
1965
|
+
console.log(render(result.comments, [
|
|
1966
|
+
{ header: "When", get: (c) => new Date(c.created_at).toLocaleString() },
|
|
1967
|
+
{ header: "Author", get: (c) => c.author_type === "agent" ? `${c.author} (agent)` : c.author, truncate: 24 },
|
|
1968
|
+
{ header: "Internal", get: (c) => c.is_internal ? "yes" : "" },
|
|
1969
|
+
// Comments are markdown and often multi-line; a table cell is one line.
|
|
1970
|
+
{ header: "Comment", get: (c) => c.content.replace(/\s+/g, " "), truncate: 90 }
|
|
1971
|
+
], format));
|
|
1972
|
+
if (result.has_more) {
|
|
1973
|
+
console.log(`
|
|
1974
|
+
Showing ${result.returned} of ${result.total}. Use --offset to page.`);
|
|
1975
|
+
}
|
|
1976
|
+
} catch (err) {
|
|
1977
|
+
console.error(formatErrorForCli(err));
|
|
1978
|
+
process.exitCode = 1;
|
|
1979
|
+
return;
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1944
1982
|
cmd.command("comment <id> <content>").description("Add a comment to a task").option("--attach <path...>", "file(s) to attach (repeatable, any type, max 25MB each)").option("-p, --profile <name>").action(async (id, content, opts) => {
|
|
1945
1983
|
try {
|
|
1946
1984
|
const client = HelmClient.fromProfile(resolveProfile(opts.profile));
|