@jakobm/peacekeeper 0.25.0 → 0.25.2

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
@@ -15,7 +15,9 @@ The flat module set consists of `cli`, `configuration`, `projects`, `testing`,
15
15
  names to explicit operations on each domain's frozen facade. Modules
16
16
  receive private factories, permitted module facades, and external services through
17
17
  Portico injection; direct runtime imports inside the module tree are rejected by
18
- the configured `portico check`. Permitted dependencies are declared in
18
+ the configured `portico check`. Each module declares its type-only contract in
19
+ `interface.ts` and exports its named `porticoFacade` factory from `facade.ts`.
20
+ Permitted dependencies are declared in
19
21
  `src/modules/dependencies.yaml`. Cmdabra generates the CLI implementation contract
20
22
  as `src/modules/cli/types.ts` from the root `cmdabra.yaml`; `npm run typecheck`
21
23
  verifies that it is current before checking the TypeScript project.
@@ -27,6 +29,11 @@ Checkpoint and session lifecycle hooks use the same Cmdabra and Portico composit
27
29
  as other CLI commands. Dependencies must therefore be installed in every worktree
28
30
  before its hooks run; the required Codex environment setup performs `npm ci`.
29
31
 
32
+ The CLI also exposes Cmdabra's global `--cmdabra-complete` option for
33
+ [shell completion adapters](https://github.com/jakobmattsson/cmdabra#shell-completion).
34
+ It accepts the current word index followed by all command-line words and prints
35
+ completion candidates without running a command.
36
+
30
37
  ## Create a compliant TypeScript project
31
38
 
32
39
  `create-project` creates a minimal ESM TypeScript library in an existing, completely
@@ -668,7 +675,9 @@ It never uses an administrator bypass or pushes directly to the default branch.
668
675
  After merge, the command verifies the package files at the PR's actual merge
669
676
  commit, tags that commit with `v<version>`, and pushes the tag. The existing
670
677
  workflow publishes through npm trusted publishing. The command then waits for
671
- the publish job and for the version to appear on npm. Git and an authenticated
678
+ the publish job and for the version to appear on npm. Monitoring reads the run
679
+ status before its jobs so a job finishing between requests does not produce a
680
+ false publication failure. Git and an authenticated
672
681
  GitHub CLI (`gh`) with Contents read/write, Pull requests read/write, Actions
673
682
  read and the policy-reading access described above are required. Registry checks
674
683
  use a temporary npm cache and request current metadata.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jakobm/peacekeeper",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
4
  "description": "Shared repository test, Git worktree, and Codex hook commands",
5
5
  "license": "MIT",
6
6
  "author": "Jakob Mattsson",
@@ -41,8 +41,8 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@iarna/toml": "^2.2.5",
44
- "@jakobm/cmdabra": "^0.6.0",
45
- "@jakobm/portico": "^0.7.0",
44
+ "@jakobm/cmdabra": "^0.7.0",
45
+ "@jakobm/portico": "^0.8.1",
46
46
  "semver": "^7.8.5",
47
47
  "yaml": "^2.9.1"
48
48
  },
@@ -0,0 +1 @@
1
+ export const porticoFacade = ({ service }) => ({ run: service.run });
@@ -1 +1 @@
1
- export default ({ service }) => ({ run: service.run });
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export const porticoFacade = ({ projectConfig, updateConfig }) => ({
2
+ projectConfig: projectConfig.projectConfig,
3
+ repositoryRoot: projectConfig.repositoryRoot,
4
+ requireTestCommands: projectConfig.requireTestCommands,
5
+ validateConfig: projectConfig.validateConfig,
6
+ updateConfig: updateConfig.run,
7
+ });
@@ -1,7 +1 @@
1
- export default ({ projectConfig, updateConfig }) => ({
2
- projectConfig: projectConfig.projectConfig,
3
- repositoryRoot: projectConfig.repositoryRoot,
4
- requireTestCommands: projectConfig.requireTestCommands,
5
- validateConfig: projectConfig.validateConfig,
6
- updateConfig: updateConfig.run,
7
- });
1
+ export {};
@@ -11,6 +11,6 @@ allowed-external:
11
11
  configuration: [execFileSync, fs, isDeepStrictEqual, output, path, projectConfigDefaults, runtime, YAML]
12
12
  lifecycle: [buffer, clock, executablePath, fs, output, path, runtime, spawn, spawnSync]
13
13
  maintenance: [execFileSync, fs, output, path, runtime, spawnSync]
