@pxlabz/tasq-cli 0.1.14 → 0.1.15
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/tasq.js +44 -9
- package/package.json +2 -2
package/dist/tasq.js
CHANGED
|
@@ -6502,6 +6502,7 @@ function toTasqError(status, body, retryAfterHeader) {
|
|
|
6502
6502
|
}
|
|
6503
6503
|
|
|
6504
6504
|
// ../sdk/src/client.ts
|
|
6505
|
+
var PROJECT_UPDATES_PAGE_MAX = 100;
|
|
6505
6506
|
function assertPrefix(token, prefix, label) {
|
|
6506
6507
|
if (!token.startsWith(prefix)) {
|
|
6507
6508
|
throw new Error(
|
|
@@ -6675,10 +6676,32 @@ var TasqClient = class _TasqClient {
|
|
|
6675
6676
|
* approving it.
|
|
6676
6677
|
*/
|
|
6677
6678
|
projectUpdates = {
|
|
6678
|
-
/**
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6679
|
+
/**
|
|
6680
|
+
* Every update on the project, drafts included, newest first. Follows
|
|
6681
|
+
* `nextCursor` until the last page; use `listPage` for one page.
|
|
6682
|
+
*/
|
|
6683
|
+
list: async (slug, projectId) => {
|
|
6684
|
+
const updates = [];
|
|
6685
|
+
let before;
|
|
6686
|
+
do {
|
|
6687
|
+
const page = await this.projectUpdates.listPage(slug, projectId, {
|
|
6688
|
+
limit: PROJECT_UPDATES_PAGE_MAX,
|
|
6689
|
+
before
|
|
6690
|
+
});
|
|
6691
|
+
updates.push(...page.updates);
|
|
6692
|
+
before = page.nextCursor ?? void 0;
|
|
6693
|
+
} while (before !== void 0);
|
|
6694
|
+
return updates;
|
|
6695
|
+
},
|
|
6696
|
+
/**
|
|
6697
|
+
* One page of the project's updates, drafts included, newest first; pass
|
|
6698
|
+
* `nextCursor` as `before` for the next. The API returns 20 by default,
|
|
6699
|
+
* at most 100.
|
|
6700
|
+
*/
|
|
6701
|
+
listPage: (slug, projectId, query = {}) => this.#get(
|
|
6702
|
+
`/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}/updates`,
|
|
6703
|
+
{ limit: query.limit, before: query.before }
|
|
6704
|
+
),
|
|
6682
6705
|
draft: (slug, input) => this.dispatch("projectUpdate.create", slug, input),
|
|
6683
6706
|
create: (slug, input) => this.dispatch("projectUpdate.create", slug, input),
|
|
6684
6707
|
update: (slug, input) => this.dispatch("projectUpdate.update", slug, input),
|
|
@@ -6923,7 +6946,7 @@ function reportError(error, io2) {
|
|
|
6923
6946
|
// package.json
|
|
6924
6947
|
var package_default = {
|
|
6925
6948
|
name: "@pxlabz/tasq-cli",
|
|
6926
|
-
version: "0.1.
|
|
6949
|
+
version: "0.1.15",
|
|
6927
6950
|
description: "Command-line client for Tasq, for humans and agents alike",
|
|
6928
6951
|
keywords: [
|
|
6929
6952
|
"tasq",
|
|
@@ -8366,10 +8389,22 @@ function draftBody(options, deps) {
|
|
|
8366
8389
|
"Pass the update with --body <markdown> or --file <path>."
|
|
8367
8390
|
);
|
|
8368
8391
|
}
|
|
8369
|
-
|
|
8392
|
+
var MAX_LIST_LIMIT = 100;
|
|
8393
|
+
function parseListLimit(raw) {
|
|
8394
|
+
if (raw === void 0) return void 0;
|
|
8395
|
+
const limit = Number(raw);
|
|
8396
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIST_LIMIT) {
|
|
8397
|
+
throw new UsageError(
|
|
8398
|
+
`--limit must be a whole number from 1 to ${MAX_LIST_LIMIT}.`
|
|
8399
|
+
);
|
|
8400
|
+
}
|
|
8401
|
+
return limit;
|
|
8402
|
+
}
|
|
8403
|
+
async function updateList(ctx, projectRef, options) {
|
|
8404
|
+
const limit = parseListLimit(options.limit);
|
|
8370
8405
|
const slug = requireWorkspace(ctx.config);
|
|
8371
8406
|
const projectId = await resolveProjectId(ctx, slug, projectRef);
|
|
8372
|
-
const updates = await ctx.client.projectUpdates.list(slug, projectId);
|
|
8407
|
+
const updates = limit === void 0 ? await ctx.client.projectUpdates.list(slug, projectId) : (await ctx.client.projectUpdates.listPage(slug, projectId, { limit })).updates;
|
|
8373
8408
|
ctx.io.out(
|
|
8374
8409
|
ctx.config.json ? jsonOutput(updates) : formatProjectUpdates(updates)
|
|
8375
8410
|
);
|
|
@@ -8587,8 +8622,8 @@ function buildProgram(io2) {
|
|
|
8587
8622
|
await initiativeUnlink(contextFor(program2, io2), ref, projectRef);
|
|
8588
8623
|
});
|
|
8589
8624
|
const update = program2.command("update").description("Project updates: agents draft, a person sends");
|
|
8590
|
-
update.command("list").argument("<project>", "project id or name").description("List a project's updates, drafts included, newest first").action(async (projectRef) => {
|
|
8591
|
-
await updateList(contextFor(program2, io2), projectRef);
|
|
8625
|
+
update.command("list").argument("<project>", "project id or name").description("List a project's updates, drafts included, newest first").option("--limit <n>", "only the latest n updates, 1-100 (default: all)").action(async (projectRef, options) => {
|
|
8626
|
+
await updateList(contextFor(program2, io2), projectRef, options);
|
|
8592
8627
|
});
|
|
8593
8628
|
update.command("draft").argument("<project>", "project id or name").description("Draft an update for a person to review and send").option("--health <health>", "on_track | at_risk | off_track").option("--body <markdown>", "the update itself").option("--file <path>", "read the update from a file").action(
|
|
8594
8629
|
async (projectRef, options) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pxlabz/tasq-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Command-line client for Tasq, for humans and agents alike",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tasq",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"commander": "^14.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@pxlabz/tasq-sdk": "0.1.
|
|
52
|
+
"@pxlabz/tasq-sdk": "0.1.13",
|
|
53
53
|
"@types/bun": "^1.3.12",
|
|
54
54
|
"tsup": "^8.5.0",
|
|
55
55
|
"typescript": "^5.7.2"
|