@i-santos/create-package-starter 1.4.0 → 1.5.0-beta.10

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
@@ -6,9 +6,14 @@ Scaffold and standardize npm packages with a Changesets-first release workflow.
6
6
 
7
7
  ```bash
8
8
  npx @i-santos/create-package-starter --name hello-package
9
- npx @i-santos/create-package-starter --name @i-santos/swarm --default-branch main
9
+ npx @i-santos/create-package-starter --name @i-santos/swarm --default-branch main --release-auth pat
10
10
  npx @i-santos/create-package-starter init --dir ./existing-package
11
+ npx @i-santos/create-package-starter init --dir . --with-github --with-beta --with-npm --release-auth app --yes
11
12
  npx @i-santos/create-package-starter setup-github --repo i-santos/firestack --dry-run
13
+ npx @i-santos/create-package-starter setup-beta --dir . --beta-branch release/beta --release-auth pat
14
+ npx @i-santos/create-package-starter open-pr --auto-merge --watch-checks
15
+ npx @i-santos/create-package-starter release-cycle --yes
16
+ npx @i-santos/create-package-starter promote-stable --dir . --type patch --summary "Promote beta to stable"
12
17
  npx @i-santos/create-package-starter setup-npm --dir ./existing-package --publish-first
13
18
  ```
14
19
 
@@ -19,6 +24,7 @@ Create new package:
19
24
  - `--name <name>` (required, supports `pkg` and `@scope/pkg`)
20
25
  - `--out <directory>` (default: current directory)
21
26
  - `--default-branch <branch>` (default: `main`)
27
+ - `--release-auth <github-token|pat|app|manual-trigger>` (default: `pat`)
22
28
 
23
29
  Bootstrap existing package:
24
30
 
@@ -28,6 +34,15 @@ Bootstrap existing package:
28
34
  - `--cleanup-legacy-release` (remove `release:beta*`, `release:stable*`, `release:promote*`, `release:rollback*`, `release:dist-tags`)
29
35
  - `--scope <scope>` (optional placeholder helper for docs/templates)
30
36
  - `--default-branch <branch>` (default: `main`)
37
+ - `--release-auth <github-token|pat|app|manual-trigger>` (default: `pat`)
38
+ - `--beta-branch <branch>` (default: `release/beta`)
39
+ - `--with-github` (run GitHub setup in same flow)
40
+ - `--with-npm` (run npm setup in same flow)
41
+ - `--with-beta` (run beta flow setup; implies `--with-github`)
42
+ - `--repo <owner/repo>` (optional; inferred from `remote.origin.url` when omitted)
43
+ - `--ruleset <path>` (optional JSON override for main ruleset payload)
44
+ - `--dry-run` (preview planned operations without mutating)
45
+ - `--yes` (skip confirmation prompts)
31
46
 
32
47
  Configure GitHub repository settings:
33
48
 
@@ -37,6 +52,75 @@ Configure GitHub repository settings:
37
52
  - `--ruleset <path>` (optional JSON override)
38
53
  - `--dry-run` (prints intended operations only)
39
54
 
