@krodak/clickup-cli 1.8.0 → 1.9.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "clickup-cli",
3
3
  "description": "ClickUp CLI skills for managing tasks, sprints, comments, checklists, custom fields, tags, and time tracking via the cup command",
4
- "version": "1.8.0",
4
+ "version": "1.9.1",
5
5
  "author": {
6
6
  "name": "Krzysztof Rodak"
7
7
  },
package/dist/index.js CHANGED
@@ -698,10 +698,17 @@ var ClickUpClient = class {
698
698
  });
699
699
  }
700
700
  async createCustomField(teamId, name, type, opts) {
701
+ const typeConfig = {};
702
+ if (opts?.options?.length) {
703
+ typeConfig.options = opts.options.map((optName, i) => ({
704
+ name: optName,
705
+ orderindex: i
706
+ }));
707
+ }
701
708
  const body = {
702
709
  name,
703
710
  type,
704
- type_config: {},
711
+ type_config: typeConfig,
705
712
  description: opts?.description ?? "",
706
713
  required: opts?.required ?? false,
707
714
  pinned: false,
@@ -1605,6 +1612,7 @@ async function resolveAssigneeId(client, value) {
1605
1612
  return parseAssigneeId(value);
1606
1613
  }
1607
1614
  function parseTimeEstimate(value) {
1615
+ if (value === "0" || value.toLowerCase() === "none" || value === "") return 0;
1608
1616
  const pattern = /^(?:(\d+)h)?(?:(\d+)m)?$/i;
1609
1617
  const match = value.match(pattern);
1610
1618
  if (match && (match[1] || match[2])) {
@@ -1613,8 +1621,10 @@ function parseTimeEstimate(value) {
1613
1621
  return (hours * 60 + minutes) * 60 * 1e3;
1614
1622
  }
1615
1623
  const ms = Number(value);
1616
- if (Number.isFinite(ms) && ms > 0) return ms;
1617
- throw new Error('Time estimate must be a duration (e.g. "2h", "30m", "1h30m") or milliseconds');
1624
+ if (Number.isFinite(ms) && ms >= 0) return ms;
1625
+ throw new Error(
1626
+ 'Time estimate must be a duration (e.g. "2h", "30m", "1h30m"), milliseconds, or "0" to clear'
1627
+ );
1618
1628
  }
1619
1629
  function buildUpdatePayload(opts) {
1620
1630
  const payload = {};
@@ -3118,7 +3128,7 @@ var commandMetadata = [
3118
3128
  {
3119
3129
  name: "field-create",
3120
3130
  description: "Create a custom field in your workspace",
3121
- flags: ["-t", "--type", "-d", "--description", "--required", "--json"],
3131
+ flags: ["-t", "--type", "-d", "--description", "--options", "--required", "--json"],
3122
3132
  quickReference: [
3123
3133
  {
3124
3134
  section: "write",
@@ -5541,7 +5551,7 @@ function buildProgram(programName = basename(process.argv[1] ?? "cup")) {
5541
5551
  program.command("field-create <name>").description("Create a custom field in your workspace").requiredOption(
5542
5552
  "-t, --type <type>",
5543
5553
  "Field type (text, number, date, checkbox, drop_down, labels, email, phone, url, currency, short_text)"
5544
- ).option("-d, --description <text>", "Field description").option("--required", "Make the field required").option("--json", "Force JSON output even in terminal").action(
5554
+ ).option("-d, --description <text>", "Field description").option("--options <items>", "Comma-separated options for drop_down or labels types").option("--required", "Make the field required").option("--json", "Force JSON output even in terminal").action(
5545
5555
  wrapAction(
5546
5556
  async (name, opts) => {
5547
5557
  if (!name.trim()) throw new Error("Field name cannot be empty");
@@ -5565,9 +5575,16 @@ function buildProgram(programName = basename(process.argv[1] ?? "cup")) {
5565
5575
  }
5566
5576
  const config = loadConfig(getProfileName());
5567
5577
  const client = new ClickUpClient(config);
5578
+ const options = opts.options ? opts.options.split(",").map((o) => o.trim()).filter(Boolean) : void 0;
5579
+ if ((opts.type === "drop_down" || opts.type === "labels") && !options?.length) {
5580
+ throw new Error(
5581
+ `--options is required for ${opts.type} fields (comma-separated values)`
5582
+ );
5583
+ }
5568
5584
  const field = await client.createCustomField(config.teamId, name, opts.type, {
5569
5585
  description: opts.description,
5570
- required: opts.required
5586
+ required: opts.required,
5587
+ options
5571
5588
  });
5572
5589
  if (shouldOutputJson(opts.json ?? false)) {
5573
5590
  console.log(JSON.stringify(field, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krodak/clickup-cli",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "ClickUp CLI for AI agents and humans",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -78,7 +78,7 @@ All commands support `--help` for full flag details. All commands support `--jso
78
78
  | `cup depend <id> [--on taskId] [--blocks taskId] [--remove]` | Add/remove dependencies |
79
79
  | `cup move <id> [--to listId] [--remove listId]` | Add/remove task from lists |
80
80
  | `cup field <id> [--set "Name" value] [--remove "Name"]` | Set/remove custom field values |
81
- | `cup field-create <name> -t <type> [-d desc] [--required]` | Create a custom field |
81
+ | `cup field-create <name> -t <type> [-d desc] [--options "a,b,c"] [--required]` | Create a custom field |
82
82
  | `cup tag <id> [--add tags] [--remove tags]` | Add/remove tags on a task |
83
83
  | `cup link <taskId> <linksTo> [--remove]` | Link/unlink tasks |
84
84
  | `cup attach <taskId> <filePath>` | Upload file attachment |
@@ -147,6 +147,7 @@ All commands support `--help` for full flag details. All commands support `--jso
147
147
  | `--include-closed` | Include closed/done tasks |
148
148
  | `--list` on create | Optional when `--parent` is given (auto-detected) |
149
149
  | `cup field --set` | Supports: text, number, checkbox (true/false), dropdown (option name), date (YYYY-MM-DD), url, email. Names resolved case-insensitively; errors list available fields/options |
150
+ | `cup field-create` | Use `--options "a,b,c"` for `drop_down` and `labels` types (required). Other types don't need `--options` |
150
151
  | `cup sprint` | Auto-detects active sprint by folder name (sprint/iteration/cycle/scrum), parses multiple date formats. Override with `--folder <id>` or `cup config set sprintFolderId <id>` |
151
152
  | `cup link` | Both IDs must be the same type (both custom or both native) |
152
153
  | `cup delete` | DESTRUCTIVE. Requires `--confirm` in non-interactive mode. Cannot be undone |