@syntopica/create-baseline 0.11.0 → 0.12.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,427 @@
1
+ # @syntopica/create-baseline
2
+
3
+ ## 0.12.0
4
+
5
+ - The published package now includes `CHANGELOG.md`, so an installed copy
6
+ carries its own release notes. `baseline-changes` (in
7
+ `@syntopica/quality-config`) prints the sections an upgrade passed.
8
+ - The generated `package.json` gets a `changes` script (`baseline-changes`) that
9
+ `check:ci` runs first, so the run after an upgrade prints what changed. Commit
10
+ the `.baseline-versions.json` it writes. Existing repositories add the script
11
+ and the `pnpm changes &&` prefix by hand.
12
+
13
+ - Generated CI workflow and `lefthook.yml` skip the gates on backlog-only
14
+ changes in repositories that keep a tadu backlog (`todo/tadu.json` or
15
+ `TODO.md`), running `tadu doctor .` instead. Output for other repositories is
16
+ unchanged. Adopters running `prettier --check .` must add `todo/` to
17
+ `.prettierignore`.
18
+
19
+ ## 0.11.0
20
+
21
+ - Add Dart, Swift and Go projects to the estate report and check their gate
22
+ versions.
23
+
24
+ - Recognize coverage scripts invoked by CI and report fatal coverage findings.
25
+
26
+ - Resolve the Oxlint configuration from the consumer project and update the
27
+ baseline package pins.
28
+
29
+ ## 0.10.6
30
+
31
+ ### Patch Changes
32
+
33
+ - fix: pin `@syntopica/eslint-config` `^0.10.0`, `@syntopica/quality-config`
34
+ `^0.14.0` and `eslint-plugin-code-policy` `^0.9.0`: the `boundaries` preset
35
+ with `atomic: false`, `knip --production` support and the opt-in dependency
36
+ cruiser module boundaries.
37
+
38
+ ## 0.10.5
39
+
40
+ ### Patch Changes
41
+
42
+ - fix: pin `@syntopica/quality-config` `^0.13.2`, whose knip preset stops
43
+ reporting `type-coverage`, `lefthook` and hosted ESLint peers wrongly.
44
+ - The generated CI workflow pins `actions/checkout` v7, `actions/setup-node` v7,
45
+ `pnpm/action-setup` v6.1.0 and `zizmorcore/zizmor-action` v0.6.4.
46
+
47
+ ## 0.10.4
48
+
49
+ ### Patch Changes
50
+
51
+ - fix: pin `@syntopica/prettier-config` `^0.3.0`, which keeps managed BEGIN/END
52
+ blocks verbatim and wraps the rest of `AGENTS.md` and `CLAUDE.md`.
53
+
54
+ ## 0.10.3
55
+
56
+ ### Patch Changes
57
+
58
+ - fix: pin `@syntopica/quality-config` `^0.13.1`, whose knip preset leaves no
59
+ configuration hints in a CLI-shaped project.
60
+
61
+ ## 0.10.2
62
+
63
+ ### Patch Changes
64
+
65
+ - fix: pin `@syntopica/quality-config` `^0.13.0`, which ships the
66
+ `baseline-hooks-install` bin the templates now call from `prepare`.
67
+
68
+ ## 0.10.1
69
+
70
+ ### Patch Changes
71
+
72
+ - fix: pin `@syntopica/prettier-config` `^0.2.2`. 0.10.0 pinned `^0.2.1`, which
73
+ was tagged but never reached npm, so 0.10.0 was never published either.
74
+
75
+ ## 0.10.0
76
+
77
+ ### Minor Changes
78
+
79
+ - feat!: the scaffolders and `--check` use the `@syntopica` scope. Templates
80
+ install `@syntopica/eslint-config`, `@syntopica/tsconfig`,
81
+ `@syntopica/prettier-config` and `@syntopica/quality-config`, and the tsconfig
82
+ conformance check expects a `@syntopica/tsconfig` preset, so a repository
83
+ still on the `@busirocket` packages reports as non-conformant until it moves.
84
+ - feat!: the Python checks follow the rename to `codeality-py`: the quality
85
+ group depends on `syntopica-codeality-py`, the workflow runs
86
+ `codeality-py gate`, and the lock check reads `python-versions.json`, split
87
+ out of `baseline-versions.json` so `--check` no longer expects a Python
88
+ release among the npm packages.
89
+ - feat: the estate report covers the Python projects. `baseline-estate` prints a
90
+ second table for every project whose pyproject.toml depends on
91
+ `syntopica-codeality-py`, found up to three levels deep. Four columns: the
92
+ quality group is declared, a workflow runs `codeality-py gate` on push, its
93
+ actions are pinned by commit, and uv.lock pins the current release.
94
+ - fix: a nested Python project's workflow is written at the repository root as
95
+ `quality-<project>.yml`, where GitHub reads it, on the checked-out branch
96
+ rather than always `main`.
97
+ - build(security): generated CI workflows check out with
98
+ `persist-credentials: false`.
99
+ - chore: templates pin the current releases of the shared packages.
100
+
101
+ ## 0.9.0
102
+
103
+ ### Minor Changes
104
+
105
+ - feat: two tsconfig conformance checks, and a `tscfg` column in the estate
106
+ matrix.
107
+
108
+ The defect they catch is the expensive kind: a gate that exits 0 while reading
109
+ almost nothing. consumer-g's root `tsconfig.json` referenced three projects
110
+ and its `type-check` script named only two, so `app/`, `proxy.ts` and
111
+ `instrumentation.ts` - the largest surface in the repo - reached `check:ci`
112
+ unchecked for months while the estate report called the repository conformant.
113
+
114
+ `--check` now asserts, first, that every project a solution-style root
115
+ references is reachable from `type-check` (a bare `tsc -b`/`vue-tsc -b`
116
+ passes; a project-scoped one covers only the projects it names), and second,
117
+ that each project tsconfig extends an `@busirocket/tsconfig` preset - judged
118
+ per shape: a single-project root extends a preset directly, a solution root
119
+ must not, because `baseline-type-coverage` walks its `references` and a root
120
+ that extends instead of referencing hides every project behind one.
121
+
122
+ - feat: `--check` asserts the gates are wired, not merely installed.
123
+
124
+ It used to assert that four packages appeared in `package.json`, which it did
125
+ happily for a repository with no CI, a `lint` script that ignored warnings,
126
+ and a `check:ci` that skipped knip, jscpd, dependency-cruiser and
127
+ type-coverage. Adoption was measured by presence, so drift in enforcement was
128
+ invisible by construction.
129
+
130
+ Seven checks now run: the `--max-warnings 0` flag (and a numeric budget
131
+ reported separately, because it is a ratchet rather than an oversight), every
132
+ gate reachable from what CI actually runs, a workflow that fires on push,
133
+ actions pinned to commit SHAs, coverage thresholds that are produced and
134
+ enforced, lefthook installed into `.git/hooks`, and dependency ranges able to
135
+ resolve the pinned baseline.
136
+
137
+ Findings can be waived by id in `baseline.exceptions.json` with a required
138
+ `reason` and an optional, enforced `expires`.
139
+
140
+ - feat: `--fix` repairs the mechanical half.
141
+
142
+ Rewrites the lint flag, appends missing gates to the right `check:*` entry,
143
+ widens a stuck dependency range, writes the CI workflow, and inserts a
144
+ `thresholds` block with `autoUpdate: true` and a floor of zero - vitest's own
145
+ ratchet, so an existing repository enters at the level its suite actually
146
+ reaches instead of turning red on a flat 80.
147
+
148
+ - feat: `create-baseline --write` writes `.github/workflows/ci.yml`.
149
+
150
+ No template shipped one and this tool never wrote one, so every adopter
151
+ hand-rolled CI or skipped it; eight of seventeen had no workflow at all while
152
+ carrying the full gate set as scripts. Four jobs, three commands, every action
153
+ pinned to a commit SHA with the tag kept as a comment. Nothing is written over
154
+ a workflow that already runs the gates, and a repository with unrelated
155
+ workflows is reported rather than given a second pipeline.
156
+
157
+ - feat: `baseline-estate <dir>` - the conformance check over every consumer.
158
+
159
+ One row per repository, one column per class of gate. Formalises the manual
160
+ pre-publish sweep that already caught three defects the templates and the unit
161
+ tests both missed. Exits non-zero when any consumer fails, so it can gate a
162
+ release.
163
+
164
+ - feat: `.oxlintrc.json` and a `lint:fast` script are part of the scaffolded
165
+ wiring, and the generated `lefthook.yml` gains a `commit-msg` hook.
166
+
167
+ ### Patch Changes
168
+
169
+ - fix: the pnpm workspace parser no longer backtracks exponentially.
170
+
171
+ `/^packages:\n((?:\s*-.*\n?)+)/m` lets `\s*` and `.*` exchange characters.
172
+ Replaced with a line loop, which has no backtracking to reason about and says
173
+ what it does. Found by `eslint-plugin-regexp`, newly part of the base config.
174
+
175
+ ## 0.8.1
176
+
177
+ ### Patch Changes
178
+
179
+ - fix: `--check` prints only the packages that are missing.
180
+
181
+ A project missing one package was handed the full eleven-package install line,
182
+ which reads as "you have none of this" and, pasted, re-pins ten packages
183
+ nobody asked to touch.
184
+
185
+ ## 0.8.0
186
+
187
+ ### Minor Changes
188
+
189
+ - feat: read a monorepo's workspace manifests, not just the root one.
190
+
191
+ In a pnpm or npm workspace the per-package dependencies -- eslint-config,
192
+ tsconfig, code-policy -- are declared by each workspace. Reading only the root
193
+ manifest reported every one of them missing: consumer-y, a repo already
194
+ running the whole toolchain across six workspaces, was told it had none of it,
195
+ and the peer check reported "not verified -- not installed here yet" about
196
+ packages that were installed and working.
197
+
198
+ Both now walk the workspaces the repo itself declares, and the peer report
199
+ labels each workspace and suggests `--filter` for it.
200
+
201
+ ## 0.7.0
202
+
203
+ ### Minor Changes
204
+
205
+ - feat: detect TanStack Start and pick its knip preset.
206
+
207
+ A Start app carries both react and vite, so it was detected as `vite-react`
208
+ and scaffolded with entry globs that match nothing in it.
209
+
210
+ ## 0.6.1
211
+
212
+ ### Patch Changes
213
+
214
+ - fix: only mention the Next tsconfig's JSX trap to a Next project. 0.6.0
215
+ printed it to every adopter, including Vite and Nuxt ones the advice cannot
216
+ apply to.
217
+
218
+ ## 0.6.0
219
+
220
+ ### Minor Changes
221
+
222
+ - feat: recognise every filename a gate tool would load, and say so instead of
223
+ writing a file the tool ignores.
224
+
225
+ consumer-m carried a `knip.json` that set `project` to `["tsconfig.json"]`, so
226
+ knip scanned almost nothing: 34 live dependencies reported as unused and 23
227
+ genuinely dead files never found. `--write` checked for `knip.config.ts` and
228
+ `knip.config.js`, saw neither, and wrote the shared factory next to it. Knip
229
+ went on loading the json. The gate stayed broken while looking configured.
230
+
231
+ Each entry now lists every filename its tool actually resolves -- knip's
232
+ seven, lefthook's three, renovate's six, dependency-cruiser's five -- and a
233
+ shadowed config is named in the output with what to do about it, rather than
234
+ skipped in silence.
235
+
236
+ - feat: `--write` names the vitest trap that comes with the shared Next
237
+ tsconfig.
238
+
239
+ `@busirocket/tsconfig/nextjs` sets `jsx: preserve`, which is what Next
240
+ documents: SWC does the transform at build time. Vitest does not go through
241
+ SWC, so every `.tsx` test fails to parse until its own config names the
242
+ runtime -- and on Vite 8 the older `esbuild` block is ignored, so a config
243
+ that used to work silently stops.
244
+
245
+ ## 0.5.2
246
+
247
+ ### Patch Changes
248
+
249
+ - chore: refresh the `@busirocket/prettier-config` pin to `^0.2.0`.
250
+
251
+ ## 0.5.1
252
+
253
+ ### Patch Changes
254
+
255
+ - fix: `--write` adds `prepare: lefthook install` alongside the lefthook config.
256
+
257
+ Without it the generated `lefthook.yml` is inert: the hooks only reach
258
+ `.git/hooks` when `lefthook install` runs. Three repos in a row adopted the
259
+ gates with the file in place and no hook installed, and knip caught it by
260
+ reporting `lefthook` as an unused dependency.
261
+
262
+ The closing note also mentions `ERR_PNPM_IGNORED_BUILDS`, which is how pnpm
263
+ reports the other half of the same problem: lefthook's install script has to
264
+ be allowed for the hooks to be written.
265
+
266
+ ## 0.5.0
267
+
268
+ ### Minor Changes
269
+
270
+ - feat: every mode reports the ESLint peers your config needs and does not have.
271
+
272
+ `@busirocket/eslint-config` ships TypeScript source rather than a build, so
273
+ its imports resolve from the consuming project. pnpm reports a peer mismatch
274
+ as one line among hundreds on install, and the consequence surfaces much later
275
+ as a crash from inside ESLint naming neither the baseline nor the peer.
276
+
277
+ Adopting consumer-u hit three in a row: `@vitest/eslint-plugin` absent,
278
+ `eslint-plugin-tailwindcss` on a prerelease whose `configs.recommended` is
279
+ still eslintrc-format, and `eslint-plugin-boundaries` a major behind the
280
+ schema the shared layer emits. Each took its own diagnosis from an opaque
281
+ stack trace.
282
+
283
+ The subpaths are read from the project's own `eslint.config.*`, so a project
284
+ that never composes `/tailwind` is never told about a Tailwind plugin.
285
+ Manifests are read out of `node_modules` rather than through
286
+ `require.resolve`, because these packages define `exports` without a root or
287
+ `./package.json` entry and resolving either throws while the package is
288
+ installed and working.
289
+
290
+ ## 0.4.1
291
+
292
+ ### Patch Changes
293
+
294
+ - chore: refresh the `@busirocket/eslint-config` pin to `^0.7.3`.
295
+
296
+ ## 0.4.0
297
+
298
+ ### Minor Changes
299
+
300
+ - feat: `create-baseline --write` scaffolds the wiring instead of describing it.
301
+
302
+ The tool could tell you `lefthook.yml` was missing and never write it, so
303
+ every adopting repo hand-wrote the same four files and the same ten scripts.
304
+ Measured across seven real adoptions in one sitting: the only thing that
305
+ varied was the knip preset, which is read off the project's dependencies, and
306
+ which directories to exempt from `no-orphans`.
307
+
308
+ `--write` creates `knip.config.ts`, `lefthook.yml`, `renovate.json` and
309
+ `.dependency-cruiser.cjs` when absent, and adds the baseline scripts
310
+ `package.json` does not already define. Nothing that exists is overwritten and
311
+ re-running is a no-op, so it is safe on a half-adopted repo.
312
+
313
+ - chore: `baseline-versions.json` now pins `dependency-cruiser`, `jiti` and
314
+ `type-coverage`.
315
+
316
+ `--write` generates a `.dependency-cruiser.cjs` that reaches the shared
317
+ factory through jiti, and a `type-coverage` script behind
318
+ `baseline-type-coverage`. Without these three on the install line the
319
+ generated wiring fails on its first run.
320
+
321
+ ## 0.3.9
322
+
323
+ ### Patch Changes
324
+
325
+ - chore: refresh the `@busirocket/quality-config` pin to `^0.7.0`. Derived from
326
+ the workspace by `pnpm sync-versions`.
327
+
328
+ ## 0.3.8
329
+
330
+ ### Patch Changes
331
+
332
+ - chore: refresh the `eslint-plugin-code-policy` and `@busirocket/eslint-config`
333
+ pins. Derived from the workspace by `pnpm sync-versions`.
334
+
335
+ ## 0.3.7
336
+
337
+ ### Patch Changes
338
+
339
+ - chore: refresh the `@busirocket/eslint-config` pin to `^0.7.1`. Derived from
340
+ the workspace by `pnpm sync-versions`; no check was added or removed.
341
+
342
+ ## 0.3.6
343
+
344
+ ### Patch Changes
345
+
346
+ - chore: refresh the `@busirocket/quality-config` pin to `^0.6.1`. Derived from
347
+ the workspace by `pnpm sync-versions`; no check was added or removed.
348
+
349
+ ## 0.3.5
350
+
351
+ ### Patch Changes
352
+
353
+ - chore: refresh the `eslint-plugin-code-policy` pin to `^0.7.2`, which stops
354
+ `file-kind-placement` firing on test files. Derived from the workspace by
355
+ `pnpm sync-versions`; no check was added or removed.
356
+
357
+ ## 0.3.4
358
+
359
+ ### Patch Changes
360
+
361
+ - chore: refresh the pins injected into scaffolded projects.
362
+
363
+ `eslint-plugin-code-policy` `^0.7.0` -> `^0.7.1` and
364
+ `@busirocket/quality-config` `^0.5.0` -> `^0.6.0`, both carrying fixes found
365
+ by running the 0.7.0 / 0.5.0 build against the repos that adopt it. Derived
366
+ from the workspace by `pnpm sync-versions`; no check was added or removed.
367
+
368
+ ## 0.3.3
369
+
370
+ ### Patch Changes
371
+
372
+ - chore: refresh the pins injected into scaffolded projects.
373
+
374
+ `@busirocket/eslint-config` `^0.6.0` -> `^0.7.0`, `eslint-plugin-code-policy`
375
+ `^0.6.0` -> `^0.7.0`, and `@busirocket/quality-config` `^0.4.0` -> `^0.5.0`.
376
+ Derived from the workspace by `pnpm sync-versions`; no check was added or
377
+ removed.
378
+
379
+ ## 0.3.2
380
+
381
+ ### Patch Changes
382
+
383
+ - chore: refresh the pins in `baseline-versions.json`.
384
+
385
+ `@busirocket/eslint-config` to `^0.6.0` and `@busirocket/quality-config` to
386
+ `^0.3.0`. No check was added or removed.
387
+
388
+ ## 0.3.1
389
+
390
+ ### Patch Changes
391
+
392
+ - chore: refresh the pins in `baseline-versions.json`.
393
+
394
+ `@busirocket/quality-config` to `^0.2.0`, `@busirocket/prettier-config` to
395
+ `^0.1.2`, `@busirocket/tsconfig` to `^0.2.1`. No check was added or removed.
396
+
397
+ ## 0.3.0
398
+
399
+ ### Minor Changes
400
+
401
+ - feat: require the quality-gate half of the baseline.
402
+
403
+ `baseline-versions.json` now also pins `@busirocket/quality-config`, `knip`
404
+ and `lefthook`, and `--hard` additionally requires `knip.config.ts`/`.js`,
405
+ `lefthook.yml` and `renovate.json` to exist. A project that passed `--check`
406
+ or `--hard` on 0.2.1 will fail until it adopts those - that is the point of
407
+ the ratchet, but it is a behavior change, not a patch.
408
+
409
+ Pins bumped in the same file: `@busirocket/eslint-config` to `^0.5.0`,
410
+ `eslint-plugin-code-policy` to `^0.6.0`.
411
+
412
+ ### Patch Changes
413
+
414
+ - fix: stop requiring `@busirocket/tsconfig` where it cannot apply.
415
+
416
+ A project whose own `tsconfig.json` extends a config inside a dot-directory -
417
+ build output its framework regenerates, such as Nuxt's
418
+ `./.nuxt/tsconfig.json` - has no insertion point for the shared presets, so
419
+ demanding the dependency only added a package nothing reads, which an
420
+ unused-dependency gate then reports as dead weight.
421
+
422
+ The exemption is narrow: an authored `./tsconfig.base.json` still requires the
423
+ package, so does a project with no `tsconfig.json`, and a `tsconfig.json` that
424
+ cannot be parsed as JSON is treated as authored so an unreadable file never
425
+ silently drops the requirement.
426
+
427
+ - fix: drop the `dependency-cruiser` pin consumers could not meet.
@@ -1,9 +1,9 @@
1
1
  {
2
- "@syntopica/eslint-config": "^0.10.1",
3
- "@syntopica/prettier-config": "^0.3.0",
4
- "@syntopica/tsconfig": "^0.3.1",
5
- "@syntopica/quality-config": "^0.16.0",
6
- "eslint-plugin-code-policy": "^0.9.1",
2
+ "@syntopica/eslint-config": "^0.10.2",
3
+ "@syntopica/prettier-config": "^0.3.1",
4
+ "@syntopica/tsconfig": "^0.3.2",
5
+ "@syntopica/quality-config": "^0.17.0",
6
+ "eslint-plugin-code-policy": "^0.9.2",
7
7
  "dependency-cruiser": "^18.1.1",
8
8
  "jiti": "^2.7.0",
9
9
  "jscpd": "^5.0.14",
@@ -36,8 +36,12 @@ export function baselineScripts() {
36
36
  // own when that date passes. Without somewhere to put a judged finding,
37
37
  // the only way to silence one is to raise the level for everything.
38
38
  'audit:check': 'baseline-audit --level moderate',
39
+ // Prints what the packages upgraded since the last run changed and what
40
+ // must be done about it, once. Always exits 0; it first so the notice is
41
+ // at the top of the gate's output.
42
+ changes: 'baseline-changes',
39
43
  'check:ci':
40
- 'pnpm lint:fast && pnpm type-check && pnpm lint && pnpm format:check && pnpm test && pnpm dupes && pnpm knip',
44
+ 'pnpm changes && pnpm lint:fast && pnpm type-check && pnpm lint && pnpm format:check && pnpm test && pnpm dupes && pnpm knip',
41
45
  'check:quality': 'pnpm deps:graph && pnpm type-coverage',
42
46
  'check:security': 'pnpm secrets:check && pnpm audit:check',
43
47
  }
@@ -12,6 +12,64 @@ import { ACTION_PINS } from './actionPins.mjs'
12
12
  // two cannot drift.
13
13
  const GITLEAKS_VERSION = '8.30.1'
14
14
 
15
+ // The tadu release the backlog job installs, pinned for the same reason as
16
+ // gitleaks. pipx is preinstalled on ubuntu-latest, so no action is needed.
17
+ const TADU_VERSION = '0.2.0'
18
+
19
+ // Conditions every gate job on the change not being backlog-only.
20
+ const CODE_ONLY = ` needs: changes
21
+ if: needs.changes.outputs.code == 'true'
22
+ `
23
+
24
+ const changesJob = () => ` changes:
25
+ name: Classify the change
26
+ runs-on: ubuntu-latest
27
+ timeout-minutes: 5
28
+ outputs:
29
+ code: \${{ steps.classify.outputs.code }}
30
+ backlog: \${{ steps.classify.outputs.backlog }}
31
+ steps:
32
+ - uses: ${ACTION_PINS.checkout.uses} # ${ACTION_PINS.checkout.tag}
33
+ with:
34
+ fetch-depth: 0
35
+ persist-credentials: false
36
+
37
+ # A change that touches only the tadu backlog skips the gates and runs
38
+ # tadu doctor instead. A job skipped by \`if\` reports success, so a
39
+ # required check stays satisfied, which \`paths-ignore\` would not do.
40
+ - name: Classify the changed paths
41
+ id: classify
42
+ env:
43
+ BASE: \${{ github.event.pull_request.base.sha || github.event.before }}
44
+ run: |
45
+ backlog=(todo TODO.md TODO_LOG.md TODO_HISTORY_INDEX.jsonl)
46
+ outside=(.)
47
+ for path in "\${backlog[@]}"; do outside+=(":(exclude)$path"); done
48
+ code=true
49
+ touched=true
50
+ # No usable base (a new branch, or history GitHub did not send): run everything.
51
+ if [ -n "\${BASE//0/}" ] && git cat-file -e "$BASE^{commit}" 2>/dev/null; then
52
+ git diff --quiet --no-renames "$BASE" HEAD -- "\${outside[@]}" && code=false
53
+ git diff --quiet --no-renames "$BASE" HEAD -- "\${backlog[@]}" && touched=false
54
+ fi
55
+ echo "code=$code" >> "$GITHUB_OUTPUT"
56
+ echo "backlog=$touched" >> "$GITHUB_OUTPUT"
57
+
58
+ backlog:
59
+ name: tadu doctor
60
+ needs: changes
61
+ if: needs.changes.outputs.backlog == 'true'
62
+ runs-on: ubuntu-latest
63
+ timeout-minutes: 5
64
+ steps:
65
+ - uses: ${ACTION_PINS.checkout.uses} # ${ACTION_PINS.checkout.tag}
66
+ with:
67
+ persist-credentials: false
68
+
69
+ - run: pipx run --spec tadu==${TADU_VERSION} tadu doctor .
70
+
71
+ `
72
+
15
73
  const setup = (
16
74
  node,
17
75
  ) => ` - uses: ${ACTION_PINS.checkout.uses} # ${ACTION_PINS.checkout.tag}
@@ -27,14 +85,13 @@ const setup = (
27
85
 
28
86
  - run: pnpm install --frozen-lockfile`
29
87
 
30
- const buildJob = (node) => `
88
+ const buildJob = (node, tadu) => `
31
89
 
32
90
  build:
33
91
  name: Production build
34
92
  runs-on: ubuntu-latest
35
93
  timeout-minutes: 20
36
- needs: verify
37
- steps:
94
+ ${tadu ? " needs: [changes, verify]\n if: needs.changes.outputs.code == 'true'\n" : ' needs: verify\n'} steps:
38
95
  ${setup(node)}
39
96
 
40
97
  - run: pnpm run build`
@@ -42,6 +99,9 @@ ${setup(node)}
42
99
  /**
43
100
  * The CI workflow every baseline project runs.
44
101
  *
102
+ * With `tadu`, a change that touches only the backlog skips the gates and runs
103
+ * `tadu doctor` instead.
104
+ *
45
105
  * Four jobs rather than one script: `verify` and `quality` are independent, so
46
106
  * running them in parallel keeps both inside a sane timeout on a repo where
47
107
  * typed linting alone takes minutes. Locally the same gates run as one command
@@ -53,7 +113,8 @@ ${setup(node)}
53
113
  * so type-check, tests, knip, jscpd, dependency-cruiser and type-coverage have
54
114
  * no automatic trigger at all.
55
115
  */
56
- export function ciWorkflow({ node = 22, hasBuild = false } = {}) {
116
+ export function ciWorkflow({ node = 22, hasBuild = false, tadu = false } = {}) {
117
+ const gate = tadu ? CODE_ONLY : ''
57
118
  return `# Written by \`create-baseline --write\`. Four jobs, three commands:
58
119
  # \`check:ci\`, \`check:quality\` and \`check:security\` are the same entrypoints
59
120
  # you run locally, so a red job reproduces with one line.
@@ -77,11 +138,11 @@ permissions:
77
138
  contents: read
78
139
 
79
140
  jobs:
80
- verify:
141
+ ${tadu ? changesJob() : ''} verify:
81
142
  name: type-check + lint + format + test + dupes + knip
82
143
  runs-on: ubuntu-latest
83
144
  timeout-minutes: 30
84
- steps:
145
+ ${gate} steps:
85
146
  ${setup(node)}
86
147
 
87
148
  - name: check:ci
@@ -91,7 +152,7 @@ ${setup(node)}
91
152
  name: dependency graph + type coverage
92
153
  runs-on: ubuntu-latest
93
154
  timeout-minutes: 20
94
- steps:
155
+ ${gate} steps:
95
156
  ${setup(node)}
96
157
 
97
158
  - name: check:quality
@@ -101,7 +162,7 @@ ${setup(node)}
101
162
  name: secrets + advisories + workflows
102
163
  runs-on: ubuntu-latest
103
164
  timeout-minutes: 15
104
- steps:
165
+ ${gate} steps:
105
166
  # Full history: gitleaks cannot see a secret committed three commits ago
106
167
  # from a shallow clone.
107
168
  - uses: ${ACTION_PINS.checkout.uses} # ${ACTION_PINS.checkout.tag}
@@ -142,6 +203,6 @@ ${setup(node)}
142
203
  - name: Workflow security
143
204
  uses: ${ACTION_PINS.zizmor.uses} # ${ACTION_PINS.zizmor.tag}
144
205
  with:
145
- advanced-security: false${hasBuild ? buildJob(node) : ''}
206
+ advanced-security: false${hasBuild ? buildJob(node, tadu) : ''}
146
207
  `
147
208
  }
@@ -0,0 +1,18 @@
1
+ import { access } from 'node:fs/promises'
2
+ import { resolve } from 'node:path'
3
+
4
+ // A format 2 backlog is `todo/tadu.json`; a format 1 backlog is `TODO.md`.
5
+ const MARKERS = ['todo/tadu.json', 'TODO.md']
6
+
7
+ /** Whether the repository at `root` keeps a tadu backlog in git. */
8
+ export async function hasTaduBacklog(root) {
9
+ for (const marker of MARKERS) {
10
+ try {
11
+ await access(resolve(root, marker))
12
+ return true
13
+ } catch {
14
+ /* not there */
15
+ }
16
+ }
17
+ return false
18
+ }
@@ -1,20 +1,45 @@
1
1
  // The git hooks every baseline project runs: lint and format on the staged
2
2
  // files at commit, secret scan before push. Mirrors createLefthookConfig() in
3
3
  // @syntopica/quality-config/lefthook.
4
- export function lefthookConfig() {
4
+ //
5
+ // With `tadu`, the backlog is left to `tadu doctor`: tadu writes JSON that
6
+ // prettier rejects, so the file checks exclude it and a `backlog` command
7
+ // validates it instead.
8
+ export function lefthookConfig({ tadu = false } = {}) {
9
+ const exclude = tadu
10
+ ? `
11
+ exclude:
12
+ - todo/**
13
+ - TODO.md
14
+ - TODO_LOG.md
15
+ - TODO_HISTORY_INDEX.jsonl`
16
+ : ''
17
+ const backlog = tadu
18
+ ? `
19
+ backlog:
20
+ glob:
21
+ - todo/**
22
+ - TODO.md
23
+ - TODO_LOG.md
24
+ - TODO_HISTORY_INDEX.jsonl
25
+ skip:
26
+ - run: '! command -v tadu'
27
+ run: tadu doctor .
28
+ `
29
+ : ''
5
30
  return `# Mirrors createLefthookConfig() in @syntopica/quality-config/lefthook.
6
31
  pre-commit:
7
32
  parallel: true
8
33
  commands:
9
34
  lint:fast:
10
- glob: '*.{js,jsx,ts,tsx,vue,astro,mjs,cjs}'
35
+ glob: '*.{js,jsx,ts,tsx,vue,astro,mjs,cjs}'${exclude}
11
36
  run: pnpm exec oxlint --deny-warnings {staged_files}
12
37
  lint:
13
- glob: '*.{js,jsx,ts,tsx,vue,astro,mjs,cjs}'
38
+ glob: '*.{js,jsx,ts,tsx,vue,astro,mjs,cjs}'${exclude}
14
39
  run: pnpm exec eslint --max-warnings 0 --no-warn-ignored {staged_files}
15
40
  format:
16
- glob: '*.{js,jsx,ts,tsx,vue,astro,mjs,cjs,json,md,css,yml,yaml}'
17
- run: pnpm exec prettier --check {staged_files}
41
+ glob: '*.{js,jsx,ts,tsx,vue,astro,mjs,cjs,json,md,css,yml,yaml}'${exclude}
42
+ run: pnpm exec prettier --check {staged_files}${backlog}
18
43
 
19
44
  # The release tooling reads the commit type to pick the semver bump and to
20
45
  # build the changelog, so a mistyped subject is a silent release defect. This
@@ -2,6 +2,7 @@ import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'
2
2
  import { resolve } from 'node:path'
3
3
 
4
4
  import { ciWorkflow } from './ciWorkflow.mjs'
5
+ import { hasTaduBacklog } from './hasTaduBacklog.mjs'
5
6
 
6
7
  const WORKFLOW_DIR = '.github/workflows'
7
8
  const WORKFLOW_NAME = 'ci.yml'
@@ -49,6 +50,10 @@ export async function writeCiWorkflow(root, { hasBuild }) {
49
50
  // eslint-disable-next-line security/detect-non-literal-fs-filename
50
51
  await mkdir(dir, { recursive: true })
51
52
  // eslint-disable-next-line security/detect-non-literal-fs-filename
52
- await writeFile(resolve(dir, WORKFLOW_NAME), ciWorkflow({ hasBuild }), 'utf8')
53
+ await writeFile(
54
+ resolve(dir, WORKFLOW_NAME),
55
+ ciWorkflow({ hasBuild, tadu: await hasTaduBacklog(root) }),
56
+ 'utf8',
57
+ )
53
58
  return { written: `${WORKFLOW_DIR}/${WORKFLOW_NAME}`, existing: null }
54
59
  }
@@ -4,6 +4,7 @@ import { resolve } from 'node:path'
4
4
  import { baselineScripts } from './baselineScripts.mjs'
5
5
  import { depCruiserConfig } from './depCruiserConfig.mjs'
6
6
  import { detectFramework } from './detectFramework.mjs'
7
+ import { hasTaduBacklog } from './hasTaduBacklog.mjs'
7
8
  import { knipConfig } from './knipConfig.mjs'
8
9
  import { lefthookConfig } from './lefthookConfig.mjs'
9
10
  import { oxlintConfig } from './oxlintConfig.mjs'
@@ -27,6 +28,7 @@ export async function writeMissing(root, deps) {
27
28
  const written = []
28
29
  const shadowed = []
29
30
  const framework = detectFramework(deps)
31
+ const tadu = await hasTaduBacklog(root)
30
32
 
31
33
  const files = [
32
34
  [
@@ -42,7 +44,11 @@ export async function writeMissing(root, deps) {
42
44
  '.knip.jsonc',
43
45
  ],
44
46
  ],
45
- ['lefthook.yml', lefthookConfig, ['lefthook.yaml', '.lefthook.yml']],
47
+ [
48
+ 'lefthook.yml',
49
+ () => lefthookConfig({ tadu }),
50
+ ['lefthook.yaml', '.lefthook.yml'],
51
+ ],
46
52
  ['.oxlintrc.json', () => oxlintConfig(root), ['oxlint.json', '.oxlintrc']],
47
53
  [
48
54
  'renovate.json',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syntopica/create-baseline",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "CLI to verify and adopt @syntopica baseline config packages",
@@ -32,7 +32,8 @@
32
32
  "dart-versions.json",
33
33
  "swift-versions.json",
34
34
  "go-versions.json",
35
- "bin"
35
+ "bin",
36
+ "CHANGELOG.md"
36
37
  ],
37
38
  "keywords": [
38
39
  "eslint",
@@ -42,7 +43,7 @@
42
43
  ],
43
44
  "devDependencies": {
44
45
  "@arethetypeswrong/cli": "^0.18.5",
45
- "@syntopica/eslint-config": "0.10.1",
46
+ "@syntopica/eslint-config": "0.10.2",
46
47
  "@vitest/coverage-v8": "^5.1.1",
47
48
  "eslint": "^10.15.0",
48
49
  "eslint-plugin-regexp": "^3.3.3",
@@ -1,3 +1,3 @@
1
1
  {
2
- "syntopica-codeality-py": "0.2.6"
2
+ "syntopica-codeality-py": "0.3.0"
3
3
  }