55
+ Bootstrap beta release flow:
56
+
57
+ - `setup-beta`
58
+ - `--dir <directory>` (default: current directory)
59
+ - `--beta-branch <branch>` (default: `release/beta`)
60
+ - `--default-branch <branch>` (default: `main`)
61
+ - `--repo <owner/repo>` (optional; inferred from `remote.origin.url` when omitted)
62
+ - `--release-auth <github-token|pat|app|manual-trigger>` (default: `pat`)
63
+ - `--force` (overwrite managed scripts/workflow)
64
+ - `--dry-run` (prints intended operations only)
65
+ - `--yes` (skip interactive confirmations)
66
+
67
+ Create/update pull requests:
68
+
69
+ - `open-pr`
70
+ - `--repo <owner/repo>` (optional; inferred from `remote.origin.url` when omitted)
71
+ - `--base <branch>` (default: `release/beta`, or `main` when head is `release/beta`)
72
+ - `--head <branch>` (default: current branch)
73
+ - `--title <text>` (default: latest commit subject)
74
+ - `--body <text>` (highest priority body source)
75
+ - `--body-file <path>`
76
+ - `--template <path>` (default fallback `.github/PULL_REQUEST_TEMPLATE.md`)
77
+ - `--draft`
78
+ - `--auto-merge`
79
+ - `--watch-checks`
80
+ - `--check-timeout <minutes>` (default: `30`)
81
+ - `--yes`
82
+ - `--dry-run`
83
+
84
+ Orchestrate release cycle:
85
+
86
+ - `release-cycle`
87
+ - `--repo <owner/repo>` (optional; inferred from `remote.origin.url` when omitted)
88
+ - `--mode <auto|open-pr|publish>` (default: `auto`)
89
+ - `--track <auto|beta|stable>` (default: `auto`)
90
+ - `--promote-stable` (explicitly trigger stable promotion path; only valid from `release/beta`)
91
+ - `--promote-type <patch|minor|major>` (default: `patch`)
92
+ - `--promote-summary <text>`
93
+ - `--head <branch>`
94
+ - `--base <branch>`
95
+ - `--title <text>`
96
+ - `--body-file <path>`
97
+ - `--draft`
98
+ - `--phase <code|full>` (default: `full`)
99
+ - `--auto-merge` (default behavior: enabled)
100
+ - `--watch-checks` (default behavior: enabled)
101
+ - `--check-timeout <minutes>` (default: `30`)
102
+ - `--confirm-merges` (require confirmation before each merge step)
103
+ - `--merge-when-green` (default behavior: enabled)
104
+ - `--merge-method <squash|merge|rebase>` (default: `squash`)
105
+ - `--wait-release-pr` (default behavior: enabled)
106
+ - `--release-pr-timeout <minutes>` (default: `30`)
107
+ - `--merge-release-pr` (default behavior: enabled)
108
+ - `--verify-npm` (default behavior: enabled)
109
+ - `--confirm-cleanup` (require confirmation before cleanup; only after npm validation pass)
110
+ - `--sync-base <auto|rebase|merge|off>` (default: `auto`; keeps code branch updated with `release/beta`)
111
+ - `--no-resume` (disable automatic resume/reconciliation behavior)
112
+ - `--no-cleanup` (disable default local cleanup after successful cycle)
113
+ - `--yes`
114
+ - `--dry-run`
115
+
116
+ Prepare stable promotion from beta track:
117
+
118
+ - `promote-stable`
119
+ - `--dir <directory>` (default: current directory)
120
+ - `--type <patch|minor|major>` (default: `patch`)
121
+ - `--summary <text>` (default: `Promote beta track to stable release.`)
122
+ - `--dry-run` (prints intended operations only)
123
+
40
124
  Bootstrap npm publishing:
41
125
 
42
126
  - `setup-npm`
@@ -54,6 +138,7 @@ The generated and managed baseline includes:
54
138
  - `.changeset/README.md`
55
139
  - `.github/workflows/ci.yml`
56
140
  - `.github/workflows/release.yml`
141
+ - `.github/workflows/promote-stable.yml`
57
142
  - `.github/PULL_REQUEST_TEMPLATE.md`
58
143
  - `.github/CODEOWNERS`
59
144
  - `CONTRIBUTING.md`
@@ -64,9 +149,20 @@ The generated and managed baseline includes:
64
149
 
65
150
  - Default mode is safe-merge: existing managed files and keys are preserved.
66
151
  - `--force` overwrites managed files and managed script/dependency keys.
152
+ - `README.md` and `CONTRIBUTING.md` are create-only in `init` (never overwritten).
153
+ - Existing `.gitignore` is merged by appending missing template entries.
67
154
  - Existing custom `check` script is preserved unless `--force`.
68
155
  - Existing `@changesets/cli` version is preserved unless `--force`.
69
156
  - Lowercase `.github/pull_request_template.md` is recognized as an existing equivalent template.
