forked from MetaMask/core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconstraints.pro
430 lines (388 loc) · 21.1 KB
/
constraints.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
%===============================================================================
% Utility predicates
%===============================================================================
% True if and only if VersionRange is a value that we would expect to see
% following a package in a "*dependencies" field within a `package.json`.
is_valid_version_range(VersionRange) :-
VersionRange = 'workspace:^';
VersionRange = 'workspace:~';
parse_version_range(VersionRange, _, _, _, _).
% Succeeds if Number can be unified with Atom converted to a number; throws if
% not.
atom_to_number(Atom, Number) :-
atom_chars(Atom, Chars),
number_chars(Number, Chars).
% True if and only if Atom can be converted to a number.
is_atom_number(Atom) :-
catch(atom_to_number(Atom, _), _, false).
% True if and only if Modifier can be unified with the leading character of the
% version range ("^" or "~" if present, or "" if not present), Major can be
% unified with the major part of the version string, Minor with the minor, and
% Patch with the patch.
parse_version_range(VersionRange, Modifier, Major, Minor, Patch) :-
% Identify and extract the modifier (^ or ~) from the version string
atom_chars(VersionRange, Chars),
Chars = [PossibleModifier | CharsWithoutPossibleModifier],
(
(
PossibleModifier = '^';
PossibleModifier = '~'
) ->
(
Modifier = PossibleModifier,
CharsWithoutModifier = CharsWithoutPossibleModifier
) ;
(
is_atom_number(PossibleModifier) ->
(
Modifier = '',
CharsWithoutModifier = Chars
) ;
false
)
),
atomic_list_concat(CharsWithoutModifier, '', VersionRangeWithoutModifier),
atomic_list_concat(VersionParts, '.', VersionRangeWithoutModifier),
% Validate version string while extracting each part
length(VersionParts, 3),
nth0(0, VersionParts, MajorAtom),
nth0(1, VersionParts, MinorAtom),
nth0(2, VersionParts, PatchAtom),
atom_to_number(MajorAtom, Major),
atom_to_number(MinorAtom, Minor),
atom_to_number(PatchAtom, Patch).
% True if and only if the first SemVer version range is greater than the second
% SemVer version range. Such a range must match "^MAJOR.MINOR.PATCH",
% "~MAJOR.MINOR.PATCH", "MAJOR.MINOR.PATCH". If two ranges do not have the same
% modifier ("^" or "~"), then they cannot be compared and the first cannot be
% considered as less than the second.
%
% Borrowed from: <https://github.com/npm/node-semver/blob/a7b8722674e2eedfd89960b4155ffddd6a20ee21/classes/semver.js#L107>
npm_version_range_out_of_sync(VersionRange1, VersionRange2) :-
parse_version_range(VersionRange1, VersionRange1Modifier, VersionRange1Major, VersionRange1Minor, VersionRange1Patch),
parse_version_range(VersionRange2, VersionRange2Modifier, VersionRange2Major, VersionRange2Minor, VersionRange2Patch),
VersionRange1Modifier == VersionRange2Modifier,
(
% 2.0.0 > 1.0.0
% 2.0.0 > 1.1.0
% 2.0.0 > 1.0.1
VersionRange1Major @> VersionRange2Major ;
(
VersionRange1Major == VersionRange2Major ,
(
% 1.1.0 > 1.0.0
% 1.1.0 > 1.0.1
VersionRange1Minor @> VersionRange2Minor ;
(
VersionRange1Minor == VersionRange2Minor ,
% 1.0.1 > 1.0.0
VersionRange1Patch @> VersionRange2Patch
)
)
)
).
% True if and only if WorkspaceBasename can unify with the part of the given
% workspace directory name that results from removing all leading directories.
workspace_basename(WorkspaceCwd, WorkspaceBasename) :-
atomic_list_concat(Parts, '/', WorkspaceCwd),
last(Parts, WorkspaceBasename).
% True if and only if WorkspacePackageName can unify with the name of the
% package which the workspace represents (which comes from the directory where
% the package is located). Assumes that the package is not in a sub-workspace
% and is not private.
workspace_package_name(WorkspaceCwd, WorkspacePackageName) :-
workspace_basename(WorkspaceCwd, WorkspaceBasename),
atom_concat('@metamask/', WorkspaceBasename, WorkspacePackageName).
% True if RepoName can be unified with the repository name part of RepoUrl, a
% complete URL for a repository on GitHub. This URL must include the ".git"
% extension.
repo_name(RepoUrl, RepoName) :-
Prefix = 'https://github.com/MetaMask/',
atom_length(Prefix, PrefixLength),
Suffix = '.git',
atom_length(Suffix, SuffixLength),
atom_length(RepoUrl, RepoUrlLength),
sub_atom(RepoUrl, 0, PrefixLength, After, Prefix),
sub_atom(RepoUrl, Before, SuffixLength, 0, Suffix),
Start is RepoUrlLength - After + 1,
End is Before + 1,
RepoNameLength is End - Start,
sub_atom(RepoUrl, PrefixLength, RepoNameLength, SuffixLength, RepoName).
% True if DependencyIdent starts with '@metamask' and ends with '-controller'.
is_controller(DependencyIdent) :-
Prefix = '@metamask/',
atom_length(Prefix, PrefixLength),
Suffix = '-controller',
atom_length(Suffix, SuffixLength),
atom_length(DependencyIdent, DependencyIdentLength),
sub_atom(DependencyIdent, 0, PrefixLength, After, Prefix),
sub_atom(DependencyIdent, Before, SuffixLength, 0, Suffix),
Start is DependencyIdentLength - After + 1,
End is Before + 1,
ControllerNameLength is End - Start,
sub_atom(DependencyIdent, PrefixLength, ControllerNameLength, SuffixLength, _).
%===============================================================================
% Constraints
%===============================================================================
% All packages, published or otherwise, must have a name.
\+ gen_enforced_field(WorkspaceCwd, 'name', null).
% The name of the root package can be anything, but the name of a non-root
% package must match its directory (e.g., a package located in "packages/foo"
% must be called "@metamask/foo").
%
% NOTE: This assumes that the set of non-root workspaces is flat. Nested
% workspaces will be added in a future change.
gen_enforced_field(WorkspaceCwd, 'name', WorkspacePackageName) :-
WorkspaceCwd \= '.',
workspace_package_name(WorkspaceCwd, WorkspacePackageName).
% All packages, published or otherwise, must have a description.
\+ gen_enforced_field(WorkspaceCwd, 'description', null).
% The description cannot end with a period.
gen_enforced_field(WorkspaceCwd, 'description', DescriptionWithoutTrailingPeriod) :-
workspace_field(WorkspaceCwd, 'description', Description),
atom_length(Description, Length),
LengthLessOne is Length - 1,
sub_atom(Description, LengthLessOne, 1, 0, LastCharacter),
sub_atom(Description, 0, LengthLessOne, 1, DescriptionWithoutPossibleTrailingPeriod),
(
LastCharacter == '.' ->
DescriptionWithoutTrailingPeriod = DescriptionWithoutPossibleTrailingPeriod ;
DescriptionWithoutTrailingPeriod = Description
).
% All published packages must have the same set of NPM keywords.
gen_enforced_field(WorkspaceCwd, 'keywords', ['MetaMask', 'Ethereum']) :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% Non-published packages do not have any NPM keywords.
gen_enforced_field(WorkspaceCwd, 'keywords', null) :-
workspace_field(WorkspaceCwd, 'private', true).
% The homepage of a published package must match its name (which is in turn
% based on its workspace directory name).
gen_enforced_field(WorkspaceCwd, 'homepage', CorrectHomepageUrl) :-
\+ workspace_field(WorkspaceCwd, 'private', true),
workspace_basename(WorkspaceCwd, WorkspaceBasename),
workspace_field(WorkspaceCwd, 'repository.url', RepoUrl),
repo_name(RepoUrl, RepoName),
atomic_list_concat(['https://github.com/MetaMask/', RepoName, '/tree/main/packages/', WorkspaceBasename, '#readme'], CorrectHomepageUrl).
% Non-published packages do not have a homepage.
gen_enforced_field(WorkspaceCwd, 'homepage', null) :-
workspace_field(WorkspaceCwd, 'private', true).
% The bugs URL of a published package must point to the Issues page for the
% repository.
gen_enforced_field(WorkspaceCwd, 'bugs.url', CorrectBugsUrl) :-
\+ workspace_field(WorkspaceCwd, 'private', true),
workspace_field(WorkspaceCwd, 'repository.url', RepoUrl),
repo_name(RepoUrl, RepoName),
atomic_list_concat(['https://github.com/MetaMask/', RepoName, '/issues'], CorrectBugsUrl).
% Non-published packages must not have a bugs section.
gen_enforced_field(WorkspaceCwd, 'bugs', null) :-
workspace_field(WorkspaceCwd, 'private', true).
% All packages must specify Git as the repository type.
gen_enforced_field(WorkspaceCwd, 'repository.type', 'git').
% All packages must match the URL of a repo within the MetaMask organization.
gen_enforced_field(WorkspaceCwd, 'repository.url', 'https://github.com/MetaMask/<insert repo name here>.git') :-
workspace_field(WorkspaceCwd, 'repository.url', RepoUrl),
\+ repo_name(RepoUrl, _).
% The repository URL for non-root packages must match the same URL used for the
% root package.
gen_enforced_field(WorkspaceCwd, 'repository.url', RepoUrl) :-
workspace_field('.', 'repository.url', RepoUrl),
repo_name(RepoUrl, _).
WorkspaceCwd \= '.'.
% The license for all published packages must be MIT unless otherwise specified.
gen_enforced_field(WorkspaceCwd, 'license', 'MIT') :-
\+ workspace_field(WorkspaceCwd, 'private', true),
WorkspaceCwd \= 'packages/json-rpc-engine',
WorkspaceCwd \= 'packages/json-rpc-middleware-stream',
WorkspaceCwd \= 'packages/permission-log-controller',
WorkspaceCwd \= 'packages/eth-json-rpc-provider'.
% The following published packages use an ISC license instead of MIT.
gen_enforced_field(WorkspaceCwd, 'license', 'ISC') :-
\+ workspace_field(WorkspaceCwd, 'private', true),
(
WorkspaceCwd == 'packages/json-rpc-engine' ;
WorkspaceCwd == 'packages/json-rpc-middleware-stream' ;
WorkspaceCwd == 'packages/eth-json-rpc-provider'
).
% The following published packages use a custom license instead of MIT.
gen_enforced_field(WorkspaceCwd, 'license', 'SEE LICENSE IN LICENSE') :-
\+ workspace_field(WorkspaceCwd, 'private', true),
WorkspaceCwd == 'packages/permission-log-controller'.
% Non-published packages do not have a license.
gen_enforced_field(WorkspaceCwd, 'license', null) :-
workspace_field(WorkspaceCwd, 'private', true).
% The entrypoint for all published packages must be the same.
gen_enforced_field(WorkspaceCwd, 'main', './dist/index.js') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% Non-published packages must not specify an entrypoint.
gen_enforced_field(WorkspaceCwd, 'main', null) :-
workspace_field(WorkspaceCwd, 'private', true).
% The type definitions entrypoint for all publishable packages must be the same.
gen_enforced_field(WorkspaceCwd, 'types', './dist/types/index.d.ts') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% Non-published packages must not specify a type definitions entrypoint.
gen_enforced_field(WorkspaceCwd, 'types', null) :-
workspace_field(WorkspaceCwd, 'private', true).
% The exports for all published packages must be the same.
gen_enforced_field(WorkspaceCwd, 'exports["."].import', './dist/index.mjs') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'exports["."].require', './dist/index.js') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'exports["."].types', './dist/types/index.d.ts') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
gen_enforced_field(WorkspaceCwd, 'exports["./package.json"]', './package.json') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% Non-published packages must not specify exports.
gen_enforced_field(WorkspaceCwd, 'exports', null) :-
workspace_field(WorkspaceCwd, 'private', true).
% Published packages must not have side effects.
gen_enforced_field(WorkspaceCwd, 'sideEffects', false) :-
\+ workspace_field(WorkspaceCwd, 'private', true),
WorkspaceCwd \= 'packages/base-controller'.
% Non-published packages must not specify side effects.
gen_enforced_field(WorkspaceCwd, 'sideEffects', null) :-
workspace_field(WorkspaceCwd, 'private', true).
% The list of files included in published packages must only include files
% generated during the build step.
gen_enforced_field(WorkspaceCwd, 'files', ['dist/']) :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% The root package must specify an empty set of published files. (This is
% required in order to be able to import anything in development-only scripts,
% as otherwise the `node/no-unpublished-require` ESLint rule will disallow it.)
gen_enforced_field(WorkspaceCwd, 'files', []) :-
WorkspaceCwd = '.'.
% All non-root packages must have the same "build" script.
gen_enforced_field(WorkspaceCwd, 'scripts.build', 'tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean') :-
WorkspaceCwd \= '.'.
% All non-root packages must have the same "build:docs" script.
gen_enforced_field(WorkspaceCwd, 'scripts.build:docs', 'typedoc') :-
WorkspaceCwd \= '.'.
% All published packages must have the same "publish:preview" script.
gen_enforced_field(WorkspaceCwd, 'scripts.publish:preview', 'yarn npm publish --tag preview') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% All published packages must not have a "prepack" script.
gen_enforced_field(WorkspaceCwd, 'scripts.prepack', null) :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% The "changelog:validate" script for each published package must run a common
% script with the name of the package as the first argument.
gen_enforced_field(WorkspaceCwd, 'scripts.changelog:validate', CorrectChangelogValidationCommand) :-
\+ workspace_field(WorkspaceCwd, 'private', true),
workspace_field(WorkspaceCwd, 'scripts.changelog:validate', ChangelogValidationCommand),
workspace_package_name(WorkspaceCwd, WorkspacePackageName),
atomic_list_concat(['../../scripts/validate-changelog.sh ', WorkspacePackageName, ' [...]'], CorrectChangelogValidationCommand),
atom_concat('../../scripts/validate-changelog.sh ', WorkspacePackageName, ExpectedPrefix),
\+ atom_concat(ExpectedPrefix, _, ChangelogValidationCommand).
% The "changelog:update" script for each published package must run a common
% script with the name of the package as the first argument.
gen_enforced_field(WorkspaceCwd, 'scripts.changelog:update', CorrectChangelogUpdateCommand) :-
\+ workspace_field(WorkspaceCwd, 'private', true),
workspace_field(WorkspaceCwd, 'scripts.changelog:update', ChangelogUpdateCommand),
workspace_package_name(WorkspaceCwd, WorkspacePackageName),
atomic_list_concat(['../../scripts/update-changelog.sh ', WorkspacePackageName, ' [...]'], CorrectChangelogUpdateCommand),
atom_concat('../../scripts/update-changelog.sh ', WorkspacePackageName, ExpectedPrefix),
\+ atom_concat(ExpectedPrefix, _, ChangelogUpdateCommand).
% All non-root packages must have the same "test" script.
gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter') :-
WorkspaceCwd \= '.'.
% All non-root packages must have the same "test:clean" script.
gen_enforced_field(WorkspaceCwd, 'scripts.test:clean', 'jest --clearCache') :-
WorkspaceCwd \= '.'.
% All non-root packages must have the same "test:verbose" script.
gen_enforced_field(WorkspaceCwd, 'scripts.test:verbose', 'jest --verbose') :-
WorkspaceCwd \= '.'.
% All non-root packages must have the same "test:watch" script.
gen_enforced_field(WorkspaceCwd, 'scripts.test:watch', 'jest --watch') :-
WorkspaceCwd \= '.'.
% All dependency ranges must be recognizable (this makes it possible to apply
% the next two rules effectively).
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, 'a range optionally starting with ^ or ~', DependencyType) :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType),
\+ is_valid_version_range(DependencyRange).
% All version ranges used to reference one workspace package in another
% workspace package's `dependencies` or `devDependencies` must be the same.
% Among all references to the same dependency across the monorepo, the one with
% the smallest version range will win. (We handle `peerDependencies` in another
% constraint, as it has slightly different logic.)
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, OtherDependencyRange, DependencyType) :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType),
workspace_has_dependency(OtherWorkspaceCwd, DependencyIdent, OtherDependencyRange, OtherDependencyType),
WorkspaceCwd \= OtherWorkspaceCwd,
DependencyRange \= OtherDependencyRange,
npm_version_range_out_of_sync(DependencyRange, OtherDependencyRange),
DependencyType \= 'peerDependencies',
OtherDependencyType \= 'peerDependencies'.
% All version ranges used to reference one workspace package in another
% workspace package's `dependencies` or `devDependencies` must match the current
% version of that package. (We handle `peerDependencies` in another rule.)
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, CorrectDependencyRange, DependencyType) :-
DependencyType \= 'peerDependencies',
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType),
workspace_ident(OtherWorkspaceCwd, DependencyIdent),
workspace_version(OtherWorkspaceCwd, OtherWorkspaceVersion),
atomic_list_concat(['^', OtherWorkspaceVersion], CorrectDependencyRange).
% If a workspace package is listed under another workspace package's
% `dependencies`, it should not also be listed under its `devDependencies`.
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, 'devDependencies') :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies').
% Each controller is a singleton, so we need to ensure the versions
% used match expectations. To accomplish this, if a controller (other than
% `base-controller`, `eth-keyring-controller` and `polling-controller`) is
% listed under a workspace package's `dependencies`, it should also be listed
% under its `peerDependencies`, and the major version of the peer dependency
% should match the major part of the current version dependency, with the minor
% and patch parts set to 0. If it is already listed there, then the major
% version should match the current version of the package and the minor and
% patch parts should be <= the corresponding parts.
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, CorrectPeerDependencyRange, 'peerDependencies') :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies'),
\+ workspace_has_dependency(WorkspaceCwd, DependencyIdent, _, 'peerDependencies'),
is_controller(DependencyIdent),
DependencyIdent \= '@metamask/base-controller',
DependencyIdent \= '@metamask/eth-keyring-controller',
DependencyIdent \= '@metamask/polling-controller',
workspace_ident(DependencyWorkspaceCwd, DependencyIdent),
workspace_version(DependencyWorkspaceCwd, CurrentDependencyWorkspaceVersion),
parse_version_range(CurrentDependencyWorkspaceVersion, _, CurrentDependencyVersionMajor, _, _),
atomic_list_concat([CurrentDependencyVersionMajor, 0, 0], '.', CorrectPeerDependencyVersion),
atom_concat('^', CorrectPeerDependencyVersion, CorrectPeerDependencyRange).
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, CorrectPeerDependencyRange, 'peerDependencies') :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, SpecifiedPeerDependencyRange, 'peerDependencies'),
is_controller(DependencyIdent),
DependencyIdent \= '@metamask/base-controller',
DependencyIdent \= '@metamask/eth-keyring-controller',
DependencyIdent \= '@metamask/polling-controller',
workspace_ident(DependencyWorkspaceCwd, DependencyIdent),
workspace_version(DependencyWorkspaceCwd, CurrentDependencyVersion),
parse_version_range(CurrentDependencyVersion, _, CurrentDependencyVersionMajor, CurrentDependencyVersionMinor, CurrentDependencyVersionPatch),
parse_version_range(SpecifiedPeerDependencyRange, _, SpecifiedPeerDependencyVersionMajor, SpecifiedPeerDependencyVersionMinor, SpecifiedPeerDependencyVersionPatch),
(
(
SpecifiedPeerDependencyVersionMajor == CurrentDependencyVersionMajor,
(
SpecifiedPeerDependencyVersionMinor @< CurrentDependencyVersionMinor ;
(
SpecifiedPeerDependencyVersionMinor == CurrentDependencyVersionMinor,
SpecifiedPeerDependencyVersionPatch @=< CurrentDependencyVersionPatch
)
)
) ->
CorrectPeerDependencyRange = SpecifiedPeerDependencyRange ;
atom_concat('^', CurrentDependencyVersion, CorrectPeerDependencyRange)
).
% The root workspace (and only the root workspace) needs to specify the Yarn
% version required for development.
gen_enforced_field(WorkspaceCwd, 'packageManager', 'yarn@4.2.2') :-
WorkspaceCwd == '.'.
gen_enforced_field(WorkspaceCwd, 'packageManager', null) :-
WorkspaceCwd \= '.'.
% All packages must specify a minimum Node version of 18.
gen_enforced_field(WorkspaceCwd, 'engines.node', '^18.18 || >=20').
% All published packages are public.
gen_enforced_field(WorkspaceCwd, 'publishConfig.access', 'public') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% All published packages are available on the NPM registry.
gen_enforced_field(WorkspaceCwd, 'publishConfig.registry', 'https://registry.npmjs.org/') :-
\+ workspace_field(WorkspaceCwd, 'private', true).
% Non-published packages do not need to specify any publishing settings
% whatsoever.
gen_enforced_field(WorkspaceCwd, 'publishConfig', null) :-
workspace_field(WorkspaceCwd, 'private', true).