14
- projects: [buffer, fs, isDeepStrictEqual, modulesRoot, output, packageVersion, path, projectConfigDefaults, runtime, semver, spawnSync, TOML, url, YAML]
15
- releases: [assessReleaseSchema, clock, execFileSync, fs, modulesRoot, os, output, path, runtime, semver, spawnSync, url, YAML]
14
+ projects: [buffer, fs, isDeepStrictEqual, modulesRoot, output, packageVersion, path, projectConfigDefaults, runtime, semver, spawnSync, structuredClone, TOML, url, YAML]
15
+ releases: [assessReleaseSchema, clock, execFileSync, fs, modulesRoot, os, output, path, runtime, semver, spawnSync, structuredClone, url, YAML]
16
16
  testing: [clock, crypto, execFileSync, fs, modulesRoot, os, output, path, runtime, spawnSync]
@@ -42,6 +42,7 @@ export default () => ({
42
42
  semver,
43
43
  spawn,
44
44
  spawnSync,
45
+ structuredClone,
45
46
  TOML,
46
47
  url: URL,
47
48
  YAML,
@@ -0,0 +1,7 @@
1
+ export const porticoFacade = ({ checkpointCodexChanges, checkpointCodexSessionStart, checkpointCodexStop, cleanupEndedSession, queueMergedWorktreeCleanup }) => ({
2
+ checkpointCodexChanges: checkpointCodexChanges.run,
3
+ checkpointCodexSessionStart: checkpointCodexSessionStart.run,
4
+ checkpointCodexStop: checkpointCodexStop.run,
5
+ cleanupEndedSession: cleanupEndedSession.run,
6
+ queueMergedWorktreeCleanup: queueMergedWorktreeCleanup.run,
7
+ });
@@ -1,7 +1 @@
1
- export default ({ checkpointCodexChanges, checkpointCodexSessionStart, checkpointCodexStop, cleanupEndedSession, queueMergedWorktreeCleanup }) => ({
2
- checkpointCodexChanges: checkpointCodexChanges.run,
3
- checkpointCodexSessionStart: checkpointCodexSessionStart.run,
4
- checkpointCodexStop: checkpointCodexStop.run,
5
- cleanupEndedSession: cleanupEndedSession.run,
6
- queueMergedWorktreeCleanup: queueMergedWorktreeCleanup.run,
7
- });
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export const porticoFacade = ({ cleanupMergedBranches, initializeCodexWorktree, removeEmptyDirectories }) => ({
2
+ applyPlan: cleanupMergedBranches.applyPlan,
3
+ buildPlan: cleanupMergedBranches.buildPlan,
4
+ cleanupMergedBranches: cleanupMergedBranches.run,
5
+ initializeCodexWorktree: initializeCodexWorktree.main,
6
+ listWorktrees: cleanupMergedBranches.listWorktrees,
7
+ removeEmptyDirectories: removeEmptyDirectories.main,
8
+ });
@@ -1,8 +1 @@
1
- export default ({ cleanupMergedBranches, initializeCodexWorktree, removeEmptyDirectories }) => ({
2
- applyPlan: cleanupMergedBranches.applyPlan,
3
- buildPlan: cleanupMergedBranches.buildPlan,
4
- cleanupMergedBranches: cleanupMergedBranches.run,
5
- initializeCodexWorktree: initializeCodexWorktree.main,
6
- listWorktrees: cleanupMergedBranches.listWorktrees,
7
- removeEmptyDirectories: removeEmptyDirectories.main,
8
- });
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export const porticoFacade = ({ checkProject, createProject, generateGithubSetup, installHooks }) => ({
2
+ checkProject: checkProject.run,
3
+ createProject: createProject.run,
4
+ generateGithubSetup: generateGithubSetup.run,
5
+ installHooks: installHooks.run,
6
+ });
@@ -1,4 +1,4 @@
1
- export default ({ configuration, createProjectCore, external: { buffer: Buffer, projectConfigDefaults, runtime, spawnSync, YAML, } }) => {
1
+ export default ({ configuration, createProjectCore, external: { buffer: Buffer, projectConfigDefaults, runtime, spawnSync, structuredClone, YAML, } }) => {
2
2
  const { validateConfig } = configuration;
3
3
  const { githubSetup, repositoryIdentity } = createProjectCore;
4
4
  function api(endpoint, missingAllowed = false) {
@@ -1,6 +1 @@
1
- export default ({ checkProject, createProject, generateGithubSetup, installHooks }) => ({
2
- checkProject: checkProject.run,
3
- createProject: createProject.run,
4
- generateGithubSetup: generateGithubSetup.run,
5
- installHooks: installHooks.run,
6
- });
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export const porticoFacade = ({ assessRelease, githubPolicy, release, releaseCore, verifyRelease, verifyReleaseProtection, verifyReleaseVersion }) => ({
2
+ assessRelease: assessRelease.run,
3
+ createGithubPolicy: githubPolicy.createGithubPolicy,
4
+ ensureLockfilesMatch: releaseCore.ensureLockfilesMatch,
5
+ githubSetupPlan: githubPolicy.setupPlan,
6
+ inspectWorkflow: releaseCore.inspectWorkflow,
7
+ release: release.run,
8
+ verifyRelease: verifyRelease.run,
9
+ verifyReleaseProtection: verifyReleaseProtection.run,
10
+ verifyReleaseVersion: verifyReleaseVersion.run,
11
+ });
@@ -1,4 +1,4 @@
1
- export default ({ external: { fs, modulesRoot, path } }) => {
1
+ export default ({ external: { fs, modulesRoot, path, structuredClone } }) => {
2
2
  const ownerIdMarker = '__PEACEKEEPER_OWNER_ID__';
3
3
  const directive = '$peacekeeper';
4
4
  function readDocument(filename) {
@@ -1,11 +1 @@
1
- export default ({ assessRelease, githubPolicy, release, releaseCore, verifyRelease, verifyReleaseProtection, verifyReleaseVersion }) => ({
2
- assessRelease: assessRelease.run,
3
- createGithubPolicy: githubPolicy.createGithubPolicy,
4
- ensureLockfilesMatch: releaseCore.ensureLockfilesMatch,
5
- githubSetupPlan: githubPolicy.setupPlan,
6
- inspectWorkflow: releaseCore.inspectWorkflow,
7
- release: release.run,
8
- verifyRelease: verifyRelease.run,
9
- verifyReleaseProtection: verifyReleaseProtection.run,
10
- verifyReleaseVersion: verifyReleaseVersion.run,
11
- });
1
+ export {};
@@ -298,6 +298,9 @@ export default ({ configuration, releaseProtection, external: { clock, fs, os, p
298
298
  }
299
299
  }
300
300
  if (runId) {
301
+ // Read the run first: it can finish while we fetch jobs. A completed
302
+ // run must be checked against a newer job snapshot, never an older one.
303
+ const runStatus = github(exec, cwd, details.host, `repos/${details.slug}/actions/runs/${runId}`, {});
301
304
  const jobs = github(exec, cwd, details.host, `repos/${details.slug}/actions/runs/${runId}/jobs`, {
302
305
  per_page: '100',
303
306
  }).jobs || [];
@@ -307,7 +310,6 @@ export default ({ configuration, releaseProtection, external: { clock, fs, os, p
307
310
  if (matching.length === 1 && matching[0].status === 'completed' && matching[0].conclusion !== 'success') {
308
311
  throw new ReleaseError(`Publish job in GitHub run ${runId} ended as ${matching[0].conclusion}.`);
309
312
  }
310
- const runStatus = github(exec, cwd, details.host, `repos/${details.slug}/actions/runs/${runId}`, {});
311
313
  if (runStatus.status === 'completed') {
312
314
  if (matching.length !== 1 || matching[0].status !== 'completed' || matching[0].conclusion !== 'success') {
313
315
  throw new ReleaseError(`Workflow run ${runId} completed without a successful publish job.`);
@@ -0,0 +1,5 @@
1
+ export const porticoFacade = ({ checkTestReceipt, recordTestReceipt, runTests }) => ({
2
+ checkTestReceipt: checkTestReceipt.run,
3
+ recordTestReceipt: recordTestReceipt.run,
4
+ runTests: runTests.run,
5
+ });
@@ -1,5 +1 @@
1
- export default ({ checkTestReceipt, recordTestReceipt, runTests }) => ({
2
- checkTestReceipt: checkTestReceipt.run,
3
- recordTestReceipt: recordTestReceipt.run,
4
- runTests: runTests.run,
5
- });
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jakobm/peacekeeper",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
4
  "description": "Shared repository test, Git worktree, and Codex hook commands",
5
5
  "license": "MIT",
6
6
  "author": "Jakob Mattsson",
@@ -41,8 +41,8 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@iarna/toml": "^2.2.5",
44
- "@jakobm/cmdabra": "^0.6.0",
45
- "@jakobm/portico": "^0.7.0",
44
+ "@jakobm/cmdabra": "^0.7.0",
45
+ "@jakobm/portico": "^0.8.1",
46
46
  "semver": "^7.8.5",
47
47
  "yaml": "^2.9.1"
48
48
  },