@mannyc1/ts-release 0.0.1 → 0.0.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/ARCHITECTURE.md +53 -0
- package/README.md +177 -34
- package/SPEC.md +8 -1
- package/dist/cli/command.d.ts +1 -1
- package/dist/cli/command.d.ts.map +1 -1
- package/dist/cli/command.js +101 -53
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/main.js +3 -9
- package/dist/cli/main.js.map +1 -1
- package/dist/domain/operation.d.ts.map +1 -1
- package/dist/domain/operation.js +31 -1
- package/dist/domain/operation.js.map +1 -1
- package/dist/domain/remote-state.d.ts +90 -0
- package/dist/domain/remote-state.d.ts.map +1 -0
- package/dist/domain/remote-state.js +85 -0
- package/dist/domain/remote-state.js.map +1 -0
- package/dist/domain/status.d.ts +43 -0
- package/dist/domain/status.d.ts.map +1 -0
- package/dist/domain/status.js +50 -0
- package/dist/domain/status.js.map +1 -0
- package/dist/domain/target.d.ts +32 -2
- package/dist/domain/target.d.ts.map +1 -1
- package/dist/domain/target.js +35 -2
- package/dist/domain/target.js.map +1 -1
- package/dist/host/host.d.ts +7 -23
- package/dist/host/host.d.ts.map +1 -1
- package/dist/host/host.js +3 -22
- package/dist/host/host.js.map +1 -1
- package/dist/host/http-live.d.ts +1 -2
- package/dist/host/http-live.d.ts.map +1 -1
- package/dist/host/http-live.js +15 -9
- package/dist/host/http-live.js.map +1 -1
- package/dist/host/platform.d.ts +10 -0
- package/dist/host/platform.d.ts.map +1 -0
- package/dist/host/platform.js +121 -0
- package/dist/host/platform.js.map +1 -0
- package/dist/host/test.d.ts +6 -3
- package/dist/host/test.d.ts.map +1 -1
- package/dist/host/test.js +111 -25
- package/dist/host/test.js.map +1 -1
- package/dist/planner/artifact-inventory.d.ts +9 -0
- package/dist/planner/artifact-inventory.d.ts.map +1 -0
- package/dist/planner/artifact-inventory.js +66 -0
- package/dist/planner/artifact-inventory.js.map +1 -0
- package/dist/planner/create-release-plan.d.ts +1 -1
- package/dist/planner/create-release-plan.d.ts.map +1 -1
- package/dist/planner/errors.d.ts +37 -1
- package/dist/planner/errors.d.ts.map +1 -1
- package/dist/planner/errors.js +30 -0
- package/dist/planner/errors.js.map +1 -1
- package/dist/planner/evidence-recorder.d.ts +13 -8
- package/dist/planner/evidence-recorder.d.ts.map +1 -1
- package/dist/planner/evidence-recorder.js +98 -18
- package/dist/planner/evidence-recorder.js.map +1 -1
- package/dist/planner/executor.d.ts +31 -19
- package/dist/planner/executor.d.ts.map +1 -1
- package/dist/planner/executor.js +19 -6
- package/dist/planner/executor.js.map +1 -1
- package/dist/planner/normalize-release.d.ts +2 -2
- package/dist/planner/normalize-release.d.ts.map +1 -1
- package/dist/planner/normalize-release.js +40 -43
- package/dist/planner/normalize-release.js.map +1 -1
- package/dist/planner/reconcile.d.ts +17 -0
- package/dist/planner/reconcile.d.ts.map +1 -0
- package/dist/planner/reconcile.js +280 -0
- package/dist/planner/reconcile.js.map +1 -0
- package/dist/planner/release-eligibility.d.ts +33 -0
- package/dist/planner/release-eligibility.d.ts.map +1 -0
- package/dist/planner/release-eligibility.js +172 -0
- package/dist/planner/release-eligibility.js.map +1 -0
- package/dist/planner/render-plan.d.ts.map +1 -1
- package/dist/planner/render-plan.js +21 -0
- package/dist/planner/render-plan.js.map +1 -1
- package/dist/planner/status.d.ts +40 -0
- package/dist/planner/status.d.ts.map +1 -0
- package/dist/planner/status.js +336 -0
- package/dist/planner/status.js.map +1 -0
- package/dist/runtime/bun.d.ts +9 -0
- package/dist/runtime/bun.d.ts.map +1 -0
- package/dist/runtime/bun.js +10 -0
- package/dist/runtime/bun.js.map +1 -0
- package/dist/targets/github.d.ts.map +1 -1
- package/dist/targets/github.js +17 -13
- package/dist/targets/github.js.map +1 -1
- package/dist/targets/npm.d.ts +2 -2
- package/dist/targets/npm.d.ts.map +1 -1
- package/dist/targets/npm.js +74 -14
- package/dist/targets/npm.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/workflows/config.d.ts +81 -0
- package/dist/workflows/config.d.ts.map +1 -0
- package/dist/workflows/config.js +191 -0
- package/dist/workflows/config.js.map +1 -0
- package/dist/workflows/evidence.d.ts +21 -0
- package/dist/workflows/evidence.d.ts.map +1 -0
- package/dist/workflows/evidence.js +45 -0
- package/dist/workflows/evidence.js.map +1 -0
- package/dist/workflows/live.d.ts +7 -0
- package/dist/workflows/live.d.ts.map +1 -0
- package/dist/workflows/live.js +5 -0
- package/dist/workflows/live.js.map +1 -0
- package/examples/README.md +6 -3
- package/examples/multi-target/release.config.json +6 -1
- package/examples/npm-first-publish/release.config.json +32 -0
- package/examples/npm-only/release.config.json +6 -1
- package/package.json +31 -9
- package/dist/cli/programmatic.d.ts +0 -25
- package/dist/cli/programmatic.d.ts.map +0 -1
- package/dist/cli/programmatic.js +0 -53
- package/dist/cli/programmatic.js.map +0 -1
- package/dist/host/bun.d.ts +0 -9
- package/dist/host/bun.d.ts.map +0 -1
- package/dist/host/bun.js +0 -156
- package/dist/host/bun.js.map +0 -1
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
`@mannyc1/ts-release` is library-first and CLI-second.
|
|
4
|
+
|
|
5
|
+
The package turns release intent into typed data, plans, evidence, and approved operations. The CLI is only an argv, console, and terminal-file adapter over those workflows.
|
|
6
|
+
|
|
7
|
+
## Module Taxonomy
|
|
8
|
+
|
|
9
|
+
- `domain/` contains durable schema-backed data models and errors.
|
|
10
|
+
- `config/` parses and validates release config into domain values.
|
|
11
|
+
- `planner/` normalizes release intent, builds plans, renders plans, executes operation data through injected services, records evidence, reports status, resumes safe work, and reconciles remote state.
|
|
12
|
+
- `targets/` models ecosystem-specific target semantics and produces operation data. Target modules may describe commands and HTTP checks, but they do not execute them.
|
|
13
|
+
- `host/` defines injectable command and HTTP services plus live or test implementations.
|
|
14
|
+
- `workflows/` contains reusable application workflows over config files, evidence files, and live target/HTTP composition. This is the high-level programmatic surface.
|
|
15
|
+
- `runtime/` contains runtime-specific layer assembly. `runtime/bun` is the Bun composition used by the published executable and maintenance scripts.
|
|
16
|
+
- `cli/` parses command-line flags, calls workflows, prints terminal output, and writes user-requested CLI output files.
|
|
17
|
+
- `scripts/` contains repository maintenance checks. Scripts may use runtime layers, but they are not package library code.
|
|
18
|
+
|
|
19
|
+
## Dependency Direction
|
|
20
|
+
|
|
21
|
+
Library modules must not import from `cli/`.
|
|
22
|
+
|
|
23
|
+
The normal flow is:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
domain <- config
|
|
27
|
+
domain <- planner <- targets
|
|
28
|
+
domain <- host
|
|
29
|
+
workflows -> config/planner/host/targets
|
|
30
|
+
runtime -> host/workflows/platform layers
|
|
31
|
+
cli -> workflows/runtime boundary
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`src/index.ts` intentionally stays empty. Public API is the explicit subpath list in `package.json`, checked by `scripts/check-package-exports.ts` and `scripts/check-tree-shaking.ts`.
|
|
35
|
+
|
|
36
|
+
## Public Workflow Surface
|
|
37
|
+
|
|
38
|
+
There is no public `./api` facade. The public workflow modules are named after the work they own:
|
|
39
|
+
|
|
40
|
+
- `./workflows/config` for config-file release workflows.
|
|
41
|
+
- `./workflows/evidence` for reusable evidence persistence.
|
|
42
|
+
- `./workflows/live` for runtime-neutral live target and HTTP services.
|
|
43
|
+
- `./runtime/bun` for the Bun runtime composition.
|
|
44
|
+
|
|
45
|
+
Use lower-level `domain/`, `config/`, `planner/`, `host/`, and `targets/` subpaths when a caller needs more control than the workflow modules provide.
|
|
46
|
+
|
|
47
|
+
## Boundary Rules
|
|
48
|
+
|
|
49
|
+
- Publish operations are data until execution is explicitly approved.
|
|
50
|
+
- `Effect.run*` belongs at true runtime boundaries.
|
|
51
|
+
- Layers are provided at CLI, runtime, script, and test boundaries.
|
|
52
|
+
- Config parsing, evidence persistence, status, resume, reconciliation, and release execution are library workflows, not CLI behavior.
|
|
53
|
+
- Terminal formatting, argv parsing, and `--out` file writing belong in `cli/`.
|
package/README.md
CHANGED
|
@@ -21,22 +21,35 @@ bun run cli validate --config release.config.json
|
|
|
21
21
|
bun run cli print --config release.config.json
|
|
22
22
|
bun run cli execute --config release.config.json --execute --approve-irreversible
|
|
23
23
|
bun run cli verify --config release.config.json
|
|
24
|
+
bun run cli eligibility --config release.config.json --format text
|
|
25
|
+
bun run cli reconcile --config release.config.json --execute
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
Rendering writes generated target files locally and records `render.json` evidence. `execute` is a lower-level primitive that runs publish operations only. Publishing is blocked unless execution is explicitly approved. Irreversible operations require a second approval flag.
|
|
27
29
|
|
|
30
|
+
Status and resume commands use existing `.release/evidence` files to report progress and continue conservative unfinished work:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
bun run cli status --config release.config.json --format text
|
|
34
|
+
bun run cli resume --config release.config.json --execute --approve-irreversible
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Resume skips operations with successful matching evidence, reruns safe read-only failures, and blocks failed publish operations until remote state is reconciled manually.
|
|
38
|
+
`eligibility` checks npm and GitHub remote state before the self-release workflow decides whether to run.
|
|
39
|
+
`reconcile` is separate from resume: it inspects GitHub release state through the API and can publish a matching draft release with explicit `--execute` without republishing immutable npm versions.
|
|
40
|
+
|
|
41
|
+
The executable is an argv and console adapter over TypeScript workflows. Release workflows are modeled as typed functions first, then exposed through the CLI for terminal and CI usage.
|
|
42
|
+
|
|
28
43
|
## Imports
|
|
29
44
|
|
|
30
45
|
The package intentionally avoids aggregate library barrels. The root `release` export is intentionally empty; import the exact module you need from an explicit subpath.
|
|
31
46
|
|
|
32
47
|
```ts
|
|
33
48
|
import * as Effect from "effect/Effect"
|
|
34
|
-
import * as Layer from "effect/Layer"
|
|
35
49
|
import { type ReleaseIntent } from "@mannyc1/ts-release/domain/release"
|
|
36
|
-
import { BunReleaseHostLayer } from "@mannyc1/ts-release/host/bun"
|
|
37
50
|
import { createReleasePlan } from "@mannyc1/ts-release/planner/create-release-plan"
|
|
38
51
|
import { validatePlan } from "@mannyc1/ts-release/planner/executor"
|
|
39
|
-
import {
|
|
52
|
+
import { makeBunReleaseWorkflowRuntimeLayer } from "@mannyc1/ts-release/runtime/bun"
|
|
40
53
|
|
|
41
54
|
const planAndValidate = (intent: ReleaseIntent) =>
|
|
42
55
|
Effect.gen(function*() {
|
|
@@ -44,46 +57,109 @@ const planAndValidate = (intent: ReleaseIntent) =>
|
|
|
44
57
|
const evidence = yield* validatePlan(plan)
|
|
45
58
|
return { plan, evidence }
|
|
46
59
|
}).pipe(
|
|
47
|
-
Effect.provide(
|
|
60
|
+
Effect.provide(makeBunReleaseWorkflowRuntimeLayer())
|
|
48
61
|
)
|
|
49
62
|
```
|
|
50
63
|
|
|
51
|
-
`createReleasePlan` needs a `TargetRegistry` layer. `
|
|
64
|
+
`createReleasePlan` needs a `TargetRegistry` layer. Command execution needs a `ReleaseCommandRunner` layer, while artifact checks and checksum generation use Effect Platform `FileSystem`, `Path`, and `Crypto` services directly. High-level config-file workflows, render writes, and evidence writes also need Effect Platform `FileSystem` and `Path` services. Workflows that verify HTTP evidence, such as `verifyPlan`, `runApprovedReleaseWorkflow`, or direct `VerifyHttpOperation` execution, also need a `ReleaseHttp` layer. `makeBunReleaseWorkflowRuntimeLayer` is the Bun runtime composition used by the published CLI; applications on other runtimes can compose `@mannyc1/ts-release/workflows/live`, `@mannyc1/ts-release/host/platform`, and their platform services at the edge. Tests can import `makeTestReleaseHttpLayer` from `@mannyc1/ts-release/host/http`. Internal Effect imports use deep module paths such as `effect/Effect` and `effect/Layer` to keep bundlers from depending on broad root-package analysis. See `ARCHITECTURE.md` for the module taxonomy.
|
|
52
65
|
|
|
53
|
-
##
|
|
66
|
+
## TypeScript Workflows
|
|
54
67
|
|
|
55
|
-
Applications can
|
|
68
|
+
Applications can call high-level release workflows without argv arrays or CLI command names:
|
|
56
69
|
|
|
57
70
|
```ts
|
|
58
71
|
import * as Effect from "effect/Effect"
|
|
72
|
+
import { makeBunReleaseWorkflowRuntimeLayer } from "@mannyc1/ts-release/runtime/bun"
|
|
59
73
|
import {
|
|
60
74
|
PlanReleaseConfigOptions,
|
|
75
|
+
ReleaseExecutionOptions,
|
|
76
|
+
ReleaseEligibilityConfigOptions,
|
|
77
|
+
ReleaseReconcileConfigOptions,
|
|
78
|
+
ReleaseResumeConfigOptions,
|
|
79
|
+
ReleaseStatusOptions,
|
|
80
|
+
checkReleaseConfigEligibility,
|
|
81
|
+
reconcileReleaseConfig,
|
|
61
82
|
planReleaseConfig,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
renderReleaseConfigPlan,
|
|
84
|
+
resumeReleaseConfig,
|
|
85
|
+
runReleaseConfig,
|
|
86
|
+
statusReleaseConfig
|
|
87
|
+
} from "@mannyc1/ts-release/workflows/config"
|
|
88
|
+
|
|
89
|
+
const root = "/path/to/release-workspace"
|
|
90
|
+
const RuntimeLayer = makeBunReleaseWorkflowRuntimeLayer({ root })
|
|
91
|
+
|
|
92
|
+
const textPlan = await Effect.runPromise(
|
|
93
|
+
renderReleaseConfigPlan(
|
|
94
|
+
PlanReleaseConfigOptions.make({ root, configPath: "release.config.json", format: "text" })
|
|
95
|
+
).pipe(Effect.provide(RuntimeLayer))
|
|
74
96
|
)
|
|
75
97
|
|
|
76
98
|
const plan = await Effect.runPromise(
|
|
77
|
-
planReleaseConfig(
|
|
78
|
-
|
|
79
|
-
|
|
99
|
+
planReleaseConfig(PlanReleaseConfigOptions.make({ root, configPath: "release.config.json" })).pipe(
|
|
100
|
+
Effect.provide(RuntimeLayer)
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
const evidence = await Effect.runPromise(
|
|
105
|
+
runReleaseConfig(
|
|
106
|
+
ReleaseExecutionOptions.make({
|
|
107
|
+
root,
|
|
108
|
+
configPath: "release.config.json",
|
|
109
|
+
execute: true,
|
|
110
|
+
approveIrreversible: true
|
|
111
|
+
})
|
|
112
|
+
).pipe(
|
|
113
|
+
Effect.provide(RuntimeLayer)
|
|
114
|
+
)
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
const status = await Effect.runPromise(
|
|
118
|
+
statusReleaseConfig(
|
|
119
|
+
ReleaseStatusOptions.make({ root, configPath: "release.config.json", format: "json" })
|
|
120
|
+
).pipe(
|
|
121
|
+
Effect.provide(RuntimeLayer)
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
const resumedEvidence = await Effect.runPromise(
|
|
126
|
+
resumeReleaseConfig(
|
|
127
|
+
ReleaseResumeConfigOptions.make({
|
|
128
|
+
root,
|
|
129
|
+
configPath: "release.config.json",
|
|
130
|
+
execute: true,
|
|
131
|
+
approveIrreversible: true
|
|
132
|
+
})
|
|
133
|
+
).pipe(
|
|
134
|
+
Effect.provide(RuntimeLayer)
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
const eligibility = await Effect.runPromise(
|
|
139
|
+
checkReleaseConfigEligibility(
|
|
140
|
+
ReleaseEligibilityConfigOptions.make({
|
|
141
|
+
root,
|
|
80
142
|
configPath: "release.config.json"
|
|
81
143
|
})
|
|
144
|
+
).pipe(
|
|
145
|
+
Effect.provide(RuntimeLayer)
|
|
146
|
+
)
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
const reconciliationEvidence = await Effect.runPromise(
|
|
150
|
+
reconcileReleaseConfig(
|
|
151
|
+
ReleaseReconcileConfigOptions.make({
|
|
152
|
+
root,
|
|
153
|
+
configPath: "release.config.json",
|
|
154
|
+
execute: true
|
|
155
|
+
})
|
|
156
|
+
).pipe(
|
|
157
|
+
Effect.provide(RuntimeLayer)
|
|
82
158
|
)
|
|
83
159
|
)
|
|
84
160
|
```
|
|
85
161
|
|
|
86
|
-
|
|
162
|
+
Use `@mannyc1/ts-release/workflows/config` for high-level config-file workflows, `@mannyc1/ts-release/workflows/evidence` for reusable evidence persistence, and `@mannyc1/ts-release/workflows/live` for the live target/HTTP layer. Bun callers can use `@mannyc1/ts-release/runtime/bun` for the same runtime layer used by the published binary. Node callers can provide Node platform services and a Node HTTP client instead. Use explicit lower-level planner, config, target, host, and domain subpaths when an application needs finer control over planning, execution, or test layers.
|
|
87
163
|
|
|
88
164
|
## Example Config
|
|
89
165
|
|
|
@@ -115,10 +191,15 @@ The helper provides the Bun host and live target registry internally, so callers
|
|
|
115
191
|
"_tag": "NpmRegistryTarget",
|
|
116
192
|
"id": "npm",
|
|
117
193
|
"registry": "https://registry.npmjs.org",
|
|
194
|
+
"packageName": "@mannyc1/ts-release",
|
|
118
195
|
"packagePath": ".",
|
|
119
|
-
"
|
|
196
|
+
"trustedPublishing": {
|
|
197
|
+
"provider": "github-actions",
|
|
198
|
+
"workflow": "release.yml",
|
|
199
|
+
"packageExists": true,
|
|
200
|
+
"verifyPackageExists": true
|
|
201
|
+
},
|
|
120
202
|
"access": "public",
|
|
121
|
-
"provenance": true,
|
|
122
203
|
"dryRunSupport": "native",
|
|
123
204
|
"mutability": "immutable",
|
|
124
205
|
"recovery": "publish-new-version"
|
|
@@ -135,11 +216,11 @@ The helper provides the Bun host and live target registry internally, so callers
|
|
|
135
216
|
}
|
|
136
217
|
],
|
|
137
218
|
"strict": true,
|
|
138
|
-
"evidenceDirectory": ".release/evidence"
|
|
219
|
+
"evidenceDirectory": ".release/evidence/{version}"
|
|
139
220
|
}
|
|
140
221
|
```
|
|
141
222
|
|
|
142
|
-
Paths are release-workspace relative and may not be absolute or contain parent traversal.
|
|
223
|
+
Paths are release-workspace relative and may not be absolute or contain parent traversal. `evidenceDirectory` may include the literal `{version}` placeholder, which is resolved during planning so each release version can use its own evidence directory.
|
|
143
224
|
|
|
144
225
|
Homebrew tap targets model catalog updates as generated files plus an approval-gated push:
|
|
145
226
|
|
|
@@ -205,23 +286,31 @@ Text plans include the release identity, evidence directory, artifact inventory,
|
|
|
205
286
|
```text
|
|
206
287
|
@mannyc1/ts-release@0.1.0
|
|
207
288
|
commit: abc123
|
|
208
|
-
evidence: .release/evidence
|
|
289
|
+
evidence: .release/evidence/0.1.0
|
|
209
290
|
artifacts: 2
|
|
210
291
|
targets: 2
|
|
211
292
|
operations: 9
|
|
212
293
|
|
|
213
294
|
targets:
|
|
214
295
|
- github [GitHubReleaseTarget] auth=env-token dry-run=simulated strategy=simulated-plan mutability=mutable-release recovery=delete-and-recreate
|
|
215
|
-
- npm [NpmRegistryTarget] auth=
|
|
296
|
+
- npm [NpmRegistryTarget] auth=trusted-publishing runs-in=ci provider=github-actions workflow=release.yml required-permission=id-token:write package-prerequisite=exists dry-run=native strategy=native-command mutability=immutable recovery=publish-new-version
|
|
216
297
|
```
|
|
217
298
|
|
|
218
299
|
JSON plans include the same data in a stable, CI-artifact-friendly shape, including `targetCapabilities`.
|
|
219
300
|
|
|
220
301
|
GitHub release verification uses the GitHub REST API to check the release tag, title, draft flag, prerelease flag, and each uploaded artifact name.
|
|
221
302
|
|
|
303
|
+
## Status and Resume
|
|
304
|
+
|
|
305
|
+
`status` reads local phase evidence and reports each current operation as pending, passed, failed, blocked, or complete without executing anything. The JSON format is schema-backed for CI or dashboards; the text format is intended for terminal review.
|
|
306
|
+
|
|
307
|
+
`resume` is intentionally conservative. It skips successful matching evidence, can rerun missing work and failed read-only validation or verification operations, and never reruns a failed publish operation. A failed publish command can still have changed the outside world, so resume blocks until a maintainer reconciles npm, GitHub, or any other remote state manually.
|
|
308
|
+
|
|
309
|
+
`reconcile` is the narrow remote repair path for GitHub Releases. It reads the GitHub release by tag, blocks on mismatched metadata or assets, skips an already matching published release, and can run `gh release edit <tag> --draft=false` for a matching draft when the target expects a public release. It does not run `npm publish`.
|
|
310
|
+
|
|
222
311
|
## Public API
|
|
223
312
|
|
|
224
|
-
The intentional public API is the explicit subpath list in `package.json`. `release/cli` and `release/cli/command`
|
|
313
|
+
The intentional public API is the explicit subpath list in `package.json`. The npm package exposes the `release` executable through `bin`; programmatic callers should import high-level workflows from `@mannyc1/ts-release/workflows/config` or use the explicit lower-level planner/config/target/status subpaths for finer control. `release/cli` and `release/cli/command` remain public for applications that need to embed the CLI command adapter.
|
|
225
314
|
|
|
226
315
|
The package export checker fails if a new export is added without being added to the intentional API list.
|
|
227
316
|
|
|
@@ -231,6 +320,7 @@ Runnable example configs live in `examples/`:
|
|
|
231
320
|
|
|
232
321
|
- `examples/multi-target`
|
|
233
322
|
- `examples/npm-only`
|
|
323
|
+
- `examples/npm-first-publish`
|
|
234
324
|
- `examples/github-release`
|
|
235
325
|
- `examples/homebrew-tap`
|
|
236
326
|
- `examples/pypi-registry`
|
|
@@ -247,7 +337,7 @@ bun ../../dist/cli/main.js plan --config release.config.json --format text
|
|
|
247
337
|
|
|
248
338
|
## Evidence
|
|
249
339
|
|
|
250
|
-
Render, validation, execution, and verification evidence is written as JSON bundles. Failed commands still preserve partial evidence before the command failure is returned.
|
|
340
|
+
Render, validation, execution, and verification evidence is written as JSON bundles. Failed commands still preserve partial evidence before the command failure is returned. Use `evidenceDirectory` such as `.release/evidence/{version}` when older local evidence should not collide with the current release version.
|
|
251
341
|
|
|
252
342
|
```json
|
|
253
343
|
{
|
|
@@ -287,7 +377,7 @@ RELEASE_INTEGRATION_GITHUB=1 bun run test:integration:tools
|
|
|
287
377
|
|
|
288
378
|
The first command validates npm adapter operations against the real `npm` CLI. The second also validates GitHub adapter readiness checks against the real `gh` CLI and requires `gh auth status` to succeed. GitHub release creation itself has no native dry-run; release validation is simulated from the deterministic plan before publish and verified against GitHub only after publish.
|
|
289
379
|
|
|
290
|
-
Example configs are checked through the
|
|
380
|
+
Example configs are checked through the TypeScript workflow path:
|
|
291
381
|
|
|
292
382
|
```sh
|
|
293
383
|
bun run check:examples
|
|
@@ -299,8 +389,61 @@ This repository also includes a first release config at `release.config.json` th
|
|
|
299
389
|
bun run check:self-release-config
|
|
300
390
|
```
|
|
301
391
|
|
|
392
|
+
### Self Release
|
|
393
|
+
|
|
394
|
+
The local non-publish gates for this package are:
|
|
395
|
+
|
|
396
|
+
```sh
|
|
397
|
+
bun run check:release
|
|
398
|
+
bun run release:artifacts
|
|
399
|
+
bun dist/cli/main.js plan --config release.config.json --format text
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
`release:artifacts` writes ignored files under `.release/artifacts`: the npm package tarball and standalone CLI executables for Linux, macOS, and Windows. GitHub Actions runs the approved release workflow on protected `main` when the package version has not already been published. The workflow uses npm trusted publishing with GitHub Actions OIDC instead of an npm token, and uploads `.release/evidence/**` for audit.
|
|
403
|
+
|
|
302
404
|
### Local Release Auth
|
|
303
405
|
|
|
304
|
-
Use `.env.example` as the local credential contract. Export `
|
|
406
|
+
Use `.env.example` as the local credential contract. Export `GH_TOKEN`, or copy
|
|
407
|
+
`.env.example` to `.env` and fill in token values locally. `.env` and `.npmrc`
|
|
408
|
+
are ignored intentionally; keep token values out of commits. `.npmrc.example`
|
|
409
|
+
shows npm's `${NPM_TOKEN}` interpolation form for token-based npm targets.
|
|
410
|
+
|
|
411
|
+
For npmjs releases from GitHub Actions, prefer structured `trustedPublishing` on
|
|
412
|
+
the npm target:
|
|
413
|
+
|
|
414
|
+
```json
|
|
415
|
+
{
|
|
416
|
+
"packageName": "@mannyc1/ts-release",
|
|
417
|
+
"trustedPublishing": {
|
|
418
|
+
"provider": "github-actions",
|
|
419
|
+
"workflow": "release.yml",
|
|
420
|
+
"packageExists": true,
|
|
421
|
+
"verifyPackageExists": true
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
```
|
|
305
425
|
|
|
306
|
-
|
|
426
|
+
Trusted publishing authenticates during `npm publish` with CI OIDC, so
|
|
427
|
+
`ts-release` records that mode in validation evidence instead of running
|
|
428
|
+
`npm whoami`, which does not validate OIDC publishing. Configure npmjs trusted
|
|
429
|
+
publishing for an existing package and use a GitHub-hosted runner with
|
|
430
|
+
`id-token: write`, Node 22.14+ and npm 11.5.1+. The `packageExists` field must be
|
|
431
|
+
`true` as a precondition acknowledgement, not first-publish support. Setting
|
|
432
|
+
`verifyPackageExists` to `true` adds a read-only `npm view <package>` validation
|
|
433
|
+
check. Trusted publishing does not use `NPM_TOKEN` for `npm publish`; token-based
|
|
434
|
+
npm targets may still use `.npmrc.example` and `NPM_TOKEN`.
|
|
435
|
+
|
|
436
|
+
### First npm Publish Bootstrap
|
|
437
|
+
|
|
438
|
+
Trusted publishing is the preferred steady state for GitHub Actions, but npm
|
|
439
|
+
requires the package to exist before trusted publishing can be configured. For a
|
|
440
|
+
new package, use a temporary token-based npm target with `tokenEnv: "NPM_TOKEN"`
|
|
441
|
+
and no `trustedPublishing` object. After the first version exists on npm,
|
|
442
|
+
configure npm trusted publishing for owner `mannyc2`, repository `ts-release`,
|
|
443
|
+
and workflow filename `release.yml`, then switch the target to
|
|
444
|
+
`trustedPublishing`.
|
|
445
|
+
|
|
446
|
+
Do not commit token values. Keep `.env.example` and `.npmrc.example` as
|
|
447
|
+
placeholder contracts only.
|
|
448
|
+
|
|
449
|
+
The first-release GitHub target uses `GH_TOKEN` for both `gh` command authentication and read-only REST API verification. The release workflow sets up a current Node/npm toolchain for trusted publishing and enables npm provenance for CI-based publishes where the registry can generate provenance.
|
package/SPEC.md
CHANGED
|
@@ -19,6 +19,7 @@ release intent
|
|
|
19
19
|
-> validation evidence
|
|
20
20
|
-> gated execution
|
|
21
21
|
-> post-publish verification
|
|
22
|
+
-> status and conservative resume
|
|
22
23
|
```
|
|
23
24
|
|
|
24
25
|
The package owns the model and the orchestration. Ecosystem tools remain the source of truth for ecosystem-specific behavior.
|
|
@@ -51,7 +52,7 @@ Examples:
|
|
|
51
52
|
- A catalog update changes a repository or index that points at artifacts.
|
|
52
53
|
- A deployment promotes already-built assets into an environment.
|
|
53
54
|
|
|
54
|
-
Each target should declare its required inputs, auth requirements, dry-run support, validation strategy, mutability rules, and recovery behavior.
|
|
55
|
+
Each target should declare its required inputs, auth requirements, dry-run support, validation strategy, mutability rules, and recovery behavior. When auth cannot be proven locally, the target should also model the expected execution context, provider-specific setup, and setup prerequisites.
|
|
55
56
|
|
|
56
57
|
### Evidence-driven validation
|
|
57
58
|
|
|
@@ -59,6 +60,8 @@ Validation should produce structured evidence, not just console output.
|
|
|
59
60
|
|
|
60
61
|
Evidence should be machine-readable enough for CI and human-readable enough for debugging. It should include command invocations, tool versions where practical, exit statuses, important paths, skipped checks, warnings, failures, and timestamps.
|
|
61
62
|
|
|
63
|
+
Evidence should also support status reporting and conservative resume after failed or interrupted releases.
|
|
64
|
+
|
|
62
65
|
Strict mode should fail on missing required validators. Non-strict mode may record skips, but skips must be visible in the evidence.
|
|
63
66
|
|
|
64
67
|
### Gated irreversible actions
|
|
@@ -67,6 +70,8 @@ Operations that publish immutable versions, create public releases, overwrite in
|
|
|
67
70
|
|
|
68
71
|
The default behavior should be dry-run or print-only. Execution should require an explicit execute flag, and irreversible operations should require a second confirmation flag or equivalent programmatic approval.
|
|
69
72
|
|
|
73
|
+
Failed publish evidence must not be treated as proof that nothing was published.
|
|
74
|
+
|
|
70
75
|
The package should make it hard to accidentally publish and easy to see exactly what would be published.
|
|
71
76
|
|
|
72
77
|
### Library-first, CLI-second
|
|
@@ -82,6 +87,8 @@ The library should expose APIs for:
|
|
|
82
87
|
- preparing executable operations
|
|
83
88
|
- running approved operations through an injected host interface
|
|
84
89
|
- recording evidence
|
|
90
|
+
- reporting release status from evidence
|
|
91
|
+
- conservatively resuming safe unfinished work
|
|
85
92
|
|
|
86
93
|
The CLI should mainly parse arguments, call the library, and format output.
|
|
87
94
|
|
package/dist/cli/command.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as Command from "effect/unstable/cli/Command";
|
|
2
2
|
export type * from "../types/effect-internal.js";
|
|
3
|
-
export declare const cli: Command.Command<"release", {}, {}, import("../
|
|
3
|
+
export declare const cli: Command.Command<"release", {}, {}, import("effect/PlatformError").PlatformError | import("../config/errors.js").ConfigReadError | import("../config/errors.js").ConfigParseError | import("../config/errors.js").ConfigValidationError | import("../domain/operation.js").ExecutionApprovalError | import("../planner/errors.js").ReleaseNormalizationError | import("../planner/errors.js").PlanConstructionError | import("../planner/errors.js").EvidenceWriteError | import("../planner/errors.js").EvidenceReadError | import("../planner/errors.js").WorkspaceWriteError | import("../planner/errors.js").ResumeBlockedError | import("../planner/errors.js").RemoteStateInspectionError | import("../planner/errors.js").ReleaseEligibilityCheckError | import("../planner/errors.js").ReconciliationBlockedError | import("../planner/errors.js").OperationFailedError | import("../targets/registry.js").MissingTargetAdapterError | import("../host/host.js").CommandRunnerError, never>;
|
|
4
4
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/cli/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/cli/command.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAA;AAqCtD,mBAAmB,6BAA6B,CAAA;AAiQhD,eAAO,MAAM,GAAG,o8BAcf,CAAA"}
|