@jakobm/peacekeeper 0.25.2 → 0.27.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.
Files changed (40) hide show
  1. package/README.md +464 -89
  2. package/dist/cmdabra.yaml +174 -110
  3. package/dist/package.json +6 -5
  4. package/dist/src/modules/cli/legacy-commands.js +37 -0
  5. package/dist/src/modules/cli/service.js +48 -39
  6. package/dist/src/modules/configuration/convention-rules.js +93 -0
  7. package/dist/src/modules/configuration/facade.js +1 -0
  8. package/dist/src/modules/configuration/project-config-defaults.json +5 -1
  9. package/dist/src/modules/configuration/project-config.js +28 -9
  10. package/dist/src/modules/configuration/update-config.js +16 -2
  11. package/dist/src/modules/dependencies.yaml +4 -4
  12. package/dist/src/modules/external.js +5 -0
  13. package/dist/src/modules/lifecycle/checkpoint-instructions.js +1 -1
  14. package/dist/src/modules/lifecycle/cleanup-ended-session.js +1 -1
  15. package/dist/src/modules/maintenance/cleanup-merged-branches.js +4 -4
  16. package/dist/src/modules/maintenance/initialize-codex-worktree.js +1 -1
  17. package/dist/src/modules/maintenance/remove-empty-directories.js +1 -1
  18. package/dist/src/modules/projects/check-project-requirements.txt +32 -31
  19. package/dist/src/modules/projects/check-project.js +16 -16
  20. package/dist/src/modules/projects/codex-setup-prefix.sh +2 -2
  21. package/dist/src/modules/projects/create-project-core.js +13 -28
  22. package/dist/src/modules/projects/generate-github-setup.js +16 -55
  23. package/dist/src/modules/projects/github-setup-prefix.sh +29 -2
  24. package/dist/src/modules/projects/github-setup-repository-template.sh +1 -40
  25. package/dist/src/modules/projects/github-setup-suffix-template.sh +7 -5
  26. package/dist/src/modules/projects/install-hooks.js +6 -5
  27. package/dist/src/modules/releases/configure-github.js +57 -0
  28. package/dist/src/modules/releases/facade.js +3 -2
  29. package/dist/src/modules/releases/github-configuration.js +166 -0
  30. package/dist/src/modules/releases/github-policy.js +45 -11
  31. package/dist/src/modules/releases/github-remote.js +230 -0
  32. package/dist/src/modules/testing/check-conventions.js +41 -0
  33. package/dist/src/modules/testing/check-test-receipt.js +17 -22
  34. package/dist/src/modules/testing/conventions.js +168 -0
  35. package/dist/src/modules/testing/facade.js +2 -1
  36. package/dist/src/modules/testing/receipt-state.js +27 -1
  37. package/dist/src/modules/testing/record-test-receipt.js +14 -13
  38. package/dist/src/modules/testing/run-tests.js +23 -14
  39. package/dist/src/modules/testing/types.js +1 -0
  40. package/package.json +6 -5
package/dist/cmdabra.yaml CHANGED
@@ -1,114 +1,178 @@
1
1
  name: peacekeeper
2
2
  description: Shared repository test, Git worktree, and Codex hook commands
3
3
  commands:
