@contentstack/cli-audit 1.17.0 → 2.0.0-beta.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.
Files changed (42) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +10 -431
  3. package/lib/audit-base-command.d.ts +4 -1
  4. package/lib/audit-base-command.js +85 -54
  5. package/lib/commands/cm/stacks/audit/fix.d.ts +0 -1
  6. package/lib/commands/cm/stacks/audit/fix.js +0 -1
  7. package/lib/commands/cm/stacks/audit/index.d.ts +0 -1
  8. package/lib/commands/cm/stacks/audit/index.js +0 -1
  9. package/lib/config/index.d.ts +0 -5
  10. package/lib/config/index.js +9 -16
  11. package/lib/messages/index.d.ts +0 -1
  12. package/lib/messages/index.js +1 -2
  13. package/lib/modules/assets.d.ts +6 -4
  14. package/lib/modules/assets.js +51 -30
  15. package/lib/modules/base-class.d.ts +24 -0
  16. package/lib/modules/base-class.js +54 -0
  17. package/lib/modules/content-types.d.ts +6 -4
  18. package/lib/modules/content-types.js +62 -40
  19. package/lib/modules/custom-roles.d.ts +4 -4
  20. package/lib/modules/custom-roles.js +82 -61
  21. package/lib/modules/entries.d.ts +5 -4
  22. package/lib/modules/entries.js +190 -168
  23. package/lib/modules/extensions.d.ts +4 -4
  24. package/lib/modules/extensions.js +78 -58
  25. package/lib/modules/field_rules.d.ts +4 -4
  26. package/lib/modules/field_rules.js +69 -52
  27. package/lib/modules/global-fields.d.ts +3 -1
  28. package/lib/modules/global-fields.js +4 -2
  29. package/lib/modules/index.d.ts +2 -2
  30. package/lib/modules/index.js +3 -3
  31. package/lib/modules/modulesData.js +8 -17
  32. package/lib/modules/workflows.d.ts +4 -4
  33. package/lib/modules/workflows.js +85 -68
  34. package/lib/types/content-types.d.ts +1 -2
  35. package/lib/types/content-types.js +0 -1
  36. package/lib/types/context.d.ts +5 -0
  37. package/oclif.manifest.json +5 -13
  38. package/package.json +4 -6
  39. package/lib/modules/composable-studio.d.ts +0 -40
  40. package/lib/modules/composable-studio.js +0 -307
  41. package/lib/types/composable-studio.d.ts +0 -25
  42. package/lib/types/composable-studio.js +0 -2
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Contentstack
3
+ Copyright (c) 2024 Contentstack
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
19
19
  $ csdx COMMAND
20
20
  running command...
21
21
  $ csdx (--version|-v)
22
- @contentstack/cli-audit/1.17.0 linux-x64 node-v22.21.1
22
+ @contentstack/cli-audit/2.0.0-beta.1 linux-x64 node-v22.21.1
23
23
  $ csdx --help [COMMAND]
24
24
  USAGE
25
25
  $ csdx COMMAND
@@ -30,130 +30,9 @@ USAGE
30
30
  # Commands
31
31
 
32
32
  <!-- commands -->
