@dench.com/cli 3.11.36-staging.805 → 3.11.37-staging.815

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/crm-comments.ts +24 -6
  2. package/package.json +1 -1
package/crm-comments.ts CHANGED
@@ -216,6 +216,28 @@ function collectMentions(args: string[]): string[] {
216
216
  return ids;
217
217
  }
218
218
 
219
+ /**
220
+ * `--due` is a day on the calendar in YYYY-MM-DD. The pattern alone let
221
+ * 2026-02-30 through, which the server now refuses too (DEN-300).
222
+ */
223
+ function assertDueDateFlag(value: string | undefined): void {
224
+ if (!value) return;
225
+ const match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
226
+ if (!match) throw new CrmCliError("--due must be YYYY-MM-DD");
227
+ const [year, month, day] = match.slice(1).map(Number) as [
228
+ number,
229
+ number,
230
+ number,
231
+ ];
232
+ const utc = new Date(Date.UTC(year, month - 1, day));
233
+ if (
234
+ utc.getUTCFullYear() !== year ||
235
+ utc.getUTCMonth() !== month - 1 ||
236
+ utc.getUTCDate() !== day
237
+ )
238
+ throw new CrmCliError(`--due ${value} is not a calendar date`);
239
+ }
240
+
219
241
  export async function runCommentsCommand(ctx: CrmCliContext): Promise<void> {
220
242
  const verb = ctx.args.shift();
221
243
  switch (verb) {
@@ -851,9 +873,7 @@ export async function runTasksCommand(ctx: CrmCliContext): Promise<void> {
851
873
  const repeatFlags = readRepeatFlags(ctx.args, repeatFreq);
852
874
  assertNoUnknownFlags(ctx.args, "crm tasks create");
853
875
  if (!name?.trim()) throw new CrmCliError("--name is required");
854
- if (dueDateKey && !/^\d{4}-\d{2}-\d{2}$/.test(dueDateKey)) {
855
- throw new CrmCliError("--due must be YYYY-MM-DD");
856
- }
876
+ assertDueDateFlag(dueDateKey);
857
877
  // `--repeat` without `--due` is fine: the server anchors the due date
858
878
  // on the first day the rule matches from today.
859
879
  const wantsRepeat = !!(repeatFreq || repeatFlags.rrule);
@@ -995,9 +1015,7 @@ export async function runTasksCommand(ctx: CrmCliContext): Promise<void> {
995
1015
  const priority = getFlag(ctx.args, "--priority");
996
1016
  assertNoUnknownFlags(ctx.args, "crm tasks create-subtask");
997
1017
  if (!name?.trim()) throw new CrmCliError("--name is required");
998
- if (dueDateKey && !/^\d{4}-\d{2}-\d{2}$/.test(dueDateKey)) {
999
- throw new CrmCliError("--due must be YYYY-MM-DD");
1000
- }
1018
+ assertDueDateFlag(dueDateKey);
1001
1019
  out(
1002
1020
  ctx,
1003
1021
  await callMutation(ctx, api.tasks.createSubtask, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.11.36-staging.805",
3
+ "version": "3.11.37-staging.815",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {