@pxlabz/tasq-cli 0.1.25 → 0.1.26

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.
Files changed (2) hide show
  1. package/dist/tasq.js +43 -7
  2. package/package.json +1 -1
package/dist/tasq.js CHANGED
@@ -6852,6 +6852,11 @@ var TasqClient = class _TasqClient {
6852
6852
  )).fields,
6853
6853
  /** Set a task's value; null, `[]` or `false` clears it. */
6854
6854
  setTaskValue: (slug, taskId, fieldKey, value) => this.dispatch("task.setField", slug, { taskId, fieldKey, value }),
6855
+ /**
6856
+ * Set one value on up to 100 tasks, all or nothing: a task whose team
6857
+ * has the field off refuses the whole set.
6858
+ */
6859
+ bulkSetTaskValue: (slug, taskIds, fieldKey, value) => this.dispatch("task.bulkSetField", slug, { taskIds, fieldKey, value }),
6855
6860
  /** Set a project field's value; null clears it. */
6856
6861
  setProjectValue: (slug, projectId, fieldKey, value) => this.dispatch("project.setField", slug, { projectId, fieldKey, value })
6857
6862
  };
@@ -7073,7 +7078,7 @@ function reportError(error, io2) {
7073
7078
  // package.json
7074
7079
  var package_default = {
7075
7080
  name: "@pxlabz/tasq-cli",
7076
- version: "0.1.25",
7081
+ version: "0.1.26",
7077
7082
  description: "Command-line client for Tasq, for humans and agents alike",
7078
7083
  keywords: [
7079
7084
  "tasq",
@@ -8588,6 +8593,12 @@ async function taskCreate(ctx, title, options) {
8588
8593
  }
8589
8594
  if (options.project !== void 0) input.projectId = options.project;
8590
8595
  if (parentTaskId !== void 0) input.parentTaskId = parentTaskId;
8596
+ if (fieldEdits.length > 0) {
8597
+ input.fields = fieldEdits.map((edit) => ({
8598
+ fieldKey: edit.key,
8599
+ value: edit.value
8600
+ }));
8601
+ }
8591
8602
  const steps = new StepRunner();
8592
8603
  const created = await steps.run(
8593
8604
  "create",
@@ -8612,12 +8623,8 @@ async function taskCreate(ctx, title, options) {
8612
8623
  })
8613
8624
  );
8614
8625
  }
8615
- const fieldOutput = await applyFieldEdits(
8616
- ctx,
8617
- slug,
8618
- steps,
8619
- task.id,
8620
- fieldEdits
8626
+ const fieldOutput = fieldEdits.length === 0 ? [] : created.result.fields.map(
8627
+ (field) => field.display === null ? ` ${field.name}: cleared` : ` ${field.name}: ${field.display}`
8621
8628
  );
8622
8629
  if (ctx.config.json) {
8623
8630
  ctx.io.out(jsonOutput(created.result));
@@ -8756,6 +8763,29 @@ function resolveApprover(members, ref) {
8756
8763
  }
8757
8764
  return only;
8758
8765
  }
8766
+ async function taskSetField(ctx, taskRefs, options) {
8767
+ const slug = requireWorkspace(ctx.config);
8768
+ if (taskRefs.length === 0 || taskRefs.length > 100) {
8769
+ throw new UsageError("Name between 1 and 100 tasks.");
8770
+ }
8771
+ const [edit] = await resolveFieldEdits(ctx.client, slug, [
8772
+ { key: options.field.trim(), value: options.value.trim() === "" ? null : options.value }
8773
+ ]);
8774
+ if (!edit) throw new UsageError(`Unknown field "${options.field}".`);
8775
+ const taskIds = [];
8776
+ for (const ref of taskRefs) taskIds.push(await resolveTaskId(ctx.client, slug, ref));
8777
+ const uniqueIds = [...new Set(taskIds)];
8778
+ const response = await ctx.client.fields.bulkSetTaskValue(
8779
+ slug,
8780
+ uniqueIds,
8781
+ edit.key,
8782
+ edit.value
8783
+ );
8784
+ const { field, changedTaskIds } = response.result;
8785
+ ctx.io.out(
8786
+ ctx.config.json ? jsonOutput(response.result) : `${field.name} ${edit.value === null ? "cleared" : "set"} on ${changedTaskIds.length} of ${uniqueIds.length} tasks; the rest already held it.`
8787
+ );
8788
+ }
8759
8789
  async function taskRequestApproval(ctx, taskRef, options) {
8760
8790
  const slug = requireWorkspace(ctx.config);
8761
8791
  if (options.approver === void 0 || options.approver.trim() === "") {
@@ -9339,6 +9369,12 @@ function buildProgram(io2) {
9339
9369
  field: options.field
9340
9370
  });
9341
9371
  });
9372
+ task.command("set-field").argument("<ids...>", "task identifiers or ids, up to 100").description("Set one custom field on several tasks at once").requiredOption("--field <key>", "the field's key").requiredOption(
9373
+ "--value <value>",
9374
+ 'the value; options and people by name, "" clears it'
9375
+ ).action(async (ids, options) => {
9376
+ await taskSetField(contextFor(program2, io2), ids, options);
9377
+ });
9342
9378
  task.command("request-approval").argument("<id>", "task identifier or id").description("Ask a person to approve a task").requiredOption(
9343
9379
  "--approver <member>",
9344
9380
  "the person's name, email or member id"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pxlabz/tasq-cli",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Command-line client for Tasq, for humans and agents alike",
5
5
  "keywords": [
6
6
  "tasq",