4
- update-config:
5
- description: Create or complete project configuration using bundled defaults.
6
- create-project:
7
- description: Create and verify a compliant TypeScript library in an empty GitHub repository.
8
- named-options:
9
- repository:
10
- description: GitHub HTTPS repository URL.
11
- required: true
12
- directory:
13
- description: Directory in which to create the project.
14
- required: true
15
- package-name:
16
- description: npm package name.
17
- required: true
18
- author-name:
19
- description: Package author name.
20
- required: true
21
- author-email:
22
- description: Package author email address.
23
- required: true
24
- publish-to-npm:
25
- description: Whether the package will be published to npm.
26
- type: enum
27
- choices: ["true", "false"]
28
- required: true
29
- generate-github-setup:
30
- description: Print commands that configure GitHub policy for one or more repositories.
31
- named-options:
32
- repository:
33
- description: GitHub HTTPS repository URL; may be repeated.
34
- required: true
35
- repeatable: true
36
- check-project:
37
- description: Validate local toolchain, hooks, CI and publication conventions.
38
- named-options:
39
- explain:
40
- description: Print the complete expected project architecture.
41
- type: boolean
42
- install-hooks:
43
- description: Install or update project Codex hooks while preserving other hooks.
44
- named-options:
45
- dry-run:
46
- description: Preview changes without writing hooks.
47
- type: boolean
48
- verify-release:
49
- description: Verify release versions, required CI and strict branch protection.
50
- verify-release-protection:
51
- description: Require strict mandatory release checks without bypass.
52
- verify-release-version:
53
- description: Check a release tag against package and lockfile versions.
4
+ project:
5
+ description: Create, configure and validate projects.
6
+ commands:
7
+ create:
8
+ description: Create and verify a compliant TypeScript library in an empty GitHub repository.
9
+ named-options:
10
+ repository:
11
+ description: GitHub HTTPS repository URL.
12
+ required: true
13
+ directory:
14
+ description: Directory in which to create the project.
15
+ required: true
16
+ package-name:
17
+ description: npm package name.
18
+ required: true
19
+ author-name:
20
+ description: Package author name.
21
+ required: true
22
+ author-email:
23
+ description: Package author email address.
24
+ required: true
25
+ publish-to-npm:
26
+ description: Whether the package will be published to npm.
27
+ type: enum
28
+ choices:
29
+ - "true"
30
+ - "false"
31
+ required: true
32
+ check:
33
+ description: Validate local toolchain, hooks, CI and publication conventions.
34
+ named-options:
35
+ explain:
36
+ description: Print the complete expected project architecture.
37
+ type: boolean
38
+ update-config:
39
+ description: Create or complete project configuration using bundled defaults.
40
+ check-conventions:
41
+ description: Test configured repository conventions.
42
+ named-options:
43
+ update:
44
+ description: Replace generated output directories after successful generation; check other rules.
45
+ type: boolean
46
+ test:
47
+ description: Run tests and manage command receipts.
48
+ commands:
49
+ run:
50
+ description: Run tests.all, reusing valid receipts for individual commands.
51
+ named-options:
52
+ force:
53
+ description: Run tests even when valid command receipts exist.
54
+ type: boolean
55
+ checkpoint:
56
+ description: Run tests.checkpoint instead of tests.all.
57
+ type: boolean
58
+ check-receipt:
59
+ description: Check whether every selected command has a valid test receipt.
60
+ named-options:
61
+ checkpoint:
62
+ description: Check tests.checkpoint instead of tests.all.
63
+ type: boolean
64
+ record-receipt:
65
+ description: Record receipts for selected commands without running tests.
66
+ named-options:
67
+ checkpoint:
68
+ description: Record tests.checkpoint instead of tests.all.
69
+ type: boolean
70
+ github:
71
+ description: Configure GitHub repository policy.
72
+ commands:
73
+ configure:
74
+ description: Plan or apply exact GitHub policy from a SHA-pinned remote source.
75
+ named-options:
76
+ repository:
77
+ description: GitHub OWNER/REPO; required for planning, or assert the saved plan target during execute.
78
+ policy-pr:
79
+ description: Open same-repository PR targeting the default branch to use as the policy source.
80
+ source-ref:
81
+ description: Expected full commit SHA of the selected default branch or policy PR.
82
+ plan-file:
83
+ description: Save a new plan here, or read this saved plan with --execute.
84
+ execute:
85
+ description: Apply the saved plan after checking current remote preconditions.
86
+ type: boolean
87
+ json:
88
+ description: Print a structured result for automation.
89
+ type: boolean
90
+ generate-setup:
91
+ description: Print commands that configure GitHub policy for one or more repositories.
92
+ named-options:
93
+ repository:
94
+ description: GitHub HTTPS repository URL; may be repeated.
95
+ required: true
96
+ repeatable: true
97
+ policy-pr:
98
+ description: Policy PR for a single repository.
99
+ source-ref:
100
+ description: Expected full policy commit SHA for a single repository.
54
101
  release:
55
- description: Publish a version through a GitHub Actions npm workflow.
56
- positional-arguments:
57
- bump:
58
- description: Version increment to publish.
59
- type: enum
60
- choices: [major, minor, patch]
61
- assess-release:
62
- description: Assess unpublished changes with Codex and return a JSON recommendation.
63
- run-tests:
64
- description: Run configured tests, reusing a valid test receipt.
65
- named-options:
66
- force:
67
- description: Run tests even when a valid receipt exists.
68
- type: boolean
69
- check-test-receipt:
70
- description: Check whether a valid test receipt exists.
71
- record-test-receipt:
72
- description: Record a test receipt without running tests.
73
- checkpoint-codex-changes:
74
- description: Commit a linked worktree and push according to project configuration.
75
- named-options:
76
- subject:
77
- description: Commit subject.
78
- required: true
79
- body:
80
- description: Commit body paragraph; may be repeated.
81
- required: true
82
- repeatable: true
83
- checkpoint-codex-session-start:
84
- description: Load checkpoint instructions for a linked Codex worktree.
85
- checkpoint-codex-stop:
86
- description: Handle the Codex Stop hook and request a checkpoint if needed.
87
- cleanup-ended-session:
88
- description: Queue cleanup for a merged Codex session worktree.
89
- queue-merged-worktree-cleanup:
90
- description: Queue cleanup for the current merged worktree.
91
- initialize-codex-worktree:
92
- description: Initialize a linked Codex worktree from the configured default branch.
93
- named-options:
94
- sync-primary:
95
- description: Safely publish and update the primary checkout too.
96
- type: boolean
97
- cleanup-merged-branches:
98
- description: Preview or delete merged worktrees and branches.
99
- named-options:
100
- dry-run:
101
- description: Preview cleanup without deleting anything.
102
- type: boolean
103
- execute:
104
- description: Delete the displayed worktrees and branches.
105
- type: boolean
106
- remove-empty-directories:
107
- description: Preview or remove directories containing only ignored files.
108
- named-options:
109
- dry-run:
110
- description: Preview cleanup without deleting anything.
111
- type: boolean
112
- execute:
113
- description: Remove the displayed directories.
114
- type: boolean
102
+ description: Assess, verify and publish releases.
103
+ commands:
104
+ assess:
105
+ description: Assess unpublished changes with Codex and return a JSON recommendation.
106
+ verify:
107
+ description: Verify release versions, required CI and strict branch protection.
108
+ verify-protection:
109
+ description: Require strict mandatory release checks without bypass.
110
+ verify-version:
111
+ description: Check a release tag against package and lockfile versions.
112
+ publish:
113
+ description: Publish a version through a GitHub Actions npm workflow.
114
+ positional-arguments:
115
+ bump:
116
+ description: Version increment to publish.
117
+ type: enum
118
+ choices:
119
+ - major
120
+ - minor
121
+ - patch
122
+ codex:
123
+ description: Manage Codex hooks, worktrees and session events.
124
+ commands:
125
+ install-hooks:
126
+ description: Install or update project Codex hooks while preserving other hooks.
127
+ named-options:
128
+ dry-run:
129
+ description: Preview changes without writing hooks.
130
+ type: boolean
131
+ init-worktree:
132
+ description: Initialize a linked Codex worktree from the configured default branch.
133
+ named-options:
134
+ sync-primary:
135
+ description: Safely publish and update the primary checkout too.
136
+ type: boolean
137
+ checkpoint:
138
+ description: Commit a linked worktree and push according to project configuration.
139
+ named-options:
140
+ subject:
141
+ description: Commit subject.
142
+ required: true
143
+ body:
144
+ description: Commit body paragraph; may be repeated.
145
+ required: true
146
+ repeatable: true
147
+ session-start:
148
+ description: Load checkpoint instructions for a linked Codex worktree.
149
+ stop:
150
+ description: Handle the Codex Stop hook and request a checkpoint if needed.
151
+ session-end:
152
+ description: Queue cleanup for a merged Codex session worktree.
153
+ named-options:
154
+ worker:
155
+ description: Internal encoded cleanup target for the detached session worker.
156
+ cleanup:
157
+ description: Clean up merged branches, worktrees and empty directories.
158
+ commands:
159
+ merged-branches:
160
+ description: Preview or delete merged worktrees and branches.
161
+ named-options:
162
+ dry-run:
163
+ description: Preview cleanup without deleting anything.
164
+ type: boolean
165
+ execute:
166
+ description: Delete the displayed worktrees and branches.
167
+ type: boolean
168
+ empty-directories:
169
+ description: Preview or remove directories containing only ignored files.
170
+ named-options:
171
+ dry-run:
172
+ description: Preview cleanup without deleting anything.
173
+ type: boolean
174
+ execute:
175
+ description: Remove the displayed directories.
176
+ type: boolean
177
+ queue-merged-worktree:
178
+ description: Queue cleanup for the current merged worktree.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jakobm/peacekeeper",
3
- "version": "0.25.2",
3
+ "version": "0.27.0",
4
4
  "description": "Shared repository test, Git worktree, and Codex hook commands",