157
+ - `npm install` runs at the end of `init` (or is previewed in `--dry-run`).
158
+ - If no `--with-*` flags are provided:
159
+ - TTY: asks interactively which external setup to run (`github`, `npm`, `beta`).
160
+ - non-TTY: runs local init only and prints warning with next steps.
161
+ - If `--release-auth` is omitted:
162
+ - TTY: asks explicitly to choose release auth mode (`pat`, `app`, `github-token`, `manual-trigger`).
163
+ - non-TTY: defaults to `pat` and prints warning.
164
+ - Integrated mode (`--with-github/--with-npm/--with-beta`) pre-validates everything first (gh auth, npm auth, repo/branch/ruleset/package checks) and fails fast before local mutations if validation fails.
165
+ - Integrated mode asks confirmation for sensitive external operations and ruleset/branch adoption conflicts (unless `--yes`).
70
166
 
71
167
  ## Output Summary Contract
72
168
 
@@ -92,6 +188,117 @@ All commands print a deterministic summary with:
92
188
 
93
189
  If `gh` is missing or unauthenticated, command exits non-zero with actionable guidance.
94
190
 
191
+ ## setup-beta Behavior
192
+
193
+ `setup-beta` configures prerelease automation:
194
+
195
+ - adds beta scripts to `package.json`
196
+ - creates/preserves `.github/workflows/release.yml` with beta+stable branch triggers
197
+ - creates/preserves `.github/workflows/ci.yml` with beta+stable branch triggers
198
+ - creates/preserves `.github/workflows/auto-retarget-pr.yml` to retarget PR bases automatically (`release/beta -> main`, all other branches -> `release/beta`)
199
+ - supports release auth strategy for Changesets branch updates: `pat`, `app`, `github-token`, or `manual-trigger`
200
+ - ensures `release/beta` branch exists remotely (created from default branch if missing)
201
+ - applies beta branch protection ruleset on GitHub with stable required check context (`required-check`)
202
+ - asks for confirmation before mutating repository settings and again before overwriting existing beta ruleset
203
+ - supports safe-merge by default and `--force` overwrite
204
+ - supports configurable beta branch (`release/beta` by default)
205
+
206
+ ## open-pr Behavior
207
+
208
+ `open-pr` removes repetitive manual PR steps:
209
+
210
+ - resolves repo + branch defaults
211
+ - pushes branch (set upstream when needed)
212
+ - creates PR or updates existing PR for same `head -> base`
213
+ - generates deterministic PR body when explicit body is not provided
214
+ - optionally enables auto-merge
215
+ - optionally watches checks until green/fail/timeout
216
+
217
+ Body source priority:
218
+ 1. `--body`
219
+ 2. `--body-file`
220
+ 3. `--template` (or `.github/PULL_REQUEST_TEMPLATE.md`)
221
+ 4. deterministic generated body
222
+
223
+ ## release-cycle Behavior
224
+
225
+ `release-cycle` orchestrates code PR and release PR progression end-to-end.
226
+
227
+ Default mode is `auto`:
228
+ - if current branch starts with `changeset-release/` => `publish`
229
+ - else if current branch is `release/beta` and exactly one open `changeset-release/*` PR exists => `publish`
230
+ - else => `open-pr`
231
+
232
+ For `open-pr` mode:
233
+ - runs open-pr flow
234
+ - auto-syncs feature/fix branch with `origin/release/beta` before PR (default `--sync-base auto`)
235
+ - enables auto-merge for code PR by default
236
+ - auto-resumes release phase if current code branch is already integrated into `release/beta`
237
+ - supports `--phase code` to stop after code PR merge
238
+ - can wait for release PR creation (`changeset-release/*`)
239
+ - enables auto-merge for release PR by default
240
+ - validates npm publish (package + version + expected dist-tag)
241
+ - cleans local branch by default when safety gates are satisfied (`--no-cleanup` to disable)
242
+
243
+ For `publish` mode:
244
+ - resolves release PR directly
245
+ - watches checks
246
+ - enables auto-merge and waits for merge completion (policy permitting)
247
+
248
+ The command is policy-aware:
249
+ - never bypasses required checks/reviews/rulesets
250
+ - fails fast with actionable diagnostics when blocked
251
+ - stops with actionable guidance when approval is still required before merge
252
+ - cleanup runs only when npm validation passes
253
+
254
+ ### Protected `release/beta` stable promotion
255
+
256
+ When `release/beta` is protected (PR-only), stable promotion in `release-cycle --promote-stable` uses a hybrid flow:
257
+
258
+ 1. dispatch `.github/workflows/promote-stable.yml`
259
+ 2. workflow creates `promote/stable-*` branch
260
+ 3. workflow opens PR `promote/stable-* -> release/beta` and enables auto-merge
261
+ 4. after merge, cycle continues with `release/beta -> main` and release PR progression
262
+
263
+ No direct push to `release/beta` is used in this path.
264
+
265
+ `release-auth` modes:
266
+ - `pat` (recommended default): uses `CHANGESETS_GH_TOKEN` fallback to `GITHUB_TOKEN`
267
+ - `app`: generates token via GitHub App (`GH_APP_ID` or `GH_APP_CLIENT_ID`, plus `GH_APP_PRIVATE_KEY`)
268
+ - `github-token`: uses built-in `GITHUB_TOKEN` only
269
+ - `manual-trigger`: uses built-in token and expects manual retrigger (empty commit) if release PR checks stay pending
270
+
271
+ If `--release-auth` is omitted in interactive mode, setup prompts for explicit mode selection.
272
+
273
+ ### release-auth decision table
274
+
275
+ | Mode | When to use | Required secrets | Trade-off |
276
+ | --- | --- | --- | --- |
277
+ | `pat` | Fastest setup for solo/small repos | `CHANGESETS_GH_TOKEN` | Simpler, but relies on PAT lifecycle/rotation |
278
+ | `app` | Preferred for long-lived org/repo automation | `GH_APP_PRIVATE_KEY` + (`GH_APP_CLIENT_ID` or `GH_APP_ID`) | More setup, better long-term security and governance |
279
+ | `github-token` | Minimal setup / experiments | none | Some downstream workflow retriggers may not happen |
280
+ | `manual-trigger` | Accept manual CI retrigger on release PR updates | none | Extra manual empty-commit step when checks are pending |
281
+
282
+ `GITHUB_TOKEN` can create/update release PRs in many cases, but events emitted by that workflow token may not retrigger downstream workflows (anti-recursion behavior).
283
+ For reliable retriggers on `changeset-release/*` updates, prefer `pat` or `app`.
284
+
285
+ GitHub App docs:
286
+ - Overview: https://docs.github.com/apps
287
+ - Create app: https://docs.github.com/apps/creating-github-apps/registering-a-github-app/registering-a-github-app
288
+ - Install app: https://docs.github.com/apps/using-github-apps/installing-your-own-github-app
289
+ - Manage secrets: https://docs.github.com/actions/security-guides/using-secrets-in-github-actions
290
+ - Project guide: https://github.com/i-santos/package-starter/blob/main/docs/release-auth-github-app.md
291
+ - PR orchestration guide: https://github.com/i-santos/package-starter/blob/main/docs/pr-orchestration.md
292
+
293
+ ## promote-stable Behavior
294
+
295
+ `promote-stable` prepares stable promotion from prerelease mode:
296
+
297
+ - validates `.changeset/pre.json` exists
298
+ - runs `changeset pre exit`
299
+ - creates a promotion changeset (`patch|minor|major`)
300
+ - prints next step guidance for opening beta->main PR
301
+
95
302
  ## setup-npm Behavior
96
303
 
97
304
  `setup-npm` validates npm publish readiness:
@@ -104,6 +311,8 @@ If `gh` is missing or unauthenticated, command exits non-zero with actionable gu
104
311
 
105
312
  Important: Trusted Publisher still needs manual setup in npm package settings.
106
313
 
314
+ When npm setup runs inside orchestrated `init --with-npm`, first publish is automatic when package is not found on npm.
315
+
107
316
  ## Trusted Publishing Note
108
317
 
109
318
  If package does not exist on npm yet, first publish may be manual: