jm2 0.1.7 → 0.1.8

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/README.md CHANGED
@@ -296,8 +296,14 @@ jm2 edit nightly-backup --cron "0 3 * * *"
296
296
  # Change command
297
297
  jm2 edit nightly-backup --command "npm run full-backup"
298
298
 
299
- # Add/remove tags
300
- jm2 edit nightly-backup --tag important --untag old
299
+ # Replace all tags (removes existing, sets new)
300
+ jm2 edit nightly-backup --tag production --tag critical
301
+
302
+ # Append tags without removing existing ones
303
+ jm2 edit nightly-backup --tag-append new-tag
304
+
305
+ # Remove specific tags
306
+ jm2 edit nightly-backup --tag-remove old-tag
301
307
 
302
308
  # Change working directory
303
309
  jm2 edit nightly-backup --cwd /new/path
@@ -308,14 +314,63 @@ Options:
308
314
  - `--at, -a <datetime>` - Convert to one-time job at datetime
309
315
  - `--command <cmd>` - New command to execute
310
316
  - `--name, -n <name>` - Rename the job
311
- - `--tag, -t <tag>` - Add tag (can be used multiple times)
312
- - `--untag <tag>` - Remove tag (can be used multiple times)
317
+ - `--tag, -t <tag>` - Set tags (replaces all existing tags, can be used multiple times)
318
+ - `--tag-append <tag>` - Append tags to existing tags (can be used multiple times)
319
+ - `--tag-remove <tag>` - Remove specific tags (can be used multiple times)
313
320
  - `--cwd <path>` - New working directory
314
321
  - `--env, -e <KEY=value>` - Set/update environment variable
315
- - `--unenv <KEY>` - Remove environment variable
316
322
  - `--timeout <duration>` - New timeout value
317
323
  - `--retry <count>` - New retry count
318
324
 
325
+ #### `jm2 tags <subcommand>`
326
+ Manage job tags in bulk.
327
+
328
+ ```bash
329
+ # List all tags with job counts
330
+ jm2 tags list
331
+
332
+ # List tags with associated jobs (verbose)
333
+ jm2 tags list -v
334
+
335
+ # Add tag to multiple jobs
336
+ jm2 tags add production 1 2 3
337
+ jm2 tags add staging job-name job2-name
338
+
339
+ # Remove tag from specific jobs
340
+ jm2 tags rm staging 1 2
341
+
342
+ # Remove tag from all jobs
343
+ jm2 tags rm old-tag --all
344
+
345
+ # Clear all tags from specific jobs
346
+ jm2 tags clear 1 2
347
+
348
+ # Clear all tags from all jobs (requires confirmation)
349
+ jm2 tags clear --all --force
350
+
351
+ # Rename a tag across all jobs
352
+ jm2 tags rename staging production
353
+
354
+ # Show jobs grouped by tag (includes untagged group)
355
+ jm2 tags jobs
356
+
357
+ # Show jobs with specific tag
358
+ jm2 tags jobs production
359
+ ```
360
+
361
+ Subcommands:
362
+ - `list` - List all tags with job counts
363
+ - `add <tag> <job-id-or-name>...` - Add tag to specified jobs
364
+ - `rm <tag> [job-id-or-name]...` - Remove tag from jobs (use `--all` for all jobs)
365
+ - `clear [job-id-or-name]...` - Clear all tags from jobs (use `--all --force` for all jobs)
366
+ - `rename <old-tag> <new-tag>` - Rename a tag across all jobs
367
+ - `jobs [tag-name]` - List jobs grouped by tag
368
+
369
+ Options:
370
+ - `-v, --verbose` - Show verbose output (list associated jobs)
371
+ - `-a, --all` - Apply to all jobs (for rm and clear commands)
372
+ - `-f, --force` - Skip confirmation for destructive operations
373
+
319
374
  ### Logs and History
320
375
 
321
376
  #### `jm2 logs [id|name]`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jm2",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Job Manager 2 - A simple yet powerful job scheduler combining cron and at functionality",
5
5
  "type": "module",
6
6
  "main": "src/cli/index.js",
@@ -47,9 +47,10 @@ export async function editCommand(jobRef, options = {}) {
47
47
  options.tagRemove !== undefined;
48
48
 
49
49
  // Check for mutually exclusive tag options
50
- const hasTagSet = options.tag !== undefined;
51
- const hasTagAppend = options.tagAppend !== undefined;
52
- const hasTagRemove = options.tagRemove !== undefined;
50
+ // options.tag has a default of [], so check if it's non-empty
51
+ const hasTagSet = options.tag !== undefined && options.tag.length > 0;
52
+ const hasTagAppend = options.tagAppend !== undefined && options.tagAppend.length > 0;
53
+ const hasTagRemove = options.tagRemove !== undefined && options.tagRemove.length > 0;
53
54
 
54
55
  if (hasTagSet && (hasTagAppend || hasTagRemove)) {
55
56
  printError('Cannot use --tag with --tag-append or --tag-remove. Use --tag to replace all tags, or --tag-append/--tag-remove to modify existing tags.');