5
5
  "license": "MIT",
6
6
  "author": "Jakob Mattsson",
@@ -28,13 +28,13 @@
28
28
  "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
29
29
  "build": "npm run clean && npm run check:cli-types && tsc && tsc -p tsconfig.test.json && node dist/scripts/copy-assets.js",
30
30
  "typecheck": "npm run check:cli-types && tsc --noEmit && tsc -p tsconfig.test.json --noEmit",
31
- "test": "npm run build && node dist/bin/peacekeeper.js run-tests",
31
+ "test": "npm run build && node dist/bin/peacekeeper.js test run",
32
32
  "prepare": "npm run build",
33
33
  "architecture": "npm run build && portico architecture --modules dist/src/modules --output architecture",
34
34
  "prerelease": "npm ci",
35
- "release": "node dist/bin/peacekeeper.js release",
36
- "cleanup:branches": "node dist/bin/peacekeeper.js cleanup-merged-branches",
37
- "cleanup:empty-directories": "node dist/bin/peacekeeper.js remove-empty-directories"
35
+ "release": "node dist/bin/peacekeeper.js release publish",
36
+ "cleanup:branches": "node dist/bin/peacekeeper.js cleanup merged-branches",
37
+ "cleanup:empty-directories": "node dist/bin/peacekeeper.js cleanup empty-directories"
38
38
  },
39
39
  "engines": {
40
40
  "node": "^22.14.0"
@@ -43,6 +43,7 @@
43
43
  "@iarna/toml": "^2.2.5",
44
44
  "@jakobm/cmdabra": "^0.7.0",
45
45
  "@jakobm/portico": "^0.8.1",
46
+ "glob": "^14.0.4",
46
47
  "semver": "^7.8.5",
47
48
  "yaml": "^2.9.1"
48
49
  },
