@simplysf/simply-permissions 1.4.3 → 1.5.0

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
@@ -66,7 +66,7 @@ FLAG DESCRIPTIONS
66
66
  The path to write the generated HTML report to.
67
67
  ```
68
68
 
69
- _See code: [lib/commands/simply/permissions/analyze.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.4.3/packages/simply-permissions/lib/commands/simply/permissions/analyze.js)_
69
+ _See code: [lib/commands/simply/permissions/analyze.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.5.0/packages/simply-permissions/lib/commands/simply/permissions/analyze.js)_
70
70
 
71
71
  ## `sf simply permissions assignment delete`
72
72
 
@@ -109,7 +109,7 @@ EXAMPLES
109
109
  $ sf simply permissions assignment delete --permission-set-group-name My_Permission_Set_Group --target-org myOrg
110
110
  ```
111
111
 
112
- _See code: [lib/commands/simply/permissions/assignment/delete.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.4.3/packages/simply-permissions/lib/commands/simply/permissions/assignment/delete.js)_
112
+ _See code: [lib/commands/simply/permissions/assignment/delete.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.5.0/packages/simply-permissions/lib/commands/simply/permissions/assignment/delete.js)_
113
113
 
114
114
  ## `sf simply permissions build`
115
115
 
@@ -119,12 +119,14 @@ Generate permission sets from Salesforce source metadata.
119
119
  USAGE
120
120
  $ sf simply permissions build [--json] [--flags-dir <value>] [-f <value> | --type read-only|view-all|modify-all | -n <value>
121
121
  | -d <value> | --output <value> | -c <value> | --include-record-types | --label <value> | --description <value>]
122
+ [--check]
122
123
 
123
124
  FLAGS
124
125
  -c, --config=<value> Path to a permission set configuration file
125
126
  -d, --directory=<value> Path to the Salesforce project directory
126
127
  -f, --file=<value> Path to a permission sets file declaring every permission set to generate
127
128
  -n, --name=<value> API name for the permission set
129
+ --check Check that the generated permission sets are up to date, without writing them
128
130
  --description=<value> Description for the permission set
129
131
  --include-record-types Include record type visibilities
130
132
  --label=<value> Label for the permission set
@@ -174,6 +176,12 @@ DESCRIPTION
174
176
  ]
175
177
  }
176
178
 
179
+ To check in CI that the committed permission sets still match their source metadata, add --check. It builds each
180
+ permission set as usual but writes nothing: it compares each one with the file already at its output path and reports
181
+ it as "up-to-date", "drifted", or "missing". If any permission set has drifted or is missing, the command exits with
182
+ code 1. Formatting differences, such as indentation, line endings, or comments, don't count as drift, so files
183
+ reformatted by Prettier still pass. Any other difference does, including hand edits and reordered entries.
184
+
177
185
  EXAMPLES
178
186
  $ sf simply permissions build --type read-only --name My_Read_Only_Access --directory force-app --output force-app/main/default/permissionsets
179
187
 
@@ -183,6 +191,10 @@ EXAMPLES
183
191
 
184
192
  $ sf simply permissions build --file config/permission-sets.json
185
193
 
194
+ In CI, fail if any permission set declared in a permission sets file needs to be regenerated:
195
+
196
+ $ sf simply permissions build --file config/permission-sets.json --check
197
+
186
198
  FLAG DESCRIPTIONS
187
199
  -c, --config=<value> Path to a permission set configuration file
188
200
 
@@ -205,6 +217,12 @@ FLAG DESCRIPTIONS
205
217
  The API name for the generated permission set; also used to derive the output filename. Required unless --file is
206
218
  used.
207
219
 
220
+ --check Check that the generated permission sets are up to date, without writing them
221
+
222
+ Instead of writing each permission set, compare what would be generated with the file already at its output path.
223
+ Exits with code 1 if any permission set has drifted or is missing. Works with --file and with the
224
+ single-permission-set flags.
225
+
208
226
  --include-record-types Include record type visibilities
209
227
 
210
228
  Automatically include record type visibilities discovered from the source metadata, marked as visible by default.
@@ -220,7 +238,7 @@ FLAG DESCRIPTIONS
220
238
  Required unless --file is used.