33
- * [`csdx audit`](#csdx-audit)
34
- * [`csdx audit:fix`](#csdx-auditfix)
35
33
  * [`csdx cm:stacks:audit`](#csdx-cmstacksaudit)
36
34
  * [`csdx cm:stacks:audit:fix`](#csdx-cmstacksauditfix)
37
35
  * [`csdx help [COMMAND]`](#csdx-help-command)
38
- * [`csdx plugins`](#csdx-plugins)
39
- * [`csdx plugins:add PLUGIN`](#csdx-pluginsadd-plugin)
40
- * [`csdx plugins:inspect PLUGIN...`](#csdx-pluginsinspect-plugin)
41
- * [`csdx plugins:install PLUGIN`](#csdx-pluginsinstall-plugin)
42
- * [`csdx plugins:link PATH`](#csdx-pluginslink-path)
43
- * [`csdx plugins:remove [PLUGIN]`](#csdx-pluginsremove-plugin)
44
- * [`csdx plugins:reset`](#csdx-pluginsreset)
45
- * [`csdx plugins:uninstall [PLUGIN]`](#csdx-pluginsuninstall-plugin)
46
- * [`csdx plugins:unlink [PLUGIN]`](#csdx-pluginsunlink-plugin)
47
- * [`csdx plugins:update`](#csdx-pluginsupdate)
48
-
49
- ## `csdx audit`
50
-
51
- Perform audits and find possible errors in the exported Contentstack data
52
-
53
- ```
54
- USAGE
55
- $ csdx audit [-c <value>] [-d <value>] [--show-console-output] [--report-path <value>] [--modules
56
- content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules|composable-studio...]
57
- [--columns <value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output
58
- csv|json|yaml]
59
-
60
- FLAGS
61
- --modules=<option>... Provide the list of modules to be audited
62
- <options: content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-ru
63
- les|composable-studio>
64
- --report-path=<value> Path to store the audit reports
65
-
66
- COMMON FLAGS
67
- -c, --config=<value> Path of the external config
68
- -d, --data-dir=<value> Path where the data is stored
69
- --show-console-output Display the audit and audit fix result for individual modules
70
-
71
- TABLE FLAGS
72
- --columns=<value> Specify columns to display, comma-separated.
73
- --csv Output results in CSV format.
74
- --filter=<value> Filter rows by a column value (e.g., name=foo).
75
- --no-header Hide table headers in output.
76
- --no-truncate Prevent truncation of long text in columns.
77
- --output=<option> Specify output format: csv, json, or yaml.
78
- <options: csv|json|yaml>
79
- --sort=<value> Sort the table by a column. Use "-" for descending.
80
-
81
- DESCRIPTION
82
- Perform audits and find possible errors in the exported Contentstack data
83
-
84
- ALIASES
85
- $ csdx audit
86
- $ csdx cm:stacks:audit
87
-
88
- EXAMPLES
89
- $ csdx audit
90
-
91
- $ csdx audit --report-path=<path>
92
-
93
- $ csdx audit --report-path=<path> --csv
94
-
95
- $ csdx audit --report-path=<path> --filter="name=<filter-value>"
96
-
97
- $ csdx audit --report-path=<path> --modules=content-types --filter="name="<filter-value>"
98
- ```
99
-
100
- ## `csdx audit:fix`
101
-
102
- Perform audits and fix possible errors in the exported Contentstack data.
103
-
104
- ```
105
- USAGE
106
- $ csdx audit:fix [-c <value>] [-d <value>] [--show-console-output] [--report-path <value>] [--modules
107
- content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules|composable-studio...]
108
- [--copy-path <value> --copy-dir] [--fix-only
109
- reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns <value>] [--sort <value>]
110
- [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
111
-
112
- FLAGS
113
- --copy-dir Create backup from the original data.
114
- --copy-path=<value> Provide the path to backup the copied data
115
- --fix-only=<option>... Provide the list of fix options
116
- <options: reference|global_field|json:rte|json:extension|blocks|group|content_types>
117
- --modules=<option>... Provide the list of modules to be audited
118
- <options: content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-r
119
- ules|composable-studio>
120
- --report-path=<value> Path to store the audit reports
121
-
122
- COMMON FLAGS
123
- -c, --config=<value> Path of the external config
124
- -d, --data-dir=<value> Path where the data is stored
125
- --show-console-output Display the audit and audit fix result for individual modules
126
-
127
- TABLE FLAGS
128
- --columns=<value> Specify columns to display, comma-separated.
129
- --csv Output results in CSV format.
130
- --filter=<value> Filter rows by a column value (e.g., name=foo).
131
- --no-header Hide table headers in output.
132
- --no-truncate Prevent truncation of long text in columns.
133
- --output=<option> Specify output format: csv, json, or yaml.
134
- <options: csv|json|yaml>
135
- --sort=<value> Sort the table by a column. Use "-" for descending.
136
-
137
- DESCRIPTION
138
- Perform audits and fix possible errors in the exported Contentstack data.
139
-
140
- ALIASES
141
- $ csdx audit:fix
142
- $ csdx cm:stacks:audit:fix
143
-
144
- EXAMPLES
145
- $ csdx audit:fix --copy-dir
146
-
147
- $ csdx audit:fix --report-path=<path> --copy-dir
148
-
149
- $ csdx audit:fix --report-path=<path> --copy-dir --csv
150
-
151
- $ csdx audit:fix --fix-only=reference,global_field --copy-dir
152
-
153
- $ csdx audit:fix --report-path=<path> --filter="name=<filter-value>"
154
-
155
- $ csdx audit:fix --report-path=<path> --modules=content-types --filter="name="<filter-value>" --copy-dir --copy-path=<path>
156
- ```
157
36
 
158
37
  ## `csdx cm:stacks:audit`
159
38
 
@@ -162,14 +41,13 @@ Perform audits and find possible errors in the exported Contentstack data
162
41
  ```
163
42
  USAGE
164
43
  $ csdx cm:stacks:audit [-c <value>] [-d <value>] [--show-console-output] [--report-path <value>] [--modules
165
- content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules|composable-studio...]
166
- [--columns <value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output
167
- csv|json|yaml]
44
+ content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--columns <value>]
45
+ [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
168
46
 
169
47
  FLAGS
170
48
  --modules=<option>... Provide the list of modules to be audited
171
- <options: content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-ru
172
- les|composable-studio>
49
+ <options:
50
+ content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
173
51
  --report-path=<value> Path to store the audit reports
174
52
 
175
53
  COMMON FLAGS
@@ -190,10 +68,6 @@ TABLE FLAGS
190
68
  DESCRIPTION
191
69
  Perform audits and find possible errors in the exported Contentstack data
192
70
 
193
- ALIASES
194
- $ csdx audit
195
- $ csdx cm:stacks:audit
196
-
197
71
  EXAMPLES
198
72
  $ csdx cm:stacks:audit
199
73
 
@@ -215,10 +89,9 @@ Perform audits and fix possible errors in the exported Contentstack data.
215
89
  ```
216
90
  USAGE
217
91
  $ csdx cm:stacks:audit:fix [-c <value>] [-d <value>] [--show-console-output] [--report-path <value>] [--modules
218
- content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules|composable-studio...]
219
- [--copy-path <value> --copy-dir] [--fix-only
220
- reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns <value>] [--sort <value>]
221
- [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
92
+ content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules...] [--copy-path <value>
93
+ --copy-dir] [--fix-only reference|global_field|json:rte|json:extension|blocks|group|content_types...] [--columns
94
+ <value>] [--sort <value>] [--filter <value>] [--csv] [--no-truncate] [--no-header] [--output csv|json|yaml]
222
95
 
223
96
  FLAGS
224
97
  --copy-dir Create backup from the original data.
@@ -226,8 +99,8 @@ FLAGS
226
99
  --fix-only=<option>... Provide the list of fix options
227
100
  <options: reference|global_field|json:rte|json:extension|blocks|group|content_types>
228
101
  --modules=<option>... Provide the list of modules to be audited
229
- <options: content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-r
230
- ules|composable-studio>
102
+ <options:
103
+ content-types|global-fields|entries|extensions|workflows|custom-roles|assets|field-rules>
231
104
  --report-path=<value> Path to store the audit reports
232
105
 
233
106
  COMMON FLAGS
@@ -248,10 +121,6 @@ TABLE FLAGS
248
121
  DESCRIPTION
249
122
  Perform audits and fix possible errors in the exported Contentstack data.
250
123
 
251
- ALIASES
252
- $ csdx audit:fix
253
- $ csdx cm:stacks:audit:fix
254
-
255
124
  EXAMPLES
256
125
  $ csdx cm:stacks:audit:fix --copy-dir
257
126
 
@@ -287,294 +156,4 @@ DESCRIPTION
287
156
  ```
288
157
 
289
158
  _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.36/src/commands/help.ts)_
290
-
291
- ## `csdx plugins`
292
-
293
- List installed plugins.
294
-
295
- ```
296
- USAGE
297
- $ csdx plugins [--json] [--core]
298
-
299
- FLAGS
300
- --core Show core plugins.
301
-
302
- GLOBAL FLAGS
303
- --json Format output as json.
304
-
305
- DESCRIPTION
306
- List installed plugins.
307
-
308
- EXAMPLES
309
- $ csdx plugins
310
- ```
311
-
312
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.54/src/commands/plugins/index.ts)_
313
-
314
- ## `csdx plugins:add PLUGIN`
315
-
316
- Installs a plugin into csdx.
317
-
318
- ```
319
- USAGE
320
- $ csdx plugins:add PLUGIN... [--json] [-f] [-h] [-s | -v]
321
-
322
- ARGUMENTS
323
- PLUGIN... Plugin to install.
324
-
325
- FLAGS
326
- -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
327
- -h, --help Show CLI help.
328
- -s, --silent Silences npm output.
329
- -v, --verbose Show verbose npm output.
330
-
331
- GLOBAL FLAGS
332
- --json Format output as json.
333
-
334
- DESCRIPTION
335
- Installs a plugin into csdx.
336
-
337
- Uses npm to install plugins.
338
-
339
- Installation of a user-installed plugin will override a core plugin.
340
-
341
- Use the CSDX_NPM_LOG_LEVEL environment variable to set the npm loglevel.
342
- Use the CSDX_NPM_REGISTRY environment variable to set the npm registry.
343
-
344
- ALIASES
345
- $ csdx plugins:add
346
-
347
- EXAMPLES
348
- Install a plugin from npm registry.
349
-
350
- $ csdx plugins:add myplugin
351
-
352
- Install a plugin from a github url.
353
-
354
- $ csdx plugins:add https://github.com/someuser/someplugin
355
-
356
- Install a plugin from a github slug.
357
-
358
- $ csdx plugins:add someuser/someplugin
359
- ```
360
-
361
- ## `csdx plugins:inspect PLUGIN...`
362
-
363
- Displays installation properties of a plugin.
364
-
365
- ```
366
- USAGE
367
- $ csdx plugins:inspect PLUGIN...
368
-
369
- ARGUMENTS
370
- PLUGIN... [default: .] Plugin to inspect.
371
-
372
- FLAGS
373
- -h, --help Show CLI help.
374
- -v, --verbose
375
-
376
- GLOBAL FLAGS
377
- --json Format output as json.
378
-
379
- DESCRIPTION
380
- Displays installation properties of a plugin.
381
-
382
- EXAMPLES
383
- $ csdx plugins:inspect myplugin
384
- ```
385
-
386
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.54/src/commands/plugins/inspect.ts)_
387
-
388
- ## `csdx plugins:install PLUGIN`
389
-
390
- Installs a plugin into csdx.
391
-
392
- ```
393
- USAGE
394
- $ csdx plugins:install PLUGIN... [--json] [-f] [-h] [-s | -v]
395
-
396
- ARGUMENTS
397
- PLUGIN... Plugin to install.
398
-
399
- FLAGS
400
- -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
401
- -h, --help Show CLI help.
402
- -s, --silent Silences npm output.
403
- -v, --verbose Show verbose npm output.
404
-
405
- GLOBAL FLAGS
406
- --json Format output as json.
407
-
408
- DESCRIPTION
409
- Installs a plugin into csdx.
410
-
411
- Uses npm to install plugins.
412
-
413
- Installation of a user-installed plugin will override a core plugin.
414
-
415
- Use the CSDX_NPM_LOG_LEVEL environment variable to set the npm loglevel.
416
- Use the CSDX_NPM_REGISTRY environment variable to set the npm registry.
417
-
418
- ALIASES
419
- $ csdx plugins:add
420
-
421
- EXAMPLES
422
- Install a plugin from npm registry.
423
-
424
- $ csdx plugins:install myplugin
425
-
426
- Install a plugin from a github url.
427
-
428
- $ csdx plugins:install https://github.com/someuser/someplugin
429
-
430
- Install a plugin from a github slug.
431
-
432
- $ csdx plugins:install someuser/someplugin
433
- ```
434
-
435
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.54/src/commands/plugins/install.ts)_
436
-
437
- ## `csdx plugins:link PATH`
438
-
439
- Links a plugin into the CLI for development.
440
-
441
- ```
442
- USAGE
443
- $ csdx plugins:link PATH [-h] [--install] [-v]
444
-
445
- ARGUMENTS
446
- PATH [default: .] path to plugin
447
-
448
- FLAGS
449
- -h, --help Show CLI help.
450
- -v, --verbose
451
- --[no-]install Install dependencies after linking the plugin.
452
-
453
- DESCRIPTION
454
- Links a plugin into the CLI for development.
455
-
456
- Installation of a linked plugin will override a user-installed or core plugin.
457
-
458
- e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
459
- command will override the user-installed or core plugin implementation. This is useful for development work.
460
-
461
-
462
- EXAMPLES
463
- $ csdx plugins:link myplugin
464
- ```
465
-
466
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.54/src/commands/plugins/link.ts)_
467
-
468
- ## `csdx plugins:remove [PLUGIN]`
469
-
470
- Removes a plugin from the CLI.
471
-
472
- ```
473
- USAGE
474
- $ csdx plugins:remove [PLUGIN...] [-h] [-v]
475
-
476
- ARGUMENTS
477
- [PLUGIN...] plugin to uninstall
478
-
479
- FLAGS
480
- -h, --help Show CLI help.
481
- -v, --verbose
482
-
483
- DESCRIPTION
484
- Removes a plugin from the CLI.
485
-
486
- ALIASES
487
- $ csdx plugins:unlink
488
- $ csdx plugins:remove
489
-
490
- EXAMPLES
491
- $ csdx plugins:remove myplugin
492
- ```
493
-
494
- ## `csdx plugins:reset`
495
-
496
- Remove all user-installed and linked plugins.
497
-
498
- ```
499
- USAGE
500
- $ csdx plugins:reset [--hard] [--reinstall]
501
-
502
- FLAGS
503
- --hard Delete node_modules and package manager related files in addition to uninstalling plugins.
504
- --reinstall Reinstall all plugins after uninstalling.
505
- ```
506
-
507
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.54/src/commands/plugins/reset.ts)_
508
-
509
- ## `csdx plugins:uninstall [PLUGIN]`
510
-
511
- Removes a plugin from the CLI.
512
-
513
- ```
514
- USAGE
515
- $ csdx plugins:uninstall [PLUGIN...] [-h] [-v]
516
-
517
- ARGUMENTS
518
- [PLUGIN...] plugin to uninstall
519
-
520
- FLAGS
521
- -h, --help Show CLI help.
522
- -v, --verbose
523
-
524
- DESCRIPTION
525
- Removes a plugin from the CLI.
526
-
527
- ALIASES
528
- $ csdx plugins:unlink
529
- $ csdx plugins:remove
530
-
531
- EXAMPLES
532
- $ csdx plugins:uninstall myplugin
533
- ```
534
-
535
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.54/src/commands/plugins/uninstall.ts)_
536
-
537
- ## `csdx plugins:unlink [PLUGIN]`
538
-
539
- Removes a plugin from the CLI.
540
-
541
- ```
542
- USAGE
543
- $ csdx plugins:unlink [PLUGIN...] [-h] [-v]
544
-
545
- ARGUMENTS
546
- [PLUGIN...] plugin to uninstall
547
-
548
- FLAGS
549
- -h, --help Show CLI help.
550
- -v, --verbose
551
-
552
- DESCRIPTION
553
- Removes a plugin from the CLI.
554
-
555
- ALIASES
556
- $ csdx plugins:unlink
557
- $ csdx plugins:remove
558
-
559
- EXAMPLES
560
- $ csdx plugins:unlink myplugin
561
- ```
562
-
563
- ## `csdx plugins:update`
564
-
565
- Update installed plugins.
566
-
567
- ```
568
- USAGE
569
- $ csdx plugins:update [-h] [-v]
570
-
571
- FLAGS
572
- -h, --help Show CLI help.
573
- -v, --verbose
574
-
575
- DESCRIPTION
576
- Update installed plugins.
577
- ```
578
-
579
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.54/src/commands/plugins/update.ts)_
580
159
  <!-- commandsstop -->
@@ -12,6 +12,10 @@ export declare abstract class AuditBaseCommand extends BaseCommand<typeof AuditB
12
12
  get: (row: any) => string;
13
13
  };
14
14
  };
15
+ /**
16
+ * Create audit context object similar to export command
17
+ */
18
+ private createAuditContext;
15
19
  /**
16
20
  * The `start` function performs an audit on content types, global fields, entries, and workflows and displays
17
21
  * any missing references.
@@ -39,7 +43,6 @@ export declare abstract class AuditBaseCommand extends BaseCommand<typeof AuditB
39
43
  missingEnvLocalesInEntries: Record<string, any> | undefined;
40
44
  missingFieldRules: Record<string, any> | undefined;
41
45
  missingMultipleFields: Record<string, any> | undefined;
42
- missingRefsInComposableStudio: {} | undefined;
43
46
  }>;
44
47
  /**
45
48
  * The `promptQueue` function prompts the user to enter a data directory path if the `data-dir` flag