@@ -0,0 +1,37 @@
1
+ // --- Implementation ---
2
+ export default () => {
3
+ // These names are a compatibility contract for existing scripts and hooks.
4
+ const commands = {
5
+ 'create-project': ['project', 'create'],
6
+ 'check-project': ['project', 'check'],
7
+ 'update-config': ['project', 'update-config'],
8
+ 'check-conventions': ['project', 'check-conventions'],
9
+ 'run-tests': ['test', 'run'],
10
+ 'check-test-receipt': ['test', 'check-receipt'],
11
+ 'record-test-receipt': ['test', 'record-receipt'],
12
+ 'configure-github': ['github', 'configure'],
13
+ 'generate-github-setup': ['github', 'generate-setup'],
14
+ 'assess-release': ['release', 'assess'],
15
+ 'verify-release': ['release', 'verify'],
16
+ 'verify-release-protection': ['release', 'verify-protection'],
17
+ 'verify-release-version': ['release', 'verify-version'],
18
+ 'release': ['release', 'publish'],
19
+ 'install-hooks': ['codex', 'install-hooks'],
20
+ 'initialize-codex-worktree': ['codex', 'init-worktree'],
21
+ 'checkpoint-codex-changes': ['codex', 'checkpoint'],
22
+ 'checkpoint-codex-session-start': ['codex', 'session-start'],
23
+ 'checkpoint-codex-stop': ['codex', 'stop'],
24
+ 'cleanup-ended-session': ['codex', 'session-end'],
25
+ 'cleanup-merged-branches': ['cleanup', 'merged-branches'],
26
+ 'remove-empty-directories': ['cleanup', 'empty-directories'],
27
+ 'queue-merged-worktree-cleanup': ['cleanup', 'queue-merged-worktree'],
28
+ };
29
+ function normalize(rawArgs) {
30
+ const [command, ...rest] = rawArgs;
31
+ // The new release group shares the old publish command's name.
32
+ if (command === 'release' && !['major', 'minor', 'patch'].includes(rest[0]))
33
+ return rawArgs;
34
+ return Object.hasOwn(commands, command) ? [...commands[command], ...rest] : rawArgs;
35
+ }
36
+ return { commands, normalize };
37
+ };
@@ -1,47 +1,56 @@
1
- export default ({ configuration, lifecycle, maintenance, projects, releases, testing, external: { cliConfigPath, runCli, runtime }, }) => {
1
+ // --- Implementation ---
2
+ export default ({ configuration, legacyCommands, lifecycle, maintenance, projects, releases, testing, external: { cliConfigPath, runCli, runtime }, }) => {
2
3
  function executionMode({ dryRun, execute }) {
3
4
  if (dryRun && execute)
4
5
  throw new Error('--dry-run and --execute cannot be combined');
5
6
  return Boolean(execute);
6
7
  }
7
8
  const implementation = {
8
- updateConfig: () => configuration.updateConfig(),
9
- checkProject: options => projects.checkProject({ explain: options.explain }),
10
- createProject: options => projects.createProject({
11
- repository: options.repository,
12
- directory: options.directory,
13
- packageName: options.packageName,
14
- authorName: options.authorName,
15
- authorEmail: options.authorEmail,
16
- published: options.publishToNpm === 'true',
17
- }),
18
- generateGithubSetup: options => projects.generateGithubSetup({ repository: options.repository }),
19
- installHooks: options => projects.installHooks({ dryRun: options.dryRun }),
20
- checkTestReceipt: () => testing.checkTestReceipt(),
21
- recordTestReceipt: () => testing.recordTestReceipt(),
22
- runTests: options => testing.runTests({ force: options.force }),
23
- assessRelease: () => releases.assessRelease(),
24
- release: bump => releases.release(bump),
25
- verifyRelease: () => releases.verifyRelease(),
26
- verifyReleaseProtection: () => releases.verifyReleaseProtection(),
27
- verifyReleaseVersion: () => releases.verifyReleaseVersion(),
28
- checkpointCodexChanges: options => lifecycle.checkpointCodexChanges({
29
- subject: options.subject,
30
- bodyParagraphs: options.body,
31
- }),
32
- checkpointCodexSessionStart: () => lifecycle.checkpointCodexSessionStart(),
33
- checkpointCodexStop: () => lifecycle.checkpointCodexStop(),
34
- cleanupEndedSession: () => lifecycle.cleanupEndedSession(),
35
- queueMergedWorktreeCleanup: () => lifecycle.queueMergedWorktreeCleanup(),
36
- initializeCodexWorktree: options => maintenance.initializeCodexWorktree({
37
- syncPrimary: options.syncPrimary,
38
- }),
39
- cleanupMergedBranches: options => maintenance.cleanupMergedBranches({
40
- execute: executionMode(options),
41
- }),
42
- removeEmptyDirectories: options => maintenance.removeEmptyDirectories({
43
- execute: executionMode(options),
44
- }),
9
+ project: {
10
+ create: options => projects.createProject({
11
+ repository: options.repository,
12
+ directory: options.directory,
13
+ packageName: options.packageName,
14
+ authorName: options.authorName,
15
+ authorEmail: options.authorEmail,
16
+ published: options.publishToNpm === 'true',
17
+ }),
18
+ check: options => projects.checkProject({ explain: options.explain }),
19
+ updateConfig: () => configuration.updateConfig(),
20
+ checkConventions: options => testing.checkConventions({ update: options.update }),
21
+ },
22
+ test: {
23
+ run: options => testing.runTests({ force: options.force, checkpoint: options.checkpoint }),
24
+ checkReceipt: options => testing.checkTestReceipt({ checkpoint: options.checkpoint }),
25
+ recordReceipt: options => testing.recordTestReceipt({ checkpoint: options.checkpoint }),
26
+ },
27
+ github: {
28
+ configure: options => releases.configureGithub(options),
29
+ generateSetup: options => projects.generateGithubSetup(options),
30
+ },
31
+ release: {
32
+ assess: () => releases.assessRelease(),
33
+ verify: () => releases.verifyRelease(),
34
+ verifyProtection: () => releases.verifyReleaseProtection(),
35
+ verifyVersion: () => releases.verifyReleaseVersion(),
36
+ publish: bump => releases.release(bump),
37
+ },
38
+ codex: {
39
+ installHooks: options => projects.installHooks({ dryRun: options.dryRun }),
40
+ initWorktree: options => maintenance.initializeCodexWorktree({ syncPrimary: options.syncPrimary }),
41
+ checkpoint: options => lifecycle.checkpointCodexChanges({
42
+ subject: options.subject,
43
+ bodyParagraphs: options.body,
44
+ }),
45
+ sessionStart: () => lifecycle.checkpointCodexSessionStart(),
46
+ stop: () => lifecycle.checkpointCodexStop(),
47
+ sessionEnd: options => lifecycle.cleanupEndedSession(options.worker ? ['--worker', options.worker] : []),
48
+ },
49
+ cleanup: {
50
+ mergedBranches: options => maintenance.cleanupMergedBranches({ execute: executionMode(options) }),
51
+ emptyDirectories: options => maintenance.removeEmptyDirectories({ execute: executionMode(options) }),
52
+ queueMergedWorktree: () => lifecycle.queueMergedWorktreeCleanup(),
53
+ },
45
54
  };
46
55
  function cliProcess(rawArgs) {
47
56
  return {
@@ -57,7 +66,7 @@ export default ({ configuration, lifecycle, maintenance, projects, releases, tes
57
66
  }
58
67
  return {
59
68
  async run(rawArgs) {
60
- await runCli(cliConfigPath, implementation, cliProcess(rawArgs));
69
+ await runCli(cliConfigPath, implementation, cliProcess(legacyCommands.normalize(rawArgs)));
61
70
  },
62
71
  };
63
72
  };
@@ -0,0 +1,93 @@
1
+ export default ({ external: { hasMagic, path } }) => {
2
+ function invalid(location, message) {
3
+ throw new Error(`Invalid conventions configuration: ${location} ${message}`);
4
+ }
5
+ function nonempty(value, location) {
6
+ if (typeof value !== 'string' || !value.trim())
7
+ invalid(location, 'must be a nonempty string');
8
+ }
9
+ function relative(value, location) {
10
+ nonempty(value, location);
11
+ if (path.posix.isAbsolute(value) || path.win32.isAbsolute(value) || value.includes('\\')
12
+ || value.split(/[/{},]/u).some(part => part === '..' || part === '.') || value.startsWith('!')) {
13
+ invalid(location, 'must be a relative path using forward slashes without traversal or negation');
14
+ }
15
+ }
16
+ function literal(value, location) {
17
+ relative(value, location);
18
+ if (hasMagic(`./${value}`, { magicalBraces: true }))
19
+ invalid(location, 'must be a literal path');
20
+ }
21
+ function template(value, location) {
22
+ relative(value, location);
23
+ const text = value;
24
+ const replaced = text.replace('{path}', 'placeholder');
25
+ if (text.split('{path}').length !== 2 || /[{}]/u.test(replaced) || hasMagic(replaced)) {
26
+ invalid(location, 'must contain exactly one {path} placeholder and no other glob patterns');
27
+ }
28
+ }
29
+ function validate(rules) {
30
+ if (!Array.isArray(rules))
31
+ invalid('conventions.rules', 'must be an array');
32
+ const fields = {
33
+ 'allowed-files': ['files', 'allow'],
34
+ 'corresponding-files': ['from', 'to'],
35
+ 'sorted-yaml-lists': ['file'],
36
+ 'document-links': ['document', 'files'],
37
+ 'file-names': ['files', 'match'],
38
+ 'generated-files': ['run', 'expected'],
39
+ };
40
+ for (const [index, rule] of rules.entries()) {
41
+ const location = `conventions.rules[${index}]`;
42
+ if (!rule || typeof rule !== 'object' || Array.isArray(rule))
43
+ invalid(location, 'must be an object');
44
+ if (typeof rule.check !== 'string' || !Object.hasOwn(fields, rule.check))
45
+ invalid(`${location}.check`, 'is unknown');
46
+ const required = ['check', ...fields[rule.check]];
47
+ for (const key of Object.keys(rule))
48
+ if (!required.includes(key))
49
+ invalid(`${location}.${key}`, 'is unknown');
50
+ for (const key of required)
51
+ if (!Object.hasOwn(rule, key))
52
+ invalid(`${location}.${key}`, 'is missing');
53
+ switch (rule.check) {
54
+ case 'allowed-files':
55
+ relative(rule.files, `${location}.files`);
56
+ if (!Array.isArray(rule.allow))
57
+ invalid(`${location}.allow`, 'must be an array');
58
+ rule.allow.forEach((value, i) => relative(value, `${location}.allow[${i}]`));
59
+ break;
60
+ case 'corresponding-files':
61
+ template(rule.from, `${location}.from`);
62
+ template(rule.to, `${location}.to`);
63
+ break;
64
+ case 'sorted-yaml-lists':
65
+ literal(rule.file, `${location}.file`);
66
+ break;
67
+ case 'document-links':
68
+ literal(rule.document, `${location}.document`);
69
+ relative(rule.files, `${location}.files`);
70
+ break;
71
+ case 'file-names':
72
+ relative(rule.files, `${location}.files`);
73
+ nonempty(rule.match, `${location}.match`);
74
+ try {
75
+ new RegExp(rule.match, 'u');
76
+ }
77
+ catch {
78
+ invalid(`${location}.match`, 'must be a valid regular expression');
79
+ }
80
+ break;
81
+ case 'generated-files':
82
+ literal(rule.expected, `${location}.expected`);
83
+ if (rule.expected.split('/').includes('.git'))
84
+ invalid(`${location}.expected`, 'must not target Git metadata');
85
+ nonempty(rule.run, `${location}.run`);
86
+ if (!rule.run.includes('{output}'))
87
+ invalid(`${location}.run`, 'must contain an {output} placeholder');
88
+ break;
89
+ }
90
+ }
91
+ }
92
+ return { validate };
93
+ };
@@ -1,4 +1,5 @@
1
1
  export const porticoFacade = ({ projectConfig, updateConfig }) => ({
2
+ codeownersError: projectConfig.codeownersError,
2
3
  projectConfig: projectConfig.projectConfig,
3
4
  repositoryRoot: projectConfig.repositoryRoot,
4
5
  requireTestCommands: projectConfig.requireTestCommands,
@@ -14,10 +14,14 @@
14
14
  "releaseTestWorkflow": "test.yml"
15
15
  },
16
16
  "tests": {
17
- "commands": [],
17
+ "all": [],
18
+ "checkpoint": [],
18
19
  "receiptMaxAgeMinutes": 60,
19
20
  "npmTestUsesRunner": false
20
21
  },
22
+ "conventions": {
23
+ "rules": []
24
+ },
21
25
  "loggingEnabled": true,
22
26
  "loggingDirectory": "tmp/logs",
23
27
  "projectChecks": {