221
239
  ```
222
240
 
223
- _See code: [lib/commands/simply/permissions/build.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.4.3/packages/simply-permissions/lib/commands/simply/permissions/build.js)_
241
+ _See code: [lib/commands/simply/permissions/build.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-permissions@1.5.0/packages/simply-permissions/lib/commands/simply/permissions/build.js)_
224
242
  <!-- commandsstop -->
225
243
 
226
244
  ## Configuration Files
@@ -1,9 +1,16 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import { PermissionSetBuildResult, PermissionSetType } from '@simplysf/simply-permissions-core';
3
- /** Where a single generated permission set was written, and how many permissions it grants. */
4
- export type PermissionsBuildResult = Omit<PermissionSetBuildResult, 'name'>;
2
+ import { PermissionSetBuildResult, PermissionSetCheckStatus, PermissionSetType } from '@simplysf/simply-permissions-core';
3
+ /** One permission set's output path and permission counts; with `--check`, also whether the file there matches. */
4
+ type PermissionsBuildEntry = PermissionSetBuildResult & {
5
+ status?: PermissionSetCheckStatus;
6
+ };
7
+ /**
8
+ * Where a single generated permission set was written (or, with `--check`, would be), and how many
9
+ * permissions it grants. With `--check`, `status` says whether the file there matches.
10
+ */
11
+ export type PermissionsBuildResult = Omit<PermissionsBuildEntry, 'name'>;
5
12
  /** With `--file`: one entry per permission set declared in the file, in file order. */
6
- export type PermissionsBuildFileResult = PermissionSetBuildResult[];
13
+ export type PermissionsBuildFileResult = PermissionsBuildEntry[];
7
14
  /**
8
15
  * Scans a Salesforce project directory for custom objects, fields, tabs, and (optionally)
9
16
  * record types, then generates a permission set XML file with a baseline of permissions
@@ -13,6 +20,9 @@ export type PermissionsBuildFileResult = PermissionSetBuildResult[];
13
20
  *
14
21
  * With `--file`, generates every permission set declared in a JSON permission sets file instead,
15
22
  * validating the whole file before writing anything.
23
+ *
24
+ * With `--check`, writes nothing: compares each permission set it would generate with the file
25
+ * already at its output path, and sets `process.exitCode = 1` if any has drifted or is missing.
16
26
  */
17
27
  export default class PermissionsBuild extends SfCommand<PermissionsBuildResult | PermissionsBuildFileResult> {
18
28
  static readonly summary: string;
@@ -28,9 +38,19 @@ export default class PermissionsBuild extends SfCommand<PermissionsBuildResult |
28
38
  'include-record-types': import("@oclif/core/interfaces").BooleanFlag<boolean>;
29
39
  label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
40
  description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
41
+ check: import("@oclif/core/interfaces").BooleanFlag<boolean>;
31
42
  'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
43
  };
33
- /** @returns The output file path and object/field permission counts — or, with `--file`, one such entry (plus its name) per permission set. */
44
+ /**
45
+ * @returns The output file path and object/field permission counts — or, with `--file`, one such entry (plus its name) per permission set.
46
+ * With `--check`, each also has a `status`, and `process.exitCode` is set to 1 when any isn't `up-to-date`.
47
+ */
34
48
  run(): Promise<PermissionsBuildResult | PermissionsBuildFileResult>;
35
- private buildFromFile;
49
+ /** Resolves the single-permission-set flags into a spec, reporting every missing required flag at once. */
50
+ private singleSpec;
51
+ private generate;
52
+ private check;
53
+ private readConfig;
54
+ private startSpinner;
36
55
  }
56
+ export {};
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { Messages } from '@salesforce/core';
17
17
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
- import { generatePermissionSets, loadPermissionSetBuildConfig, loadPermissionSetsFile, PermissionSetBuildError, } from '@simplysf/simply-permissions-core';
18
+ import { checkPermissionSets, generatePermissionSets, loadPermissionSetBuildConfig, loadPermissionSetsFile, PermissionSetBuildError, } from '@simplysf/simply-permissions-core';
19
19
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
20
  const messages = Messages.loadMessages('@simplysf/simply-permissions', 'simply.permissions.build');
21
21
  /** The flags that describe a single permission set, and so can't be combined with `--file`. */
@@ -29,6 +29,12 @@ const SINGLE_PERMISSION_SET_FLAGS = [
29
29
  'label',
30
30
  'description',
31
31
  ];
32
+ const TABLE_COLUMNS = [
33
+ { key: 'name', name: 'NAME' },
34
+ { key: 'path', name: 'PATH' },
35
+ { key: 'objectPermissionCount', name: 'OBJECT PERMISSIONS' },
36
+ { key: 'fieldPermissionCount', name: 'FIELD PERMISSIONS' },
37
+ ];
32
38
  /** Maps `PermissionSetBuildError`'s structural codes to this command's own `Messages` catalog. */
33
39
  function toCliError(error) {
34
40
  switch (error.code) {
@@ -51,6 +57,9 @@ function toCliError(error) {
51
57
  *
52
58
  * With `--file`, generates every permission set declared in a JSON permission sets file instead,
53
59
  * validating the whole file before writing anything.
60
+ *
61
+ * With `--check`, writes nothing: compares each permission set it would generate with the file
62
+ * already at its output path, and sets `process.exitCode = 1` if any has drifted or is missing.
54
63
  */
55
64
  export default class PermissionsBuild extends SfCommand {
56
65
  static summary = messages.getMessage('summary');
@@ -103,71 +112,91 @@ export default class PermissionsBuild extends SfCommand {
103
112
  description: Flags.string({
104
113
  summary: messages.getMessage('flags.description.summary'),
105
114
  }),
115
+ check: Flags.boolean({
116
+ summary: messages.getMessage('flags.check.summary'),
117
+ description: messages.getMessage('flags.check.description'),
118
+ default: false,
119
+ }),
106
120
  };
107
- /** @returns The output file path and object/field permission counts — or, with `--file`, one such entry (plus its name) per permission set. */
121
+ /**
122
+ * @returns The output file path and object/field permission counts — or, with `--file`, one such entry (plus its name) per permission set.
123
+ * With `--check`, each also has a `status`, and `process.exitCode` is set to 1 when any isn't `up-to-date`.
124
+ */
108
125
  async run() {
109
126
  const { flags } = await this.parse(PermissionsBuild);
110
127
  try {
111
- if (flags.file) {
112
- return await this.buildFromFile(flags.file);
113
- }
114
- const { type, name, directory, output } = flags;
115
- if (!type || !name || !directory || !output) {
116
- const missing = Object.entries({ type, name, directory, output })
117
- .filter(([, value]) => !value)
118
- .map(([flag]) => `--${flag}`);
119
- throw messages.createError('error.missingRequiredFlags', [missing.join(', ')]);
128
+ const { file } = flags;
129
+ const specs = file ? await this.readConfig(() => loadPermissionSetsFile(file)) : await this.singleSpec(flags);
130
+ const results = flags.check ? await this.check(specs) : await this.generate(specs, Boolean(file));
131
+ if (file) {
132
+ return results;
120
133
  }
121
- let config;
122
- if (flags.config) {
123
- this.spinner.start(messages.getMessage('info.readingConfig'));
124
- config = await loadPermissionSetBuildConfig(flags.config);
125
- this.spinner.stop();
126
- }
127
- const [built] = await generatePermissionSets([
128
- {
129
- type,
130
- name,
131
- label: flags.label,
132
- description: flags.description,
133
- includeRecordTypes: flags['include-record-types'],
134
- config,
135
- directory,
136
- output,
137
- },
138
- ], () => this.spinner.start(messages.getMessage('info.buildingPermissionSet', [name])));
139
- this.spinner.stop();
140
- this.info(messages.getMessage('info.fileGenerated', [built.path]));
141
- return {
142
- path: built.path,
143
- objectPermissionCount: built.objectPermissionCount,
144
- fieldPermissionCount: built.fieldPermissionCount,
145
- };
134
+ // Single-set mode has never included `name` in its result.
135
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
136
+ const { name, ...result } = results[0];
137
+ return result;
146
138
  }
147
139
  catch (error) {
148
140
  throw error instanceof PermissionSetBuildError ? toCliError(error) : error;
149
141
  }
150
142
  }
151
- async buildFromFile(file) {
152
- this.spinner.start(messages.getMessage('info.readingConfig'));
153
- const specs = await loadPermissionSetsFile(file);
143
+ /** Resolves the single-permission-set flags into a spec, reporting every missing required flag at once. */
144
+ async singleSpec(flags) {
145
+ const { type, name, directory, output, config } = flags;
146
+ if (!type || !name || !directory || !output) {
147
+ const missing = Object.entries({ type, name, directory, output })
148
+ .filter(([, value]) => !value)
149
+ .map(([flag]) => `--${flag}`);
150
+ throw messages.createError('error.missingRequiredFlags', [missing.join(', ')]);
151
+ }
152
+ return [
153
+ {
154
+ type,
155
+ name,
156
+ label: flags.label,
157
+ description: flags.description,
158
+ includeRecordTypes: flags['include-record-types'],
159
+ config: config ? await this.readConfig(() => loadPermissionSetBuildConfig(config)) : undefined,
160
+ directory,
161
+ output,
162
+ },
163
+ ];
164
+ }
165
+ async generate(specs, fromFile) {
166
+ const results = await generatePermissionSets(specs, (name) => this.startSpinner('info.buildingPermissionSet', name));
154
167
  this.spinner.stop();
155
- const results = await generatePermissionSets(specs, (name) => {
156
- this.spinner.stop();
157
- this.spinner.start(messages.getMessage('info.buildingPermissionSet', [name]));
158
- });
168
+ if (fromFile) {
169
+ this.table({ data: results, columns: TABLE_COLUMNS });
170
+ this.info(messages.getMessage('info.filesGenerated', [results.length]));
171
+ }
172
+ else {
173
+ this.info(messages.getMessage('info.fileGenerated', [results[0].path]));
174
+ }
175
+ return results;
176
+ }
177
+ async check(specs) {
178
+ const results = await checkPermissionSets(specs, (name) => this.startSpinner('info.checkingPermissionSet', name));
159
179
  this.spinner.stop();
160
- this.table({
161
- data: results,
162
- columns: [
163
- { key: 'name', name: 'NAME' },
164
- { key: 'path', name: 'PATH' },
165
- { key: 'objectPermissionCount', name: 'OBJECT PERMISSIONS' },
166
- { key: 'fieldPermissionCount', name: 'FIELD PERMISSIONS' },
167
- ],
168
- });
169
- this.info(messages.getMessage('info.filesGenerated', [results.length]));
180
+ this.table({ data: results, columns: [...TABLE_COLUMNS, { key: 'status', name: 'STATUS' }] });
181
+ const stale = results.filter((result) => result.status !== 'up-to-date').length;
182
+ if (stale > 0) {
183
+ this.warn(messages.getMessage('warning.drifted', [stale, results.length]));
184
+ process.exitCode = 1;
185
+ }
186
+ else {
187
+ this.info(messages.getMessage('info.upToDate', [results.length]));
188
+ }
170
189
  return results;
171
190
  }
191
+ async readConfig(load) {
192
+ this.spinner.start(messages.getMessage('info.readingConfig'));
193
+ const loaded = await load();
194
+ this.spinner.stop();
195
+ return loaded;
196
+ }
197
+ startSpinner(key, name) {
198
+ this.spinner.stop();
199
+ this.spinner.start(messages.getMessage(key, [name]));
200
+ }
172
201
  }
173
202
  //# sourceMappingURL=build.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/commands/simply/permissions/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AA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CAAC,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,YAAY,CAAC,GAAW,EAAE,IAAY;QAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC"}
@@ -30,6 +30,8 @@ To regenerate every permission set in a project with one command, declare them a
30
30
  ]
31
31
  }
32
32
 
33
+ To check in CI that the committed permission sets still match their source metadata, add --check. It builds each permission set as usual but writes nothing: it compares each one with the file already at its output path and reports it as "up-to-date", "drifted", or "missing". If any permission set has drifted or is missing, the command exits with code 1. Formatting differences, such as indentation, line endings, or comments, don't count as drift, so files reformatted by Prettier still pass. Any other difference does, including hand edits and reordered entries.
34
+
33
35
  # flags.file.summary
34
36
 
35
37
  Path to a permission sets file declaring every permission set to generate
@@ -94,6 +96,14 @@ Label for the permission set
94
96
 
95
97
  Description for the permission set
96
98
 
99
+ # flags.check.summary
100
+
101
+ Check that the generated permission sets are up to date, without writing them
102
+
103
+ # flags.check.description
104
+
105
+ Instead of writing each permission set, compare what would be generated with the file already at its output path. Exits with code 1 if any permission set has drifted or is missing. Works with --file and with the single-permission-set flags.
106
+
97
107
  # examples
98
108
 
99
109
  - <%= config.bin %> <%= command.id %> --type read-only --name My_Read_Only_Access --directory force-app --output force-app/main/default/permissionsets
@@ -104,6 +114,10 @@ Description for the permission set
104
114
 
105
115
  <%= config.bin %> <%= command.id %> --file config/permission-sets.json
106
116
 
117
+ - In CI, fail if any permission set declared in a permission sets file needs to be regenerated:
118
+
119
+ <%= config.bin %> <%= command.id %> --file config/permission-sets.json --check
120
+
107
121
  # error.missingRequiredFlags
108
122
 
109
123
  Missing required flag(s): %s. Provide them, or use --file to build every permission set declared in a permission sets file.
@@ -139,3 +153,15 @@ Permission set successfully generated at %s
139
153
  # info.filesGenerated
140
154
 
141
155
  Successfully generated %s permission set(s).
156
+
157
+ # info.checkingPermissionSet
158
+
159
+ Checking permission set %s...
160
+
161
+ # info.upToDate
162
+
163
+ All %s permission set(s) are up to date.
164
+
165
+ # warning.drifted
166
+
167
+ %s of %s permission set(s) have drifted from their source metadata or are missing. Run this command without --check to regenerate them.
@@ -90,11 +90,12 @@
90
90
  "simply:permissions:build": {
91
91
  "aliases": [],
92
92
  "args": {},
93
- "description": "Scans a Salesforce project directory for custom objects, fields, tabs, and (optionally) record types, then generates a permission set XML file with a baseline of permissions determined by --type. An optional JSON --config file can override individual object, field, tab, record type, and user permission settings, as well as whether the permission set requires activation.\n\nTo regenerate every permission set in a project with one command, declare them all in a JSON file and pass it with --file instead of the other flags. Each entry in the file's \"permissionSets\" array takes the same settings as one run of this command; a top-level \"defaults\" object supplies the \"directory\", \"output\", and \"includeRecordTypes\" values shared by every entry, and any entry can override them. An entry's \"config\" is either a path to a --config file or the same overrides inline. Relative paths are resolved against the current directory, as they are for flags. The whole file, including referenced override files and source directories, is validated before anything is written, and each source directory is scanned only once.\n\n {\n \"defaults\": {\n \"directory\": \"force-app\",\n \"output\": \"force-app/main/default/permissionsets\"\n },\n \"permissionSets\": [\n { \"name\": \"App_Read_Only\", \"type\": \"read-only\" },\n {\n \"name\": \"App_Admin\",\n \"type\": \"modify-all\",\n \"label\": \"App Admin\",\n \"includeRecordTypes\": true,\n \"config\": \"config/app-admin-overrides.json\"\n },\n {\n \"name\": \"App_Support\",\n \"type\": \"view-all\",\n \"config\": { \"userPermissions\": { \"ViewSetup\": true } }\n }\n ]\n }",
93
+ "description": "Scans a Salesforce project directory for custom objects, fields, tabs, and (optionally) record types, then generates a permission set XML file with a baseline of permissions determined by --type. An optional JSON --config file can override individual object, field, tab, record type, and user permission settings, as well as whether the permission set requires activation.\n\nTo regenerate every permission set in a project with one command, declare them all in a JSON file and pass it with --file instead of the other flags. Each entry in the file's \"permissionSets\" array takes the same settings as one run of this command; a top-level \"defaults\" object supplies the \"directory\", \"output\", and \"includeRecordTypes\" values shared by every entry, and any entry can override them. An entry's \"config\" is either a path to a --config file or the same overrides inline. Relative paths are resolved against the current directory, as they are for flags. The whole file, including referenced override files and source directories, is validated before anything is written, and each source directory is scanned only once.\n\n {\n \"defaults\": {\n \"directory\": \"force-app\",\n \"output\": \"force-app/main/default/permissionsets\"\n },\n \"permissionSets\": [\n { \"name\": \"App_Read_Only\", \"type\": \"read-only\" },\n {\n \"name\": \"App_Admin\",\n \"type\": \"modify-all\",\n \"label\": \"App Admin\",\n \"includeRecordTypes\": true,\n \"config\": \"config/app-admin-overrides.json\"\n },\n {\n \"name\": \"App_Support\",\n \"type\": \"view-all\",\n \"config\": { \"userPermissions\": { \"ViewSetup\": true } }\n }\n ]\n }\n\nTo check in CI that the committed permission sets still match their source metadata, add --check. It builds each permission set as usual but writes nothing: it compares each one with the file already at its output path and reports it as \"up-to-date\", \"drifted\", or \"missing\". If any permission set has drifted or is missing, the command exits with code 1. Formatting differences, such as indentation, line endings, or comments, don't count as drift, so files reformatted by Prettier still pass. Any other difference does, including hand edits and reordered entries.",
94
94
  "examples": [
95
95
  "<%= config.bin %> <%= command.id %> --type read-only --name My_Read_Only_Access --directory force-app --output force-app/main/default/permissionsets",
96
96
  "<%= config.bin %> <%= command.id %> --type modify-all --name My_Admin_Access --directory force-app --config config/permission-overrides.json --output force-app/main/default/permissionsets --include-record-types",
97
- "Regenerate every permission set declared in a permission sets file:\n<%= config.bin %> <%= command.id %> --file config/permission-sets.json"
97
+ "Regenerate every permission set declared in a permission sets file:\n<%= config.bin %> <%= command.id %> --file config/permission-sets.json",
98
+ "In CI, fail if any permission set declared in a permission sets file needs to be regenerated:\n<%= config.bin %> <%= command.id %> --file config/permission-sets.json --check"
98
99
  ],
99
100
  "flags": {
100
101
  "json": {
@@ -199,6 +200,13 @@
199
200
  "hasDynamicHelp": false,
200
201
  "multiple": false,
201
202
  "type": "option"
203
+ },
204
+ "check": {
205
+ "description": "Instead of writing each permission set, compare what would be generated with the file already at its output path. Exits with code 1 if any permission set has drifted or is missing. Works with --file and with the single-permission-set flags.",
206
+ "name": "check",
207
+ "summary": "Check that the generated permission sets are up to date, without writing them",
208
+ "allowNo": false,
209
+ "type": "boolean"
202
210
  }
203
211
  },
204
212
  "hasDynamicHelp": false,
@@ -340,5 +348,5 @@
340
348
  ]
341
349
  }
342
350
  },
343
- "version": "1.4.3"
351
+ "version": "1.5.0"
344
352
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplysf/simply-permissions",
3
3
  "description": "Utilities for working with permissions",
4
- "version": "1.4.3",
4
+ "version": "1.5.0",
5
5
  "author": "@ClayChipps",
6
6
  "homepage": "https://github.com/SimplySF/simply-plugins",
7
7
  "bugs": "https://github.com/SimplySF/simply-plugins/issues",
@@ -62,7 +62,7 @@
62
62
  "@salesforce/sf-plugins-core": "^12.2.16",
63
63
  "@salesforce/source-deploy-retrieve": "^12.37.2",
64
64
  "@simplysf/simply-core": "^1.6.7",
65
- "@simplysf/simply-permissions-core": "^0.3.0",
65
+ "@simplysf/simply-permissions-core": "^0.4.0",
66
66
  "@simplysf/simply-plugin-kit": "^1.0.9",
67
67
  "zod": "^4.6.5"
68
68
  },
@@ -202,5 +202,5 @@
202
202
  "output": []
203
203
  }
204
204
  },
205
- "gitHead": "ed47c90787cbc2e2f98e07a00ca05fbe918baa4c"
205
+ "gitHead": "2436881d910bec0763ea34ffeba1f4bc848a4810"
206
206
  }