|
|
|
|
@ -13,7 +13,7 @@ import { Metrics } from './metrics';
|
|
|
|
|
import { ResponseQueue } from './response-queue';
|
|
|
|
|
import { randomTokenBase64Url, sha256Hex } from '../utils/crypto';
|
|
|
|
|
import { route as routeCommand } from './commands';
|
|
|
|
|
import { ACTION_ALIASES, SCOPE_ALIASES, todayYMD as todayYMD_TZ, resolveTaskIdFromInput } from './commands/shared';
|
|
|
|
|
import { ACTION_ALIASES, SCOPE_ALIASES, todayYMD as todayYMD_TZ, resolveTaskIdFromInput, parseMultipleIds } from './commands/shared';
|
|
|
|
|
import { parseNueva } from './commands/parsers/nueva';
|
|
|
|
|
|
|
|
|
|
type CommandContext = {
|
|
|
|
|
@ -329,18 +329,7 @@ export class CommandService {
|
|
|
|
|
// Completar tarea (con validación opcional de membresía)
|
|
|
|
|
if (action === 'completar') {
|
|
|
|
|
// Soportar múltiples IDs separados por espacios y/o comas
|
|
|
|
|
const rawIds = (tokens.slice(2).join(' ') || '').trim();
|
|
|
|
|
const parsedList = Array.from(new Set(
|
|
|
|
|
rawIds
|
|
|
|
|
.split(/[,\s]+/)
|
|
|
|
|
.map(t => t.trim())
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
.map(t => parseInt(t, 10))
|
|
|
|
|
.filter(n => Number.isFinite(n) && n > 0)
|
|
|
|
|
));
|
|
|
|
|
const MAX_IDS = 10;
|
|
|
|
|
const truncated = parsedList.length > MAX_IDS;
|
|
|
|
|
const ids = parsedList.slice(0, MAX_IDS);
|
|
|
|
|
const { ids, truncated } = parseMultipleIds(tokens.slice(2), 10);
|
|
|
|
|
|
|
|
|
|
// Sin IDs: ayuda de uso
|
|
|
|
|
if (ids.length === 0) {
|
|
|
|
|
@ -457,18 +446,7 @@ export class CommandService {
|
|
|
|
|
// Tomar tarea (con validación opcional de membresía)
|
|
|
|
|
if (action === 'tomar') {
|
|
|
|
|
// Soportar múltiples IDs separados por espacios y/o comas
|
|
|
|
|
const rawIds = (tokens.slice(2).join(' ') || '').trim();
|
|
|
|
|
const parsedList = Array.from(new Set(
|
|
|
|
|
rawIds
|
|
|
|
|
.split(/[,\s]+/)
|
|
|
|
|
.map(t => t.trim())
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
.map(t => parseInt(t, 10))
|
|
|
|
|
.filter(n => Number.isFinite(n) && n > 0)
|
|
|
|
|
));
|
|
|
|
|
const MAX_IDS = 10;
|
|
|
|
|
const truncated = parsedList.length > MAX_IDS;
|
|
|
|
|
const ids = parsedList.slice(0, MAX_IDS);
|
|
|
|
|
const { ids, truncated } = parseMultipleIds(tokens.slice(2), 10);
|
|
|
|
|
|
|
|
|
|
// Sin IDs: ayuda de uso
|
|
|
|
|
if (ids.length === 0) {
|
|
|
|
|
|