@formigio/fazemos-cli 0.10.49 → 0.10.50

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/index.js CHANGED
@@ -2391,7 +2391,7 @@ ws
2391
2391
  });
2392
2392
  ws
2393
2393
  .command('archive')
2394
- .description('Archive a worksheet. Archived worksheets are hidden from "ws list" by default but can be found with "ws list -s archived". This is not reversible from the CLI.')
2394
+ .description('Archive a worksheet. Archived worksheets are hidden from "ws list" by default but can be found with "ws list -s archived". Reversible with "ws reopen <id>".')
2395
2395
  .argument('<id>', 'Worksheet ID')
2396
2396
  .action(async (id) => {
2397
2397
  try {
@@ -2403,6 +2403,38 @@ ws
2403
2403
  process.exit(1);
2404
2404
  }
2405
2405
  });
2406
+ // W-TOOL-4: first-class active → completed transition (owner-only). Completed
2407
+ // worksheets leave the default active list; find them with "ws list -s completed".
2408
+ ws
2409
+ .command('complete')
2410
+ .description('Mark a worksheet completed (active → completed). Owner-only. Completed worksheets are hidden from "ws list" by default but can be found with "ws list -s completed". Reversible with "ws reopen <id>".')
2411
+ .argument('<id>', 'Worksheet ID')
2412
+ .action(async (id) => {
2413
+ try {
2414
+ await api('POST', `/api/worksheets/${id}/complete`);
2415
+ console.log(chalk.green('Worksheet completed'));
2416
+ }
2417
+ catch (err) {
2418
+ console.error(chalk.red(err.message));
2419
+ process.exit(1);
2420
+ }
2421
+ });
2422
+ // W-TOOL-4: symmetric inverse of complete/archive (completed | archived → active,
2423
+ // owner-only). Also serves as the un-archive path.
2424
+ ws
2425
+ .command('reopen')
2426
+ .description('Reopen a completed or archived worksheet back to active (also un-archives). Owner-only.')
2427
+ .argument('<id>', 'Worksheet ID')
2428
+ .action(async (id) => {
2429
+ try {
2430
+ await api('POST', `/api/worksheets/${id}/reopen`);
2431
+ console.log(chalk.green('Worksheet reopened'));
2432
+ }
2433
+ catch (err) {
2434
+ console.error(chalk.red(err.message));
2435
+ process.exit(1);
2436
+ }
2437
+ });
2406
2438
  ws
2407
2439
  .command('progress')
2408
2440
  .description('Show the aggregated progress board for a worksheet. Combines outcomes, milestones, commitments, and actions into a single view. Use "ws show <id>" for the raw detail view instead.')
@@ -3341,11 +3373,17 @@ commitments
3341
3373
  .requiredOption('-d, --description <desc>', 'What you commit to do')
3342
3374
  .option('-a, --action <id>', 'Linked action ID')
3343
3375
  .requiredOption('--due <date>', 'Due date (YYYY-MM-DD)')
3376
+ .option('--allow-past-due', 'Back-date a still-open commitment (admin/owner only)')
3344
3377
  .action(async (opts) => {
3345
3378
  try {
3346
3379
  const body = { description: opts.description, dueDate: opts.due };
3347
3380
  if (opts.action)
3348
3381
  body.actionId = opts.action;
3382
+ // W-TOOL-7: opt-in back-dating of a still-open commitment. Gated to org
3383
+ // admin/owner server-side (403 otherwise); omit the flag to leave the
3384
+ // default forward-dating behavior unchanged.
3385
+ if (opts.allowPastDue)
3386
+ body.allowPastDue = true;
3349
3387
  const data = await api('POST', `/api/worksheets/${opts.worksheet}/commitments`, body);
3350
3388
  const c = data.commitment;
3351
3389
  console.log(chalk.green(`Commitment made: ${c.description}`));